Skip to content

Commit

Permalink
Feature/v1tov2 (#573)
Browse files Browse the repository at this point in the history
* update smc + v1tov2 environment

* Events

* logs

* New lastGer custom endpoint implemented

* linter
  • Loading branch information
ARR552 authored Jan 19, 2024
1 parent dad171d commit fa88bf2
Show file tree
Hide file tree
Showing 18 changed files with 565 additions and 145 deletions.
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,35 @@ DOCKER_COMPOSE_POOL_DB := zkevm-pool-db
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_L1_NETWORK := zkevm-mock-l1-network
DOCKER_COMPOSE_L1_NETWORK_V1TOV2 := zkevm-v1tov2-l1-network
DOCKER_COMPOSE_ZKPROVER := zkevm-prover
DOCKER_COMPOSE_BRIDGE := zkevm-bridge-service
DOCKER_COMPOSE_BRIDGE_V1TOV2 := zkevm-bridge-service-v1tov2

RUN_STATE_DB := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_STATE_DB)
RUN_POOL_DB := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_POOL_DB)
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_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_BRIDGE := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_BRIDGE)
RUN_BRIDGE_V1TOV2 := $(DOCKER_COMPOSE) up -d $(DOCKER_COMPOSE_BRIDGE_V1TOV2)

STOP_NODE_DB := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_NODE_DB) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_NODE_DB)
STOP_BRIDGE_DB := $(DOCKER_COMPOSE) stop $(DOCKER_COMPOSE_BRIDGE_DB) && $(DOCKER_COMPOSE) rm -f $(DOCKER_COMPOSE_BRIDGE_DB)
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_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_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

LDFLAGS += -X 'github.com/0xPolygonHermez/zkevm-bridge-service.Version=$(VERSION)'
Expand Down Expand Up @@ -108,6 +117,22 @@ run-network: ## Runs the l1 network
stop-network: ## Stops the l1 network
$(STOP_NETWORK)

.PHONY: run-node-v1tov2
run-node-v1tov2: ## Runs the node
$(RUN_NODE_V1TOV2)

.PHONY: stop-node-v1tov2
stop-node-v1tov2: ## Stops the node
$(STOP_NODE_V1TOV2)

.PHONY: run-network-v1tov2
run-network-v1tov2: ## Runs the l1 network
$(RUN_L1_NETWORK_V1TOV2)

.PHONY: stop-network-v1tov2
stop-network-v1tov2: ## Stops the l1 network
$(STOP_NETWORK_V1TOV2)

.PHONY: run-prover
run-prover: ## Runs the zk prover
$(RUN_ZKPROVER)
Expand All @@ -124,6 +149,14 @@ run-bridge: ## Runs the bridge service
stop-bridge: ## Stops the bridge service
$(STOP_BRIDGE)

.PHONY: run-bridge-v1tov2
run-bridge-v1tov2: ## Runs the bridge service
$(RUN_BRIDGE_V1TOV2)

.PHONY: stop-bridge-v1tov2
stop-bridge-v1tov2: ## Stops the bridge service
$(STOP_BRIDGE_V1TOV2)

.PHONY: stop
stop: ## Stops all services
$(STOP)
Expand All @@ -142,6 +175,17 @@ run: stop ## runs all services
sleep 7
$(RUN_BRIDGE)

.PHONY: run-v1tov2
run-v1tov2: stop ## runs all services
$(RUN_DBS)
$(RUN_L1_NETWORK_V1TOV2)
sleep 5
$(RUN_ZKPROVER)
sleep 3
$(RUN_NODE_V1TOV2)
sleep 7
$(RUN_BRIDGE_V1TOV2)

.PHONY: update-external-dependencies
update-external-dependencies: ## Updates external dependencies like images, test vectors or proto files
go run ./scripts/cmd/... updatedeps
Expand Down
2 changes: 2 additions & 0 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func setupLog(c log.Config) {
func newEthermans(c *config.Config) (*etherman.Client, []*etherman.Client, error) {
l1Etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.PolygonBridgeAddress, c.NetworkConfig.PolygonZkEVMGlobalExitRootAddress, c.NetworkConfig.PolygonRollupManagerAddress, c.NetworkConfig.PolygonZkEvmAddress)
if err != nil {
log.Error("L1 etherman error: ", err)
return nil, nil, err
}
if len(c.L2PolygonBridgeAddresses) != len(c.Etherman.L2URLs) {
Expand All @@ -149,6 +150,7 @@ func newEthermans(c *config.Config) (*etherman.Client, []*etherman.Client, error
for i, addr := range c.L2PolygonBridgeAddresses {
l2Etherman, err := etherman.NewL2Client(c.Etherman.L2URLs[i], addr)
if err != nil {
log.Error("L2 etherman ", i, c.Etherman.L2URLs[i], ", error: ", err)
return l1Etherman, nil, err
}
l2Ethermans = append(l2Ethermans, l2Etherman)
Expand Down
86 changes: 81 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ services:

zkevm-node:
container_name: zkevm-node
image: hermeznetwork/zkevm-node:v0.5.0-RC8
image: hermeznetwork/zkevm-node:v0.5.0-RC18
ports:
- 8123:8123
- 61090:61090
environment:
- ZKEVM_NODE_STATEDB_HOST=zkevm-state-db
- 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_PRIVATEKEYPATH=/pk/keystore
volumes:
- ./test/test.keystore.sequencer:/pk/keystore.sequencer
- ./test/test.keystore.aggregator:/pk/keystore.aggregator
Expand All @@ -77,15 +76,67 @@ services:
- "/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"

zkevm-node-v1tov2:
container_name: zkevm-node-v1tov2
image: hermeznetwork/zkevm-node:v0.5.0-RC18
ports:
- 8123:8123
- 61090:61090
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
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 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"

zkevm-mock-l1-network:
container_name: zkevm-local-l1-network
image: hermeznetwork/geth-zkevm-contracts:v2.1.1-fork.7-geth1.12.0
ports:
- 8545:8545

zkevm-v1tov2-l1-network:
container_name: zkevm-v1tov2-l1-network
image: hermeznetwork/geth-zkevm-contracts:v2.1.1-lxly-updateV1ToV2-etrog-geth1.12.0
ports:
- 8545:8545
- 8546:8546
command:
- "--http"
- "--http.api"
- "admin,eth,debug,miner,net,txpool,personal,web3"
- "--http.addr"
- "0.0.0.0"
- "--http.corsdomain"
- "*"
- "--http.vhosts"
- "*"
- "--ws"
- "--ws.origins"
- "*"
- "--ws.addr"
- "0.0.0.0"
- "--dev"
- "--dev.period"
- "1"
- "--datadir"
- "/geth_data"
- "--syncmode"
- "full"
- "--rpc.allow-unprotected-txs"

zkevm-prover:
container_name: zkevm-prover
image: hermeznetwork/zkevm-prover:v4.0.0-RC21
image: hermeznetwork/zkevm-prover:v4.0.0-RC27
ports:
- 50051:50051 # Prover
- 50052:50052 # MockProver
Expand Down Expand Up @@ -114,4 +165,29 @@ services:
command:
- "/bin/sh"
- "-c"
- "/app/zkevm-bridge run --cfg /app/config.toml"
- "/app/zkevm-bridge run --cfg /app/config.toml"

zkevm-bridge-service-v1tov2:
container_name: zkevm-bridge-service-v1tov2
image: zkevm-bridge-service
ports:
- 8080:8080
- 9090:9090
environment:
- ZKEVM_BRIDGE_DATABASE_USER=test_user
- ZKEVM_BRIDGE_DATABASE_PASSWORD=test_password
- ZKEVM_BRIDGE_DATABASE_NAME=test_db
- ZKEVM_BRIDGE_DATABASE_HOST=zkevm-bridge-db
- ZKEVM_BRIDGE_DATABASE_PORT=5432
- ZKEVM_BRIDGE_ETHERMAN_L1URL=http://zkevm-v1tov2-l1-network:8545
- ZKEVM_BRIDGE_ETHERMAN_L2URLS=http://zkevm-node-v1tov2:8123
- ZKEVM_BRIDGE_NETWORKCONFIG_POLYGONZKEVMADDRESS=0x3Aa5ebB10DC797CAC828524e59A333d0A371443c
- ZKEVM_BRIDGE_NETWORKCONFIG_POLYGONBRIDGEADDRESS=0x80a540502706aa690476D5534e26939894559c05
- ZKEVM_BRIDGE_NETWORKCONFIG_L2POLYGONBRIDGEADDRESSES=0x80a540502706aa690476D5534e26939894559c05
volumes:
- ./test/test.keystore.claimtx:/pk/keystore.claimtxmanager
- ./config/config.local.toml:/app/config.toml
command:
- "/bin/sh"
- "-c"
- "env && /app/zkevm-bridge run --cfg /app/config.toml"
Loading

0 comments on commit fa88bf2

Please sign in to comment.