hubble-contracts icon indicating copy to clipboard operation
hubble-contracts copied to clipboard

Update Solidity v0.8, @openzeppelin/contracts

Open jacque006 opened this issue 4 years ago • 2 comments

https://www.npmjs.com/package/@openzeppelin/contracts Update to latest v4

  • Requires solidity v0.8
  • Note section How to upgrade from 3.x in https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v4.0.0 , includes upgrade script.

jacque006 avatar Apr 26 '21 13:04 jacque006

Note risks/considerations in https://github.com/thehubbleproject/hubble-contracts/issues/564#issuecomment-826034726

jacque006 avatar Apr 26 '21 13:04 jacque006

One nice thing to have in 0.8 is the dynamic calldata. Solidity seems to support this in the higher version https://github.com/ethereum/solidity/issues/9160 (need to validate if it works ).

The current submitTransfer looks like this

function submitTransfer(
        bytes32[] calldata stateRoots,
        uint256[2][] calldata signatures,
        uint256[] calldata feeReceivers,
        bytes[] calldata txss
    ) external ... {

but with that, we can do

function submitTransfer(TransferCommitment[] calldata commits)  external ... {

which would improve readability a lot.

ChihChengLiang avatar May 04 '21 16:05 ChihChengLiang