diff --git a/Makefile b/Makefile index 2898ce62..571b92fb 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,11 @@ DOCKER_COMPOSE_RPC_DB := zkevm-rpc-db DOCKER_COMPOSE_BRIDGE_DB := zkevm-bridge-db DOCKER_COMPOSE_ZKEVM_NODE := zkevm-node DOCKER_COMPOSE_ZKEVM_NODE_V1TOV2 := zkevm-node-v1tov2 +DOCKER_COMPOSE_ZKEVM_AGGREGATOR_V1TOV2 := zkevm-aggregator-v1tov2 DOCKER_COMPOSE_L1_NETWORK := zkevm-mock-l1-network DOCKER_COMPOSE_L1_NETWORK_V1TOV2 := zkevm-v1tov2-l1-network DOCKER_COMPOSE_ZKPROVER := zkevm-prover +DOCKER_COMPOSE_ZKPROVER_V1TOV2 := zkevm-prover-v1tov2 DOCKER_COMPOSE_BRIDGE := zkevm-bridge-service DOCKER_COMPOSE_BRIDGE_V1TOV2 := zkevm-bridge-service-v1tov2 @@ -19,9 +21,11 @@ RUN_BRIDGE_DB := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_BRIDGE_DB) RUN_DBS := ${RUN_BRIDGE_DB} && ${RUN_STATE_DB} && ${RUN_POOL_DB} RUN_NODE := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_ZKEVM_NODE) RUN_NODE_V1TOV2 := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_ZKEVM_NODE_V1TOV2) +RUN_AGGREGATOR_V1TOV2 := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_ZKEVM_AGGREGATOR_V1TOV2) RUN_L1_NETWORK := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_L1_NETWORK) RUN_L1_NETWORK_V1TOV2 := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_L1_NETWORK_V1TOV2) RUN_ZKPROVER := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_ZKPROVER) +RUN_ZKPROVER_V1TOV2 := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_ZKPROVER_V1TOV2) RUN_BRIDGE := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_BRIDGE) RUN_BRIDGE_V1TOV2 := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_BRIDGE_V1TOV2) @@ -30,9 +34,11 @@ STOP_BRIDGE_DB := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_BRIDGE_DB) && $(DOCKER STOP_DBS := ${STOP_NODE_DB} && ${STOP_BRIDGE_DB} STOP_NODE := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_ZKEVM_NODE) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_ZKEVM_NODE) STOP_NODE_V1TOV2 := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_ZKEVM_NODE_V1TOV2) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_ZKEVM_NODE_V1TOV2) +STOP_AGGREGATOR_V1TOV2 := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_ZKEVM_AGGREGATOR_V1TOV2) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_ZKEVM_AGGREGATOR_V1TOV2) STOP_NETWORK := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_L1_NETWORK) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_L1_NETWORK) STOP_NETWORK_V1TOV2 := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_L1_NETWORK_V1TOV2) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_L1_NETWORK_V1TOV2) STOP_ZKPROVER := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_ZKPROVER) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_ZKPROVER) +STOP_ZKPROVER_V1TOV2 := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_ZKPROVER_V1TOV2) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_ZKPROVER_V1TOV2) STOP_BRIDGE := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_BRIDGE) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_BRIDGE) STOP_BRIDGE_V1TOV2 := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_BRIDGE_V1TOV2) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_BRIDGE_V1TOV2) STOP := $(DOCKER_COMPOSE) down --remove-orphans @@ -125,6 +131,14 @@ run-node-v1tov2: ## Runs the node stop-node-v1tov2: ## Stops the node $(STOP_NODE_V1TOV2) +.PHONY: run-aggregator-v1tov2 +run-aggregator-v1tov2: ## Runs the aggregator + $(RUN_AGGREGATOR_V1TOV2) + +.PHONY: stop-aggregator-v1tov2 +stop-aggregator-v1tov2: ## Stops the aggregator + $(STOP_AGGREGATOR_V1TOV2) + .PHONY: run-network-v1tov2 run-network-v1tov2: ## Runs the l1 network $(RUN_L1_NETWORK_V1TOV2) @@ -141,6 +155,14 @@ run-prover: ## Runs the zk prover stop-prover: ## Stops the zk prover $(STOP_ZKPROVER) +.PHONY: run-prover-v1tov2 +run-prover-v1tov2: ## Runs the zk prover + $(RUN_ZKPROVER_V1TOV2) + +.PHONY: stop-prover-v1tov2 +stop-prover-v1tov2: ## Stops the zk prover + $(STOP_ZKPROVER_V1TOV2) + .PHONY: run-bridge run-bridge: ## Runs the bridge service $(RUN_BRIDGE) @@ -180,10 +202,11 @@ run-v1tov2: stop ## runs all services $(RUN_DBS) $(RUN_L1_NETWORK_V1TOV2) sleep 5 - $(RUN_ZKPROVER) + $(RUN_ZKPROVER_V1TOV2) sleep 3 $(RUN_NODE_V1TOV2) sleep 7 + $(RUN_AGGREGATOR_V1TOV2) $(RUN_BRIDGE_V1TOV2) .PHONY: update-external-dependencies diff --git a/docker-compose.yml b/docker-compose.yml index 9ff895ea..daf4c5a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -57,7 +57,7 @@ services: zkevm-node: container_name: zkevm-node - image: hermeznetwork/zkevm-node:v0.5.0-RC18 + image: hermeznetwork/zkevm-node:v0.5.0-RC23 ports: - 8123:8123 - 61090:61090 @@ -78,15 +78,17 @@ services: zkevm-node-v1tov2: container_name: zkevm-node-v1tov2 - image: hermeznetwork/zkevm-node:v0.5.0-RC18 + image: hermeznetwork/zkevm-node:v0.5.0-RC23 ports: - 8123:8123 - - 61090:61090 + - 9091:9091 # needed if metrics enabled environment: - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db - ZKEVM_NODE_POOL_HOST=zkevm-pool-db - ZKEVM_NODE_RPC_DB_HOST=zkevm-rpc-db - ZKEVM_NODE_ETHERMAN_URL=http://zkevm-v1tov2-l1-network:8545 + - ZKEVM_NODE_EXECUTOR_URI=zkevm-prover-v1tov2:50071 + - ZKEVM_NODE_MTCLIENT_URI=zkevm-prover-v1tov2:50061 volumes: - ./test/test.keystore.sequencer:/pk/keystore.sequencer - ./test/test.keystore.aggregator:/pk/keystore.aggregator @@ -96,7 +98,30 @@ services: - "/bin/sh" - "-c" - "/app/zkevm-node approve --network custom --custom-network-file /app/genesis.json --am 115792089237316195423570985008687907853269984665640564039457584007913129639935 -y --cfg /app/config.toml --key-store-path /pk/keystore.sequencer --password testonly && - /app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components \"synchronizer,rpc,sequencer,sequence-sender,aggregator,eth-tx-manager,l2gaspricer\" --http.api eth,net,debug,zkevm,txpool,web3" + /app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components \"synchronizer,rpc,sequencer,sequence-sender,eth-tx-manager,l2gaspricer\" --http.api eth,net,debug,zkevm,txpool,web3" + + zkevm-aggregator-v1tov2: + container_name: zkevm-aggregator-v1tov2 + image: hermeznetwork/zkevm-node:v0.5.0-RC23 + ports: + - 9092:9091 # needed if metrics enabled + environment: + - ZKEVM_NODE_STATE_DB_HOST=zkevm-state-db + - ZKEVM_NODE_POOL_HOST=zkevm-pool-db + - ZKEVM_NODE_RPC_DB_HOST=zkevm-rpc-db + - ZKEVM_NODE_ETHERMAN_URL=http://zkevm-v1tov2-l1-network:8545 + - ZKEVM_NODE_EXECUTOR_URI=zkevm-prover-v1tov2:50071 + - ZKEVM_NODE_MTCLIENT_URI=zkevm-prover-v1tov2:50061 + - ZKEVM_NODE_AGGREGATOR_UPGRADEETROGBATCHNUMBER=2 + volumes: + - ./test/test.keystore.sequencer:/pk/keystore.sequencer + - ./test/test.keystore.aggregator:/pk/keystore.aggregator + - ./test/config/node/config.zkevm.node.toml:/app/config.toml + - ./test/config/node/genesis.local-v1tov2.json:/app/genesis.json + command: + - "/bin/sh" + - "-c" + - "/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components \"aggregator\"" zkevm-mock-l1-network: container_name: zkevm-local-l1-network @@ -147,6 +172,21 @@ services: command: > zkProver -c /usr/src/app/config.json + zkevm-prover-v1tov2: + container_name: zkevm-prover-v1tov2 + image: hermeznetwork/zkevm-prover:v4.0.0-RC27 + environment: + - AGGREGATOR_CLIENT_HOST=zkevm-aggregator-v1tov2 + ports: + - 50051:50051 # Prover + - 50052:50052 # MockProver + - 50061:50061 # MT + - 50071:50071 # Executor + volumes: + - ./test/config/prover/config.prover.json:/usr/src/app/config.json + command: > + zkProver -c /usr/src/app/config.json + zkevm-bridge-service: container_name: zkevm-bridge-service image: zkevm-bridge-service @@ -190,4 +230,4 @@ services: command: - "/bin/sh" - "-c" - - "env && /app/zkevm-bridge run --cfg /app/config.toml" \ No newline at end of file + - "/app/zkevm-bridge run --cfg /app/config.toml" \ No newline at end of file diff --git a/synchronizer/synchronizer.go b/synchronizer/synchronizer.go index 3d83fd1c..c152bc4c 100644 --- a/synchronizer/synchronizer.go +++ b/synchronizer/synchronizer.go @@ -68,6 +68,9 @@ func NewSynchronizer( if err != nil { log.Fatal("error checking if LxLyEtrog is activated. Error: ", err) } + if isActivated { + log.Info("LxLyEtrog already activated") + } if networkID == 0 { return &ClientSynchronizer{ isLxLyEtrog: isActivated, @@ -129,13 +132,6 @@ func (s *ClientSynchronizer) Sync() error { return nil case <-time.After(waitDuration): log.Debugf("NetworkID: %d, syncing...", s.networkID) - if !s.isLxLyEtrog { - // Read db to see if the LxLy is already activated - s.isLxLyEtrog, err = s.storage.IsLxLyActivated(s.ctx, nil) - if err != nil { - log.Fatal("error checking if LxLyEtrog is activated. Error: ", err) - } - } //Sync L1Blocks if lastBlockSynced, err = s.syncBlocks(lastBlockSynced); err != nil { log.Warnf("networkID: %d, error syncing blocks: %v", s.networkID, err) @@ -677,5 +673,6 @@ func (s *ClientSynchronizer) processTokenWrapped(tokenWrapped etherman.TokenWrap func (s *ClientSynchronizer) activateLxLyEtrog() { // this is activated when the bridge detects the CreateNewRollup or the AddExistingRollup event from the rollupManager + log.Info("Event received. Activating LxLyEtrog...") s.isLxLyEtrog = true } diff --git a/test/config/node/config.zkevm.node.toml b/test/config/node/config.zkevm.node.toml index 8c179e89..b84821a0 100644 --- a/test/config/node/config.zkevm.node.toml +++ b/test/config/node/config.zkevm.node.toml @@ -138,6 +138,7 @@ ProofStatePollingInterval = "5s" SenderAddress = "0x70997970c51812dc3a010c7d01b50e0d17dc79c8" CleanupLockedProofsInterval = "2m" GeneratingProofCleanupThreshold = "10m" +UpgradeEtrogBatchNumber = 0 [EthTxManager] ForcedGas = 0