Skip to content

Conversation

@pmikolajczyk41
Copy link
Member

  1. Just before the first IO (wavmio) instruction in replay.wasm we call a hook. For native compilation, it's a noop. For wasm, we expect that the execution environment will provide a module called hooks with a method beforeFirstIO.
  2. JIT and Arbitrator provers provide noop implementation. SP1 runner (once added) will call sp1__dumpElf (as in Add a new Succinct SP1 based arbitrator-like runner #4170)
  3. Rename wavmio/stub.go to wavmio/native.go (it's not about stubbing, but running replay.wasm as a native binary instead).
  4. Rename StubInit and StubFinal to OnInit and OnFinal, so that together with the new OnReady, they compose a triple of wavmio lifecycle hooks called directly from replay.wasm.

closes NIT-4401

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 34.65%. Comparing base (670d1bf) to head (fb84cdb).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4283      +/-   ##
==========================================
+ Coverage   34.58%   34.65%   +0.06%     
==========================================
  Files         475      475              
  Lines       56720    56722       +2     
==========================================
+ Hits        19619    19655      +36     
+ Misses      33633    33603      -30     
+ Partials     3468     3464       -4     

@github-actions
Copy link
Contributor

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
4036 4 4032 0
View the top 3 failed tests by shortest run time
TestBlocksReExecutorCommitState
Stack Traces | 2.400s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
TRACE[01-28|10:31:40.099] Handled RPC response                     reqid=18320 duration="1.623µs"
DEBUG[01-28|10:31:40.099] Pushed sync data from consensus to execution synced=true  maxMessageCount=6   updatedAt=2026-01-28T10:31:40+0000 hasProgressMap=false
DEBUG[01-28|10:31:40.100] Finality not supported, not pushing finality data to execution
DEBUG[01-28|10:31:40.100] Served eth_getBlockByNumber              reqid=1435  duration="53.229µs"
TRACE[01-28|10:31:40.100] Handled RPC response                     reqid=1435  duration="1.242µs"
DEBUG[01-28|10:31:40.101] Pushed sync data from consensus to execution synced=true  maxMessageCount=5   updatedAt=2026-01-28T10:31:40+0000 hasProgressMap=false
DEBUG[01-28|10:31:40.101] Finality not supported, not pushing finality data to execution
DEBUG[01-28|10:31:40.101] Executing EVM call finished              runtime="113.281µs"
DEBUG[01-28|10:31:40.101] Served eth_call                          reqid=18321 duration="155.48µs"
DEBUG[01-28|10:31:40.101] Executing EVM call finished              runtime="119.343µs"
DEBUG[01-28|10:31:40.101] Served eth_call                          reqid=8157  duration="189.644µs"
TRACE[01-28|10:31:40.101] Handled RPC response                     reqid=18321 duration=672ns
TRACE[01-28|10:31:40.101] Handled RPC response                     reqid=8157  duration="1.924µs"
DEBUG[01-28|10:31:40.101] Executing EVM call finished              runtime="138.969µs"
DEBUG[01-28|10:31:40.101] Served eth_call                          reqid=18322 duration="174.476µs"
DEBUG[01-28|10:31:40.101] Executing EVM call finished              runtime="119.613µs"
DEBUG[01-28|10:31:40.101] Served eth_call                          reqid=8158  duration="187.947µs"
TRACE[01-28|10:31:40.101] Handled RPC response                     reqid=18322 duration="1.162µs"
TRACE[01-28|10:31:40.101] Handled RPC response                     reqid=8158  duration="1.413µs"
--- FAIL: TestBlocksReExecutorCommitState (2.40s)
TestSequencerPriceAdjustsFrom2Gwei
Stack Traces | 27.380s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [01-28|10:42:29.622] Updated payload                          id=0x03655969a4a8bf93 number=537 hash=3af272..7620c9 txs=1   withdrawals=0 gas=21000     fees=0.0021         root=6855de..a8991b elapsed=1.041ms
INFO [01-28|10:42:29.622] Persisting dirty state                   head=21  root=8726a6..704076 layers=21
INFO [01-28|10:42:29.623] Stopping work on payload                 id=0x03655969a4a8bf93 reason=delivery
INFO [01-28|10:42:29.623] Submitted transaction                    hash=0x4c8135baac2998807eb431f1d8a0d9504d8f07b75bb46a4557c1fda4d061ec78 from=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23 nonce=81  recipient=0x057f26cdC37D64A0da7A20EeBFc5Bf543d1B4133 value=0
INFO [01-28|10:42:29.624] Persisted dirty state to disk            size=100.64KiB elapsed=1.575ms
INFO [01-28|10:42:29.624] Imported new potential chain segment     number=537 hash=3af272..7620c9 blocks=1  txs=1   mgas=0.021 elapsed=1.799ms     mgasps=11.668   triediffs=649.78KiB triedirty=246.04KiB
INFO [01-28|10:42:29.624] releasing chosen one                     myUrl=/home/runner/work/nitro/nitro/target/tmp/deadbeefbee/3596435846/2.ipc attempt=3
WARN [01-28|10:42:29.624] unable to verify sequencer release status due to Redis error: %v "!BADKEY"="redis: client is closed" "!BADKEY"=<nil>                     LOG_ERROR="Normalized odd number of arguments by adding nil"
ERROR[01-28|10:42:29.624] failed to release chosen one status on shutdown err="redis: client is closed"
INFO [01-28|10:42:29.624] Blockchain stopped
INFO [01-28|10:42:29.624] DataPoster sent transaction              nonce=81  hash=4c8135..61ec78 feeCap=50,000,000,070 tipCap=5,000,000,000 blobFeeCap=<nil> gas=158,236
INFO [01-28|10:42:29.624] Chain head was updated                   number=537 hash=3af272..7620c9 root=6855de..a8991b elapsed="82.834µs"
INFO [01-28|10:42:29.624] BatchPoster: batch sent                  sequenceNumber=82 from=253 to=256 prevDelayed=73 currentDelayed=73 totalSegments=7  numBlobs=0
INFO [01-28|10:42:29.625] Indexed transactions                     blocks=46 txs=90  tail=0 elapsed=1.482ms
INFO [01-28|10:42:29.625] Ethereum protocol stopped
INFO [01-28|10:42:29.625] Transaction pool stopped
INFO [01-28|10:42:29.625] Persisting dirty state                   head=35  root=56142e..099530 layers=35
INFO [01-28|10:42:29.628] Persisted dirty state to disk            size=168.84KiB elapsed=2.694ms
INFO [01-28|10:42:29.628] Blockchain stopped
--- FAIL: TestSequencerPriceAdjustsFrom2Gwei (27.38s)
TestTwoNodesLong
Stack Traces | 33.590s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [01-28|10:40:10.473] Deploying upgrade executor mock
WARN [01-28|10:40:10.474] error fetching batch poster wallet balance err="io: read/write on closed pipe"
INFO [01-28|10:40:10.474] Persisted dirty state to disk            size=988.06KiB elapsed=12.933ms
WARN [01-28|10:40:10.474] error posting batch                      err="io: read/write on closed pipe"
INFO [01-28|10:40:10.474] Blockchain stopped
INFO [01-28|10:40:10.475] New Key                                  name=Faucet           Address=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A
INFO [01-28|10:40:10.475] New Key                                  name=Faucet           Address=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A
INFO [01-28|10:40:10.475] New Key                                  name=RollupOwner      Address=0x57Ff0F473737a1c161bfF9efDF016F7991585088
INFO [01-28|10:40:10.475] New Key                                  name=RollupOwner      Address=0x57Ff0F473737a1c161bfF9efDF016F7991585088
INFO [01-28|10:40:10.475] New Key                                  name=Sequencer        Address=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23
INFO [01-28|10:40:10.475] Deploying upgrade executor mock
INFO [01-28|10:40:10.475] New Key                                  name=Validator        Address=0x83FFCFaCE2Fb0E1286686815503608A16EF41e47
INFO [01-28|10:40:10.475] New Key                                  name=User             Address=0x7E23C8862920797d81916d62c274dd9217113e28
INFO [01-28|10:40:10.475] New Key                                  name=Sequencer        Address=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23
INFO [01-28|10:40:10.475] New Key                                  name=Validator        Address=0x83FFCFaCE2Fb0E1286686815503608A16EF41e47
INFO [01-28|10:40:10.475] New Key                                  name=User             Address=0x7E23C8862920797d81916d62c274dd9217113e28
INFO [01-28|10:40:10.476] Allocated trie memory caches             clean=154.00MiB dirty=256.00MiB
INFO [01-28|10:40:10.476] State schema set to default              scheme=path
INFO [01-28|10:40:10.476] Allocated trie memory caches             clean=154.00MiB dirty=256.00MiB
--- FAIL: TestTwoNodesLong (33.59s)

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

Copy link
Contributor

@bragaigor bragaigor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

"keccak256" => func!(arbkeccak::keccak256),
},
"hooks" => {
"beforeFirstIO" => func!(|_: WasmEnvMut|{}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implementation will be done in another PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JIT and Arbitrator provers have noop implementations.

that's why

func validateCertificate(ty uint32, hash unsafe.Pointer) uint32

//go:wasmimport hooks beforeFirstIO
func beforeFirstIO()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: maybe actionBeforeFirstIO but that doesn't make that much difference. beforeFirstIO already implies action.

@bragaigor bragaigor assigned tsahee and unassigned bragaigor Jan 28, 2026
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.

4 participants