From 99552400000be08766229d3ae3c934a56a22e342 Mon Sep 17 00:00:00 2001 From: josojo Date: Sun, 20 Aug 2023 12:23:52 +0200 Subject: [PATCH] rebase on fork5 of polygon --- development/contracts/Arbitrator.sol | 2 +- development/contracts/Auction_ERC20.sol | 2 +- development/contracts/ForkableBridge.sol | 2 +- development/contracts/ForkableGlobalExitRoot.sol | 2 +- development/contracts/ForkableRealityETH_ERC20.sol | 2 +- development/contracts/ForkableZkEVM.sol | 8 ++++---- development/contracts/ForkingManager.sol | 2 +- development/contracts/ForkonomicToken.sol | 2 +- development/contracts/WhitelistArbitrator.sol | 2 +- .../contracts/interfaces/IForkableBridge.sol | 2 +- .../interfaces/IForkableGlobalExitRoot.sol | 2 +- .../contracts/interfaces/IForkableStructure.sol | 2 +- .../contracts/interfaces/IForkableZkEVM.sol | 2 +- .../contracts/interfaces/IForkingManager.sol | 2 +- .../contracts/interfaces/IForkonomicToken.sol | 2 +- .../contracts/lib/BridgeAssetOperations.sol | 2 +- development/contracts/lib/CreateChildren.sol | 2 +- development/contracts/mixin/BalanceHolder.sol | 2 +- .../contracts/mixin/BalanceHolder_ERC20.sol | 2 +- development/contracts/mixin/ForkableStructure.sol | 2 +- development/contracts/mixin/Owned.sol | 2 +- foundry.toml | 2 +- lib/zkevm-contracts | 2 +- test/Arbitrator.t.sol | 2 +- test/ForkableBridge.t.sol | 2 +- test/ForkableGlobalExitRoot.t.sol | 2 +- test/ForkableStructure.t.sol | 2 +- test/ForkableZkEVM.t.sol | 14 +++++++++++--- test/ForkingManager.t.sol | 2 +- test/ForkonomicToken.t.sol | 2 +- test/testcontract/ForkableBridgeWrapper.sol | 2 +- test/testcontract/ForkableStructureWrapper.sol | 2 +- test/utils/Util.sol | 2 +- 33 files changed, 46 insertions(+), 38 deletions(-) diff --git a/development/contracts/Arbitrator.sol b/development/contracts/Arbitrator.sol index 73c3612c..11760bd3 100644 --- a/development/contracts/Arbitrator.sol +++ b/development/contracts/Arbitrator.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import "./interfaces/IArbitrator.sol"; import "./interfaces/IRealityETH.sol"; diff --git a/development/contracts/Auction_ERC20.sol b/development/contracts/Auction_ERC20.sol index 4a657c92..7b97b295 100644 --- a/development/contracts/Auction_ERC20.sol +++ b/development/contracts/Auction_ERC20.sol @@ -10,7 +10,7 @@ They will then be paid out in one or the other of the tokens, at the rate they b eg if you say the value of A:B splits 80:20, you will receive at least either 5 of B or 1.25 of A. */ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; contract Auction_ERC20 { // todo: rething the name: actually there are 101 slots diff --git a/development/contracts/ForkableBridge.sol b/development/contracts/ForkableBridge.sol index 69a52ea7..1db89059 100644 --- a/development/contracts/ForkableBridge.sol +++ b/development/contracts/ForkableBridge.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {PolygonZkEVMBridge, IBasePolygonZkEVMGlobalExitRoot} from "@RealityETH/zkevm-contracts/contracts/inheritedMainContracts/PolygonZkEVMBridge.sol"; import {IPolygonZkEVMBridge} from "@RealityETH/zkevm-contracts/contracts/interfaces/IPolygonZkEVMBridge.sol"; diff --git a/development/contracts/ForkableGlobalExitRoot.sol b/development/contracts/ForkableGlobalExitRoot.sol index bc3f2766..125ca5d3 100644 --- a/development/contracts/ForkableGlobalExitRoot.sol +++ b/development/contracts/ForkableGlobalExitRoot.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {PolygonZkEVMGlobalExitRoot} from "@RealityETH/zkevm-contracts/contracts/inheritedMainContracts/PolygonZkEVMGlobalExitRoot.sol"; import {TokenWrapped} from "@RealityETH/zkevm-contracts/contracts/lib/TokenWrapped.sol"; diff --git a/development/contracts/ForkableRealityETH_ERC20.sol b/development/contracts/ForkableRealityETH_ERC20.sol index 47e969e6..455fb349 100644 --- a/development/contracts/ForkableRealityETH_ERC20.sol +++ b/development/contracts/ForkableRealityETH_ERC20.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import "./mixin/BalanceHolder_ERC20.sol"; diff --git a/development/contracts/ForkableZkEVM.sol b/development/contracts/ForkableZkEVM.sol index acc17f4e..f2f0eb02 100644 --- a/development/contracts/ForkableZkEVM.sol +++ b/development/contracts/ForkableZkEVM.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {PolygonZkEVM} from "@RealityETH/zkevm-contracts/contracts/inheritedMainContracts/PolygonZkEVM.sol"; import {IPolygonZkEVMGlobalExitRoot} from "@RealityETH/zkevm-contracts/contracts/interfaces/IPolygonZkEVMGlobalExitRoot.sol"; @@ -58,7 +58,7 @@ contract ForkableZkEVM is ForkableStructure, IForkableZkEVM, PolygonZkEVM { uint64 finalNewBatch, bytes32 newLocalExitRoot, bytes32 newStateRoot, - bytes calldata proof + bytes32[24] calldata proof ) public override onlyBeforeForking { PolygonZkEVM.verifyBatches( pendingStateNum, @@ -76,7 +76,7 @@ contract ForkableZkEVM is ForkableStructure, IForkableZkEVM, PolygonZkEVM { uint64 finalNewBatch, bytes32 newLocalExitRoot, bytes32 newStateRoot, - bytes calldata proof + bytes32[24] calldata proof ) public override onlyBeforeForking { PolygonZkEVM.verifyBatchesTrustedAggregator( pendingStateNum, @@ -101,7 +101,7 @@ contract ForkableZkEVM is ForkableStructure, IForkableZkEVM, PolygonZkEVM { uint64 finalNewBatch, bytes32 newLocalExitRoot, bytes32 newStateRoot, - bytes calldata proof + bytes32[24] calldata proof ) public override onlyBeforeForking { PolygonZkEVM.overridePendingState( initPendingStateNum, diff --git a/development/contracts/ForkingManager.sol b/development/contracts/ForkingManager.sol index 4e265a38..c3eba5e9 100644 --- a/development/contracts/ForkingManager.sol +++ b/development/contracts/ForkingManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {ERC20PresetMinterPauser} from "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; diff --git a/development/contracts/ForkonomicToken.sol b/development/contracts/ForkonomicToken.sol index 0cc12f13..349e4c4a 100644 --- a/development/contracts/ForkonomicToken.sol +++ b/development/contracts/ForkonomicToken.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol"; import {ForkableStructure} from "./mixin/ForkableStructure.sol"; diff --git a/development/contracts/WhitelistArbitrator.sol b/development/contracts/WhitelistArbitrator.sol index 981df75f..3772e56d 100644 --- a/development/contracts/WhitelistArbitrator.sol +++ b/development/contracts/WhitelistArbitrator.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import "./mixin/BalanceHolder.sol"; diff --git a/development/contracts/interfaces/IForkableBridge.sol b/development/contracts/interfaces/IForkableBridge.sol index 25c852bb..4057ffe0 100644 --- a/development/contracts/interfaces/IForkableBridge.sol +++ b/development/contracts/interfaces/IForkableBridge.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import {IPolygonZkEVMBridge} from "@RealityETH/zkevm-contracts/contracts/interfaces/IPolygonZkEVMBridge.sol"; diff --git a/development/contracts/interfaces/IForkableGlobalExitRoot.sol b/development/contracts/interfaces/IForkableGlobalExitRoot.sol index 3ffa254e..d4b485c7 100644 --- a/development/contracts/interfaces/IForkableGlobalExitRoot.sol +++ b/development/contracts/interfaces/IForkableGlobalExitRoot.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {IForkableStructure} from "./IForkableStructure.sol"; import {IPolygonZkEVMGlobalExitRoot} from "@RealityETH/zkevm-contracts/contracts/interfaces/IPolygonZkEVMGlobalExitRoot.sol"; diff --git a/development/contracts/interfaces/IForkableStructure.sol b/development/contracts/interfaces/IForkableStructure.sol index 19d8c264..8134f099 100644 --- a/development/contracts/interfaces/IForkableStructure.sol +++ b/development/contracts/interfaces/IForkableStructure.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; interface IForkableStructure { function getChildren() external view returns (address, address); diff --git a/development/contracts/interfaces/IForkableZkEVM.sol b/development/contracts/interfaces/IForkableZkEVM.sol index e9e16bde..2dfec15d 100644 --- a/development/contracts/interfaces/IForkableZkEVM.sol +++ b/development/contracts/interfaces/IForkableZkEVM.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {IForkableStructure} from "./IForkableStructure.sol"; import {IPolygonZkEVM} from "@RealityETH/zkevm-contracts/contracts/interfaces/IPolygonZkEVM.sol"; diff --git a/development/contracts/interfaces/IForkingManager.sol b/development/contracts/interfaces/IForkingManager.sol index 1d4fcd2b..1ac4c3f6 100644 --- a/development/contracts/interfaces/IForkingManager.sol +++ b/development/contracts/interfaces/IForkingManager.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {IForkableStructure} from "./IForkableStructure.sol"; diff --git a/development/contracts/interfaces/IForkonomicToken.sol b/development/contracts/interfaces/IForkonomicToken.sol index ccb0dd85..0f21ccef 100644 --- a/development/contracts/interfaces/IForkonomicToken.sol +++ b/development/contracts/interfaces/IForkonomicToken.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {IForkableStructure} from "./IForkableStructure.sol"; diff --git a/development/contracts/lib/BridgeAssetOperations.sol b/development/contracts/lib/BridgeAssetOperations.sol index 30e46337..3f5b28e4 100644 --- a/development/contracts/lib/BridgeAssetOperations.sol +++ b/development/contracts/lib/BridgeAssetOperations.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {PolygonZkEVMBridge} from "@RealityETH/zkevm-contracts/contracts/inheritedMainContracts/PolygonZkEVMBridge.sol"; import {TokenWrapped} from "@RealityETH/zkevm-contracts/contracts/lib/TokenWrapped.sol"; import {ForkableBridge} from "../ForkableBridge.sol"; diff --git a/development/contracts/lib/CreateChildren.sol b/development/contracts/lib/CreateChildren.sol index c791a75c..f02f5caf 100644 --- a/development/contracts/lib/CreateChildren.sol +++ b/development/contracts/lib/CreateChildren.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol"; import {TransparentUpgradeableProxy} from "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; diff --git a/development/contracts/mixin/BalanceHolder.sol b/development/contracts/mixin/BalanceHolder.sol index 1e4c5990..a8a8b268 100644 --- a/development/contracts/mixin/BalanceHolder.sol +++ b/development/contracts/mixin/BalanceHolder.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import "../interfaces/IBalanceHolder.sol"; diff --git a/development/contracts/mixin/BalanceHolder_ERC20.sol b/development/contracts/mixin/BalanceHolder_ERC20.sol index 267a5456..f9dd01b8 100644 --- a/development/contracts/mixin/BalanceHolder_ERC20.sol +++ b/development/contracts/mixin/BalanceHolder_ERC20.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import "../interfaces/IERC20.sol"; import "../interfaces/IBalanceHolder_ERC20.sol"; diff --git a/development/contracts/mixin/ForkableStructure.sol b/development/contracts/mixin/ForkableStructure.sol index 9c87c799..a3416da3 100644 --- a/development/contracts/mixin/ForkableStructure.sol +++ b/development/contracts/mixin/ForkableStructure.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {IForkableStructure} from "../interfaces/IForkableStructure.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; diff --git a/development/contracts/mixin/Owned.sol b/development/contracts/mixin/Owned.sol index d9ae4031..8c60e571 100644 --- a/development/contracts/mixin/Owned.sol +++ b/development/contracts/mixin/Owned.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; contract Owned { address public owner; diff --git a/foundry.toml b/foundry.toml index 5e36ff53..a9c6126a 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,7 +5,7 @@ libs = ["node_modules", "lib"] optimizer = true optimizer_runs = 200 evm_version = "london" -solc_version = "0.8.17" +solc_version = "0.8.20" [rpc_endpoints] env = "${NODE_URL}" diff --git a/lib/zkevm-contracts b/lib/zkevm-contracts index 30702201..f23ceb83 160000 --- a/lib/zkevm-contracts +++ b/lib/zkevm-contracts @@ -1 +1 @@ -Subproject commit 307022015886ca3d16715106fd9dac13efc225e9 +Subproject commit f23ceb830f2710e54ce83e34f7380099ae7e7954 diff --git a/test/Arbitrator.t.sol b/test/Arbitrator.t.sol index ee0e136c..5e0d130f 100644 --- a/test/Arbitrator.t.sol +++ b/test/Arbitrator.t.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {Test} from "forge-std/Test.sol"; import {Arbitrator} from "../development/contracts/Arbitrator.sol"; diff --git a/test/ForkableBridge.t.sol b/test/ForkableBridge.t.sol index e94284dc..6658658d 100644 --- a/test/ForkableBridge.t.sol +++ b/test/ForkableBridge.t.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {Test} from "forge-std/Test.sol"; import {ForkableBridge} from "../development/contracts/ForkableBridge.sol"; diff --git a/test/ForkableGlobalExitRoot.t.sol b/test/ForkableGlobalExitRoot.t.sol index cf394478..db58532e 100644 --- a/test/ForkableGlobalExitRoot.t.sol +++ b/test/ForkableGlobalExitRoot.t.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {Test} from "forge-std/Test.sol"; import {ForkableGlobalExitRoot} from "../development/contracts/ForkableGlobalExitRoot.sol"; diff --git a/test/ForkableStructure.t.sol b/test/ForkableStructure.t.sol index b019535a..a0a67ad6 100644 --- a/test/ForkableStructure.t.sol +++ b/test/ForkableStructure.t.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {Test} from "forge-std/Test.sol"; import {ForkableStructureWrapper} from "./testcontract/ForkableStructureWrapper.sol"; diff --git a/test/ForkableZkEVM.t.sol b/test/ForkableZkEVM.t.sol index 970f2211..02d5c710 100644 --- a/test/ForkableZkEVM.t.sol +++ b/test/ForkableZkEVM.t.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {Test} from "forge-std/Test.sol"; import {PolygonZkEVM} from "@RealityETH/zkevm-contracts/contracts/inheritedMainContracts/PolygonZkEVM.sol"; @@ -128,7 +128,10 @@ contract ForkableZkEVMTest is Test { abi.encodePacked("newLocalExitRoot") ); bytes32 newStateRoot = keccak256(abi.encodePacked("newStateRoot")); - bytes memory proof = abi.encodePacked("proof"); + bytes32[24] memory proof; + for (uint i = 0; i < 24; i++) { + proof[i] = bytes32(abi.encodePacked("proof", i)); + } vm.prank(forkableZkEVM.forkmanager()); forkableZkEVM.createChildren(forkableZkEVMImplementation); @@ -151,6 +154,11 @@ contract ForkableZkEVMTest is Test { vm.expectRevert("No changes after forking"); forkableZkEVM.consolidatePendingState(10); + bytes32[24] memory proof; + for (uint i = 0; i < 24; i++) { + proof[i] = bytes32("0x"); // Whatever initialization value you want + } + vm.expectRevert("No changes after forking"); forkableZkEVM.overridePendingState( 10, @@ -159,7 +167,7 @@ contract ForkableZkEVMTest is Test { 10, bytes32("0x"), bytes32("0x"), - "" + proof ); vm.expectRevert("No changes after forking"); diff --git a/test/ForkingManager.t.sol b/test/ForkingManager.t.sol index 94b95de8..ae507877 100644 --- a/test/ForkingManager.t.sol +++ b/test/ForkingManager.t.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {Test} from "forge-std/Test.sol"; import {ForkingManager} from "../development/contracts/ForkingManager.sol"; diff --git a/test/ForkonomicToken.t.sol b/test/ForkonomicToken.t.sol index 86d55343..30f9ffc7 100644 --- a/test/ForkonomicToken.t.sol +++ b/test/ForkonomicToken.t.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {Test} from "forge-std/Test.sol"; import {ForkonomicToken} from "../development/contracts/ForkonomicToken.sol"; diff --git a/test/testcontract/ForkableBridgeWrapper.sol b/test/testcontract/ForkableBridgeWrapper.sol index e9a1a005..17a788ac 100644 --- a/test/testcontract/ForkableBridgeWrapper.sol +++ b/test/testcontract/ForkableBridgeWrapper.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {ForkableBridge} from "../../development/contracts/ForkableBridge.sol"; import {IBasePolygonZkEVMGlobalExitRoot} from "@RealityETH/zkevm-contracts/contracts/inheritedMainContracts/PolygonZkEVMBridge.sol"; diff --git a/test/testcontract/ForkableStructureWrapper.sol b/test/testcontract/ForkableStructureWrapper.sol index 17bee2fb..95df3e1b 100644 --- a/test/testcontract/ForkableStructureWrapper.sol +++ b/test/testcontract/ForkableStructureWrapper.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; import {ForkableStructure} from "../../development/contracts/mixin/ForkableStructure.sol"; diff --git a/test/utils/Util.sol b/test/utils/Util.sol index ee434c31..21c91e09 100644 --- a/test/utils/Util.sol +++ b/test/utils/Util.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.8.17; +pragma solidity ^0.8.20; library Util { function bytesToAddress(bytes32 b) public pure returns (address) {