mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-12 07:28:08 -05:00
Compare commits
40 Commits
fix/macos
...
feat-deter
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f69fc7b5d5 | ||
|
|
6e905352fc | ||
|
|
0680c0d4d3 | ||
|
|
29a3447d50 | ||
|
|
977f5701fe | ||
|
|
53d0389ba7 | ||
|
|
15969d34ce | ||
|
|
fc0cb979f0 | ||
|
|
2b5b82d466 | ||
|
|
e2b87879da | ||
|
|
4ab710359d | ||
|
|
f27d27cb8a | ||
|
|
0e28f28a6f | ||
|
|
cbd3f54b6b | ||
|
|
bc1cb1f86e | ||
|
|
5497777c88 | ||
|
|
39db5634e2 | ||
|
|
2d14457c91 | ||
|
|
5b3a65b208 | ||
|
|
53b14bc090 | ||
|
|
180f3c63fb | ||
|
|
5e59373cf4 | ||
|
|
1d856821df | ||
|
|
98d2c333bd | ||
|
|
d4bbb252de | ||
|
|
7ac34b3196 | ||
|
|
dfab7315df | ||
|
|
623cf34fa3 | ||
|
|
ad5c47509f | ||
|
|
03fdd8eb05 | ||
|
|
421cd7e96d | ||
|
|
31a636a66b | ||
|
|
3c6c86eaad | ||
|
|
9f7841a468 | ||
|
|
e56d9a9cff | ||
|
|
7b2228898b | ||
|
|
491aa91369 | ||
|
|
6eb58c1097 | ||
|
|
5c42eb381b | ||
|
|
febc8a7a38 |
47
contracts/docker/Dockerfile.deploy
Normal file
47
contracts/docker/Dockerfile.deploy
Normal file
@@ -0,0 +1,47 @@
|
||||
# Use the latest node Debian slim base image
|
||||
# This makes installing yarn dep much easier
|
||||
FROM node:20-bookworm-slim
|
||||
|
||||
# Switch to bash shell
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
# Install dependencies
|
||||
RUN apt update
|
||||
RUN apt install --yes curl bash coreutils git jq
|
||||
|
||||
# Download and run the Foundry installation script
|
||||
RUN curl -L https://foundry.paradigm.xyz | bash
|
||||
|
||||
# Set the environment variables to ensure Foundry tools are in the PATH
|
||||
ENV PATH="/root/.foundry/bin:${PATH}"
|
||||
|
||||
# Run foundryup to update Foundry
|
||||
RUN foundryup -v nightly-56dbd20c7179570c53b6c17ff34daa7273a4ddae
|
||||
|
||||
# copy dependencies
|
||||
COPY ./lib /contracts/lib
|
||||
COPY ./node_modules/@openzeppelin /contracts/node_modules/@openzeppelin
|
||||
|
||||
# copy configurations
|
||||
COPY foundry.toml /contracts/foundry.toml
|
||||
COPY remappings.txt /contracts/remappings.txt
|
||||
|
||||
# copy source code
|
||||
COPY ./src /contracts/src
|
||||
COPY ./scripts /contracts/scripts
|
||||
|
||||
# compile contracts
|
||||
ENV FOUNDRY_EVM_VERSION="cancun"
|
||||
ENV FOUNDRY_BYTECODE_HASH="none"
|
||||
|
||||
WORKDIR /contracts
|
||||
RUN forge build
|
||||
|
||||
# copy script configs
|
||||
COPY ./docker/templates/config-contracts.toml /contracts/docker/templates/config-contracts.toml
|
||||
|
||||
COPY ./docker/scripts/deploy.sh /contracts/docker/scripts/deploy.sh
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/contracts/docker/scripts/deploy.sh"]
|
||||
53
contracts/docker/Dockerfile.gen-configs
Normal file
53
contracts/docker/Dockerfile.gen-configs
Normal file
@@ -0,0 +1,53 @@
|
||||
# Use the latest node Debian slim base image
|
||||
# This makes installing yarn dep much easier
|
||||
FROM node:20-bookworm-slim
|
||||
|
||||
# Switch to bash shell
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
WORKDIR /root
|
||||
|
||||
# Install dependencies
|
||||
RUN apt update
|
||||
RUN apt install --yes curl bash coreutils git jq
|
||||
|
||||
# Download and run the Foundry installation script
|
||||
RUN curl -L https://foundry.paradigm.xyz | bash
|
||||
|
||||
# Set the environment variables to ensure Foundry tools are in the PATH
|
||||
ENV PATH="/root/.foundry/bin:${PATH}"
|
||||
|
||||
# Run foundryup to update Foundry
|
||||
RUN foundryup -v nightly-56dbd20c7179570c53b6c17ff34daa7273a4ddae
|
||||
|
||||
# copy dependencies
|
||||
COPY ./lib /contracts/lib
|
||||
COPY ./node_modules/@openzeppelin /contracts/node_modules/@openzeppelin
|
||||
|
||||
# copy configurations
|
||||
COPY foundry.toml /contracts/foundry.toml
|
||||
COPY remappings.txt /contracts/remappings.txt
|
||||
|
||||
# copy source code
|
||||
COPY ./src /contracts/src
|
||||
COPY ./scripts /contracts/scripts
|
||||
|
||||
# compile contracts
|
||||
ENV FOUNDRY_EVM_VERSION="cancun"
|
||||
ENV FOUNDRY_BYTECODE_HASH="none"
|
||||
|
||||
WORKDIR /contracts
|
||||
RUN forge build
|
||||
|
||||
# copy script configs
|
||||
COPY ./docker/templates/balance-checker-config.json /contracts/docker/templates/balance-checker-config.json
|
||||
COPY ./docker/templates/bridge-history-config.json /contracts/docker/templates/bridge-history-config.json
|
||||
COPY ./docker/templates/chain-monitor-config.json /contracts/docker/templates/chain-monitor-config.json
|
||||
COPY ./docker/templates/config-contracts.toml /contracts/docker/templates/config-contracts.toml
|
||||
COPY ./docker/templates/coordinator-config.json /contracts/docker/templates/coordinator-config.json
|
||||
COPY ./docker/templates/genesis.json /contracts/docker/templates/genesis.json
|
||||
COPY ./docker/templates/rollup-config.json /contracts/docker/templates/rollup-config.json
|
||||
|
||||
COPY ./docker/scripts/gen-configs.sh /contracts/docker/scripts/gen-configs.sh
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/contracts/docker/scripts/gen-configs.sh"]
|
||||
75
contracts/docker/config-example.toml
Normal file
75
contracts/docker/config-example.toml
Normal file
@@ -0,0 +1,75 @@
|
||||
[general]
|
||||
|
||||
L1_RPC_ENDPOINT = "http://l1geth:8545"
|
||||
L2_RPC_ENDPOINT = "http://l2geth:8545"
|
||||
|
||||
CHAIN_ID_L1 = 111111
|
||||
CHAIN_ID_L2 = 222222
|
||||
|
||||
MAX_TX_IN_CHUNK = 100
|
||||
MAX_BLOCK_IN_CHUNK = 100
|
||||
MAX_L1_MESSAGE_GAS_LIMIT = 10000
|
||||
|
||||
L1_CONTRACT_DEPLOYMENT_BLOCK = 0
|
||||
|
||||
TEST_ENV_MOCK_FINALIZE_ENABLED = true
|
||||
TEST_ENV_MOCK_FINALIZE_TIMEOUT_SEC = 3600
|
||||
|
||||
|
||||
[accounts]
|
||||
|
||||
# note: for now we simply use Anvil's dev accounts
|
||||
|
||||
DEPLOYER_PRIVATE_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
||||
OWNER_PRIVATE_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
||||
|
||||
L1_COMMIT_SENDER_PRIVATE_KEY = "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
|
||||
L1_FINALIZE_SENDER_PRIVATE_KEY = "0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"
|
||||
L1_GAS_ORACLE_SENDER_PRIVATE_KEY = "0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"
|
||||
L2_GAS_ORACLE_SENDER_PRIVATE_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
||||
|
||||
DEPLOYER_ADDR = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
||||
OWNER_ADDR = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
||||
|
||||
L1_COMMIT_SENDER_ADDR = "0x70997970C51812dc3A010C7d01b50e0d17dc79C8"
|
||||
L1_FINALIZE_SENDER_ADDR = "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
|
||||
L1_GAS_ORACLE_SENDER_ADDR = "0x90F79bf6EB2c4f870365E785982E1f101E93b906"
|
||||
L2_GAS_ORACLE_SENDER_ADDR = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
||||
|
||||
L2GETH_SIGNER_0_ADDRESS = "0x756EA06BDEe36de11F22DCca45a31d8a178eF3c6"
|
||||
|
||||
[db]
|
||||
|
||||
SCROLL_DB_CONNECTION_STRING = "postgres://postgres:scroll2022@db:5432/scroll?sslmode=disable"
|
||||
CHAIN_MONITOR_DB_CONNECTION_STRING = "postgres://postgres:scroll2022@db:5432/chain_monitor?sslmode=disable"
|
||||
BRIDGE_HISTORY_DB_CONNECTION_STRING = "postgres://postgres:scroll2022@db:5432/bridge_history?sslmode=disable"
|
||||
|
||||
|
||||
[genesis]
|
||||
|
||||
L2_MAX_ETH_SUPPLY = "226156424291633194186662080095093570025917938800079226639565593765455331328"
|
||||
L2_DEPLOYER_INITIAL_BALANCE = 1000000000000000000
|
||||
|
||||
|
||||
[contracts]
|
||||
|
||||
DEPLOYMENT_SALT = ""
|
||||
|
||||
# contracts deployed outside this script
|
||||
L1_FEE_VAULT_ADDR = "0x0000000000000000000000000000000000000001"
|
||||
L1_PLONK_VERIFIER_ADDR = "0x0000000000000000000000000000000000000001"
|
||||
|
||||
[contracts.overrides]
|
||||
|
||||
# L1_WETH = "0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14"
|
||||
|
||||
L2_MESSAGE_QUEUE = "0x5300000000000000000000000000000000000000"
|
||||
L1_GAS_PRICE_ORACLE = "0x5300000000000000000000000000000000000002"
|
||||
L2_WHITELIST = "0x5300000000000000000000000000000000000003"
|
||||
L2_WETH = "0x5300000000000000000000000000000000000004"
|
||||
L2_TX_FEE_VAULT = "0x5300000000000000000000000000000000000005"
|
||||
|
||||
|
||||
[coordinator]
|
||||
|
||||
COORDINATOR_JWT_SECRET_KEY = "e788b62d39254928a821ac1c76b274a8c835aa1e20ecfb6f50eb10e87847de44"
|
||||
26
contracts/docker/scripts/build.sh
Executable file
26
contracts/docker/scripts/build.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
latest_commit=$(git log -1 --pretty=format:%h)
|
||||
tag=${latest_commit:0:8}
|
||||
echo "Using Docker image tag: $tag"
|
||||
echo ""
|
||||
|
||||
docker build -f docker/Dockerfile.gen-configs -t scrolltech/scroll-stack-contracts:gen-configs-$tag-amd64 --platform linux/amd64 .
|
||||
echo
|
||||
echo "built scrolltech/scroll-stack-contracts:gen-configs-$tag-amd64"
|
||||
echo
|
||||
|
||||
docker build -f docker/Dockerfile.gen-configs -t scrolltech/scroll-stack-contracts:gen-configs-$tag-arm64 --platform linux/arm64 .
|
||||
echo
|
||||
echo "built scrolltech/scroll-stack-contracts:gen-configs-$tag-arm64"
|
||||
echo
|
||||
|
||||
docker build -f docker/Dockerfile.deploy -t scrolltech/scroll-stack-contracts:deploy-$tag-amd64 --platform linux/amd64 .
|
||||
echo
|
||||
echo "built scrolltech/scroll-stack-contracts:deploy-$tag-amd64"
|
||||
echo
|
||||
|
||||
docker build -f docker/Dockerfile.deploy -t scrolltech/scroll-stack-contracts:deploy-$tag-arm64 --platform linux/arm64 .
|
||||
echo
|
||||
echo "built scrolltech/scroll-stack-contracts:deploy-$tag-arm64"
|
||||
echo
|
||||
46
contracts/docker/scripts/deploy.sh
Executable file
46
contracts/docker/scripts/deploy.sh
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
export FOUNDRY_EVM_VERSION="cancun"
|
||||
export FOUNDRY_BYTECODE_HASH="none"
|
||||
|
||||
if [ "${L1_RPC_ENDPOINT}" = "" ]; then
|
||||
echo "L1_RPC_ENDPOINT is not set"
|
||||
L1_RPC_ENDPOINT="http://host.docker.internal:8543"
|
||||
fi
|
||||
|
||||
if [ "$L2_RPC_ENDPOINT" = "" ]; then
|
||||
echo "L2_RPC_ENDPOINT is not set"
|
||||
L2_RPC_ENDPOINT="http://host.docker.internal:8545"
|
||||
fi
|
||||
|
||||
if [ "${L1_RPC_ENDPOINT}" = "" ]; then
|
||||
echo "L1_RPC_ENDPOINT is not set"
|
||||
L1_RPC_ENDPOINT="http://host.docker.internal:8543"
|
||||
fi
|
||||
|
||||
if [ "${BATCH_SIZE}" = "" ]; then
|
||||
BATCH_SIZE="100"
|
||||
fi
|
||||
|
||||
echo "using L1_RPC_ENDPOINT = $L1_RPC_ENDPOINT"
|
||||
echo "using L2_RPC_ENDPOINT = $L2_RPC_ENDPOINT"
|
||||
|
||||
# simulate L1
|
||||
echo ""
|
||||
echo "simulating on L1"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:DeployScroll --rpc-url "$L1_RPC_ENDPOINT" --sig "run(string,string)" "L1" "verify-config" || exit 1
|
||||
|
||||
# simulate L2
|
||||
echo ""
|
||||
echo "simulating on L2"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:DeployScroll --rpc-url "$L2_RPC_ENDPOINT" --sig "run(string,string)" "L2" "verify-config" --legacy || exit 1
|
||||
|
||||
# deploy L1
|
||||
echo ""
|
||||
echo "deploying on L1"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:DeployScroll --rpc-url "$L1_RPC_ENDPOINT" --batch-size "$BATCH_SIZE" --sig "run(string,string)" "L1" "verify-config" --broadcast || exit 1
|
||||
|
||||
# deploy L2
|
||||
echo ""
|
||||
echo "deploying on L2"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:DeployScroll --rpc-url "$L2_RPC_ENDPOINT" --batch-size "$BATCH_SIZE" --sig "run(string,string)" "L2" "verify-config" --broadcast --legacy || exit 1
|
||||
33
contracts/docker/scripts/gen-configs.sh
Executable file
33
contracts/docker/scripts/gen-configs.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo ""
|
||||
echo "generating config-contracts.toml"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:DeployScroll --sig "run(string,string)" "none" "write-config" || exit 1
|
||||
|
||||
echo ""
|
||||
echo "generating genesis.json"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:GenerateGenesis || exit 1
|
||||
|
||||
echo ""
|
||||
echo "generating rollup-config.json"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:GenerateRollupConfig || exit 1
|
||||
|
||||
echo ""
|
||||
echo "generating coordinator-config.json"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:GenerateCoordinatorConfig || exit 1
|
||||
|
||||
echo ""
|
||||
echo "generating chain-monitor-config.json"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:GenerateChainMonitorConfig || exit 1
|
||||
|
||||
echo ""
|
||||
echo "generating bridge-history-config.json"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:GenerateBridgeHistoryConfig || exit 1
|
||||
|
||||
echo ""
|
||||
echo "generating balance-checker-config.json"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:GenerateBalanceCheckerConfig || exit 1
|
||||
|
||||
echo ""
|
||||
echo "generating .env.frontend"
|
||||
forge script scripts/foundry/DeployScroll.s.sol:GenerateFrontendConfig || exit 1
|
||||
24
contracts/docker/scripts/push.sh
Executable file
24
contracts/docker/scripts/push.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
latest_commit=$(git log -1 --pretty=format:%h)
|
||||
tag=${latest_commit:0:8}
|
||||
echo "Using Docker image tag: $tag"
|
||||
echo ""
|
||||
|
||||
docker push scrolltech/scroll-stack-contracts:gen-configs-$tag-amd64
|
||||
docker push scrolltech/scroll-stack-contracts:gen-configs-$tag-arm64
|
||||
|
||||
docker manifest create scrolltech/scroll-stack-contracts:gen-configs-$tag \
|
||||
--amend scrolltech/scroll-stack-contracts:gen-configs-$tag-amd64 \
|
||||
--amend scrolltech/scroll-stack-contracts:gen-configs-$tag-arm64
|
||||
|
||||
docker manifest push scrolltech/scroll-stack-contracts:gen-configs-$tag
|
||||
|
||||
docker push scrolltech/scroll-stack-contracts:deploy-$tag-amd64
|
||||
docker push scrolltech/scroll-stack-contracts:deploy-$tag-arm64
|
||||
|
||||
docker manifest create scrolltech/scroll-stack-contracts:deploy-$tag \
|
||||
--amend scrolltech/scroll-stack-contracts:deploy-$tag-amd64 \
|
||||
--amend scrolltech/scroll-stack-contracts:deploy-$tag-arm64
|
||||
|
||||
docker manifest push scrolltech/scroll-stack-contracts:deploy-$tag
|
||||
42
contracts/docker/templates/balance-checker-config.json
Normal file
42
contracts/docker/templates/balance-checker-config.json
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
"addresses": [
|
||||
{
|
||||
"rpc_url": "${SCROLL_L1_RPC}",
|
||||
"min_balance_ether": "10",
|
||||
"address": "${L1_COMMIT_SENDER_ADDRESS}",
|
||||
"name": "L1_COMMIT_SENDER"
|
||||
},
|
||||
{
|
||||
"rpc_url": "${SCROLL_L1_RPC}",
|
||||
"min_balance_ether": "10",
|
||||
"address": "${L1_FINALIZE_SENDER_ADDRESS}",
|
||||
"name": "L1_FINALIZE_SENDER"
|
||||
},
|
||||
{
|
||||
"rpc_url": "${SCROLL_L1_RPC}",
|
||||
"min_balance_ether": "1.1",
|
||||
"address": "${L1_GAS_ORACLE_SENDER_ADDRESS}",
|
||||
"name": "L1_GAS_ORACLE_SENDER"
|
||||
},
|
||||
{
|
||||
"rpc_url": "${SCROLL_L1_RPC}",
|
||||
"min_balance_ether": "0",
|
||||
"address": "${L1_SCROLL_FEE_VAULT_ADDRESS}",
|
||||
"name": "L1_SCROLL_FEE_VAULT"
|
||||
},
|
||||
{
|
||||
"rpc_url": "${SCROLL_L2_RPC}",
|
||||
"min_balance_ether": "1.1",
|
||||
"address": "${L2_GAS_ORACLE_SENDER_ADDRESS}",
|
||||
"name": "L2_GAS_ORACLE_SENDER"
|
||||
},
|
||||
{
|
||||
"rpc_url": "${SCROLL_L2_RPC}",
|
||||
"min_balance_ether": "0",
|
||||
"address": "${L2_TX_FEE_VAULT_ADDR}",
|
||||
"name": "L2_TX_FEE_VAULT"
|
||||
}
|
||||
],
|
||||
"JOB_INTERVAL_SECS": 60,
|
||||
"BIND_PORT": 8080
|
||||
}
|
||||
56
contracts/docker/templates/bridge-history-config.json
Normal file
56
contracts/docker/templates/bridge-history-config.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"L1": {
|
||||
"confirmation": 0,
|
||||
"endpoint": null,
|
||||
"startHeight": 0,
|
||||
"blockTime": 12,
|
||||
"fetchLimit": 16,
|
||||
"MessageQueueAddr": null,
|
||||
"MessengerAddr": null,
|
||||
"ScrollChainAddr": null,
|
||||
"GatewayRouterAddr": null,
|
||||
"ETHGatewayAddr": null,
|
||||
"WETHGatewayAddr": null,
|
||||
"StandardERC20GatewayAddr": null,
|
||||
"CustomERC20GatewayAddr": null,
|
||||
"ERC721GatewayAddr": null,
|
||||
"ERC1155GatewayAddr": null,
|
||||
"USDCGatewayAddr": "0x0000000000000000000000000000000000000000",
|
||||
"LIDOGatewayAddr": "0x0000000000000000000000000000000000000000",
|
||||
"DAIGatewayAddr": "0x0000000000000000000000000000000000000000",
|
||||
"PufferGatewayAddr": "0x0000000000000000000000000000000000000000"
|
||||
},
|
||||
"L2": {
|
||||
"confirmation": 0,
|
||||
"endpoint": null,
|
||||
"blockTime": 3,
|
||||
"fetchLimit": 64,
|
||||
"MessageQueueAddr": null,
|
||||
"MessengerAddr": null,
|
||||
"GatewayRouterAddr": null,
|
||||
"ETHGatewayAddr": null,
|
||||
"WETHGatewayAddr": null,
|
||||
"StandardERC20GatewayAddr": null,
|
||||
"CustomERC20GatewayAddr": null,
|
||||
"ERC721GatewayAddr": null,
|
||||
"ERC1155GatewayAddr": null,
|
||||
"USDCGatewayAddr": "0x0000000000000000000000000000000000000000",
|
||||
"LIDOGatewayAddr": "0x0000000000000000000000000000000000000000",
|
||||
"DAIGatewayAddr": "0x0000000000000000000000000000000000000000",
|
||||
"PufferGatewayAddr": "0x0000000000000000000000000000000000000000"
|
||||
},
|
||||
"db": {
|
||||
"dsn": null,
|
||||
"driverName": "postgres",
|
||||
"maxOpenNum": 200,
|
||||
"maxIdleNum": 20
|
||||
},
|
||||
"redis": {
|
||||
"address": "localhost:6379",
|
||||
"username": "default",
|
||||
"password": "",
|
||||
"local": true,
|
||||
"minIdleConns": 10,
|
||||
"readTimeoutMs": 500
|
||||
}
|
||||
}
|
||||
56
contracts/docker/templates/chain-monitor-config.json
Normal file
56
contracts/docker/templates/chain-monitor-config.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"l1_config": {
|
||||
"l1_url": null,
|
||||
"confirm": "0x20",
|
||||
"start_number": null,
|
||||
"l1_contracts": {
|
||||
"l1_gateways": {
|
||||
"eth_gateway": null,
|
||||
"weth_gateway": null,
|
||||
"standard_erc20_gateway": null,
|
||||
"custom_erc20_gateway": null,
|
||||
"erc721_gateway": null,
|
||||
"erc1155_gateway": null,
|
||||
"dai_gateway": "0x0000000000000000000000000000000000000000",
|
||||
"usdc_gateway": "0x0000000000000000000000000000000000000000",
|
||||
"lido_gateway": "0x0000000000000000000000000000000000000000",
|
||||
"puffer_gateway": "0x0000000000000000000000000000000000000000"
|
||||
},
|
||||
"scroll_messenger": null,
|
||||
"message_queue": null,
|
||||
"scroll_chain": null
|
||||
},
|
||||
"start_messenger_balance": null
|
||||
},
|
||||
"l2_config": {
|
||||
"l2_url": null,
|
||||
"confirm": "0x80",
|
||||
"l2_contracts": {
|
||||
"l2_gateways": {
|
||||
"eth_gateway": null,
|
||||
"weth_gateway": null,
|
||||
"standard_erc20_gateway": null,
|
||||
"custom_erc20_gateway": null,
|
||||
"erc721_gateway": null,
|
||||
"erc1155_gateway": null,
|
||||
"dai_gateway": "0x0000000000000000000000000000000000000000",
|
||||
"usdc_gateway": "0x0000000000000000000000000000000000000000",
|
||||
"lido_gateway": "0x0000000000000000000000000000000000000000",
|
||||
"puffer_gateway": "0x0000000000000000000000000000000000000000"
|
||||
},
|
||||
"scroll_messenger": null,
|
||||
"message_queue": null
|
||||
}
|
||||
},
|
||||
"slack_webhook_config": {
|
||||
"webhook_url": "http://localhost:1234",
|
||||
"worker_count": 5,
|
||||
"worker_buffer_size": 1000
|
||||
},
|
||||
"db_config": {
|
||||
"driver_name": "postgres",
|
||||
"dsn": null,
|
||||
"maxOpenNum": 100,
|
||||
"maxIdleNum": 20
|
||||
}
|
||||
}
|
||||
55
contracts/docker/templates/config-contracts.toml
Normal file
55
contracts/docker/templates/config-contracts.toml
Normal file
@@ -0,0 +1,55 @@
|
||||
L1_WETH_ADDR = ""
|
||||
L1_PROXY_ADMIN_ADDR = ""
|
||||
L1_PROXY_IMPLEMENTATION_PLACEHOLDER_ADDR = ""
|
||||
L1_WHITELIST_ADDR = ""
|
||||
L2_GAS_PRICE_ORACLE_IMPLEMENTATION_ADDR = ""
|
||||
L2_GAS_PRICE_ORACLE_PROXY_ADDR = ""
|
||||
L1_SCROLL_CHAIN_PROXY_ADDR = ""
|
||||
L1_SCROLL_MESSENGER_PROXY_ADDR = ""
|
||||
L1_ENFORCED_TX_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L1_ENFORCED_TX_GATEWAY_PROXY_ADDR = ""
|
||||
L1_ZKEVM_VERIFIER_V1_ADDR = ""
|
||||
L1_MULTIPLE_VERSION_ROLLUP_VERIFIER_ADDR = ""
|
||||
L1_MESSAGE_QUEUE_IMPLEMENTATION_ADDR = ""
|
||||
L1_MESSAGE_QUEUE_PROXY_ADDR = ""
|
||||
L1_SCROLL_CHAIN_IMPLEMENTATION_ADDR = ""
|
||||
L1_GATEWAY_ROUTER_IMPLEMENTATION_ADDR = ""
|
||||
L1_GATEWAY_ROUTER_PROXY_ADDR = ""
|
||||
L1_ETH_GATEWAY_PROXY_ADDR = ""
|
||||
L1_WETH_GATEWAY_PROXY_ADDR = ""
|
||||
L1_STANDARD_ERC20_GATEWAY_PROXY_ADDR = ""
|
||||
L1_CUSTOM_ERC20_GATEWAY_PROXY_ADDR = ""
|
||||
L1_ERC721_GATEWAY_PROXY_ADDR = ""
|
||||
L1_ERC1155_GATEWAY_PROXY_ADDR = ""
|
||||
L2_MESSAGE_QUEUE_ADDR = ""
|
||||
L1_GAS_PRICE_ORACLE_ADDR = ""
|
||||
L2_WHITELIST_ADDR = ""
|
||||
L2_WETH_ADDR = ""
|
||||
L2_TX_FEE_VAULT_ADDR = ""
|
||||
L2_PROXY_ADMIN_ADDR = ""
|
||||
L2_PROXY_IMPLEMENTATION_PLACEHOLDER_ADDR = ""
|
||||
L2_SCROLL_MESSENGER_PROXY_ADDR = ""
|
||||
L2_ETH_GATEWAY_PROXY_ADDR = ""
|
||||
L2_WETH_GATEWAY_PROXY_ADDR = ""
|
||||
L2_STANDARD_ERC20_GATEWAY_PROXY_ADDR = ""
|
||||
L2_CUSTOM_ERC20_GATEWAY_PROXY_ADDR = ""
|
||||
L2_ERC721_GATEWAY_PROXY_ADDR = ""
|
||||
L2_ERC1155_GATEWAY_PROXY_ADDR = ""
|
||||
L2_SCROLL_STANDARD_ERC20_ADDR = ""
|
||||
L2_SCROLL_STANDARD_ERC20_FACTORY_ADDR = ""
|
||||
L1_SCROLL_MESSENGER_IMPLEMENTATION_ADDR = ""
|
||||
L1_STANDARD_ERC20_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L1_ETH_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L1_WETH_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L1_CUSTOM_ERC20_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L1_ERC721_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L1_ERC1155_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L2_SCROLL_MESSENGER_IMPLEMENTATION_ADDR = ""
|
||||
L2_GATEWAY_ROUTER_IMPLEMENTATION_ADDR = ""
|
||||
L2_GATEWAY_ROUTER_PROXY_ADDR = ""
|
||||
L2_STANDARD_ERC20_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L2_ETH_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L2_WETH_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L2_CUSTOM_ERC20_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L2_ERC721_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
L2_ERC1155_GATEWAY_IMPLEMENTATION_ADDR = ""
|
||||
30
contracts/docker/templates/coordinator-config.json
Normal file
30
contracts/docker/templates/coordinator-config.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"prover_manager": {
|
||||
"provers_per_session": 1,
|
||||
"session_attempts": 100,
|
||||
"chunk_collection_time_sec": 3600,
|
||||
"batch_collection_time_sec": 600,
|
||||
"verifier": {
|
||||
"fork_name": "bernoulli",
|
||||
"mock_mode": false,
|
||||
"params_path": "/verifier/params",
|
||||
"assets_path": "/verifier/assets"
|
||||
},
|
||||
"max_verifier_workers": 4,
|
||||
"min_prover_version": "v4.3.41"
|
||||
},
|
||||
"db": {
|
||||
"driver_name": "postgres",
|
||||
"dsn": null,
|
||||
"maxOpenNum": 200,
|
||||
"maxIdleNum": 20
|
||||
},
|
||||
"l2": {
|
||||
"chain_id": null
|
||||
},
|
||||
"auth": {
|
||||
"secret": null,
|
||||
"challenge_expire_duration_sec": 10,
|
||||
"login_expire_duration_sec": 3600
|
||||
}
|
||||
}
|
||||
48
contracts/docker/templates/genesis.json
Normal file
48
contracts/docker/templates/genesis.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"config": {
|
||||
"chainId": null,
|
||||
"homesteadBlock": 0,
|
||||
"eip150Block": 0,
|
||||
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"eip155Block": 0,
|
||||
"eip158Block": 0,
|
||||
"byzantiumBlock": 0,
|
||||
"constantinopleBlock": 0,
|
||||
"petersburgBlock": 0,
|
||||
"istanbulBlock": 0,
|
||||
"berlinBlock": 0,
|
||||
"londonBlock": 0,
|
||||
"archimedesBlock": 0,
|
||||
"shanghaiBlock": 0,
|
||||
"bernoulliBlock": 0,
|
||||
"curieBlock": 0,
|
||||
"clique": {
|
||||
"period": 3,
|
||||
"epoch": 30000
|
||||
},
|
||||
"scroll": {
|
||||
"useZktrie": true,
|
||||
"maxTxPerBlock": null,
|
||||
"maxTxPayloadBytesPerBlock": 122880,
|
||||
"feeVaultAddress": null,
|
||||
"l1Config": {
|
||||
"l1ChainId": null,
|
||||
"l1MessageQueueAddress": null,
|
||||
"scrollChainAddress": null,
|
||||
"numL1MessagesPerBlock": "10"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nonce": "0x0",
|
||||
"timestamp": null,
|
||||
"extraData": null,
|
||||
"gasLimit": "10000000",
|
||||
"difficulty": "0x1",
|
||||
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"coinbase": "0x0000000000000000000000000000000000000000",
|
||||
"alloc": {},
|
||||
"number": "0x0",
|
||||
"gasUsed": "0x0",
|
||||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"baseFeePerGas": null
|
||||
}
|
||||
87
contracts/docker/templates/rollup-config.json
Normal file
87
contracts/docker/templates/rollup-config.json
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"l1_config": {
|
||||
"confirmations": "0x0",
|
||||
"endpoint": null,
|
||||
"l1_message_queue_address": null,
|
||||
"scroll_chain_address": null,
|
||||
"start_height": 0,
|
||||
"relayer_config": {
|
||||
"gas_price_oracle_contract_address": null,
|
||||
"sender_config": {
|
||||
"endpoint": null,
|
||||
"escalate_blocks": 100,
|
||||
"escalate_multiple_num": 11,
|
||||
"escalate_multiple_den": 10,
|
||||
"max_gas_price": 10000000000000,
|
||||
"tx_type": "LegacyTx",
|
||||
"check_pending_time": 3,
|
||||
"confirmations": "0x0"
|
||||
},
|
||||
"gas_oracle_config": {
|
||||
"min_gas_price": 0,
|
||||
"gas_price_diff": 50000,
|
||||
"l1_base_fee_weight": 0.086,
|
||||
"l1_blob_base_fee_weight": 0.030
|
||||
},
|
||||
"gas_oracle_sender_private_key": null
|
||||
}
|
||||
},
|
||||
"l2_config": {
|
||||
"confirmations": "0x0",
|
||||
"endpoint": null,
|
||||
"l2_message_queue_address": null,
|
||||
"relayer_config": {
|
||||
"rollup_contract_address": null,
|
||||
"gas_price_oracle_contract_address": null,
|
||||
"sender_config": {
|
||||
"endpoint": null,
|
||||
"escalate_blocks": 4,
|
||||
"escalate_multiple_num": 12,
|
||||
"escalate_multiple_den": 10,
|
||||
"max_gas_price": 200000000000,
|
||||
"max_blob_gas_price": 200000000000,
|
||||
"tx_type": "DynamicFeeTx",
|
||||
"check_pending_time": 10,
|
||||
"confirmations": "0x0"
|
||||
},
|
||||
"gas_oracle_config": {
|
||||
"min_gas_price": 0,
|
||||
"gas_price_diff": 50000
|
||||
},
|
||||
"chain_monitor": {
|
||||
"enabled": true,
|
||||
"timeout": 3,
|
||||
"try_times": 5,
|
||||
"base_url": "http://chain-monitorv2:8080"
|
||||
},
|
||||
"enable_test_env_bypass_features": null,
|
||||
"finalize_batch_without_proof_timeout_sec": null,
|
||||
"gas_oracle_sender_private_key": null,
|
||||
"commit_sender_private_key": null,
|
||||
"finalize_sender_private_key": null,
|
||||
"l1_commit_gas_limit_multiplier": 1.2
|
||||
},
|
||||
"chunk_proposer_config": {
|
||||
"max_block_num_per_chunk": null,
|
||||
"max_tx_num_per_chunk": null,
|
||||
"max_l1_commit_gas_per_chunk": 5000000,
|
||||
"max_l1_commit_calldata_size_per_chunk": 110000,
|
||||
"chunk_timeout_sec": 2700,
|
||||
"max_row_consumption_per_chunk": 1000000,
|
||||
"gas_cost_increase_multiplier": 1.2
|
||||
},
|
||||
"batch_proposer_config": {
|
||||
"max_chunk_num_per_batch": 15,
|
||||
"max_l1_commit_gas_per_batch": 5000000,
|
||||
"max_l1_commit_calldata_size_per_batch": 110000,
|
||||
"batch_timeout_sec": 2700,
|
||||
"gas_cost_increase_multiplier": 1.2
|
||||
}
|
||||
},
|
||||
"db_config": {
|
||||
"driver_name": "postgres",
|
||||
"dsn": null,
|
||||
"maxOpenNum": 50,
|
||||
"maxIdleNum": 20
|
||||
}
|
||||
}
|
||||
@@ -7,15 +7,13 @@ libs = [] # a list of librar
|
||||
remappings = [] # a list of remappings
|
||||
libraries = [] # a list of deployed libraries to link against
|
||||
cache = true # whether to cache builds or not
|
||||
force = true # whether to ignore the cache (clean build)
|
||||
force = false # whether to ignore the cache (clean build)
|
||||
evm_version = 'cancun' # the evm version (by hardfork name)
|
||||
solc_version = '0.8.24' # override for the solc version (setting this ignores `auto_detect_solc`)
|
||||
optimizer = true # enable or disable the solc optimizer
|
||||
optimizer_runs = 200 # the number of optimizer runs
|
||||
verbosity = 2 # the verbosity of tests
|
||||
ignored_error_codes = [] # a list of ignored solc error codes
|
||||
fuzz_runs = 256 # the number of fuzz runs for tests
|
||||
ffi = false # whether to enable ffi or not
|
||||
sender = '0x00a329c0648769a73afac7f9381e08fb43dbea72' # the address of `msg.sender` in tests
|
||||
tx_origin = '0x00a329c0648769a73afac7f9381e08fb43dbea72' # the address of `tx.origin` in tests
|
||||
initial_balance = '0xffffffffffffffffffffffff' # the initial balance of the test contract
|
||||
@@ -27,4 +25,15 @@ block_coinbase = '0x0000000000000000000000000000000000000000' # the address of `
|
||||
block_timestamp = 0 # the value of `block.timestamp` in tests
|
||||
block_difficulty = 0 # the value of `block.difficulty` in tests
|
||||
|
||||
# remove bytecode hash for reliable deterministic addresses
|
||||
bytecode_hash = 'none'
|
||||
|
||||
# file system permissions
|
||||
ffi = true
|
||||
|
||||
fs_permissions = [
|
||||
{ access='read', path='./docker' },
|
||||
{ access='read-write', path='./volume' },
|
||||
]
|
||||
|
||||
gas_reports = ["L2GasPriceOracle"]
|
||||
|
||||
Submodule contracts/lib/forge-std updated: 662ae0d693...bb4ceea94d
2291
contracts/scripts/foundry/DeployScroll.s.sol
Normal file
2291
contracts/scripts/foundry/DeployScroll.s.sol
Normal file
File diff suppressed because it is too large
Load Diff
@@ -112,11 +112,11 @@ contract ScrollChain is OwnableUpgradeable, PausableUpgradeable, IScrollChain {
|
||||
*************/
|
||||
|
||||
/// @dev Address of the point evaluation precompile used for EIP-4844 blob verification.
|
||||
address private constant POINT_EVALUATION_PRECOMPILE_ADDR = address(0x0A);
|
||||
address internal constant POINT_EVALUATION_PRECOMPILE_ADDR = address(0x0A);
|
||||
|
||||
/// @dev BLS Modulus value defined in EIP-4844 and the magic value returned from a successful call to the
|
||||
/// point evaluation precompile
|
||||
uint256 private constant BLS_MODULUS =
|
||||
uint256 internal constant BLS_MODULUS =
|
||||
52435875175126190479447740508185965837690552500527637822603658699938581184513;
|
||||
|
||||
/// @notice The chain id of the corresponding layer 2 chain.
|
||||
|
||||
@@ -60,7 +60,7 @@ contract L1GasPriceOracle is OwnableBase, IL1GasPriceOracle {
|
||||
/// commit_scalar = commit_gas_per_tx * fluctuation_multiplier * 1e9
|
||||
/// ```
|
||||
/// So, the value should not exceed 10^9 * 1e9 normally.
|
||||
uint256 private constant MAX_COMMIT_SCALAR = 10 ** 9 * PRECISION;
|
||||
uint256 private constant MAX_COMMIT_SCALAR = 10**9 * PRECISION;
|
||||
|
||||
/// @dev The maximum possible l1 blob fee scalar after Curie.
|
||||
/// We derive the blob scalar by
|
||||
@@ -68,7 +68,7 @@ contract L1GasPriceOracle is OwnableBase, IL1GasPriceOracle {
|
||||
/// blob_scalar = fluctuation_multiplier / compression_ratio / blob_util_ratio * 1e9
|
||||
/// ```
|
||||
/// So, the value should not exceed 10^9 * 1e9 normally.
|
||||
uint256 private constant MAX_BLOB_SCALAR = 10 ** 9 * PRECISION;
|
||||
uint256 private constant MAX_BLOB_SCALAR = 10**9 * PRECISION;
|
||||
|
||||
/*************
|
||||
* Variables *
|
||||
@@ -113,6 +113,9 @@ contract L1GasPriceOracle is OwnableBase, IL1GasPriceOracle {
|
||||
|
||||
constructor(address _owner) {
|
||||
_transferOwnership(_owner);
|
||||
|
||||
// by default we enable Curie from genesis
|
||||
isCurie = true;
|
||||
}
|
||||
|
||||
/*************************
|
||||
@@ -150,10 +153,11 @@ contract L1GasPriceOracle is OwnableBase, IL1GasPriceOracle {
|
||||
}
|
||||
|
||||
/// @inheritdoc IL1GasPriceOracle
|
||||
function setL1BaseFeeAndBlobBaseFee(
|
||||
uint256 _l1BaseFee,
|
||||
uint256 _l1BlobBaseFee
|
||||
) external override onlyWhitelistedSender {
|
||||
function setL1BaseFeeAndBlobBaseFee(uint256 _l1BaseFee, uint256 _l1BlobBaseFee)
|
||||
external
|
||||
override
|
||||
onlyWhitelistedSender
|
||||
{
|
||||
l1BaseFee = _l1BaseFee;
|
||||
l1BlobBaseFee = _l1BlobBaseFee;
|
||||
|
||||
|
||||
119
contracts/src/mocks/ScrollChainMockFinalize.sol
Normal file
119
contracts/src/mocks/ScrollChainMockFinalize.sol
Normal file
@@ -0,0 +1,119 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity =0.8.24;
|
||||
|
||||
import {ScrollChain} from "../L1/rollup/ScrollChain.sol";
|
||||
|
||||
import {BatchHeaderV0Codec} from "../libraries/codec/BatchHeaderV0Codec.sol";
|
||||
import {BatchHeaderV1Codec} from "../libraries/codec/BatchHeaderV1Codec.sol";
|
||||
|
||||
contract ScrollChainMockFinalize is ScrollChain {
|
||||
/***************
|
||||
* Constructor *
|
||||
***************/
|
||||
|
||||
/// @notice Constructor for `ScrollChain` implementation contract.
|
||||
///
|
||||
/// @param _chainId The chain id of L2.
|
||||
/// @param _messageQueue The address of `L1MessageQueue` contract.
|
||||
/// @param _verifier The address of zkevm verifier contract.
|
||||
constructor(
|
||||
uint64 _chainId,
|
||||
address _messageQueue,
|
||||
address _verifier
|
||||
) ScrollChain(_chainId, _messageQueue, _verifier) {}
|
||||
|
||||
/*****************************
|
||||
* Public Mutating Functions *
|
||||
*****************************/
|
||||
|
||||
function finalizeBatch(
|
||||
bytes calldata _batchHeader,
|
||||
bytes32 _prevStateRoot,
|
||||
bytes32 _postStateRoot,
|
||||
bytes32 _withdrawRoot
|
||||
) external OnlyProver whenNotPaused {
|
||||
require(_prevStateRoot != bytes32(0), "previous state root is zero");
|
||||
require(_postStateRoot != bytes32(0), "new state root is zero");
|
||||
|
||||
// compute batch hash and verify
|
||||
(uint256 memPtr, bytes32 _batchHash, uint256 _batchIndex, ) = _loadBatchHeader(_batchHeader);
|
||||
|
||||
// verify previous state root.
|
||||
require(finalizedStateRoots[_batchIndex - 1] == _prevStateRoot, "incorrect previous state root");
|
||||
|
||||
// avoid duplicated verification
|
||||
require(finalizedStateRoots[_batchIndex] == bytes32(0), "batch already verified");
|
||||
|
||||
// check and update lastFinalizedBatchIndex
|
||||
unchecked {
|
||||
require(lastFinalizedBatchIndex + 1 == _batchIndex, "incorrect batch index");
|
||||
lastFinalizedBatchIndex = _batchIndex;
|
||||
}
|
||||
|
||||
// record state root and withdraw root
|
||||
finalizedStateRoots[_batchIndex] = _postStateRoot;
|
||||
withdrawRoots[_batchIndex] = _withdrawRoot;
|
||||
|
||||
// Pop finalized and non-skipped message from L1MessageQueue.
|
||||
_popL1Messages(
|
||||
BatchHeaderV0Codec.getSkippedBitmapPtr(memPtr),
|
||||
BatchHeaderV0Codec.getTotalL1MessagePopped(memPtr),
|
||||
BatchHeaderV0Codec.getL1MessagePopped(memPtr)
|
||||
);
|
||||
|
||||
emit FinalizeBatch(_batchIndex, _batchHash, _postStateRoot, _withdrawRoot);
|
||||
}
|
||||
|
||||
function finalizeBatch4844(
|
||||
bytes calldata _batchHeader,
|
||||
bytes32 _prevStateRoot,
|
||||
bytes32 _postStateRoot,
|
||||
bytes32 _withdrawRoot,
|
||||
bytes calldata _blobDataProof
|
||||
) external OnlyProver whenNotPaused {
|
||||
if (_prevStateRoot == bytes32(0)) revert ErrorPreviousStateRootIsZero();
|
||||
if (_postStateRoot == bytes32(0)) revert ErrorStateRootIsZero();
|
||||
|
||||
// compute batch hash and verify
|
||||
(uint256 memPtr, bytes32 _batchHash, uint256 _batchIndex, ) = _loadBatchHeader(_batchHeader);
|
||||
bytes32 _blobVersionedHash = BatchHeaderV1Codec.getBlobVersionedHash(memPtr);
|
||||
|
||||
// Calls the point evaluation precompile and verifies the output
|
||||
{
|
||||
(bool success, bytes memory data) = POINT_EVALUATION_PRECOMPILE_ADDR.staticcall(
|
||||
abi.encodePacked(_blobVersionedHash, _blobDataProof)
|
||||
);
|
||||
// We verify that the point evaluation precompile call was successful by testing the latter 32 bytes of the
|
||||
// response is equal to BLS_MODULUS as defined in https://eips.ethereum.org/EIPS/eip-4844#point-evaluation-precompile
|
||||
if (!success) revert ErrorCallPointEvaluationPrecompileFailed();
|
||||
(, uint256 result) = abi.decode(data, (uint256, uint256));
|
||||
if (result != BLS_MODULUS) revert ErrorUnexpectedPointEvaluationPrecompileOutput();
|
||||
}
|
||||
|
||||
// verify previous state root.
|
||||
if (finalizedStateRoots[_batchIndex - 1] != _prevStateRoot) revert ErrorIncorrectPreviousStateRoot();
|
||||
|
||||
// avoid duplicated verification
|
||||
if (finalizedStateRoots[_batchIndex] != bytes32(0)) revert ErrorBatchIsAlreadyVerified();
|
||||
|
||||
// check and update lastFinalizedBatchIndex
|
||||
unchecked {
|
||||
if (lastFinalizedBatchIndex + 1 != _batchIndex) revert ErrorIncorrectBatchIndex();
|
||||
lastFinalizedBatchIndex = _batchIndex;
|
||||
}
|
||||
|
||||
// record state root and withdraw root
|
||||
finalizedStateRoots[_batchIndex] = _postStateRoot;
|
||||
withdrawRoots[_batchIndex] = _withdrawRoot;
|
||||
|
||||
// Pop finalized and non-skipped message from L1MessageQueue.
|
||||
_popL1Messages(
|
||||
BatchHeaderV1Codec.getSkippedBitmapPtr(memPtr),
|
||||
BatchHeaderV1Codec.getTotalL1MessagePopped(memPtr),
|
||||
BatchHeaderV1Codec.getL1MessagePopped(memPtr)
|
||||
);
|
||||
|
||||
emit FinalizeBatch(_batchIndex, _batchHash, _postStateRoot, _withdrawRoot);
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,8 @@ contract L1GasPriceOracleTest is DSTestPlus {
|
||||
uint256 private constant PRECISION = 1e9;
|
||||
uint256 private constant MAX_OVERHEAD = 30000000 / 16;
|
||||
uint256 private constant MAX_SCALAR = 1000 * PRECISION;
|
||||
uint256 private constant MAX_COMMIT_SCALAR = 10 ** 9 * PRECISION;
|
||||
uint256 private constant MAX_BLOB_SCALAR = 10 ** 9 * PRECISION;
|
||||
uint256 private constant MAX_COMMIT_SCALAR = 10**9 * PRECISION;
|
||||
uint256 private constant MAX_BLOB_SCALAR = 10**9 * PRECISION;
|
||||
|
||||
L1GasPriceOracle private oracle;
|
||||
Whitelist private whitelist;
|
||||
|
||||
Reference in New Issue
Block a user