Skip to content

fix: make debank block replay protocol-correct - #4

Closed
littlehand26 wants to merge 7 commits into
debankfrom
feature/arc-writer-correctness-v0.7.3
Closed

littlehand26 wants to merge 7 commits into
debankfrom
feature/arc-writer-correctness-v0.7.3

Conversation

@littlehand26

@littlehand26 littlehand26 commented Aug 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • replay each block through the canonical Arc executor in separate state and trace passes, including pre/post block hooks
  • build StateDiff from Reth's canonical State + BundleState path so EIP-161 touched-empty accounts, unchanged slots, and same-block net-zero changes are filtered correctly
  • capture full Arc events with emitter address, frame ownership, precompile ordering, reverted events, and direct journal logs
  • retain standard precompile call frames to match the canonical pipeline producer and Arc debug callTracer
  • fix CREATE transaction targets, CREATE2 trace type, error-event indexes, and deterministic state-diff ordering
  • match current reth-x/pipeline effective-failure semantics: successful descendants of failed ancestors use parent call failed, while their own EVM errors take precedence
  • remove the Tempo AA classification fallback; Arc now fails the RPC on receipt/root classification contradictions or invalid success/error buckets

Validation

  • cargo fmt --all --check
  • cargo test -p debank-rpc --all-targets (39 passed)
  • cargo test -p arc-execution-e2e --test debank_trace (2 passed; real trace_debankBlock pre/transaction/post path)
  • cargo clippy -p arc-execution-e2e --all-targets --no-deps -- -D warnings
  • cargo clippy -p debank-rpc --all-targets -- -D warnings
  • cargo test -p arc-evm-node --lib (87 passed)
  • git diff --check
  • three independent read-only reviews found no blocker
  • amd64, arm64, and multiarch jobs passed for current head 582bc9e (test-only follow-up; runtime logic remains 5fb88e2)
  • multiarch image: blockchain/arc-x:5fb88e2@sha256:34543489497e5512f337e0deaf95c720f47869c8e02e42697d16f7cc880ac5be

Mainnet verification

  • the original f525595 image passed the fixed 10,001-block and 20,001-block Arc mainnet corpora, with zero T*, C*, D*, non-S22 S*, WARN, or incomplete-block findings
  • deployed amd64-5fb88e2@sha256:d1eb5da0b8769f79e7b4b29e105f575247f659062070212c3ba126a98a4095df on the stopped-head Arc mainnet archive
  • two empty blocks still contain both EIP-2935 and SystemAccounting writes; their 413-byte StateDiff payloads are byte-identical to the previous implementation
  • replayed 5,000 consecutive blocks: 5,000/5,000 RPC success, the same 52 error-trace IDs/tree/buckets, and empty error strings reduced from one to zero; block 15,814,391 now has the exact parent call failed descendant error while its StateDiff remains byte-identical
  • canonical verifier covered CREATE block 10,385,977 plus 500 consecutive blocks: 501/501 blocks, 23,677 trace comparisons, 2,424 event comparisons, all three oracles RAN, zero WARN/UNCOVERED, and zero T*, C*, D*, or non-S22 failures
  • the only raw findings were 37 known S22 false positives on Arc EIP-7708 system logs; all 37 IDs were unique and all address/topics/data matched receipts, as did all 149 successful events in the affected blocks
  • execution-witness verification covered another 100 consecutive blocks and performed 3,356 state-value comparisons with zero UNCOVERED, zero D09-D16 findings, and zero state mismatch
  • the same witness range produced 5,949 comparisons with the old raw-hook implementation; the reduction is expected because BundleState omits redundant touched/unchanged entries
  • after validation the node remained healthy: restart count 0, OOM false, about 85 MiB / 8 GiB memory

Operational notes

  • this change intentionally does not extend the StateDiff schema for StorageCleared
  • applying every StateDiff to its parent and recomputing the state root remains a separate release gate
  • deploy the companion Leafage warmup fix before enabling warmup against newly produced BlockFiles

@littlehand26

Copy link
Copy Markdown
Collaborator Author

Companion warmup compatibility change: Chaintable/leafage-evm#209. Deploy the Leafage change before enabling warmup for BlockFiles produced by this writer change.

@littlehand26

Copy link
Copy Markdown
Collaborator Author

Mainnet archive image validation passed on lihe-dev.

  • multiarch image: 5a42639@sha256:f4105b4e59e814835f1c5eef8e67abf7823228e21bc70dfc03192a618d3627f8
  • block 0xf15008: 17/17 events match receipt address/topics/data/order; all 6 EIP-7708 emitters are 0xfffffffffffffffffffffffffffffffffffffffe; trace/event IDs, parent/position, validation hash, RLP sorting, and repeat-request determinism pass
  • block 0x9e7a39: CREATE transaction target changed from zero to receipt contract 0xdc6f9efa59c314a2c5ec8f2b28666415d228f5ee; root trace type/target and tx index pass
  • empty block 0xf15d5b: no txs, but two Arc system storage contracts and a 413-byte StateDiff are preserved, confirming block hooks are captured
  • successful block 0xf15db4, failed block 0xf15dbb, and genesis smoke/determinism checks pass
  • container remains running with restart count 0 and no ERROR/panic/fatal logs

Remaining Phase 1 gates are StateDiff apply/state-root verification, a continuous 10,000-block run, performance measurements, and additional reverted-log/failed-CREATE fixtures. web3_clientVersion still contains stale build metadata because arc-version does not rerun for VERGEN_GIT_* changes; runtime behavior above proves the PR source is present, and the metadata issue is tracked separately.

@littlehand26

Copy link
Copy Markdown
Collaborator Author

Additional continuous validation passed: 10,000 explicit mainnet blocks (0xf136af through 0xf15dbe) at concurrency 1 in 11.903s. Coverage: 4,523 txs including 91 failed txs, 53,651 traces, 99 error traces, and 11,622 events. Per-block replay, transaction/event indexes, trace/event IDs, parent/position, trace addresses, validation hashes, and storage_contract ordering had zero failures. Latency mean/P50/P95/P99/max was 1.186/0.760/3.014/4.673/79.783 ms. Container restart count remains 0; memory after the run was 77.5 MiB. This is a hot local archive sequential-read result and is not a substitute for the background-tracer concurrency/cold-history benchmark.

@littlehand26

Copy link
Copy Markdown
Collaborator Author

Added reusable BlockFile feature coverage in commit 1ff564a.

Coverage now includes failed CREATE, internal CREATE2, EIP-6780 SELFDESTRUCT, reverted EIP-7708 and ordinary LOG events, PQ/P256 canonical transactions, ProtocolConfig/Denylist/NCC/Validator mutations, and EIP-7702 type-4 delegation. The fixtures use the current mainnet hardfork set (Zero3-Zero6 and Osaka active; Zero7/Zero8 inactive).

Validation: scripts/test-debank-blockfile.sh passed 54/54 tests; cargo fmt, targeted Clippy, bash syntax, and git diff checks passed.

@littlehand26

Copy link
Copy Markdown
Collaborator Author

PR stack note (2026-08-22): merge order is #4 -> #6 -> #7. Please use merge commits for the parent PRs; do not squash/rebase, because #7 verifies that the #6 producer baseline is in its ancestry. #5 has been superseded and closed without deleting its branch.

@littlehand26

Copy link
Copy Markdown
Collaborator Author

Superseded by #9. The v0.7.3 Writer correctness changes and their tests were ported to the clean v0.8.0 baseline in f9525a5 and merged via #9 (cf34e58). Closing this old PR to avoid merging the legacy implementation again. Branch and review history are retained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant