Skip to content

test: expose batch output to tests and harden test assertions#585

Open
antoniolocascio wants to merge 43 commits into
alocascio-batch-prover-input-runfrom
alocascio-native-run-testing
Open

test: expose batch output to tests and harden test assertions#585
antoniolocascio wants to merge 43 commits into
alocascio-batch-prover-input-runfrom
alocascio-native-run-testing

Conversation

@antoniolocascio
Copy link
Copy Markdown
Contributor

What ❔

  • Exposes prover-input replay outputs in the test rig via last_executed_block_info(), including prover-input BlockOutput and BatchOutput.

  • Uses that to strengthen tests with proving-side assertions:

    • interop-root tests now check interop_roots_rolling_hash
    • settlement-layer chain-id tests now check the prover-input output
    • transaction tests now check number_of_layer_1_txs and priority_operations_hash

Why ❔

Is this a breaking change?

  • Yes
  • No

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted.

## What ❔

Reimplement the hints for ecrecover from ethproofs.
Instead of having a new full implementation of ecrecover, this PR
introduces "hooks" for 3 secp256k1 field operations. These hooks have
two implmentations: default, where the implementation is straightforward
(same implementation as before this PR) and oracle-based, where we use
the new callable oracles.
This way, most of the logic for ecrecover is reused.

Given that this is a critical part of the system, the PR includes:
* PBT for "good" case (showing equivalence when using the right oracle)
* Tests for the "bad" case (showing panics if the oracle lies)
* Modifies the fuzz target for ecrecover to compare the forward and
oracle runs. I've ran the fuzzer for over 1h without finding issues.

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- The `Why` has to be clear to non-Matter Labs entities running their
own ZK Chain -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Is this a breaking change?
- [ ] Yes
- [ ] No

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted.
@antoniolocascio antoniolocascio changed the title Alocascio native run testing test: expose batch output to tests and harden test assertion Mar 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Benchmark report

Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%)
block_19299001 process_block 299,143,094 299,143,094 (+0.00%) 263,812,006 263,812,006 (+0.00%) 410,630 410,630 (+0.00%) 7,190,252 7,190,252 (+0.00%)
block_22244135 process_block 183,605,248 183,605,248 (+0.00%) 162,886,764 162,886,764 (+0.00%) 172,040 172,040 (+0.00%) 4,491,461 4,491,461 (+0.00%)
precompiles bn254_ecadd 53,268 53,268 (+0.00%) 47,816 47,816 (+0.00%) 0 0 (+0.00%) 1,363 1,363 (+0.00%)
precompiles bn254_ecmul 728,781 728,781 (+0.00%) 564,593 564,593 (+0.00%) 0 0 (+0.00%) 41,047 41,047 (+0.00%)
precompiles bn254_pairing 72,336,733 72,336,733 (+0.00%) 57,808,589 57,808,589 (+0.00%) 0 0 (+0.00%) 3,632,036 3,632,036 (+0.00%)
precompiles ecrecover 381,899 381,184 (-0.19%) 255,999 255,556 (-0.17%) 0 0 (+0.00%) 31,475 31,407 (-0.22%)
precompiles id 927 927 (+0.00%) 927 927 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles keccak 137,579 137,579 (+0.00%) 137,579 137,579 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles modexp 31,267,857 31,267,857 (+0.00%) 20,610,037 20,610,037 (+0.00%) 0 0 (+0.00%) 2,664,455 2,664,455 (+0.00%)
precompiles p256_verify 748,861 748,861 (+0.00%) 470,169 470,169 (+0.00%) 0 0 (+0.00%) 69,673 69,673 (+0.00%)
precompiles process_block 147,359,005 147,358,433 (-0.00%) 117,963,329 117,976,273 (+0.01%) 5,140 5,140 (+0.00%) 7,328,359 7,324,980 (-0.05%)
precompiles process_transaction 73,394,709 73,390,502 (-0.01%) 58,733,293 58,730,410 (-0.00%) 160 160 (+0.00%) 3,664,714 3,664,383 (-0.01%)
precompiles ripemd 8,013 8,013 (+0.00%) 8,013 8,013 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles run_tx_loop 146,707,594 146,703,919 (-0.00%) 117,403,450 117,401,119 (-0.00%) 180 180 (+0.00%) 7,325,316 7,324,980 (-0.00%)
precompiles sha256 13,168 13,168 (+0.00%) 13,168 13,168 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles system_init 46,790 46,790 (+0.00%) 46,790 46,790 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles verify_and_apply_batch 142,057 146,212 (+2.92%) 106,057 109,892 (+3.62%) 2,250 2,270 (+0.89%) 0 0 (+0.00%)

@antoniolocascio antoniolocascio changed the title test: expose batch output to tests and harden test assertion test: expose batch output to tests and harden test assertions Mar 23, 2026
@antoniolocascio antoniolocascio force-pushed the alocascio-batch-prover-input-run branch 2 times, most recently from 4a9d958 to de4da02 Compare March 31, 2026 14:09
@antoniolocascio antoniolocascio force-pushed the alocascio-batch-prover-input-run branch 8 times, most recently from b6ce646 to 90c1a64 Compare April 24, 2026 11:27
@0xVolosnikov 0xVolosnikov force-pushed the alocascio-batch-prover-input-run branch from 90c1a64 to 153a5e4 Compare May 27, 2026 18:52
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