Skip to content

Commit da9461c

Browse files
Thegaramzimpha
andauthored
feat: euclid phase-1 contract changes (#79)
Co-authored-by: zimpha <zimpha@gmail.com>
1 parent 2d06562 commit da9461c

11 files changed

+904
-1613
lines changed

.github/workflows/contracts.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
run : forge coverage --evm-version cancun --report lcov
8080

8181
- name : Prune coverage
82-
run : lcov --rc branch_coverage=1 --remove ./lcov.info -o ./lcov.info.pruned 'src/mocks/*' 'src/test/*' 'scripts/*' 'node_modules/*' 'lib/*'
82+
run : lcov --rc branch_coverage=1 --remove ./lcov.info -o ./lcov.info.pruned 'src/mocks/*' 'src/test/*' 'scripts/*' 'node_modules/*' 'lib/*' --ignore-errors unused,unused
8383

8484
- name: Upload coverage reports to Codecov
8585
uses: codecov/codecov-action@v3

scripts/foundry/DeployL1BridgeContracts.s.sol

+10-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {L2GasPriceOracle} from "../../src/L1/rollup/L2GasPriceOracle.sol";
2323
import {MultipleVersionRollupVerifier} from "../../src/L1/rollup/MultipleVersionRollupVerifier.sol";
2424
import {ScrollChain} from "../../src/L1/rollup/ScrollChain.sol";
2525
import {Whitelist} from "../../src/L2/predeploys/Whitelist.sol";
26-
import {ZkEvmVerifierV1} from "../../src/libraries/verifier/ZkEvmVerifierV1.sol";
26+
import {ZkEvmVerifierPostEuclid} from "../../src/libraries/verifier/ZkEvmVerifierPostEuclid.sol";
2727

2828
// solhint-disable max-states-count
2929
// solhint-disable state-visibility
@@ -38,6 +38,8 @@ contract DeployL1BridgeContracts is Script {
3838
address L2_WETH_ADDR = vm.envAddress("L2_WETH_ADDR");
3939

4040
address L1_PLONK_VERIFIER_ADDR = vm.envAddress("L1_PLONK_VERIFIER_ADDR");
41+
bytes32 VERIFIER_DIGEST_1 = vm.envBytes32("VERIFIER_DIGEST_1");
42+
bytes32 VERIFIER_DIGEST_2 = vm.envBytes32("VERIFIER_DIGEST_2");
4143

4244
address L1_PROXY_ADMIN_ADDR = vm.envAddress("L1_PROXY_ADMIN_ADDR");
4345

@@ -55,7 +57,7 @@ contract DeployL1BridgeContracts is Script {
5557
address L2_SCROLL_STANDARD_ERC20_ADDR = vm.envAddress("L2_SCROLL_STANDARD_ERC20_ADDR");
5658
address L2_SCROLL_STANDARD_ERC20_FACTORY_ADDR = vm.envAddress("L2_SCROLL_STANDARD_ERC20_FACTORY_ADDR");
5759

58-
ZkEvmVerifierV1 zkEvmVerifierV1;
60+
ZkEvmVerifierPostEuclid zkEvmVerifier;
5961
MultipleVersionRollupVerifier rollupVerifier;
6062
EnforcedTxGateway enforcedTxGateway;
6163
ProxyAdmin proxyAdmin;
@@ -66,7 +68,7 @@ contract DeployL1BridgeContracts is Script {
6668

6769
vm.startBroadcast(L1_DEPLOYER_PRIVATE_KEY);
6870

69-
deployZkEvmVerifierV1();
71+
deployZkEvmVerifier();
7072
deployMultipleVersionRollupVerifier();
7173
deployL1Whitelist();
7274
deployEnforcedTxGateway();
@@ -85,17 +87,17 @@ contract DeployL1BridgeContracts is Script {
8587
vm.stopBroadcast();
8688
}
8789

88-
function deployZkEvmVerifierV1() internal {
89-
zkEvmVerifierV1 = new ZkEvmVerifierV1(L1_PLONK_VERIFIER_ADDR);
90+
function deployZkEvmVerifier() internal {
91+
zkEvmVerifier = new ZkEvmVerifierPostEuclid(L1_PLONK_VERIFIER_ADDR, VERIFIER_DIGEST_1, VERIFIER_DIGEST_2);
9092

91-
logAddress("L1_ZKEVM_VERIFIER_V1_ADDR", address(zkEvmVerifierV1));
93+
logAddress("L1_ZKEVM_VERIFIER_V1_ADDR", address(zkEvmVerifier));
9294
}
9395

9496
function deployMultipleVersionRollupVerifier() internal {
9597
uint256[] memory _versions = new uint256[](1);
9698
address[] memory _verifiers = new address[](1);
97-
_versions[0] = 0;
98-
_verifiers[0] = address(zkEvmVerifierV1);
99+
_versions[0] = 6;
100+
_verifiers[0] = address(zkEvmVerifier);
99101
rollupVerifier = new MultipleVersionRollupVerifier(_versions, _verifiers);
100102

101103
logAddress("L1_MULTIPLE_VERSION_ROLLUP_VERIFIER_ADDR", address(rollupVerifier));

src/L1/rollup/IScrollChain.sol

+4-35
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,6 @@ interface IScrollChain {
6868
* Public Mutating Functions *
6969
*****************************/
7070

71-
/// @notice Commit a batch of transactions on layer 1.
72-
///
73-
/// @param version The version of current batch.
74-
/// @param parentBatchHeader The header of parent batch, see the comments of `BatchHeaderV0Codec`.
75-
/// @param chunks The list of encoded chunks, see the comments of `ChunkCodec`.
76-
/// @param skippedL1MessageBitmap The bitmap indicates whether each L1 message is skipped or not.
77-
function commitBatch(
78-
uint8 version,
79-
bytes calldata parentBatchHeader,
80-
bytes[] memory chunks,
81-
bytes calldata skippedL1MessageBitmap
82-
) external;
83-
8471
/// @notice Commit a batch of transactions on layer 1 with blob data proof.
8572
///
8673
/// @dev Memory layout of `blobDataProof`:
@@ -107,28 +94,6 @@ interface IScrollChain {
10794
/// @param lastBatchHeader The header of last batch to revert, see the encoding in comments of `commitBatch`.
10895
function revertBatch(bytes calldata firstBatchHeader, bytes calldata lastBatchHeader) external;
10996

110-
/// @notice Finalize a committed batch (with blob) on layer 1.
111-
///
112-
/// @dev Memory layout of `blobDataProof`:
113-
/// | z | y | kzg_commitment | kzg_proof |
114-
/// |---------|---------|----------------|-----------|
115-
/// | bytes32 | bytes32 | bytes48 | bytes48 |
116-
///
117-
/// @param batchHeader The header of current batch, see the encoding in comments of `commitBatch.
118-
/// @param prevStateRoot The state root of parent batch.
119-
/// @param postStateRoot The state root of current batch.
120-
/// @param withdrawRoot The withdraw trie root of current batch.
121-
/// @param blobDataProof The proof for blob data.
122-
/// @param aggrProof The aggregation proof for current batch.
123-
function finalizeBatchWithProof4844(
124-
bytes calldata batchHeader,
125-
bytes32 prevStateRoot,
126-
bytes32 postStateRoot,
127-
bytes32 withdrawRoot,
128-
bytes calldata blobDataProof,
129-
bytes calldata aggrProof
130-
) external;
131-
13297
/// @notice Finalize a list of committed batches (i.e. bundle) on layer 1.
13398
/// @param batchHeader The header of last batch in current bundle, see the encoding in comments of `commitBatch.
13499
/// @param postStateRoot The state root after current bundle.
@@ -140,4 +105,8 @@ interface IScrollChain {
140105
bytes32 withdrawRoot,
141106
bytes calldata aggrProof
142107
) external;
108+
109+
/// @notice Finalize the initial Euclid batch.
110+
/// @param postStateRoot The state root after current batch.
111+
function finalizeEuclidInitialBatch(bytes32 postStateRoot) external;
143112
}

0 commit comments

Comments
 (0)