Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/v1to v2 #576

Merged
merged 2 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
50 changes: 45 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -190,4 +230,4 @@ services:
command:
- "/bin/sh"
- "-c"
- "env && /app/zkevm-bridge run --cfg /app/config.toml"
- "/app/zkevm-bridge run --cfg /app/config.toml"
11 changes: 4 additions & 7 deletions synchronizer/synchronizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
1 change: 1 addition & 0 deletions test/config/node/config.zkevm.node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ ProofStatePollingInterval = "5s"
SenderAddress = "0x70997970c51812dc3a010c7d01b50e0d17dc79c8"
CleanupLockedProofsInterval = "2m"
GeneratingProofCleanupThreshold = "10m"
UpgradeEtrogBatchNumber = 0

[EthTxManager]
ForcedGas = 0
Expand Down
Loading