Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVM: spec header access #4840

Open
Tracked by #4790 ...
dbanks12 opened this issue Feb 28, 2024 · 2 comments
Open
Tracked by #4790 ...

AVM: spec header access #4840

dbanks12 opened this issue Feb 28, 2024 · 2 comments
Labels
C-avm Component: AVM related tickets (aka public VM)

Comments

@dbanks12
Copy link
Collaborator

No description provided.

@github-project-automation github-project-automation bot moved this to Todo in A3 Feb 28, 2024
@dbanks12 dbanks12 changed the title (discuss spec) HEADERMEMBER Add HEADERMEMBER opcode to AVM transpiler & simulator (discuss spec - it's probably wrong!) Feb 28, 2024
@fcarreiro fcarreiro self-assigned this Mar 4, 2024
@fcarreiro
Copy link
Contributor

Some notes on this, from other people:

From David: Regarding HEADERMEMBER, it is really the least-specced opcode at this time. [We should look into what it should do] I think what we want is for HEADERMEMBER to do the following:

  • Internally to the simulator, retrieve the entire header at the specified block (use the getHeader db call - will need to add this to an interface in our "HostStorage")
  • Return to the user the requested word/member from that header
  • Indicate whether a header actually exists at that block number (can actually check this just by checking that the provided block index is less than the current block number)

Note: we probably also need to trace the entire header (although I didn't add that to the trace struct in the spec)! That is because the current plan is for the VM circuit to accept the entire header as a public input, and then hash it to an archive leaf. The kernel will get a list of archive leaves to membership check.

From Lasse: For a lot of the state in there, seems somewhat nasty to make membership proofs available. e.g., if I can have transaction that need to provide a membership proof in historical state, then only archive nodes can satisfy it. So a lot of these cases you would do in private anyway. So it might just be specifying the actual values. That way you could have airdrops or whatever where you are specifying that it uses a given root or whatever. So in my mind, it is GET_MEMBER_OF_HISTORICAL_HEADER, if that makes sense.

From Maddiaa: We will split header member into 6 opcodes each representing the root of a different state tree @ block number that is the input

  1. l1 to l2 messages tree root
  2. note hash tree root
  3. nullifier tree root
  4. contract tree root
  5. public data tree root
  6. archive tree root
    I have decided to do this as this is what i envision David was going for whenever this opcode was added to the spec, to have a way to access the roots of these trees ( contained in the header ).

Why:
Adding these opcodes covers the intended functionality, and having them bespoke for each state access should be functionally easier to prove.

Could this change in the future:
Most of these membership proofs could be done in private, and the result of the proof provided to a user function, this design will be cheaper for application devs, so in the future it may be the canonical route to accessing this functionality, we can remove it in time if that decision is made. I do not think the opcode implementation will take too long to perform.

@fcarreiro
Copy link
Contributor

We've decided to deprioritize this one for a while.

@fcarreiro fcarreiro removed their assignment Mar 6, 2024
This was referenced Jun 19, 2024
@dbanks12 dbanks12 changed the title Add HEADERMEMBER opcode to AVM transpiler & simulator (discuss spec - it's probably wrong!) AVM: spec header access Jun 19, 2024
@dbanks12 dbanks12 added the C-avm Component: AVM related tickets (aka public VM) label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-avm Component: AVM related tickets (aka public VM)
Projects
Status: Todo
Development

No branches or pull requests

2 participants