- PoA Consensus Audit by MixBytes
- PoA Consensus Audit by ChainSecurity
- Install npm dependencies
npm i
- Generate flat sources of contracts with the script
./make_flat.sh
- We need a bytecode of
PoaNetworkConsensus
contract to add it tospec.json
of the network.
Go toscripts
directory and runpoa-bytecode.js
:
$ cd scripts
$ npm i
$ MASTER_OF_CEREMONY=0x0039F22efB07A647557C7C5d17854CFD6D489eF3 node poa-bytecode.js
It will show the bytecode of PoaNetworkConsensus
contract. Copy the bytecode and paste it into spec.json
.
Start Parity UI. In the contracts section press Develop
button.
Select 0.4.24
Solidity compiler version. Set Optimize
to true
.
- In Parity UI
Contracts
tab choose watch custom contract. Paste bytecode and ABI ofPoaNetworkConsensus
contract from Remix.
Compile and deploy contracts in the next sequence:
ProxyStorage_flat.sol
- DeployProxyStorage
contract.EternalStorageProxy_flat.sol
- DeployEternalStorageProxy
contract with constructor parameters:
_proxyStorage
- equal to zero,_implementationAddress
- address of ProxyStorage contract.- Make a call to
ProxyStorage init
with_poaConsensus
parameter equal to the address of PoaNetworkConsensus contract, using the address ofEternalStorageProxy
and ABI ofProxyStorage
. - Select
PoaNetworkConsensus
contract and callsetProxyStorage
with the address of ProxyStorage contract. KeysManager_flat.sol
- DeployKeysManager
contract.EternalStorageProxy_flat.sol
- DeployEternalStorageProxy
contract with constructor parameters:
_proxyStorage
- address of ProxyStorage contract,_implementationAddress
- address of KeysManager contract.- Make a call to
KeysManager init
with_previousKeysManager
parameter equal to 0x0000000000000000000000000000000000000000, using the address ofEternalStorageProxy
and ABI ofKeysManager
. BallotsStorage_flat.sol
- DeployBallotsStorage
contract.EternalStorageProxy_flat.sol
- DeployEternalStorageProxy
contract with constructor parameters:
_proxyStorage
- address of ProxyStorage contract,_implementationAddress
- address of BallotsStorage contract.- Make a call to
BallotsStorage init
with_thresholds
parameter equal to [3, 2], using the address ofEternalStorageProxy
and ABI ofBallotsStorage
. VotingToChangeKeys_flat.sol
- DeployVotingToChangeKeys
contract.EternalStorageProxy_flat.sol
- DeployEternalStorageProxy
contract with constructor parameters:
_proxyStorage
- address of ProxyStorage contract,_implementationAddress
- address of VotingToChangeKeys contract.- Make a call to
VotingToChangeKeys init
with_minBallotDuration
parameter equal to172800
, using the address ofEternalStorageProxy
and ABI ofVotingToChangeKeys
. - Make a call to
VotingToChangeKeys migrateDisable
, using the address ofEternalStorageProxy
and ABI ofVotingToChangeKeys
. VotingToChangeMinThreshold_flat.sol
- DeployVotingToChangeMinThreshold
contract.EternalStorageProxy_flat.sol
- DeployEternalStorageProxy
contract with constructor parameters:
_proxyStorage
- address of ProxyStorage contract,_implementationAddress
- address of VotingToChangeMinThreshold contract.- Make a call to
VotingToChangeMinThreshold init
with_minBallotDuration
parameter equal to172800
and_minPossibleThreshold
parameter equal to3
, using the address ofEternalStorageProxy
and ABI ofVotingToChangeMinThreshold
. - Make a call to
VotingToChangeMinThreshold migrateDisable
, using the address ofEternalStorageProxy
and ABI ofVotingToChangeMinThreshold
. VotingToChangeProxyAddress_flat.sol
- DeployVotingToChangeProxyAddress
contract.EternalStorageProxy_flat.sol
- DeployEternalStorageProxy
contract with constructor parameters:
_proxyStorage
- address of ProxyStorage contract,_implementationAddress
- address of VotingToChangeProxyAddress contract.- Make a call to
VotingToChangeProxyAddress init
with_minBallotDuration
parameter equal to172800
, using the address ofEternalStorageProxy
and ABI ofVotingToChangeProxyAddress
. - Make a call to
VotingToChangeProxyAddress migrateDisable
, using the address ofEternalStorageProxy
and ABI ofVotingToChangeProxyAddress
. ValidatorMetadata_flat.sol
- DeployValidatorMetadata
contract.EternalStorageProxy_flat.sol
- DeployEternalStorageProxy
contract with constructor parameters:
_proxyStorage
- address of ProxyStorage contract,_implementationAddress
- address of ValidatorMetadata contract.VotingToManageEmissionFunds_flat.sol
- DeployVotingToManageEmissionFunds
contract.EternalStorageProxy_flat.sol
- DeployEternalStorageProxy
contract with constructor parameters:
_proxyStorage
- address of ProxyStorage contract,_implementationAddress
- address of VotingToManageEmissionFunds contract.EmissionFunds_flat.sol
- DeployEmissionFunds
contract with constructor parameter_votingToManageEmissionFunds
equal toEternalStorageProxy
address ofVotingToManageEmissionFunds
contract.RewardByBlock_flat.sol
- DeployRewardByBlock
contract and replaceemissionFunds
constant value0x00...
inside it with the address of deployedEmissionFunds
. Then deployRewardByBlock
.EternalStorageProxy_flat.sol
- DeployEternalStorageProxy
contract with constructor parameters:
_proxyStorage
- address of ProxyStorage contract,_implementationAddress
- address of RewardByBlock contract.- Make a call to
VotingToManageEmissionFunds init
, using the address ofEternalStorageProxy
and ABI ofVotingToManageEmissionFunds
, with the next parameters:
_emissionFunds
- address of EmissionFunds contract,_emissionReleaseTime
- your emission release unix timestamp,_emissionReleaseThreshold
- your emission release threshold in seconds,_distributionThreshold
- your distribution threshold in seconds. - Select deployed
ProxyStorage
contract and make a call from MoC address toinitializeAddresses
with relevant addresses.
Contract: BallotsStorage [all features]
#init
β prevent from double init
β thresholds are correct (40ms)
#migrate
β should copy thresholds from an old contract (282ms)
#setThreshold
β can only be called from votingToChangeThreshold address (66ms)
β cannot be set for Invalid threshold (200ms)
β new value cannot be equal to 0 (124ms)
β sets new value for Keys threshold (57ms)
β sets new value for MetadataChange threshold (71ms)
#getProxyThreshold
β return value is correct (392ms)
β return value is correct if MoC is removed (1286ms)
#getVotingToChangeThreshold
β returns voting to change min threshold address (71ms)
#getBallotLimitPerValidator
β returns correct limit (253ms)
β returns correct limit if MoC is removed (1044ms)
#upgradeTo
β may only be called by ProxyStorage (131ms)
β should change implementation address (145ms)
β should increment implementation version (125ms)
β new implementation should work (156ms)
β new implementation should use the same proxyStorage address (121ms)
β new implementation should use the same storage (157ms)
Contract: BallotsStorage upgraded [all features]
#init
β prevent from double init
β thresholds are correct
#migrate
β should copy thresholds from an old contract (222ms)
#setThreshold
β can only be called from votingToChangeThreshold address (58ms)
β cannot be set for Invalid threshold (181ms)
β new value cannot be equal to 0 (138ms)
β sets new value for Keys threshold (53ms)
β sets new value for MetadataChange threshold (66ms)
#getProxyThreshold
β return value is correct (370ms)
β return value is correct if MoC is removed (1220ms)
#getVotingToChangeThreshold
β returns voting to change min threshold address (51ms)
#getBallotLimitPerValidator
β returns correct limit (243ms)
β returns correct limit if MoC is removed (1079ms)
Contract: EmissionFunds [all features]
constructor
β should save VotingToManageEmissionFunds address
#fallback
β should receive funds (327ms)
#sendFundsTo
β may only be called by VotingToManageEmissionFunds (39ms)
β should send funds to receiver (332ms)
β should send entire amount (339ms)
β should not send funds if amount greater than balance (319ms)
β should not send funds if amount is too much (312ms)
β should be fulfilled if receiver is 0x0 (168ms)
β should be fulfilled if amount is zero (328ms)
β should fail if receiver address is not full (664ms)
#burnFunds
β may only be called by VotingToManageEmissionFunds
β should burn funds (163ms)
β should burn entire amount (165ms)
β should not burn funds if amount greater than balance (165ms)
β should not burn funds if amount is too much (263ms)
β should be fulfilled if amount is zero (159ms)
#freezeFunds
β may only be called by VotingToManageEmissionFunds (45ms)
β should freeze funds (168ms)
β should be fulfilled if amount is zero (159ms)
Contract: EternalStorageProxy [all features]
constructor
β should revert if implementation address is equal to 0x0
β should allow ProxyStorage address equal to 0x0 (53ms)
β should set ProxyStorage address (52ms)
β should set implementation address (61ms)
β should set owner (42ms)
#renounceOwnership
β may only be called by an owner
β should set owner to 0x0
#transferOwnership
β may only be called by an owner (129ms)
β should change owner
β should not change owner if its address is 0x0
#upgradeTo
β may only be called by ProxyStorage (41ms)
β should not change implementation address if it is the same
β should not change implementation address if it is 0x0
β should change implementation address
β should increment version (53ms)
Contract: KeysManager [all features]
#constructor
β sets masterOfCeremony, proxyStorage, poaConsensus (133ms)
β adds masterOfCeremony to validators hash
β cannot be called twice
#initiateKeys
β can only be called by master of ceremony (104ms)
β cannot allow 0x0 addresses (57ms)
β should not allow to initialize already initialized key (74ms)
β should not allow to initialize already initialized key after validator created mining key (172ms)
β should not equal to master of ceremony
β should not allow to initialize more than maxNumberOfInitialKeys (595ms)
β should increment initialKeyCount by 1 (80ms)
β should set initialKeys hash to activated status (103ms)
#createKeys
β should only be called from initialized key (162ms)
β params should not be equal to 0x0 (209ms)
β params should not be equal to each other (138ms)
β any of params should not be equal to initialKey (231ms)
β should not allow passing the same key after it is already created (355ms)
β should assign mining, voting, payout keys to relative mappings (184ms)
β should assign voting <-> mining key and payout <-> mining key relationships (156ms)
β adds validator to poaConsensus contract (156ms)
β should set validatorKeys hash (149ms)
β should set validatorKeys hash (148ms)
#addMiningKey
β may only be called if KeysManager.init had been called before (85ms)
β should only be called from votingToChangeKeys (111ms)
β should not let add more than maxLimit (64ms)
β should set validatorKeys hash (92ms)
#addVotingKey
β may only be called if KeysManager.init had been called before (125ms)
β may only be called if params are not the same (150ms)
β should add VotingKey (165ms)
β should only be called if mining is active (239ms)
β swaps keys if voting already exists (236ms)
#addPayoutKey
β may only be called if KeysManager.init had been called before (132ms)
β may only be called if params are not the same (147ms)
β should add PayoutKey (175ms)
β should only be called if mining is active (321ms)
β swaps keys if voting already exists (252ms)
#removeMiningKey
β may only be called if KeysManager.init had been called before (183ms)
β should remove miningKey (667ms)
β removes validator from poaConsensus (331ms)
β removes MoC from poaConsensus (1040ms)
β should still enforce removal of votingKey to 0x0 even if voting key did not exist (299ms)
#removeVotingKey
β may only be called if KeysManager.init had been called before (208ms)
β should be successful only for active voting key (245ms)
β should remove votingKey (283ms)
#removePayoutKey
β may only be called if KeysManager.init had been called before (215ms)
β should be successful only for active payout key (257ms)
β should remove payoutKey (274ms)
#swapMiningKey
β should swap mining key (702ms)
β should swap MoC (352ms)
β should keep voting and payout keys (531ms)
#swapVotingKey
β should swap voting key (221ms)
#swapPayoutKey
β should swap payout key (256ms)
#migrateInitialKey
β can copy initial keys (390ms)
#migrateMiningKey
β copies validator keys (1208ms)
β throws when trying to copy invalid mining key (208ms)
#upgradeTo
β may only be called by ProxyStorage (99ms)
β should change implementation address (174ms)
β should increment implementation version (89ms)
β new implementation should work (123ms)
β new implementation should use the same proxyStorage address (186ms)
β new implementation should use the same storage (324ms)
Contract: KeysManager upgraded [all features]
#constructor
β sets masterOfCeremony, proxyStorage, poaConsensus (169ms)
β adds masterOfCeremony to validators hash
β cannot be called twice
#initiateKeys
β can only be called by master of ceremony (81ms)
β cannot allow 0x0 addresses (64ms)
β should not allow to initialize already initialized key (87ms)
β should not allow to initialize already initialized key after validator created mining key (185ms)
β should not equal to master of ceremony (44ms)
β should not allow to initialize more than maxNumberOfInitialKeys (674ms)
β should increment initialKeyCount by 1 (82ms)
β should set initialKeys hash to activated status (100ms)
#createKeys
β should only be called from initialized key (182ms)
β params should not be equal to 0x0 (246ms)
β params should not be equal to each other (149ms)
β any of params should not be equal to initialKey (152ms)
β should not allow passing the same key after it is already created (380ms)
β should assign mining, voting, payout keys to relative mappings (171ms)
β should assign voting <-> mining key and payout <-> mining key relationships (187ms)
β adds validator to poaConsensus contract (154ms)
β should set validatorKeys hash (165ms)
β should set validatorKeys hash (247ms)
#addMiningKey
β may only be called if KeysManager.init had been called before (88ms)
β should only be called from votingToChangeKeys (122ms)
β should not let add more than maxLimit (50ms)
β should set validatorKeys hash (108ms)
#addVotingKey
β may only be called if KeysManager.init had been called before (117ms)
β may only be called if params are not the same (156ms)
β should add VotingKey (179ms)
β should only be called if mining is active (239ms)
β swaps keys if voting already exists (238ms)
#addPayoutKey
β may only be called if KeysManager.init had been called before (145ms)
β may only be called if params are not the same (143ms)
β should add PayoutKey (169ms)
β should only be called if mining is active (344ms)
β swaps keys if voting already exists (251ms)
#removeMiningKey
β may only be called if KeysManager.init had been called before (181ms)
β should remove miningKey (707ms)
β removes validator from poaConsensus (348ms)
β removes MoC from poaConsensus (1048ms)
β should still enforce removal of votingKey to 0x0 even if voting key did not exist (308ms)
#removeVotingKey
β may only be called if KeysManager.init had been called before (216ms)
β should be successful only for active voting key (229ms)
β should remove votingKey (377ms)
#removePayoutKey
β may only be called if KeysManager.init had been called before (206ms)
β should be successful only for active payout key (231ms)
β should remove payoutKey (260ms)
#swapMiningKey
β should swap mining key (737ms)
β should swap MoC (384ms)
β should keep voting and payout keys (523ms)
#swapVotingKey
β should swap voting key (230ms)
#swapPayoutKey
β should swap payout key (283ms)
#migrateInitialKey
β can copy initial keys (445ms)
#migrateMiningKey
β copies validator keys (1228ms)
β throws when trying to copy invalid mining key (205ms)
Contract: ValidatorMetadata [all features]
#createMetadata
β happy path (170ms)
β should not let create metadata if fullAddress is too long (200ms)
β should not let create metadata if called by non-voting key (86ms)
β should not let create metadata if called second time (153ms)
#clearMetadata
β happy path (770ms)
#moveMetadata
β happy path (1142ms)
#initMetadata
β happy path (441ms)
#changeRequest
β happy path (248ms)
β should not let call if there is no metadata
β resets confirmations when changeRequest recreated (515ms)
#cancelPendingChange
β happy path (473ms)
β should not let delete records for someone else miningKey (490ms)
#confirmPendingChange
β should not let confirm your own changes (236ms)
β should confirm changes (316ms)
β prevent from double voting (337ms)
β should not exceed confirmations limit (577ms)
#finalize
β happy path (758ms)
#getMinThreshold
β returns default value
#upgradeTo
β may only be called by ProxyStorage (82ms)
β should change implementation address (79ms)
β should increment implementation version (80ms)
β new implementation should work (120ms)
β new implementation should use the same proxyStorage address (80ms)
β new implementation should use the same storage (321ms)
Contract: ValidatorMetadata upgraded [all features]
#createMetadata
β happy path (169ms)
β should not let create metadata if fullAddress is too long (210ms)
β should not let create metadata if called by non-voting key (88ms)
β should not let create metadata if called second time (145ms)
#clearMetadata
β happy path (677ms)
#moveMetadata
β happy path (1014ms)
#initMetadata
β happy path (553ms)
#changeRequest
β happy path (165ms)
β should not let call if there is no metadata
β resets confirmations when changeRequest recreated (495ms)
#cancelPendingChange
β happy path (586ms)
β should not let delete records for someone else miningKey (490ms)
#confirmPendingChange
β should not let confirm your own changes (415ms)
β should confirm changes (310ms)
β prevent from double voting (383ms)
β should not exceed confirmations limit (608ms)
#finalize
β happy path (760ms)
#getMinThreshold
β returns default value
Contract: PoaNetworkConsensus [all features]
default values
β finalized should be false
β checks systemAddress
β allows you to set current list of validators (87ms)
β validators in the list must differ (129ms)
#finalizeChange
β should only be called by systemAddress (79ms)
β should set finalized to true (73ms)
β should set currentValidators to pendingList (78ms)
β set currentValidators to pendingList after addValidator call (301ms)
#addValidator
β should only be called from keys manager (63ms)
β should not allow to add already existing validator (78ms)
β should not allow 0x0 addresses (74ms)
β should set validatorsState for new validator (80ms)
β should set finalized to false (72ms)
β should emit InitiateChange with blockhash and pendingList as params (284ms)
#swapValidatorKey
β should swap validator key (294ms)
β should swap MoC (271ms)
#removeValidator
β should remove validator (95ms)
β should remove MoC (249ms)
β should only be called from keys manager (112ms)
β should only be allowed to remove from existing set of validators (46ms)
β should decrease length of pendingList (258ms)
β should change validatorsState (100ms)
β should set finalized to false (114ms)
#setProxyStorage
β can be called by MoC (62ms)
β can be called by owner (67ms)
β can only be called once
β cannot be set to 0x0 address
β sets proxyStorage (51ms)
β sets wasProxyStorageSet (47ms)
β emits MoCInitializedProxyStorage (38ms)
β #getKeysManager (58ms)
#isValidator
β returns true for validator
#isValidatorFinalized
β returns true for finalized validator (1654ms)
Contract: ProxyStorage [all features]
#constructor
β sets PoA
#initializeAddresses
β sets all addresses (158ms)
β prevents Moc to call it more than once (89ms)
#setContractAddress
β can only be called from votingToChangeProxy address (93ms)
β cannot be set to 0x0 address (69ms)
β sets keysManager (142ms)
β sets votingToChangeKeys (154ms)
β sets votingToChangeMinThreshold (253ms)
β sets ballotsStorage (142ms)
β sets poaConsensus (81ms)
β sets validatorMetadata (227ms)
β changes proxyStorage (itself) implementation (205ms)
#upgradeTo
β may only be called by ProxyStorage (itself) (119ms)
β should change implementation address (115ms)
β should increment implementation version (127ms)
β new implementation should work (168ms)
β new implementation should use the same storage (182ms)
Contract: ProxyStorage upgraded [all features]
#constructor
β sets PoA
#initializeAddresses
β sets all addresses (165ms)
β prevents Moc to call it more than once (81ms)
#setContractAddress
β can only be called from votingToChangeProxy address (180ms)
β cannot be set to 0x0 address (67ms)
β sets keysManager (158ms)
β sets votingToChangeKeys (163ms)
β sets votingToChangeMinThreshold (144ms)
β sets ballotsStorage (253ms)
β sets poaConsensus (81ms)
β sets validatorMetadata (172ms)
β changes proxyStorage (itself) implementation (145ms)
Contract: RewardByBlock [all features]
#reward
β may only be called by system address (94ms)
β should revert if input array contains more than one item
β should revert if lengths of input arrays are not equal (38ms)
β should revert if `kind` parameter is not 0
β should revert if mining key does not exist (252ms)
β should assign rewards to payout key and EmissionFunds (88ms)
β should assign reward to mining key if payout key is 0 (143ms)
β should assign rewards to extra receivers and clear extra receivers list (369ms)
#addExtraReceiver
β may only be called by bridge contract (59ms)
β should revert if receiver address is 0x0
β should revert if amount is 0 (39ms)
β can only be called once for the same recipient (79ms)
β should add receivers (214ms)
#upgradeTo
β may only be called by ProxyStorage (111ms)
β should change implementation address (111ms)
β should increment implementation version (116ms)
β new implementation should work (154ms)
β new implementation should use the same proxyStorage address (112ms)
Contract: RewardByBlock upgraded [all features]
#reward
β may only be called by system address (89ms)
β should revert if input array contains more than one item
β should revert if lengths of input arrays are not equal (46ms)
β should revert if `kind` parameter is not 0 (48ms)
β should revert if mining key does not exist (246ms)
β should assign rewards to payout key and EmissionFunds (81ms)
β should assign reward to mining key if payout key is 0 (121ms)
β should assign rewards to extra receivers and clear extra receivers list (421ms)
#addExtraReceiver
β may only be called by bridge contract (68ms)
β should revert if receiver address is 0x0 (45ms)
β should revert if amount is 0 (47ms)
β can only be called once for the same recipient (72ms)
β should add receivers (199ms)
Contract: RewardByTime [all features]
#reward
β may only be called by system address (152ms)
β should assign rewards to payout keys and EmissionFunds (3292ms)
β should work fine after some validators are removed and added (1355ms)
#upgradeTo
β may only be called by ProxyStorage (108ms)
β should change implementation address (111ms)
β should increment implementation version (112ms)
β new implementation should work (259ms)
β new implementation should use the same proxyStorage address (113ms)
Contract: RewardByTime upgraded [all features]
#reward
β may only be called by system address (150ms)
β should assign rewards to payout keys and EmissionFunds (3160ms)
β should work fine after some validators are removed and added (1459ms)
Contract: Voting to change keys [all features]
#createBallot
β happy path (705ms)
β should not let create voting with invalid duration (170ms)
β should not let add votingKey for MoC (416ms)
β should not let add votingKey for 0x0 (447ms)
β should not let add payoutKey for 0x0 (588ms)
β should not let create more ballots than the limit (10140ms)
#createBallotToAddNewValidator
β happy path (296ms)
β deny adding already existed voting key
β deny adding already existed payout key (199ms)
β should create validator with all keys after finalization (1282ms)
β should allow removing new validator if finalizeChange did not happen (2249ms)
#vote
β should let a validator to vote (194ms)
β reject vote should be accepted (199ms)
β should allow multiple voters to vote (875ms)
β should not let vote nonVoting key (57ms)
β should not let vote before startTime key (102ms)
β should not let vote after endTime key (97ms)
β should not let vote with already voted key (271ms)
β should not let vote with invalid choice (267ms)
β should not let vote with invalid id (170ms)
#finalize
β happy path - no action since it did not meet minimum number of totalVoters (803ms)
β finalize addition of payout key (933ms)
β finalize addition of VotingKey (1027ms)
β cannot create ballot for using previous mining key (2257ms)
β finalize addition of MiningKey (1144ms)
β finalize removal of MiningKey (2097ms)
β finalize removal of VotingKey (1237ms)
β finalize removal of PayoutKey (1178ms)
β finalize swap of VotingKey (1216ms)
β finalize swap of PayoutKey (1178ms)
β finalize swap of MiningKey (1373ms)
β prevent double finalize (1841ms)
β allowed at once after all validators gave their votes (1730ms)
#migrate
β should copy a ballot to the new contract (2013ms)
#upgradeTo
β may only be called by ProxyStorage (98ms)
β should change implementation address (101ms)
β should increment implementation version (98ms)
β new implementation should work (148ms)
β new implementation should use the same proxyStorage address (186ms)
β new implementation should use the same storage (963ms)
Contract: Voting to change keys upgraded [all features]
#createBallot
β happy path (782ms)
β should not let create voting with invalid duration (187ms)
β should not let add votingKey for MoC (624ms)
β should not let add votingKey for 0x0 (518ms)
β should not let add payoutKey for 0x0 (480ms)
β should not let create more ballots than the limit (10430ms)
#createBallotToAddNewValidator
β happy path (316ms)
β deny adding already existed voting key
β deny adding already existed payout key (227ms)
β should create validator with all keys after finalization (1418ms)
β should allow removing new validator if finalizeChange did not happen (2165ms)
#vote
β should let a validator to vote (190ms)
β reject vote should be accepted (196ms)
β should allow multiple voters to vote (831ms)
β should not let vote nonVoting key (57ms)
β should not let vote before startTime key (93ms)
β should not let vote after endTime key (94ms)
β should not let vote with already voted key (191ms)
β should not let vote with invalid choice (179ms)
β should not let vote with invalid id (173ms)
#finalize
β happy path - no action since it did not meet minimum number of totalVoters (830ms)
β finalize addition of payout key (910ms)
β finalize addition of VotingKey (1022ms)
β cannot create ballot for using previous mining key (2234ms)
β finalize addition of MiningKey (1023ms)
β finalize removal of MiningKey (2017ms)
β finalize removal of VotingKey (1237ms)
β finalize removal of PayoutKey (1142ms)
β finalize swap of VotingKey (1172ms)
β finalize swap of PayoutKey (1155ms)
β finalize swap of MiningKey (1503ms)
β prevent double finalize (1828ms)
β allowed at once after all validators gave their votes (1722ms)
#migrate
β should copy a ballot to the new contract (2024ms)
Contract: VotingToChangeMinThreshold [all features]
#createBallot
β happy path (377ms)
β proposed value should be more than or equal to 3
β proposed value should not be equal to the same value
β should not let create more ballots than the limit (10284ms)
#vote
β should let a validator to vote (181ms)
β reject vote should be accepted (407ms)
β should allow multiple voters to vote (422ms)
β should not let vote nonVoting key (69ms)
β should not let vote before startTime key (91ms)
β should not let vote after endTime key (95ms)
β should not let vote with already voted key (209ms)
β should not let vote with invalid choice (166ms)
β should not let vote with invalid id (169ms)
#finalize
β does not change if it did not pass minimum threshold (561ms)
β should change to proposedValue when quorum is reached (1253ms)
β prevents double finalize (1671ms)
β allowed at once after all validators gave their votes (2039ms)
β should decrease validator limit only once when calling finalize more than once (1589ms)
#migrate
β should copy a ballot to the new contract (1495ms)
#upgradeTo
β may only be called by ProxyStorage (77ms)
β should change implementation address (93ms)
β should increment implementation version (91ms)
β new implementation should work (120ms)
β new implementation should use the same proxyStorage address (89ms)
β new implementation should use the same storage (585ms)
Contract: VotingToChangeMinThreshold upgraded [all features]
#createBallot
β happy path (271ms)
β proposed value should be more than or equal to 3 (133ms)
β proposed value should not be equal to the same value
β should not let create more ballots than the limit (10305ms)
#vote
β should let a validator to vote (194ms)
β reject vote should be accepted (190ms)
β should allow multiple voters to vote (481ms)
β should not let vote nonVoting key (51ms)
β should not let vote before startTime key (108ms)
β should not let vote after endTime key (108ms)
β should not let vote with already voted key (193ms)
β should not let vote with invalid choice (182ms)
β should not let vote with invalid id (262ms)
#finalize
β does not change if it did not pass minimum threshold (560ms)
β should change to proposedValue when quorum is reached (1312ms)
β prevents double finalize (1806ms)
β allowed at once after all validators gave their votes (2331ms)
β should decrease validator limit only once when calling finalize more than once (1595ms)
#migrate
β should copy a ballot to the new contract (1508ms)
Contract: VotingToChangeProxyAddress [all features]
#createBallot
β happy path (278ms)
β proposed address should not be 0x0
β can create multiple ballots (489ms)
β should not let create more ballots than the limit (9893ms)
#vote
β should let a validator to vote (183ms)
β reject vote should be accepted (284ms)
β should allow multiple voters to vote (852ms)
β should not let vote nonVoting key (52ms)
β should not let vote before startTime key (103ms)
β should not let vote after endTime key (97ms)
β should not let vote with already voted key (195ms)
β should not let vote with invalid choice (181ms)
β should not let vote with invalid id (180ms)
#finalize
β does not change if it did not pass minimum threshold (598ms)
β should change KeysManager implementation (920ms)
β should change VotingToChangeKeys implementation (1053ms)
β should change VotingToChangeMinThreshold implementation (995ms)
β should change VotingToChangeProxy implementation (1083ms)
β should change BallotsStorage implementation (1075ms)
β should change ValidatorMetadata implementation (1062ms)
β should change ProxyStorage implementation (1068ms)
β prevents double finalize (1513ms)
β allowed at once after all validators gave their votes (1768ms)
#migrate
β should copy a ballot to the new contract (1995ms)
#upgradeTo
β may only be called by ProxyStorage (88ms)
β should change implementation address (87ms)
β should increment implementation version (113ms)
β new implementation should work (139ms)
β new implementation should use the same proxyStorage address (86ms)
β new implementation should use the same storage (620ms)
Contract: VotingToChangeProxyAddress upgraded [all features]
#createBallot
β happy path (395ms)
β proposed address should not be 0x0 (119ms)
β can create multiple ballots (394ms)
β should not let create more ballots than the limit (10105ms)
#vote
β should let a validator to vote (179ms)
β reject vote should be accepted (194ms)
β should allow multiple voters to vote (805ms)
β should not let vote nonVoting key (55ms)
β should not let vote before startTime key (103ms)
β should not let vote after endTime key (213ms)
β should not let vote with already voted key (224ms)
β should not let vote with invalid choice (225ms)
β should not let vote with invalid id (196ms)
#finalize
β does not change if it did not pass minimum threshold (684ms)
β should change KeysManager implementation (1177ms)
β should change VotingToChangeKeys implementation (1182ms)
β should change VotingToChangeMinThreshold implementation (1065ms)
β should change VotingToChangeProxy implementation (1115ms)
β should change BallotsStorage implementation (985ms)
β should change ValidatorMetadata implementation (1082ms)
β should change ProxyStorage implementation (1080ms)
β prevents double finalize (1522ms)
β allowed at once after all validators gave their votes (1686ms)
#migrate
β should copy a ballot to the new contract (2022ms)
Contract: VotingToManageEmissionFunds [all features]
#init
β should change state correctly (119ms)
β cannot be called more than once
#createBallot
β happy path (866ms)
β may only be called by valid voting key (139ms)
β endTime must be greater than startTime
β startTime must be greater than current time (39ms)
β cannot be called before emission release time (64ms)
β ballot cannot last longer than distribution threshold (55ms)
β receiver address should not be 0x0 (64ms)
β cannot create multiple ballots during the same distribution period (435ms)
β should allow creating new ballot after the next emission release threshold (490ms)
#cancelNewBallot
β happy path (880ms)
β cannot cancel nonexistent or finalized ballot (341ms)
β may only be called by creator of a ballot (232ms)
β may only be called within ballot canceling threshold (265ms)
β cannot cancel already cancelled ballot (221ms)
β should restore emission release time (493ms)
#refreshEmissionReleaseTime
β should not update until the next threshold (130ms)
β should update to the next threshold (72ms)
β should update to the future threshold (86ms)
#vote
β should let a validator to vote (959ms)
β should allow multiple voters to vote (1497ms)
β should not let vote by nonvoting key (57ms)
β should not let vote before startTime (94ms)
β should not let vote after endTime (260ms)
β should not let vote with already voted key (207ms)
β should not let vote with invalid choice (152ms)
β should not let vote with invalid id (164ms)
β should not let vote if already finalized (1535ms)
β should not let vote with old miningKey (2431ms)
β should not let vote if ballot is canceled (256ms)
#finalize
β happy path (591ms)
β freeze funds if it did not pass minimum voters count (1036ms)
β freeze funds if there is no majority of 3 votes (1322ms)
β freeze funds if there is no majority of 4 votes (1678ms)
β send funds to receiver if most votes are for sending (2089ms)
β send funds to receiver if most votes are for sending (1749ms)
β burn funds if most votes are for burning (1704ms)
β prevents finalize with invalid id (280ms)
β do not let finalize if a ballot is active (189ms)
β finalize immediately if the last validator gave his vote (1187ms)
β does not finalize immediately until ballot canceling threshold is reached (1236ms)
β prevents double finalize (279ms)
β should refresh emission release time (256ms)
β deny finalization if the voting key is a contract (703ms)
β deny finalization within ballot canceling threshold (301ms)
β deny finalization of canceled ballot (461ms)
#upgradeTo
β may only be called by ProxyStorage (91ms)
β should change implementation address (92ms)
β should increment implementation version (91ms)
β new implementation should work (129ms)
β new implementation should use the same proxyStorage address (92ms)
β new implementation should use the same storage (960ms)
Contract: VotingToManageEmissionFunds upgraded [all features]
#init
β should change state correctly (111ms)
β cannot be called more than once
#createBallot
β happy path (835ms)
β may only be called by valid voting key (142ms)
β endTime must be greater than startTime (45ms)
β startTime must be greater than current time (126ms)
β cannot be called before emission release time (64ms)
β ballot cannot last longer than distribution threshold (41ms)
β receiver address should not be 0x0 (52ms)
β cannot create multiple ballots during the same distribution period (467ms)
β should allow creating new ballot after the next emission release threshold (464ms)
#cancelNewBallot
β happy path (878ms)
β cannot cancel nonexistent or finalized ballot (300ms)
β may only be called by creator of a ballot (290ms)
β may only be called within ballot canceling threshold (250ms)
β cannot cancel already cancelled ballot (244ms)
β should restore emission release time (601ms)
#refreshEmissionReleaseTime
β should not update until the next threshold (129ms)
β should update to the next threshold (273ms)
β should update to the future threshold (72ms)
#vote
β should let a validator to vote (842ms)
β should allow multiple voters to vote (1572ms)
β should not let vote by nonvoting key (60ms)
β should not let vote before startTime (89ms)
β should not let vote after endTime (253ms)
β should not let vote with already voted key (202ms)
β should not let vote with invalid choice (173ms)
β should not let vote with invalid id (155ms)
β should not let vote if already finalized (1404ms)
β should not let vote with old miningKey (2283ms)
β should not let vote if ballot is canceled (152ms)
#finalize
β happy path (569ms)
β freeze funds if it did not pass minimum voters count (1142ms)
β freeze funds if there is no majority of 3 votes (1393ms)
β freeze funds if there is no majority of 4 votes (1872ms)
β send funds to receiver if most votes are for sending (2304ms)
β send funds to receiver if most votes are for sending (1816ms)
β burn funds if most votes are for burning (1898ms)
β prevents finalize with invalid id (209ms)
β do not let finalize if a ballot is active (211ms)
β finalize immediately if the last validator gave his vote (1281ms)
β does not finalize immediately until ballot canceling threshold is reached (1316ms)
β prevents double finalize (292ms)
β should refresh emission release time (265ms)
β deny finalization if the voting key is a contract (737ms)
β deny finalization within ballot canceling threshold (305ms)
β deny finalization of canceled ballot (284ms)
598 passing (18m)