2018-09-19 | #4622420
Hard Fork Date | Block Number
Info
Network: Sokol
Date: 2018-09-19
Block number: 4622420
Description
Problems
Governance smart contracts are non-upgradable.
Feature request: we need to increase emission supply for self-sustainability of the network (poanetwork/RFC#14).
Feature request: there is no ability to create one ballot for three keys (poanetwork/poa-network-consensus-contracts#92).
Feature request: there is no ability to finalize ballot earlier if all validators voted before the end of a ballot (poanetwork/RFC#8).
DApp performance: There are no tuple getters in smart contracts. It leads to the low performance of
Voting DApp
.pragma solidity ^0.4.18;
used for governance smart contracts is outdated.Smart contracts need to be refactored in order to make them easy to read.
Smart contracts need to be checked for security and design issues (audit report by MixBytes team, audit report by ChainSecurity team).
Minor bugs.
Changelog
Major changes
smart contracts were made upgradable:
BallotsStorage
,KeysManager
,ProxyStorage
,ValidatorMetadata
,VotingToChangeKeys
,VotingToChangeMinThreshold
,VotingToChangeProxyAddress
;scripts for migration from old to new smart contracts were added to
scripts/migrate
directory;new smart contracts for
Increased Emission Supply
were added:VotingToManageEmissionFunds
,EmissionFunds
,RewardByBlock
;a new feature was implemented for creating a ballot to add a new validator with three keys at once;
a new feature was implemented for finalizing a ballot before its end time in case of all validators voted;
tuple getters were added to increase the performance of
Voting DApp
;smart contracts were migrated to the latest stable
Solidity
compiler version (0.4.24
);smart contracts were refactored;
npm packages were updated;
found bugs were fixed;
the test environment was updated (
ganache-cli
instead oftestrpc
, newsolidity-coverage
);security improvements were made according to reports of security audits.
Major pull requests
(Feature) Add script for checking contracts' functions for a clashing (poanetwork/poa-network-consensus-contracts#179)
(Fix) Reduce gas spending, improve migrations, and minor enhancements (poanetwork/poa-network-consensus-contracts#171)
(Feature) Allow cancellation of a ballot in
VotingToManageEmissionFunds
by its creator for 15 minutes after it's created (poanetwork/poa-network-consensus-contracts#168)(Fix) Accounting of pending confirmations in ValidatorMetadata's
moveMetadata
andclearMetadata
functions (poanetwork/poa-network-consensus-contracts#164)(Fix) Add moveMetadata and clearMetadata functions to ValidatorMetadata contract (poanetwork/poa-network-consensus-contracts#158)
(Fix) Finalization without reverts, optimizations and unit tests updates (poanetwork/poa-network-consensus-contracts#155)
(Fix) Remove changing of ProxyStorage's address from ValidatorMetadata (poanetwork/poa-network-consensus-contracts#150)
(Feature) Block Reward emission by time (poanetwork/poa-network-consensus-contracts#133)
(Feature) Add extra getters for Voting DApp optimization (poanetwork/poa-network-consensus-contracts#129)
(Feature) Add new validator with mining/voting/payout keys at once (poanetwork/poa-network-consensus-contracts#118)
(Feature) Allow finalize at once if all validators gave their votes (poanetwork/poa-network-consensus-contracts#113)
(Fix) removeVotingKey and removePayoutKey shouldn't revert if voting/ payout key is already removed (poanetwork/poa-network-consensus-contracts#127)
(Fix) Add missed unit tests (poanetwork/poa-network-consensus-contracts#125)
(Refactor) Small enhancements, refactoring and fixes (poanetwork/poa-network-consensus-contracts#122)
(Refactor) Update solc to 0.4.24 and truffle to 4.1.11 (poanetwork/poa-network-consensus-contracts#106)
(Feature) Unit tests and enhancements for Increased Emission Supply (poanetwork/poa-network-consensus-contracts#105)
(Fix) MoC can be removed (poanetwork/poa-network-consensus-contracts#101)
(Fix) Update web3 (poanetwork/poa-network-consensus-contracts#99)
(Refactor) New smart contracts refactoring (poanetwork/poa-network-consensus-contracts#96)
(Feature) Add BlockReward contract (poanetwork/poa-network-consensus-contracts#83)
(Refactor) Code refactoring (poanetwork/poa-network-consensus-contracts#82)
(Feature) Upgradable contracts (poanetwork/poa-network-consensus-contracts#81)
(Fix) Some of proposals from auditors (poanetwork/poa-network-consensus-contracts#135)
Minor pull requests
(Fix) Update README.md (poanetwork/poa-network-consensus-contracts#183)
(Fix) Enhancements of migration scripts (poanetwork/poa-network-consensus-contracts#182)
(Fix) Enhancement of VotingToManageEmissionFunds._finalize function (poanetwork/poa-network-consensus-contracts#181)
(Refactor) Put address arguments at the end of argument list of functions (poanetwork/poa-network-consensus-contracts#178)
(Refactor) Remove
this
and other code improvements (poanetwork/poa-network-consensus-contracts#175)(Fix) Replace uint8 with uint256 to reduce gas spending (poanetwork/poa-network-consensus-contracts#174)
(Fix) Minor improvements of KeysManager and PoaNetworkConsensus.setProxyStorage (poanetwork/poa-network-consensus-contracts#173)
(Fix) Remove theoretical reentrancy from
VotingTo._createBallot
method and other enhancements (poanetwork/poa-network-consensus-contracts#170)(Fix) Security enhancements of
VotingToChange*.migrateBasicOne
function (poanetwork/poa-network-consensus-contracts#169)(Fix) Deny using VotingToChange* functions unless migration is completed (poanetwork/poa-network-consensus-contracts#167)
(Feature) Checking if a voting key is EOA or a contract in VotingToManageEmissionFunds (poanetwork/poa-network-consensus-contracts#165)
(Refactor) Move
implementation
andversion
functions fromEternalStorage
toEternalStorageProxy
(poanetwork/poa-network-consensus-contracts#163)(Refactor) Replace returns(address) with returns(interface) in several private functions (poanetwork/poa-network-consensus-contracts#162)
(Fix) Using of BallotsStorage.getProxyThreshold in VotingToManageEmissionFunds (poanetwork/poa-network-consensus-contracts#160)
(Fix) Replace abi.encodePacked with abi.encode (poanetwork/poa-network-consensus-contracts#159)
(Fix) ValidatorMetadata contract enhancements (poanetwork/poa-network-consensus-contracts#157)
(Fix) PoaNetworkConsensus contract and KeysManager.migrateMiningKey function (poanetwork/poa-network-consensus-contracts#156)
(Fix) Removing usage of a free pointer from EternalStorageProxy's fallback function (poanetwork/poa-network-consensus-contracts#151)
(Refactor) A few enhancements proposed by auditors (poanetwork/poa-network-consensus-contracts#149)
(Refactor) Add KeysManager.getInitialKeyStatus function instead of initialKeys and getInitialKey (poanetwork/poa-network-consensus-contracts#148)
(Fix) Don't allow adding voting/ payout key for zero mining key (poanetwork/poa-network-consensus-contracts#147)
(Fix) Fixes and enhancements of BallotsStorage.sol, EternalStorageProxy.sol, KeysManager.sol, ValidatorMetadata.sol, VotingToChange.sol, VotingToChangeKeys.sol (poanetwork/poa-network-consensus-contracts#145, poanetwork/poa-network-consensus-contracts#146, poanetwork/poa-network-consensus-contracts#152, poanetwork/poa-network-consensus-contracts#153, poanetwork/poa-network-consensus-contracts#166)
(Feature) A new RewardByBlock.addExtraReceiver function (poanetwork/poa-network-consensus-contracts#144)
(Fix) Add keeping of RewardByBlock and VotingToManageEmissionFunds addresses to ProxyStorage (poanetwork/poa-network-consensus-contracts#143)
(Fix) Fixes of migration scripts (poanetwork/poa-network-consensus-contracts#141, poanetwork/poa-network-consensus-contracts#142)
(Fix) BlockReward upgradability and splitting into RewardByBlock and RewardByTime (poanetwork/poa-network-consensus-contracts#140)
(Fix) Add solc to scripts/package.json (poanetwork/poa-network-consensus-contracts#138)
(Refactor) Rename BlockReward.rewardHBBFT function to rewardByTime (poanetwork/poa-network-consensus-contracts#136)
(Refactor) Rewrite migrations/2_deploy_contract.js (poanetwork/poa-network-consensus-contracts#134)
(Fix) Checking transaction status in scripts/migrate (poanetwork/poa-network-consensus-contracts#132)
(Fix) Refreshing unit tests' results in README (poanetwork/poa-network-consensus-contracts#131)
(Fix) "Stack too deep" error in VotingToChangeKeys.getBallotInfo (poanetwork/poa-network-consensus-contracts#130)
(Fix) migrations/2_deploy_contract.js (poanetwork/poa-network-consensus-contracts#124)
(Fix) PoaNetworkConsensus small changes (poanetwork/poa-network-consensus-contracts#123)
(Refactor) Enhancements and fixes (poanetwork/poa-network-consensus-contracts#112)
(Fix) Unit tests for solidity-coverage (poanetwork/poa-network-consensus-contracts#109)
(Fix) KeysManager and a few enhancements (poanetwork/poa-network-consensus-contracts#104)
(Fix) Known vulnerability in
hoek@4.2.0
dependency (poanetwork/poa-network-consensus-contracts#97)(Fix) README text about PoaNetworkConsensus bytecode (poanetwork/poa-network-consensus-contracts#79)
(Refactor) Collapse master and demo branch (poanetwork/poa-network-consensus-contracts#76)
Solution
Deploy new smart contracts and migrate all the data from old to new contracts with
scripts/migrate/migrateAll.js
.Update
poa-chain-spec/contracts.json
.Update
poa-chain-spec/abis
.Update
poa-chain-spec/spec.json
:add an address of the new
PoaNetworkConsensus
contract toengine/authorityRound/params/validators/multi
;add
blockRewardContractAddress
(obtained from step 1) andblockRewardContractTransition
(equal to4639000
) toengine/authorityRound/params
.Organize the HF on block
4622420
.
Increased Emission Supply
In the scope of this hard fork, the emission supply will be increased by 1 POA per block.
POA has a block time of ~5 seconds and rewards each validated block miner 1 POA for each block. These block rewards never run out and after the hard fork there will be 2 POA minted per block. The remaining 1 POA per block will be put aside to benefit the network however the current Validators vote to choose, some example use cases are to Burn coins, hold coins or spend on R&D for the POA Foundation. Validator's reward will remain at 1 POA after this transition.
You can find more info located in the POA Whitepaper Economy Section and RFC issue #14.
Instructions
Follow Sokol spec.json hard-fork guide
Verify
You should see:
Last updated