AZIP 4: Add L1 Block info to public and private context#13
AZIP 4: Add L1 Block info to public and private context#13joeandrews wants to merge 5 commits intoAztecProtocol:mainfrom
Conversation
This AZIP introduces L1 block roots into the Noir contract execution context, enabling trustless reads of L1 state, transactions, and receipts. It outlines the specification for accessing these roots and their implications for various stakeholders.
This AZIP proposal updates the context for accessing L1 block header data in Noir contracts, enhancing the ability to read Ethereum state without oracles. It introduces a new structure for L1 block header fields, optimizing the protocol for trustless reads and reducing gas costs.
Updated the 'discussions-to' field in the AZIP preamble to include a link to the relevant GitHub discussion.
critesjosh
left a comment
There was a problem hiding this comment.
Assigned as AZIP-4 and a couple of nits
|
|
||
| | `azip` | `title` | `description` | `author` | `discussions-to` | `status` | `category` | `created` | | ||
| | ------ | ---------------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------- | ---------------------------------------------------------- | -------- | ---------- | ---------- | | ||
| | TBD | L1 Block Header Access | Make L1 block header data available to Noir contracts via a single Poseidon2 commitment. | Joe Andrews (@joeandrews, joe@aztec-labs.com) | https://github.com/AztecProtocol/governance/discussions/12 | Draft | Core | 2026-04-17 | |
There was a problem hiding this comment.
| | TBD | L1 Block Header Access | Make L1 block header data available to Noir contracts via a single Poseidon2 commitment. | Joe Andrews (@joeandrews, joe@aztec-labs.com) | https://github.com/AztecProtocol/governance/discussions/12 | Draft | Core | 2026-04-17 | | |
| | 4 | L1 Block Header Access | Make L1 block header data available to Noir contracts via a single Poseidon2 commitment. | Joe Andrews (@joeandrews, joe@aztec-labs.com) | https://github.com/AztecProtocol/governance/discussions/12 | Draft | Core | 2026-04-17 | |
|
|
||
| As Aztec is an Ethereum rollup. Every checkpoint already references an L1 block. This AZIP exposes that block's header to contracts, so any L1 state can be proven with a Merkle-Patricia trie proof in Noir, with no trust beyond L1 consensus. | ||
|
|
||
| Rather than adding six fields to `GlobalVariables` (six Fields in every `BlockHeader` hash, six AVM opcodes, six fields through the rollup circuits), we commit them behind a single Poseidon2 hash. Contracts provide the preimage as a witness and open it — one hash check. One Field, one opcode, and extensible: adding header fields later requires only a preimage struct update. |
There was a problem hiding this comment.
The template.md requires a Rationale section, distinct from Motivation. I think this line would make sense to include in the Rationale section
|
|
||
| New fields in `GlobalVariables`, `BlockHeader`, `CheckpointConstantData`, `CheckpointHeader`, and `ProposedHeader` break the block format. Upgrade via AZUP. Existing contracts unaffected. | ||
|
|
||
| ## Testing |
There was a problem hiding this comment.
| ## Testing | |
| ## Test Cases |
for consistency
|
I investigated the cost of doing an SSZ proof of an EL state root within an CL block hash https://github.com/just-mitch/ssz Looks like it is roughly 110k gates. Compared to basically a no-op "hello world" transaction (which models the case where the EL state root is provided in the global variables directly), the inclusion proof generation time is
Based on this, I think we ought to only include the beacon block hash. |
Cool exploration! I'm not sure I agree with the tradeoff though (yet) -- a 5%-8% slow-down for a slightly tidier design. My mind might be swayed if:
|
No problem. I didn't know what any hard requirements were here. Are you saying that the EL state root must be available for free to applications? I would be willing to make applications that want to use the EL state root "pay" an additional second to save the protocol extra hashing and reduce the time to market and risk of bugs. If we found that users were making heavy use of this feature, we could always bring the hashing in-protocol later. We probably ought to include a list of requirements we intend to meet at the top of these AZIPs, otherwise it will devolve into gut-checks of what individuals like more on a given day. |
|
@just-mitch I cc'd you on a refactored version of this AZIP, including a list of "cons" that need to be considered -- cons which are likely more of a sticking point than the above discussion. Not actually sure of the most elegant way to incorporate those thoughts here. A PR into Joe's branch? Kind of ugly.
I think that's what the Motivation section is for. |
👍 Thanks Mike |
Maybe we should close this PR and you, @iAmMichaelConnor, open the PR with updated AZIP-4 referencig this (would be closed PR) |
Good idea, I'll open a PR shortly |
|
All good to close mine @iAmMichaelConnor. Thanks for refactoring. @just-mitch we also need to account for the mana cost of ssz, maybe its negligible but I imagine a lot of use cases will defer the SSZ to a public function to do. Maybe thats a good for fees though :D |
|
As per above, closing and continuing discussion here: #24 |
Draft AZIP to discuss adding L1 block info including storage roots to L2 private and public context.