feat(l2): remove public inputs from verify() function in OnChainProposer#2836
feat(l2): remove public inputs from verify() function in OnChainProposer#2836pedrobergamini wants to merge 16 commits into
Conversation
LeanSerra
left a comment
There was a problem hiding this comment.
Hi! Congratulations for your first PR on Ethrex. The code is looking great however there are a few things that need fixing that cause the integration test to fail.
To fix them please address all the review comments + this change at the very end of the file crates/l2/prover/zkvm/interface/sp1/src/main.rs
// Calculate final state root hash and check
let final_state_hash = state_trie.hash_no_commit();
if final_state_hash != last_block_state_root {
panic!("invalid final state trie");
}
sp1_zkvm::io::commit_slice(
&ProgramOutput {
initial_state_hash,
final_state_hash,
#[cfg(feature = "l2")]
withdrawals_merkle_root,
#[cfg(feature = "l2")]
deposit_logs_hash,
}
.encode(),
);We have to remove the gas_used as a public value as we don't want to store it in the contract and we need to use commit_slice as the previous commit function was adding a few bytes of padding leading to a mismatch when verifying the proof.
With these changes the integration test will pass however with the recent merged PRs TDX was added as a prover which implies a few changes on the OnChainProposer contract that you'll need to address.
Feel free to ask for help if you need any
…rom-verify-function Feat/remove public inputs from verify function
|
@pedrobergamini overall code looks good but the integration test is not passing, seems like there's a few things to fix on the contract and the proof sender code |
|
Hey @pedrobergamini! The CI is not running because we're using a GitHub Variable in all workflows, which isn't accessible from PRs created from forks. This is a problem we had not anticipated. Due to this, I'm currently working on a fix which removes the use of this variable completely, which would allow the CI to run in this PR (and all future PRs from forks). Sorry for the inconvenience, I'll let you know when you can merge changes from cc @jrchatruc |
|
#3318: Fix in progress. I'll merge it as soon as all its CI jobs succeed. |
| if (SP1VERIFIER != DEV_MODE) { | ||
| // If the verification fails, it will revert. | ||
| _verifyPublicData(batchNumber, sp1PublicValues[8:]); | ||
| ISP1Verifier(SP1VERIFIER).verifyProof( | ||
| SP1_VERIFICATION_KEY, | ||
| sp1PublicValues, | ||
| publicInputs, | ||
| sp1ProofBytes | ||
| ); | ||
| } |
There was a problem hiding this comment.
SP1 public inputs have an 8 byte header containing the length of the data.
|
Closing since this hasn't been worked on in some time. Feel free to reopen. |
|
The CI was fixed in #3591. @pedrobergamini do you want to work on this still? |
Yep! I will get back to it this week then, thanks for the ping. |
…ation Mirrors EELS PR #2836 (merged 2026-05-12, devnets/bal/7): ethereum/execution-specs#2836 When the authority's pre-state code slot already holds a 7702 delegation indicator (overwrite or clear), refill the 23-byte AUTH_BASE portion of intrinsic state gas via both the reservoir and the state_refund channel. Keys off the pre-state code, not the auth target, so it applies whether auth.address is a new delegation target or zero (clear). Breaks ef-tests until upstream re-cuts fixtures past tests-bal@v7.0.0; no skips added per the bal-devnet-7 alignment policy.
…ation Mirrors EELS PR #2836 (merged 2026-05-12, devnets/bal/7): ethereum/execution-specs#2836 When the authority's pre-state code slot already holds a 7702 delegation indicator (overwrite or clear), refill the 23-byte AUTH_BASE portion of intrinsic state gas via both the reservoir and the state_refund channel. Keys off the pre-state code, not the auth target, so it applies whether auth.address is a new delegation target or zero (clear). Breaks ef-tests until upstream re-cuts fixtures past tests-bal@v7.0.0; no skips added per the bal-devnet-7 alignment policy.
…ation Mirrors EELS PR #2836 (merged 2026-05-12, devnets/bal/7): ethereum/execution-specs#2836 When the authority's pre-state code slot already holds a 7702 delegation indicator (overwrite or clear), refill the 23-byte AUTH_BASE portion of intrinsic state gas via both the reservoir and the state_refund channel. Keys off the pre-state code, not the auth target, so it applies whether auth.address is a new delegation target or zero (clear). Breaks ef-tests until upstream re-cuts fixtures past tests-bal@v7.0.0; no skips added per the bal-devnet-7 alignment policy.
…ation Mirrors EELS PR #2836 (merged 2026-05-12, devnets/bal/7): ethereum/execution-specs#2836 When the authority's pre-state code slot already holds a 7702 delegation indicator (overwrite or clear), refill the 23-byte AUTH_BASE portion of intrinsic state gas via both the reservoir and the state_refund channel. Keys off the pre-state code, not the auth target, so it applies whether auth.address is a new delegation target or zero (clear). Breaks ef-tests until upstream re-cuts fixtures past tests-bal@v7.0.0; no skips added per the bal-devnet-7 alignment policy.
Mirrors EELS PR #2848 (tests-bal@v7.1.1, devnets/bal/7): ethereum/execution-specs#2848 PR #2836 already refunded the 23-byte AUTH_BASE portion when the authority's pre-state code slot held a delegation indicator. #2848 broadens the condition: when the auth is a clear (`auth.address == 0x00`), no new indicator bytes are written regardless of pre-state code, so the AUTH_BASE refill applies even against an authority with no prior code. Equivalent to EELS: if authority_account.code_hash != EMPTY_CODE_HASH or auth.address == NULL_ADDRESS: refund = STATE_BYTES_PER_AUTH_BASE * COST_PER_STATE_BYTE
**Motivation** Bring ethrex up to bal-devnet-7 (BAL fixtures `bal@v7.1.1`). Stacked on top of #bal-devnet-6-pr (now in main). **Description** Aligns EIP-8037 state-gas accounting with bal-devnet-7 spec progression (EELS PRs lambdaclass#2815 / lambdaclass#2816 / lambdaclass#2823 / lambdaclass#2827 / lambdaclass#2828 / lambdaclass#2836 / lambdaclass#2845 / lambdaclass#2848), bumps Amsterdam fixtures from `snobal-devnet-6@v1.1.0` to `bal@v7.1.1`, and bumps the pinned hive version past the ethrex `--http.api` fix. Main changes: - EIP-8037 state-gas alignment with bal-devnet-7: - System-call state-gas reservoir. - Halt refunds spilled state gas (Policy A). - Tx-level CREATE failure refunds intrinsic `NEW_ACCOUNT`; `intrinsic_state_gas_charged` preserved across the failure path. - Tx-CREATE collision refund with regular-gas burn; billing matches EELS. - Cross-frame revert leaks inline credits. - Cross-frame revert reservoir formula fix. - Block-level `state_gas_used` subtracts `state_refund`. - Remove same-tx SELFDESTRUCT state-gas refund (EELS PR lambdaclass#2845, v7.1.0). - EIP-7702: - `set_delegation` refund via dedicated `state_refund` channel. - `set_delegation` refunds `AUTH_BASE` on existing delegation (EELS PR lambdaclass#2836). - `set_delegation` refunds `AUTH_BASE` on delegation clear (EELS PR lambdaclass#2848, v7.1.1). - levm fixes pulled from main: - `revert` doesn't unmark the account as existing (lambdaclass#6592). - Account erroneously considered as existing after zero-value transfer (lambdaclass#6591). - Tooling / tests: - Per-tx gas-dimension dump on block `gas_used` mismatch. - Bump Amsterdam fixtures to `bal@v7.1.1`. - Annotate BAL balance-mismatch errors with gas-equivalent diff and recognised state-gas constant multiples. - Unskip 74 bal-devnet-6 Amsterdam fixtures now passing. - Skip 21 stale EIP-8025 fixtures pinned at `bal@v5.7.0` (zkevm@v0.3.3 bundle, pre-bal-7). - Drop stale bal-devnet-6 known-issues entries from `docs/known_issues.md` and hive `KNOWN_EXCLUDED_TESTS`. - CI: - Bump pinned hive version past the ethrex `--http.api` flag feature-detect fix (`c4d839b3`, hive lambdaclass#1485). Without this, hive starts ethrex with the default HTTP namespace allowlist (`eth,net,web3`) and tests touching `admin_*`/`debug_*`/`txpool_*` fail. **Local test run** `./run_test.sh` against `tests-bal@v7.1.1`: 2,145 / 2,145 pass. `cargo test -p ethrex-test --tests`: 453 / 453 pass. **Checklist** - [ ] Updated `STORE_SCHEMA_VERSION` (crates/storage/lib.rs) if the PR includes breaking changes to the `Store` requiring a re-sync. --------- Co-authored-by: Lucas Fiegl <iovoid@users.noreply.github.com> Co-authored-by: Ivan Litteri <67517699+ilitteri@users.noreply.github.com>
Motivation
This PR implements the removal of public inputs from the
verifyBatch()function in the OnChainProposer contract. Public inputs are now retrieved from the committed batch data instead of being passed as parameters.Description
This PR removes public inputs from the
verifyBatchfunction signature and instead reconstructs them from already-committed batch data. This simplifies the interface and reduces calldata size.OnChainProposer.sol
verifyBatchfunction signature: Removed all public input parameterssp1PublicValuesparameter (SP1 now only needssp1ProofBytes)tdxPublicValuesparameter (TDX now only needstdxSignature)_getPublicInputsFromCommitmentfunction: Internal function that reconstructs 160-byte public inputs from committed batch datasha256(publicInputs)publicInputsdirectlypublicInputsdirectlyzkVM Interface Updates
commit_slicefor outputcommit_slicefor outputl1_proof_sender.rs
VERIFY_FUNCTION_SIGNATUREconstant to match new contract signatureproving_systems.rs
empty_calldata()method for proving systemsCloses #2804