You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3.**Fork block matters** — If the fork block is after the real finalization, you must manually reset `lastFinalizedBatchIndex` and `nextUnfinalizedQueueIndex`.
825
825
4.**Public input hash must match exactly** — Any discrepancy in `msg_queue_hash`, `chain_id`, `num_batches`, or roots will cause `VerificationFailed`.
826
826
5.**Anvil default account is not an EOA in fork mode** — Use a freshly generated EOA for `addProver`; `0xf39F...` has contract code and will fail the EOA check.
827
+
6.**Reset `rollup_status` before relayer finalize** — The shadow DB retains mainnet rollup state (`RollupFinalized` = 5). The relayer's `GetFirstPendingBundle` only queries `rollup_status = RollupPending` (1). You must reset both `bundle` and `batch` tables before the relayer will pick up bundles for finalization.
828
+
829
+
## Multi-Bundle Relayer Finalize Test (5 Bundles)
830
+
831
+
This test demonstrates running the actual `rollup_relayer` binary against an Anvil mainnet fork to finalize **5 consecutive bundles** (17297–17301, batches 517761–517765) using shadow proofs.
832
+
833
+
### Prerequisites
834
+
835
+
- Anvil fork running with `lastFinalizedBatchIndex` reset to `517760`
836
+
- Shadow proofs generated for all 5 bundles (`proving_status = 4`)
837
+
- Verifier `0xb1F2C5c1ea2885278a1070350d12d3D8824265B0` registered as `latestVerifier[10]`
838
+
- Prover/finalize EOA `0x410E...` authorized on `ScrollChain`
839
+
840
+
### Step 1: Reset DB Rollup Status
841
+
842
+
The shadow DB retains mainnet rollup state. Before the relayer can pick up bundles, reset their status:
843
+
844
+
```sql
845
+
UPDATE bundle SET rollup_status =1WHERE index BETWEEN 17297AND17301;
846
+
UPDATE batch SET rollup_status =1WHERE index BETWEEN 517761AND517765;
847
+
```
848
+
849
+
(`1` = `RollupPending`; without this, `GetFirstPendingBundle` returns nothing.)
850
+
851
+
### Step 2: Build and Configure Relayer
852
+
853
+
```bash
854
+
cd rollup
855
+
go build -o /tmp/rollup_relayer ./cmd/rollup_relayer
The relayer starts all modules (L2 watcher, proposers, batch committer, bundle finalizer). The batch committer will fail with `ErrorCallerIsNotSequencer` (expected — the commit sender is not a sequencer), but the **bundle finalizer runs independently every 15 seconds** and will pick up the pending bundles.
905
+
906
+
### Step 4: Monitor Finalization
907
+
908
+
Watch `/tmp/relayer.log` for:
909
+
910
+
```
911
+
{"msg":"Start to roll up zk proof","index":17297,...}
912
+
{"msg":"finalizeBundle in layer1","index":17297,"tx hash":"0x6d62...","with proof":"true"}
913
+
```
914
+
915
+
### Results
916
+
917
+
| Bundle | Batch | Transaction Hash | Status | Gas Used |
All 5 bundles finalized consecutively without manual intervention. Each bundle proof was verified on-chain by the `ZkEvmVerifierPostFeynman` contract deployed at `0xb1F2C5c1ea2885278a1070350d12d3D8824265B0`.
928
+
929
+
### Key Differences from CLI Approach
930
+
931
+
| Aspect | CLI (`cast send`) | Relayer |
932
+
|--------|-------------------|---------|
933
+
| Calldata construction | Manual Python script | Relayer reads from DB + constructs automatically |
934
+
| Sender management | Single EOA | Separate commit/finalize senders |
935
+
| Batch status tracking | None | Updates `bundle` and `batch``rollup_status` in DB |
936
+
| Error handling | Manual retry | Built-in retry and status polling |
937
+
| Multi-bundle support | One at a time | Processes all pending bundles automatically |
0 commit comments