From 14642b1174003f8ff37e4dd2d9f4eaa292bdda94 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Thu, 29 Aug 2024 18:58:30 +0800 Subject: [PATCH] Config L1, L2 block time, set poll intervals --- compose/docker-compose-fixturenet-optimism.yml | 5 +++++ config/fixturenet-optimism/l1-params.env | 3 +++ config/fixturenet-optimism/l2-params.env | 2 ++ .../optimism-contracts/deploy-contracts.sh | 4 ++-- config/fixturenet-optimism/run-op-node.sh | 5 ++++- config/fixturenet-optimism/run-op-proposer.sh | 3 ++- 6 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 config/fixturenet-optimism/l2-params.env diff --git a/compose/docker-compose-fixturenet-optimism.yml b/compose/docker-compose-fixturenet-optimism.yml index d53b1a6..4828cdc 100644 --- a/compose/docker-compose-fixturenet-optimism.yml +++ b/compose/docker-compose-fixturenet-optimism.yml @@ -8,6 +8,7 @@ services: hostname: fixturenet-optimism-contracts env_file: - ../config/fixturenet-optimism/l1-params.env + - ../config/fixturenet-optimism/l2-params.env environment: CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_L1_CHAIN_ID: ${CERC_L1_CHAIN_ID} @@ -15,6 +16,8 @@ services: CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL} CERC_L1_ADDRESS: ${CERC_L1_ADDRESS} CERC_L1_PRIV_KEY: ${CERC_L1_PRIV_KEY} + CERC_L1_BLOCK_TIME: ${CERC_L1_BLOCK_TIME} + CERC_L2_BLOCK_TIME: ${CERC_L2_BLOCK_TIME} CERC_PROPOSER_AMOUNT: ${CERC_PROPOSER_AMOUNT} CERC_BATCHER_AMOUNT: ${CERC_BATCHER_AMOUNT} volumes: @@ -92,6 +95,7 @@ services: environment: CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_L1_RPC: ${CERC_L1_RPC} + CERC_L1_BLOCK_TIME: ${CERC_L1_BLOCK_TIME} CERC_L1_BEACON: ${CERC_L1_BEACON} volumes: - ../config/fixturenet-optimism/run-op-node.sh:/run-op-node.sh @@ -155,6 +159,7 @@ services: CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_L1_RPC: ${CERC_L1_RPC} CERC_L1_CHAIN_ID: ${CERC_L1_CHAIN_ID} + CERC_L1_BLOCK_TIME: ${CERC_L1_BLOCK_TIME} volumes: - ../config/network/wait-for-it.sh:/wait-for-it.sh - ../config/fixturenet-optimism/run-op-proposer.sh:/run-op-proposer.sh diff --git a/config/fixturenet-optimism/l1-params.env b/config/fixturenet-optimism/l1-params.env index 4f10a54..13069d9 100644 --- a/config/fixturenet-optimism/l1-params.env +++ b/config/fixturenet-optimism/l1-params.env @@ -6,6 +6,9 @@ DEFAULT_CERC_L1_RPC="http://fixturenet-eth-geth-1:8545" DEFAULT_CERC_L1_HOST="fixturenet-eth-geth-1" DEFAULT_CERC_L1_PORT=8545 +# Default block time to match L1 fixturenet config +DEFAULT_CERC_L1_BLOCK_TIME=3 + # URL to get CSV with credentials for accounts on L1 # that are used to send balance to Optimism Proxy contract # (enables them to do transactions on L2) diff --git a/config/fixturenet-optimism/l2-params.env b/config/fixturenet-optimism/l2-params.env new file mode 100644 index 0000000..a18c13c --- /dev/null +++ b/config/fixturenet-optimism/l2-params.env @@ -0,0 +1,2 @@ +# Default L2 block time. Must be <= L1 block time. +DEFAULT_CERC_L2_BLOCK_TIME=1 diff --git a/config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh b/config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh index 31d9ba3..25afe2a 100755 --- a/config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh +++ b/config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh @@ -126,8 +126,8 @@ GS_SEQUENCER_ADDRESS=$SEQ \ L1_RPC_URL=$CERC_L1_RPC \ L1_CHAIN_ID=$CERC_L1_CHAIN_ID \ L2_CHAIN_ID=42069 \ -L1_BLOCK_TIME=12 \ -L2_BLOCK_TIME=2 \ +L1_BLOCK_TIME=${CERC_L1_BLOCK_TIME:-$DEFAULT_CERC_L1_BLOCK_TIME} \ +L2_BLOCK_TIME=${CERC_L2_BLOCK_TIME:-$DEFAULT_CERC_L2_BLOCK_TIME} \ $config_build_script echo "Writing deployment config." diff --git a/config/fixturenet-optimism/run-op-node.sh b/config/fixturenet-optimism/run-op-node.sh index 95b81eb..697a999 100755 --- a/config/fixturenet-optimism/run-op-node.sh +++ b/config/fixturenet-optimism/run-op-node.sh @@ -5,6 +5,7 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then fi CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}" +CERC_L1_BLOCK_TIME="${CERC_L1_BLOCK_TIME:-$DEFAULT_CERC_L1_BLOCK_TIME}" CERC_L1_BEACON="${CERC_L1_BEACON:-${DEFAULT_CERC_L1_BEACON}}" # Start op-node @@ -28,4 +29,6 @@ exec op-node \ --p2p.sequencer.key="${SEQ_KEY#0x}" \ --l1=$CERC_L1_RPC \ --l1.rpckind=$rpc_kind \ - --l1.beacon=$CERC_L1_BEACON + --l1.beacon=$CERC_L1_BEACON \ + --l1.http-poll-interval="${CERC_L1_BLOCK_TIME}s" \ + --l1.epoch-poll-interval="$((CERC_L1_BLOCK_TIME * 32))s" diff --git a/config/fixturenet-optimism/run-op-proposer.sh b/config/fixturenet-optimism/run-op-proposer.sh index 15ed1cb..28dc561 100755 --- a/config/fixturenet-optimism/run-op-proposer.sh +++ b/config/fixturenet-optimism/run-op-proposer.sh @@ -6,6 +6,7 @@ fi CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}" CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}" +CERC_L1_BLOCK_TIME="${CERC_L1_BLOCK_TIME:-${DEFAULT_CERC_L1_BLOCK_TIME}}" DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID" # Start op-proposer @@ -14,7 +15,7 @@ PROPOSER_KEY=$(cat /l2-accounts/accounts.json | jq -r .ProposerKey) L2OO_ADDR=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json | jq -r .L2OutputOracleProxy) exec op-proposer \ - --poll-interval=12s \ + --poll-interval="${CERC_L1_BLOCK_TIME}s" \ --rpc.port=8560 \ --rollup-rpc=$ROLLUP_RPC \ --l2oo-address="${L2OO_ADDR#0x}" \