Skip to content

Commit

Permalink
v1 to v2 working (0xPolygonHermez#3069)
Browse files Browse the repository at this point in the history
* v1 to v2 working

* fix make file
  • Loading branch information
ARR552 authored Jan 15, 2024
1 parent 2acd0ed commit 021a399
Show file tree
Hide file tree
Showing 4 changed files with 223 additions and 14 deletions.
8 changes: 6 additions & 2 deletions etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,13 @@ func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequen
func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence, l2Coinbase common.Address) (*types.Transaction, error) {
var batches []polygonzkevm.PolygonRollupBaseEtrogBatchData
for _, seq := range sequences {
var ger common.Hash
if seq.ForcedBatchTimestamp > 0 {
ger = seq.GlobalExitRoot
}
batch := polygonzkevm.PolygonRollupBaseEtrogBatchData{
Transactions: seq.BatchL2Data,
ForcedGlobalExitRoot: seq.GlobalExitRoot,
ForcedGlobalExitRoot: ger,
ForcedTimestamp: uint64(seq.ForcedBatchTimestamp),
ForcedBlockHashL1: seq.PrevBlockHash,
}
Expand Down Expand Up @@ -1572,7 +1576,7 @@ func (etherMan *Client) GetL2ChainID() (uint64, error) {
if err != nil || chainID == 0 {
log.Debug("error from oldZkevm: ", err)
rollupData, err := etherMan.RollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID)
log.Debug("chainID read from rollupManager: ", rollupData.ChainID)
log.Debugf("ChainID read from rollupManager: %d using rollupID: %d", rollupData.ChainID, etherMan.RollupID)
if err != nil {
log.Debug("error from rollupManager: ", err)
return 0, err
Expand Down
99 changes: 88 additions & 11 deletions test/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
DOCKERCOMPOSE := docker-compose -f docker-compose.yml
DOCKERCOMPOSEAPPSEQ := zkevm-sequencer
DOCKERCOMPOSEAPPSEQV1TOV2 := zkevm-sequencer-v1tov2
DOCKERCOMPOSEAPPSEQSENDER := zkevm-sequence-sender
DOCKERCOMPOSEAPPSEQSENDERV1TOV2 := zkevm-sequence-sender-v1tov2
DOCKERCOMPOSEAPPL2GASP := zkevm-l2gaspricer
DOCKERCOMPOSEAPPL2GASPV1TOV2 := zkevm-l2gaspricer-v1tov2
DOCKERCOMPOSEAPPAGG := zkevm-aggregator
DOCKERCOMPOSEAPPAGGV1TOV2 := zkevm-aggregator-v1tov2
DOCKERCOMPOSEAPPRPC := zkevm-json-rpc
DOCKERCOMPOSEAPPRPCV1TOV2 := zkevm-json-rpc-v1tov2
DOCKERCOMPOSEAPPSYNC := zkevm-sync
DOCKERCOMPOSEAPPSYNCV1TOV2 := zkevm-sync-v1tov2
DOCKERCOMPOSEAPPETHTXMANAGER := zkevm-eth-tx-manager
DOCKERCOMPOSEAPPETHTXMANAGERV1TOV2 := zkevm-eth-tx-manager-v1tov2
DOCKERCOMPOSESTATEDB := zkevm-state-db
DOCKERCOMPOSEPOOLDB := zkevm-pool-db
DOCKERCOMPOSEEVENTDB := zkevm-event-db
Expand All @@ -22,20 +28,27 @@ DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db
DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node
DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover
DOCKERCOMPOSENODEAPPROVE := zkevm-approve
DOCKERCOMPOSENODEAPPROVEV1TOV2 := zkevm-approve-v1tov2
DOCKERCOMPOSEMETRICS := zkevm-metrics
DOCKERCOMPOSEGRAFANA := grafana

RUNSTATEDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSESTATEDB)
RUNPOOLDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPOOLDB)
RUNEVENTDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEEVENTDB)
RUNSEQUENCER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPSEQ)
RUNV1TOV2SEQUENCER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPSEQV1TOV2)
RUNSEQUENCESENDER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPSEQSENDER)
RUNV1TOV2SEQUENCESENDER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPSEQSENDERV1TOV2)
RUNL2GASPRICER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPL2GASP)
RUNV1TOV2L2GASPRICER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPL2GASPV1TOV2)
RUNAGGREGATOR := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPAGG)
RUNV1TOV2AGGREGATOR := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPAGGV1TOV2)
RUNJSONRPC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPRPC)
RUNV1TOV2JSONRPC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPRPCV1TOV2)
RUNSYNC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPSYNC)
RUNV1TOV2SYNC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPSYNCV1TOV2)
RUNETHTXMANAGER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPETHTXMANAGER)
RUNV1TOV2ETHTXMANAGER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEAPPETHTXMANAGERV1TOV2)
RUNGRAFANA := DOCKERGID=`stat -c '%g' /var/run/docker.sock` $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEGRAFANA)

RUNL1NETWORK := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENETWORK)
Expand All @@ -52,6 +65,7 @@ RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNOD
RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)

RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE)
RUNV1TOV2APPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVEV1TOV2)

RUNMETRICS := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEMETRICS)

Expand All @@ -61,13 +75,19 @@ STOPSTATEDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSESTATEDB) && $(DOCKERCOMPOSE)
STOPPOOLDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPOOLDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPOOLDB)
STOPEVENTDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEEVENTDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEEVENTDB)
STOPSEQUENCER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPSEQ) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPSEQ)
STOPV1TOV2SEQUENCER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPSEQV1TOV2) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPSEQV1TOV2)
STOPSEQUENCESENDER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPSEQSENDER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPSEQSENDER)
STOPV1TOV2SEQUENCESENDER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPSEQSENDERV1TOV2) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPSEQSENDERV1TOV2)
STOPL2GASPRICER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPL2GASP) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPL2GASP)
STOPV1TOV2L2GASPRICER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPL2GASPV1TOV2) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPL2GASPV1TOV2)
STOPAGGREGATOR := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPAGG) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPAGG)
STOPV1TOV2AGGREGATOR := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPAGGV1TOV2) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPAGGV1TOV2)
STOPJSONRPC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPRPC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPRPC)
STOPV1TOV2JSONRPC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPRPCV1TOV2) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPRPCV1TOV2)
STOPSYNC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPSYNC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPSYNC)
STOPV1TOV2SYNC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPSYNCV1TOV2) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPSYNCV1TOV2)
STOPETHTXMANAGER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPETHTXMANAGER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPETHTXMANAGER)
STOPV1TOV2ETHTXMANAGER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEAPPETHTXMANAGERV1TOV2) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEAPPETHTXMANAGERV1TOV2)
STOPGRAFANA := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEGRAFANA) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEGRAFANA)

STOPNETWORK := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENETWORK) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENETWORK)
Expand All @@ -84,6 +104,7 @@ STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNOD
STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)

STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE)
STOPV1TOV2APPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVEV1TOV2) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVEV1TOV2)

STOPMETRICS := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEMETRICS) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEMETRICS)

Expand Down Expand Up @@ -386,30 +407,46 @@ stop-explorer-db: ## Stops the explorer database
run-seq: ## runs the sequencer
$(RUNSEQUENCER)

.PHONY: run-seq-v1tov2
run-seq-v1tov2: ## runs the sequencer
$(RUNV1TOV2SEQUENCER)

.PHONY: stop-seq
stop-seq: ## stops the sequencer
$(STOPSEQUENCER)

.PHONY: stop-seq-v1tov2
stop-seq-v1tov2: ## stops the sequencer
$(STOPV1TOV2SEQUENCER)

.PHONY: run-seqsender
run-seqsender: ## runs the sequencer sender
$(RUNSEQUENCESENDER)

.PHONY: run-seqsender-v1tov2
run-seqsender-v1tov2: ## runs the sequencer sender
$(RUNV1TOV2SEQUENCESENDER)

.PHONY: stop-seqsender
stop-seqsender: ## stops the sequencer sender
$(STOPSEQUENCESENDER)

.PHONY: stop-seqsender-v1tov2
stop-seqsender-v1tov2: ## stops the sequencer sender
$(STOPV1TOV2SEQUENCESENDER)

.PHONY: run-sync
run-sync: ## runs the synchronizer
$(RUNSYNC)

.PHONY: stop-sync
stop-sync: ## stops the synchronizer
$(STOPSYNC)

.PHONY: run-sync-v1tov2
run-sync-v1tov2: ## runs the synchronizer
$(RUNV1TOV2SYNC)

.PHONY: stop-sync
stop-sync: ## stops the synchronizer
$(STOPSYNC)

.PHONY: stop-sync-v1tov2
stop-sync-v1tov2: ## stops the synchronizer
$(STOPV1TOV2SYNC)
Expand All @@ -418,34 +455,66 @@ stop-sync-v1tov2: ## stops the synchronizer
run-json-rpc: ## runs the JSON-RPC
$(RUNJSONRPC)

.PHONY: run-json-rpc-v1tov2
run-json-rpc-v1tov2: ## runs the JSON-RPC
$(RUNV1TOV2JSONRPC)

.PHONY: stop-json-rpc
stop-json-rpc: ## stops the JSON-RPC
$(STOPJSONRPC)

.PHONY: stop-json-rpc-v1tov2
stop-json-rpc-v1tov2: ## stops the JSON-RPC
$(STOPV1TOV2JSONRPC)

.PHONY: run-l2gaspricer
run-l2gaspricer: ## runs the L2 Gas Price component
$(RUNL2GASPRICER)

.PHONY: run-l2gaspricer-v1tov2
run-l2gaspricer-v1tov2: ## runs the L2 Gas Price component
$(RUNV1TOV2L2GASPRICER)

.PHONY: stop-l2gaspricer
stop-l2gaspricer: ## stops the L2 Gas Price component
$(STOPL2GASPRICER)

.PHONY: stop-l2gaspricer-v1tov2
stop-l2gaspricer-v1tov2: ## stops the L2 Gas Price component
$(STOPV1TOV2L2GASPRICER)

.PHONY: run-eth-tx-manager
run-eth-tx-manager: ## Runs the eth tx manager service
$(RUNETHTXMANAGER)

.PHONY: run-eth-tx-manager-v1tov2
run-eth-tx-manager-v1tov2: ## Runs the eth tx manager service
$(RUNV1TOV2ETHTXMANAGER)

.PHONY: stop-eth-tx-manager
stop-eth-tx-manager: ## Stops the eth tx manager service
$(STOPETHTXMANAGER)

.PHONY: stop-eth-tx-manager-v1tov2
stop-eth-tx-manager-v1tov2: ## Stops the eth tx manager service
$(STOPV1TOV2ETHTXMANAGER)

.PHONY: run-agg
run-agg: ## Runs the aggregator service
$(RUNAGGREGATOR)

.PHONY: run-agg-v1tov2
run-agg-v1tov2: ## Runs the aggregator service
$(RUNV1TOV2AGGREGATOR)

.PHONY: stop-agg
stop-agg: ## Stops the aggregator service
$(STOPAGGREGATOR)

.PHONY: stop-agg-v1tov2
stop-agg-v1tov2: ## Stops the aggregator service
$(STOPV1TOV2AGGREGATOR)

.PHONY: run-grafana
run-grafana: ## Runs the grafana service
$(RUNGRAFANA)
Expand Down Expand Up @@ -483,10 +552,18 @@ stop-permissionless-dependencies: ## Stop the permissionless dependencies (db +
run-approve-pol: ## Runs approve in node container
$(RUNAPPROVE)

.PHONY: run-approve-pol-v1tov2
run-approve-pol-v1tov2: ## Runs approve in node container
$(RUNV1TOV2APPROVE)

.PHONY: stop-approve-pol
stop-approve-pol: ## Stops approve in node container
$(STOPAPPROVE)

.PHONY: stop-approve-pol-v1tov2
stop-approve-pol-v1tov2: ## Stops approve in node container
$(STOPV1TOV2APPROVE)

.PHONY: run
run: ## Runs a full node
$(RUNSTATEDB)
Expand Down Expand Up @@ -514,16 +591,16 @@ run-v1tov2: ## Runs a full node using v1tov2 network
$(RUNV1TOV2L1NETWORK)
sleep 1
$(RUNZKPROVER)
$(RUNAPPROVE)
$(RUNV1TOV2APPROVE)
sleep 3
$(RUNV1TOV2SYNC)
sleep 4
$(RUNETHTXMANAGER)
$(RUNSEQUENCER)
$(RUNSEQUENCESENDER)
$(RUNL2GASPRICER)
$(RUNAGGREGATOR)
$(RUNJSONRPC)
$(RUNV1TOV2ETHTXMANAGER)
$(RUNV1TOV2SEQUENCER)
$(RUNV1TOV2SEQUENCESENDER)
$(RUNV1TOV2L2GASPRICER)
$(RUNV1TOV2AGGREGATOR)
$(RUNV1TOV2JSONRPC)

.PHONY: stop
stop: ## Stops all services
Expand Down
2 changes: 1 addition & 1 deletion test/config/test.genesis-v1tov2.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"polTokenAddress": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"polygonZkEVMGlobalExitRootAddress": "0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"
},
"genesisBlockNumber": 119,
"genesisBlockNumber": 146,
"root": "0x735855436440d5fbc4f4fe36b1148c22c16ab1d2c042926a455933fd6584a7e2",
"genesis": [
{
Expand Down
Loading

0 comments on commit 021a399

Please sign in to comment.