-
Notifications
You must be signed in to change notification settings - Fork 392
Parse deposit requests after all transactions #1197
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
Parse deposit requests after all transactions #1197
Conversation
src/ethereum/prague/vm/__init__.py
Outdated
| receipts_trie: Trie[Bytes, Optional[Union[Bytes, Receipt]]] = field( | ||
| default_factory=lambda: Trie(secured=False, default=None) | ||
| ) | ||
| receipts: Tuple[Union[Bytes, Receipt], ...] = field(default_factory=tuple) |
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.
These seem to store similar data? Can receipts_trie be computed from receipts? Would it be better if Trie exposed a values() -> Iterator function?
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.
-
receipts_triecan be computed from thereceiptsbut then that would have to be done outsideprocess_transactionfunction. However, this moves us away from the idea of packaging up all the transaction related logic inprocess_transaction -
With the data in a Trie stored as
_data: Dict[K, V], iterating over the trie does not guarantee the proper order of receipts processing. The order in which receipts are processed matters here. Hence,value() -> Iteratorfunction might not work. Perhaps, moving toOrderedDictmight work but we need to look into other consequences that might have.
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.
Updated to store receipt_keys in a tuple instead of the receipts themselves.
8909997 to
2c893be
Compare
| if index not in receipts_trie._data: | ||
| # Meaning the transaction has somehow failed | ||
| return receipts | ||
| for key in block_output.receipt_keys: |
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'm getting an AttributeError on this line when I run the tests.
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.
Ah. Missed pushing the commit which has the back-ports to older forks. Should be good now
9ec8101 to
1f476c9
Compare
…ereum#1197) * fix: broken documentation links have been repaired (issue ethereum#1196) * Update src/ethereum_test_vm/opcode.py --------- Co-authored-by: Mario Vega <[email protected]>
…ereum#1197) * fix: broken documentation links have been repaired (issue ethereum#1196) * Update src/ethereum_test_vm/opcode.py --------- Co-authored-by: Mario Vega <[email protected]>
(closes #1196 )
What was wrong?
The deposit requests from each transaction were being parsed immediately after that transaction. The specification is to parse the requests after all the transactions. Although this should not be an issue when it comes to the final block processing, it is best to align the EELS code with the spec.
Related to Issue #1196
How was it fixed?
Parse deposit requests at the end of block processing, after all the transactions and withdrawals have been processed.