Skip to content

Move wavmio logic to caller-env#4472

Open
pmikolajczyk41 wants to merge 2 commits intomasterfrom
pmikolajczyk/nit-4614-port-wavmio
Open

Move wavmio logic to caller-env#4472
pmikolajczyk41 wants to merge 2 commits intomasterfrom
pmikolajczyk/nit-4614-port-wavmio

Conversation

@pmikolajczyk41
Copy link
Member

This PR just ports changes done to standard JIT validator done in #4458


closes NIT-4614

@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 32.81%. Comparing base (f9004e9) to head (234469b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4472      +/-   ##
==========================================
- Coverage   32.92%   32.81%   -0.12%     
==========================================
  Files         493      493              
  Lines       58294    58294              
==========================================
- Hits        19193    19128      -65     
- Misses      35768    35825      +57     
- Partials     3333     3341       +8     

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

❌ 5 Tests Failed:

Tests completed Failed Passed Skipped
4295 5 4290 0
View the top 3 failed tests by shortest run time
TestNitroNodeVersionAlerter
Stack Traces | 1.100s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [03-05|14:19:04.927] Updated payload                          id=0x037a4a7c2c1ceba4 number=209 hash=45932f..613bb6 txs=1  withdrawals=0 gas=140,843    fees=0.000704215    root=e62577..9c3d35 elapsed=10.109ms
INFO [03-05|14:19:04.928] Stopping work on payload                 id=0x03e208fff2a5a547 reason=delivery
INFO [03-05|14:19:04.928] Imported new potential chain segment     number=63  hash=31a7e6..b7d784 blocks=1  txs=1  mgas=0.142  elapsed=16.254ms     mgasps=8.745    triediffs=384.33KiB  triedirty=0.00B
INFO [03-05|14:19:04.928] Chain head was updated                   number=63  hash=31a7e6..b7d784 root=a6971c..29d885 elapsed="119.493µs"
INFO [03-05|14:19:04.929] Imported new potential chain segment     number=4   hash=4ba99c..6bf1ed blocks=1  txs=1  mgas=3.188  elapsed=4.420ms      mgasps=721.168  triediffs=11.60KiB   triedirty=0.00B
INFO [03-05|14:19:04.929] Chain head was updated                   number=4   hash=4ba99c..6bf1ed root=c07cb2..c1fc9b elapsed="325.879µs"
INFO [03-05|14:19:04.932] Starting peer-to-peer node               instance=test-stack-name/linux-amd64/go1.25.7
WARN [03-05|14:19:04.932] P2P server will be useless, neither dialing nor listening
WARN [03-05|14:19:04.932] Served eth_sendRawTransactionConditional reqid=1687 duration=20.0253ms     err="Storage root hash condition not met"
INFO [03-05|14:19:04.933] DataPoster sent transaction              nonce=119 hash=7c0e42..e3928d feeCap=50,000,000,070 tipCap=5,000,000,000 blobFeeCap=<nil> gas=154,389
INFO [03-05|14:19:04.934] BatchPoster: batch sent                  sequenceNumber=120 from=305 to=306 prevDelayed=113 currentDelayed=113 totalSegments=3  numBlobs=0
INFO [03-05|14:19:04.933] Stopping work on payload                 id=0x037a4a7c2c1ceba4 reason=delivery
INFO [03-05|14:19:04.937] Imported new potential chain segment     number=27  hash=8b2865..7f7cc8 blocks=1  txs=1  mgas=7.089  elapsed=39.469ms     mgasps=179.597  triediffs=128.48KiB  triedirty=0.00B
INFO [03-05|14:19:04.937] Started log indexer
INFO [03-05|14:19:04.938] Chain head was updated                   number=27  hash=8b2865..7f7cc8 root=e603e7..87294c elapsed="377.235µs"
INFO [03-05|14:19:04.938] New local node record                    seq=1,772,720,344,937 id=d2e8221d5b29d479   ip=127.0.0.1 udp=0 tcp=0
WARN [03-05|14:19:04.937] Getting file info                        dir= error="stat : no such file or directory"
--- FAIL: TestNitroNodeVersionAlerter (1.10s)
INFO [03-05|14:19:05.376] Stopping work on payload                 id=0x033eb8683dd2e92b reason=delivery
INFO [03-05|14:19:05.376] Submitted transaction                    hash=0x0c5152f1d8d76d0004d7632da515aaa1032c1e315c90b5f4dfcd31f1f222753f from=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A nonce=194 recipient=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A value=1
TestOutOfGasInStorageCacheFlush
Stack Traces | 9.820s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [03-05|12:54:54.220] Updated payload                          id=0x03d4c7a9f8eac564 number=213  hash=f6799a..e607f9 txs=1  withdrawals=0 gas=21000      fees=0.0021         root=c40b59..be194a elapsed=9.824ms
INFO [03-05|12:54:54.220] Stopping work on payload                 id=0x03d4c7a9f8eac564 reason=delivery
INFO [03-05|12:54:54.222] Persisted dirty state to disk            size=174.67KiB elapsed=330.081ms
INFO [03-05|12:54:54.223] Blockchain stopped
INFO [03-05|12:54:54.223] HTTP server stopped                      endpoint=127.0.0.1:44507
TRACE[03-05|12:54:54.223] P2P networking is spinning down
INFO [03-05|12:54:54.224] New Key                                  name=Faucet            Address=0xaF24Ca6c2831f4d4F629418b50C227DF0885613A
INFO [03-05|12:54:54.224] New Key                                  name=RollupOwner       Address=0x57Ff0F473737a1c161bfF9efDF016F7991585088
INFO [03-05|12:54:54.224] New Key                                  name=Sequencer         Address=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23
INFO [03-05|12:54:54.224] New Key                                  name=Validator         Address=0x83FFCFaCE2Fb0E1286686815503608A16EF41e47
INFO [03-05|12:54:54.224] New Key                                  name=User              Address=0x7E23C8862920797d81916d62c274dd9217113e28
INFO [03-05|12:54:54.224] Allocated trie memory caches             clean=154.00MiB dirty=256.00MiB
INFO [03-05|12:54:54.224] State schema set to default              scheme=path
INFO [03-05|12:54:54.228] Imported new potential chain segment     number=349  hash=afca9e..6a48bd blocks=1  txs=1  mgas=0.021  elapsed=12.107ms     mgasps=1.734    triediffs=732.83KiB  triedirty=160.11KiB
INFO [03-05|12:54:54.228] Chain head was updated                   number=349  hash=afca9e..6a48bd root=f3fb04..f36e61 elapsed="62.006µs"
INFO [03-05|12:54:54.231] Submitted transaction                    hash=0x467269f63bb442406541bebb8f08248f3fda0c4bfc921302e9d49bb1d59e1a5a from=0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23 nonce=33  recipient=0x1277aC08028e0130A1Ca800B254dFcb48935E7D0 value=0
INFO [03-05|12:54:54.231] DataPoster sent transaction              nonce=33  hash=467269..9e1a5a feeCap=50,000,000,390 tipCap=5,000,000,000 blobFeeCap=<nil> gas=161,059
INFO [03-05|12:54:54.231] BatchPoster: batch sent                  sequenceNumber=34  from=111  to=115  prevDelayed=31  currentDelayed=32  totalSegments=9  numBlobs=0
INFO [03-05|12:54:54.233] Starting work on payload                 id=0x03647aaf8e0c44bf
--- FAIL: TestOutOfGasInStorageCacheFlush (9.82s)
TestBatchPosterWithDelayProofsAndBacklog
Stack Traces | 17.110s run time
... [CONTENT TRUNCATED: Keeping last 20 lines]
INFO [03-05|14:18:41.367] Imported new potential chain segment     number=31  hash=6a93f5..a40bb4 blocks=1  txs=1  mgas=0.021  elapsed=1.301ms      mgasps=16.135   triediffs=159.20KiB triedirty=0.00B
INFO [03-05|14:18:41.367] Chain head was updated                   number=31  hash=6a93f5..a40bb4 root=991b12..5b7721 elapsed="72.966µs"
INFO [03-05|14:18:41.368] ExecutionEngine: Added DelayedMessages   msgIdx=137 delayedMsgIdx=50 block-header="&{ParentHash:0xf1b0cde77ecd3056954ddfc4666efc3c69b49e1b89977efadb57d12981dfe21e UncleHash:0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 Coinbase:0xb386a74Dcab67b66F8AC07B4f08365d37495Dd23 Root:0x6cd6d6e1dfe39b7a73dd187e6882f41eb1f5c573322e71f192e1076ed5c3f356 TxHash:0x87194ac18ba896dc96f17fc73e8734e60499734050ccd4eb617b9497429f0387 ReceiptHash:0xf08cf5553e1dae52e3df19b356b8320e17c39fb055f635739c31052db5c3e45e Bloom:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Difficulty:+1 Number:+137 GasLimit:1125899906842624 GasUsed:0 Time:1772720467 Extra:[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] MixDigest:0x000000000000000000000000000000b000000000000000330000000000000000 Nonce:[0 0 0 0 0 0 0 51] BaseFee:+100000000 WithdrawalsHash:<nil> BlobGasUsed:<nil> ExcessBlobGas:<nil> ParentBeaconRoot:<nil> RequestsHash:<nil>}"
INFO [03-05|14:18:41.376] Starting work on payload                 id=0x03aa078f865305eb
INFO [03-05|14:18:41.378] Updated payload                          id=0x03aa078f865305eb number=26  hash=a57ff4..7e49a8 txs=1  withdrawals=0 gas=5,314,408  fees=5.314408e-06   root=c5921d..b295c0 elapsed=2.150ms
INFO [03-05|14:18:41.380] Stopping work on payload                 id=0x03aa078f865305eb reason=delivery
INFO [03-05|14:18:41.382] Imported new potential chain segment     number=26  hash=a57ff4..7e49a8 blocks=1  txs=1  mgas=5.314  elapsed=3.137ms      mgasps=1693.580 triediffs=97.33KiB  triedirty=0.00B
INFO [03-05|14:18:41.382] Ethereum protocol stopped
INFO [03-05|14:18:41.382] Chain head was updated                   number=26  hash=a57ff4..7e49a8 root=c5921d..b295c0 elapsed="433.801µs"
INFO [03-05|14:18:41.382] Transaction pool stopped
INFO [03-05|14:18:41.383] Persisting dirty state                   head=33  root=97e568..fb8555 layers=33
INFO [03-05|14:18:41.384] Indexed transactions                     blocks=6  txs=10 tail=0 elapsed=8.794ms
INFO [03-05|14:18:41.385] Persisted dirty state to disk            size=152.08KiB elapsed=2.466ms
INFO [03-05|14:18:41.385] Blockchain stopped
    batch_poster_test.go:719: �[31;1m [Unexpected batch poster transaction] �[0;0m
WARN [03-05|14:18:53.667] Served eth_sendRawTransactionConditional reqid=1067 duration=16.381181ms   err="Storage slot value condition not met"
INFO [03-05|14:18:53.671] Imported new potential chain segment     number=171 hash=ee412d..f9ce97 blocks=1  txs=1  mgas=0.141  elapsed=6.661ms      mgasps=21.142   triediffs=905.29KiB triedirty=55.58KiB
INFO [03-05|14:18:53.672] Chain head was updated                   number=171 hash=ee412d..f9ce97 root=65b17e..2805fd elapsed="371.925µs"
INFO [03-05|14:18:53.674] Submitted transaction                    hash=0xe819e86e7ecbdc1ca068347c7bdea515e6c4a32c4d9c58fdada17d5523fcae12 from=0x75a40d07efB4495e449f91cB9c370d5E1b453723 nonce=133 recipient=0x75a40d07efB4495e449f91cB9c370d5E1b453723 value=0
--- FAIL: TestBatchPosterWithDelayProofsAndBacklog (17.11s)

📣 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, just 2 minor comments

Comment on lines +166 to +172
let (mem, exec) = env.jit_env();
Ok(caller_env::wavmio::validate_certificate(
&mem,
exec,
preimage_type,
hash_ptr,
))
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: even though logic i the same, if preimage has the wrong type we silently return None which could make debugging a bit harder, so wondering if it's worth to re-add the eprintln msg?

}

/// Reads up to 32 bytes of a sequencer inbox message at the given offset.
pub fn read_inbox_message(
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: I was going to suggest to combine this and read_delayed_inbox_message since they are almost identical, but I think I prefer to keep them separate. Simplifying like this would just make readability harder. Will leave up to you

pub fn read_inbox_message(
...
) -> Result<u32, String> {
    read_message(mem, io.get_sequencer_message(msg_num), offset, out_ptr, format!("missing sequencer inbox message {msg_num}"))
}

pub fn read_delayed_inbox_message(
...
) -> Result<u32, String> {
    read_message(mem, io.get_delayed_message(msg_num), offset, out_ptr, format!("missing delayed inbox message {msg_num}"))
}

fn read_message(
    mem: &mut impl MemAccess,
    message: Option<&[u8]>,
    offset: u32,
    out_ptr: GuestPtr,
    err: String,
) -> Result<u32, String> {
    let message = message.ok_or(err)?;
    let offset = offset as usize;
    let len = min(32, message.len().saturating_sub(offset));
    let read = message.get(offset..(offset + len)).unwrap_or_default();
    mem.write_slice(out_ptr, read);
    Ok(read.len() as u32)
}

@bragaigor bragaigor assigned pmikolajczyk41 and unassigned bragaigor Mar 5, 2026
) -> Result<u32, Escape> {
let (mut mem, exec) = env.jit_env();
let offset = offset as usize;
ready_hostio(exec)?;
Copy link
Contributor

@bragaigor bragaigor Mar 5, 2026

Choose a reason for hiding this comment

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

Forgot to ask if the addition of ready_hostio here is intentional?

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.

2 participants