-
Notifications
You must be signed in to change notification settings - Fork 3
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
Added support for withdrawals #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. As discussed offline, we'll need to possibly update this or plonky2's logic at some point.
Actually @BGluth we may want to think on how to handle from now. I think the reason why we're processing
|
I guess it depends on the number of withdrawals. Like if there's only one, it might be cheaper to just add the withdrawal to the last txn instead of having an additional proof with an empty txn. |
Ah ok, so maybe just hold off on this PR for now then? |
We'll need this soon though, if we want to prove real blocks :) But up to you! |
@BGluth As we'll need withdrawals to test real-life block, I'd suggest updating the logic to include always a dummy txn for now at the end of a block, after the last actual txn, containing no txn but the full withdrawals vector. For partially empty blocks we would then have:
We can always update / optimize this logic in the future, as William mentioned we could always add them to the last txn if there aren't many, but that will require updating plonky2 anyway, so could be left for future work. |
Sounds good. I'll update this PR and then give you a ping when it's ready for a review. |
Is this PR still relevant? |
@dvdplm Yeah, we've been busy with the debugging the whole e2e flow but we still need to support withdrawals |
Alright I'm going to try to get this done this afternoon. I don't think I made the suggested changed above, so I'll do that now and add @Nashtare as a reviewer. |
- See [this PR post](#4 (comment)) for more info.
Ok good to go! Let me know if this is works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I wrote some nitpicky comments inline. However, I think we still need some changes on the dummy inputs generation:
trie_roots_after
for dummy proofs are constructed as:
let trie_roots_after = TrieRoots {
state_root: tries.state_trie.hash(),
transactions_root: EMPTY_TRIE_HASH,
receipts_root: EMPTY_TRIE_HASH,
};
This is valid for padding dummy txns, which are always prepended to the list of actual txns in a block, but this won't be for a dummy txn to be created after the entire block execution to accomodate for withdrawals
- The
state_root
component oftries_root_after
will also need updating for the dummy_txn containing the withdrawals, as these update the state.
Robin's spelling corrections. Co-authored-by: Robin Salen <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's still an issue for the case where dummy txns were already added (but state post withdrawal isn't)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
Two part PR. The second PR will be upstream in zero-bin.