Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge registry removal #271

Merged
merged 5 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ Check also the [BlockRewardHbbft call graph](/docs/BlockRewardHbbft-call-graph.p
- `setCurrentSeed`. This is a setter that can only be called by the HBBFT engine in order to set the newly generated random number that is gonna be used for the new validator set selection.
- `currentSeed`. This public getter is used by the `ValidatorSetHbbft` contract at a predefined block of each staking epoch to get the accumulated random seed for randomly choosing new validators among active pools. It can also be used by anyone who wants to use the network's random seed.

- `Registry`: stores human-readable keys associated with addresses, like DNS information (see [Parity Wiki](https://wiki.parity.io/Parity-name-registry.html)). This contract is needed primarily to store the address of the `Certifier` contract (see [Parity Wiki](https://wiki.parity.io/Permissioning.html#gas-price) for details).

- `StakingHbbft`: contains staking logic including:
- creating, storing, and removing pools by candidates and validators;
- staking coins by participants (delegators, candidates, or validators) into the pools;
Expand Down
243 changes: 0 additions & 243 deletions contracts/Registry.sol

This file was deleted.

7 changes: 5 additions & 2 deletions contracts/ValidatorSetHbbft.sol
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@ contract ValidatorSetHbbft is Initializable, OwnableUpgradeable, IValidatorSetHb
}

/// @dev Called by the system when a pending validator set is ready to be activated.
/// Only valid when msg.sender == SUPER_USER (EIP96, 2**160 - 2).
/// After this function is called, the `getValidators` getter returns the new validator set.
/// If this function finalizes a new validator set formed by the `newValidatorSet` function,
/// If this function finalizes, a new validator set is created by the `newValidatorSet` function.
/// an old validator set is also stored and can be read by the `getPreviousValidators` getter.
function finalizeChange() external onlyBlockRewardContract {
if (_pendingValidators.length != 0) {
Expand All @@ -227,7 +226,11 @@ contract ValidatorSetHbbft is Initializable, OwnableUpgradeable, IValidatorSetHb
_newValidatorSet(new address[](0));
}

/// @dev Inactive validators and their stakers loose there stake after a certain period of time.
/// This function defines the lenght of this time window.
/// @param _seconds new value in seconds.
function setValidatorInactivityThreshold(uint256 _seconds) external onlyOwner {

// chosen abritary minimum value of a week.
// if you want smaller values for tests,
// the contract can be deployed with a smaller value
Expand Down
21 changes: 0 additions & 21 deletions contracts/interfaces/IMetadataRegistry.sol

This file was deleted.

14 changes: 0 additions & 14 deletions contracts/interfaces/IOwnerRegistry.sol

This file was deleted.

15 changes: 0 additions & 15 deletions contracts/interfaces/IReverseRegistry.sol

This file was deleted.

2 changes: 0 additions & 2 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ POSDAO smart contracts are located in the contracts directory, which contains th

- **RandomHbbft:** stores random numbers that the engine generates and sends, used for the validator selection.

- **Registry:** stores human-readable keys associated with addresses (see [Parity Wiki](https://wiki.parity.io/Parity-name-registry.html)). Used primarily to store the address of the `Certifier` contract (see [Parity Wiki](https://wiki.parity.io/Permissioning.html#gas-price) for details).

- **StakingHbbft:** contains the contract staking logic for candidates, delegators and validators.

- **TxPermission:** controls the use of a zero gas price by validators in service transactions, protecting the network against "transaction spamming" by malicious validators.
Expand Down
6 changes: 1 addition & 5 deletions initial-contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,5 @@
"proxyAddress": "0x1300000000000000000000000000000000000001",
"implementationAddress": "0x1300000000000000000000000000000000000000"
}
],
"registry": {
"name": "Registry",
"address": "0x6000000000000000000000000000000000000000"
}
]
}
15 changes: 2 additions & 13 deletions tasks/make_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,9 @@ task("make_spec_hbbft", "used to make a spec file")
spec.engine.hbbft.params.blockRewardContractAddress = initialContracts.getAddress("BlockRewardHbbft");
spec.params.transactionPermissionContract = initialContracts.getAddress("TxPermissionHbbft");
spec.params.transactionPermissionContractTransition = '0x0';
spec.params.registrar = initialContracts.registry?.address;

console.log("compiling registry contract.");
await initialContracts.registry!.compileContract(
hre,
[
initialContracts.getAddress("CertifierHbbft"),
networkConfig.owner
]
);


spec.accounts = {
...spec.accounts,
...initialContracts.registry?.toSpecAccount(0)
...spec.accounts
};

console.log('Using the following initial validators: ' + networkConfig.initialMiningAddresses);
Expand Down
Loading
Loading