In order to avoid reorgs and other undesirable scenarios, all L2 transactions must be verified before upgrading a fork. Verification means that all batches are closed, sequenced, and verified on L1.
Follow the steps to verify all batches for upgrading.
-
Stop the sequencer.
-
Enforce the sequencer to stop at a specific
batch_num
.-
In the statedb, get WIP batch number:
SELECT batch_num, wip FROM state.batch WHERE wip IS true;
Result = X (write down X for later)
-
Edit node config:
Sequencer.Finalizer.HaltOnBatchNumber = X+1
Sequencer.BatchMaxDeltaTimestamp = “120s” # 1800s
SequenceSender.WaitPeriodSendSequence = "10s" # 60s
SequenceSender.LastBatchVirtualizationTimeMaxWaitPeriod = “30s” # 600s
-
Restart sequencer, sequence-sender.
-
Check sequencer halted when reaching batch
X+1
(this is obvious in the logs). -
Wait until all pending batches are virtualized (X):
SELECT batch_num FROM state.virtual_batch ORDER BY batch_num DESC LIMIT 1;
→ X -
Wait until the aggregator has aggregated proofs for all the batches:
-
SELECT batch_num FROM state.verified_batch ORDER BY batch_num DESC LIMIT 1;
→ Y (if Y == X) you can skip next steps until3. Prepare (**do not apply**) new versions according to the version matrix
-
SELECT batch_num, batch_num_final FROM state.proof WHERE NOT generating AND batch_num = Y AND batch_num_final = X
wait until this query returns a row, removeWHERE
conditions to get a sense of progress.
-
-
Edit node config to force the aggregator into sending the already aggregated proof ASAP:
Aggregator.VerifyProofInterval = "5m”
. Then restart aggregator. -
Wait until the proof is settled on-chain:
SELECT batch_num FROM state.verified_batch ORDER BY batch_num DESC LIMIT 1;
→ X
-
-
Prepare (do not apply) new versions according to the version matrix.
-
Stop all services (node, prover/executor, bridge).
-
Start synchronizer's new version.
-
Wait until synchornizer receives a fork id event (check table
state.fork_id
). -
Edit node config file (node v0.6.2 version):
Sequencer.Finalizer.HaltOnBatchNumber = 0
-
Start all node components, executors, provers, and bridge with new versions.
-
Check batches ≥ X are virtualized and verified.
-
Edit new node config (restore previous values):
Aggregator.VerifyProofInterval = "25m”
# restore previous valueSequencer.BatchMaxDeltaTimestamp = “1800s”
SequenceSender.WaitPeriodSendSequence = "60s”
# restore previous valueSequenceSender.LastBatchVirtualizationTimeMaxWaitPeriod = “600s”
# restore previous value
-
Restart sequencer, sequence-sender, and aggregator.