-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CIP-21: Governable LookbackWindow Smart Contract changes (#4747)
Implementation of CIP-21 smart contract changes. celo-blockchain related PR: celo-org/celo-blockchain#1136 Adds the uptimeLookbackWindow to the BlockchainParameters contract. This is only ever used on the celo-blockchain client to determine the size of the uptime lookback window which is used to compute the validator uptimeScore An important invariant, is that UptimeLookbackWindow must remain constant during an epoch. Thus, changes to the parameter only take effect on the next epoch. There's an exception to this rule during migration/deployment of this change; there uptimeLookbackWindow should be initialized to chain's current value for the parameter which is part of the ChainConfig on the genesis block. To initialize the value: On a new testnet: As part of the migrations, BlockchainParamets.initialize() will do the initialization On an existing testnet: After upgrading the contract, first call to setLookbackWindow() will the value for the current epoch. Since BlockchainParameters won't be reinitialized when this change is deployed, a patch was made to the getUptimteLookbackWindow() contract to return 12 (mainnet, baklava & alfajores value for lookbackWindow) in the case of the value not being initalized. This patch can be removed in the future, since it's only necessary until setLoobackWindow() is called and first epoch since deployment has passed Co-authored-by: Mariano Cortesi <[email protected]>
- Loading branch information
Showing
10 changed files
with
228 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/protocol/contracts/governance/test/BlockchainParametersTest.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pragma solidity ^0.5.13; | ||
|
||
import "../BlockchainParameters.sol"; | ||
import "./MockUsingPrecompiles.sol"; | ||
|
||
contract BlockchainParametersTest is BlockchainParameters, MockUsingPrecompiles {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.