Skip to content

Commit

Permalink
first experimental cleanup of the registry
Browse files Browse the repository at this point in the history
  • Loading branch information
SurfingNerd committed Jul 26, 2024
1 parent e8c4032 commit e9cb195
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 314 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,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 @@ -244,9 +244,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 @@ -270,7 +269,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 @@ -40,9 +40,5 @@
"proxyAddress": "0x1200000000000000000000000000000000000001",
"implementationAddress": "0x1200000000000000000000000000000000000000"
}
],
"registry": {
"name": "Registry",
"address": "0x6000000000000000000000000000000000000000"
}
]
}
20 changes: 10 additions & 10 deletions tasks/make_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,20 @@ 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;

// spec.params.registrar = initialContracts.registry?.address;


await initialContracts.registry!.compileContract(
hre,
[
initialContracts.getAddress("CertifierHbbft"),
networkConfig.owner
]
);
// 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

0 comments on commit e9cb195

Please sign in to comment.