upgrade consensus contracts to solidity 0.8.30#189
Open
Andrew-Pohl wants to merge 1 commit into
Open
Conversation
mul53
reviewed
Jun 18, 2026
|
|
||
| function upgradeConsensusMock(address _implementation) public { | ||
| EternalStorageProxy(getConsensus()).upgradeTo(_implementation); | ||
| EternalStorageProxy(payable(getConsensus())).upgradeTo(_implementation); |
Collaborator
There was a problem hiding this comment.
do we need to add payable here?
Member
Author
There was a problem hiding this comment.
Pre 0.5.0 all addresses were payable. in 0.5.0 it split to non payable to payable.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades all consensus contracts (Consensus, BlockReward, Voting, ProxyStorage, EternalStorage/Proxy + abstracts, interfaces and test mocks) from Solidity
0.4.24to0.8.30.These are drop-in implementation upgrades: storage layout and all keccak storage keys are unchanged, so the new implementations can be rolled out to the live proxies through the existing ballot →
ProxyStorage.setContractAddress→upgradeTogovernance flow. No re-initialization is required (isInitializedremains set in proxy storage).Compiler / EVM target
0.8.30, optimizer unchanged (enabled, 200 runs)evmVersionis explicitly pinned toberlin. Perconfig/spec.json, Fuse/Spark have Constantinople + Istanbul/Berlin EIPs activated but not Shanghai, so default 0.8.20+ codegen would emitPUSH0and produce bytecode that cannot run on chain.Contract changes
openzeppelin-soliditydependency dropped entirely..add/.sub/.mul/.div/.modreplaced with native operators (0.8 checked arithmetic has the same revert-on-overflow semantics).Math.min/maxreplaced with internal_min/_maxhelpers inConsensusUtils.Consensus:receive()+fallback()both stakemsg.valueformsg.sender, matching the old catch-all fallback (plain send = stake, unknown selector = stake).EternalStorageProxy:receive()+fallback()both delegatecall to the implementation via a shared_delegateToImplementation().memory/calldatadata locations,arr.length--→arr.pop(),payable(...)casts for.transfer()and proxy address conversions,abstract/virtual/overridewiring (including theonlyConsensusmodifier override inVotingMock), 0.8 assembly syntax (gas(),calldatasize(), ...), SPDX identifiers.require(x >= 0)checks on uints inBlockReward(always true; compiler warnings only).Behaviour notes
DECIMALS - validatorFee()in delegator reward distribution was an unchecked subtraction in 0.4; it now reverts on underflow. Unreachable in practice (fee capped at 100%), but a strictly safer failure mode.Panic(0x11)instead of a silent wrap / plain revert. All existing guards (explicitrequires) still fire first on the normal paths.Tooling
~2.22.19(last 2.x line fully supporting Node 18; newer requires Node 20+)solc@0.4.24devDependency (flatten useshardhat flatten)Testing
yarn compile— 20 files compile cleanly (evm target: berlin)yarn test— 173 passing, 0 failing, including theupgradeTosuites that exercise upgrading proxies in place and verifying state survives