Skip to content

Commit

Permalink
Rebase on fork5 of polygon (#70)
Browse files Browse the repository at this point in the history
* rebase on fork5 of polygon

* updating zkevm contract repo

* use new zkevm-contracts- update lib dependency
  • Loading branch information
josojo authored Sep 20, 2023
1 parent 2244399 commit 35bb9e2
Show file tree
Hide file tree
Showing 33 changed files with 46 additions and 38 deletions.
2 changes: 1 addition & 1 deletion development/contracts/Arbitrator.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/Auction_ERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/ForkableBridge.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/ForkableGlobalExitRoot.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/ForkableRealityETH_ERC20.sol
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
8 changes: 4 additions & 4 deletions development/contracts/ForkableZkEVM.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/ForkingManager.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/ForkonomicToken.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/WhitelistArbitrator.sol
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion development/contracts/interfaces/IForkableBridge.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/interfaces/IForkableStructure.sol
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/interfaces/IForkableZkEVM.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/interfaces/IForkingManager.sol
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion development/contracts/interfaces/IForkonomicToken.sol
Original file line number Diff line number Diff line change
@@ -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 {IERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/lib/BridgeAssetOperations.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/lib/CreateChildren.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/mixin/BalanceHolder.sol
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion development/contracts/mixin/BalanceHolder_ERC20.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/mixin/ForkableStructure.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion development/contracts/mixin/Owned.sol
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion lib/zkevm-contracts
Submodule zkevm-contracts updated 72 files
+1 −1 .eslintrc.js
+1 −2 .github/workflows/build-docker.yml
+3 −35 .github/workflows/main.yml
+0 −22 .github/workflows/ok-to-test.yml
+5 −2 .solhint.json
+2 −1 .vscode/settings.json
+2 −2 compiled-contracts/ERC20PermitMock.json
+4 −4 compiled-contracts/FflonkVerifier.json
+10 −10 compiled-contracts/PolygonZkEVM.json
+2 −2 compiled-contracts/PolygonZkEVMBridge.json
+2 −2 compiled-contracts/PolygonZkEVMBridgeMock.json
+2 −2 compiled-contracts/PolygonZkEVMDeployer.json
+2 −2 compiled-contracts/PolygonZkEVMGlobalExitRoot.json
+2 −2 compiled-contracts/PolygonZkEVMGlobalExitRootL2.json
+2 −2 compiled-contracts/PolygonZkEVMGlobalExitRootL2Mock.json
+2 −2 compiled-contracts/PolygonZkEVMGlobalExitRootMock.json
+10 −10 compiled-contracts/PolygonZkEVMMock.json
+2 −2 compiled-contracts/PolygonZkEVMTimelock.json
+2 −2 compiled-contracts/ProxyAdmin.json
+2 −2 compiled-contracts/TokenWrapped.json
+2 −2 compiled-contracts/TransparentUpgradeableProxy.json
+4 −4 compiled-contracts/VerifierRollupHelperMock.json
+1 −1 contracts/PolygonZkEVMBridgeWrapper.sol
+1 −1 contracts/PolygonZkEVMGlobalExitRootL2.sol
+1 −1 contracts/PolygonZkEVMGlobalExitRootWrapper.sol
+1 −1 contracts/PolygonZkEVMTimelock.sol
+3 −3 contracts/PolygonZkEVMWrapper.sol
+1 −1 contracts/deployment/PolygonZkEVMDeployer.sol
+9 −9 contracts/inheritedMainContracts/PolygonZkEVM.sol
+1 −1 contracts/inheritedMainContracts/PolygonZkEVMBridge.sol
+1 −1 contracts/inheritedMainContracts/PolygonZkEVMGlobalExitRoot.sol
+1 −1 contracts/interfaces/IBasePolygonZkEVMGlobalExitRoot.sol
+1 −1 contracts/interfaces/IBridgeMessageReceiver.sol
+1 −1 contracts/interfaces/IPolygonZkEVM.sol
+1 −1 contracts/interfaces/IPolygonZkEVMBridge.sol
+1 −1 contracts/interfaces/IPolygonZkEVMErrors.sol
+1 −1 contracts/interfaces/IPolygonZkEVMGlobalExitRoot.sol
+2 −2 contracts/interfaces/IVerifierRollup.sol
+1 −1 contracts/lib/DepositContract.sol
+1 −1 contracts/lib/EmergencyManager.sol
+1 −1 contracts/lib/GlobalExitRootLib.sol
+1 −1 contracts/lib/TokenWrapped.sol
+140 −0 contracts/mainnetUpgraded/PolygonZkEVMUpgraded.sol
+1 −1 contracts/mocks/DepositContractMock.sol
+1 −1 contracts/mocks/ERC20PermitMock.sol
+1 −1 contracts/mocks/PolygonZkEVMBridgeMock.sol
+1 −1 contracts/mocks/PolygonZkEVMGlobalExitRootL2Mock.sol
+1 −1 contracts/mocks/PolygonZkEVMGlobalExitRootMock.sol
+1 −1 contracts/mocks/PolygonZkEVMMock.sol
+1 −1 contracts/mocks/SequenceBatchesMock.sol
+2 −2 contracts/mocks/VerifierRollupHelperMock.sol
+1 −1 contracts/testnet/PolygonZkEVMTestnetClearStorage.sol
+1 −1 contracts/testnet/PolygonZkEVMTestnetV2.sol
+719 −240 contracts/verifiers/FflonkVerifier.sol
+343 −0 deployment/0_createGenesisMainnet.js
+2 −1 deployment/3_deployContracts.js
+1 −0 docker/scripts/deploy-docker.sh
+16 −0 docker/scripts/deploy-dockerv2.sh
+12 −12 docs/PolygonZkEVM.md
+90 −0 docs/mainnetUpgraded/PolygonZkEVMUpgraded.md
+82 −74 gas_report.md
+151 −150 hardhat.config.js
+3,331 −2,895 package-lock.json
+8 −5 package.json
+1 −1 test/contracts/emergencyManager.test.js
+5 −5 test/contracts/polygonZkEVM.test.js
+662 −0 test/contracts/polygonZkEVMUpgraded.test.js
+24 −24 test/contracts/real-prover/test-inputs/proof.json
+1 −1 test/contracts/real-prover/test-inputs/public.json
+12 −11 upgrade/timeLockUpgrade.js
+2 −1 verifyMainnetDeployment/verifyDeployment.md
+1 −1 verifyMainnetDeployment/verifyMainnetProofVerifier.md
2 changes: 1 addition & 1 deletion test/Arbitrator.t.sol
Original file line number Diff line number Diff line change
@@ -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";

Expand Down
2 changes: 1 addition & 1 deletion test/ForkableBridge.t.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion test/ForkableGlobalExitRoot.t.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion test/ForkableStructure.t.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
14 changes: 11 additions & 3 deletions test/ForkableZkEVM.t.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -159,7 +167,7 @@ contract ForkableZkEVMTest is Test {
10,
bytes32("0x"),
bytes32("0x"),
""
proof
);

vm.expectRevert("No changes after forking");
Expand Down
2 changes: 1 addition & 1 deletion test/ForkingManager.t.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion test/ForkonomicToken.t.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion test/testcontract/ForkableBridgeWrapper.sol
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
2 changes: 1 addition & 1 deletion test/testcontract/ForkableStructureWrapper.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.8.17;
pragma solidity ^0.8.20;

import {ForkableStructure} from "../../development/contracts/mixin/ForkableStructure.sol";

Expand Down
2 changes: 1 addition & 1 deletion test/utils/Util.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pragma solidity ^0.8.17;
pragma solidity ^0.8.20;

library Util {
function bytesToAddress(bytes32 b) public pure returns (address) {
Expand Down

0 comments on commit 35bb9e2

Please sign in to comment.