forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 4
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
V1.10.2 statediff 0.0.20 #68
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Awesome work. Please make the appropriate upstream PRs. Thanks! |
i-norden
force-pushed
the
v1.10.2-statediff-0.0.20
branch
from
May 3, 2021 17:31
47106bc
to
ded4e12
Compare
i-norden
force-pushed
the
v1.10.2-statediff-0.0.20
branch
from
May 3, 2021 17:41
ded4e12
to
4336bf6
Compare
i-norden
force-pushed
the
v1.10.2-statediff-0.0.20
branch
from
May 3, 2021 18:11
9609b7c
to
b13ce2a
Compare
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This took a lot longer than expected. This includes the fixes to support EIP-2718/EIP-2930 transactions.
tx_type
field in thetransaction_cids
tableaccess_list_element
table which contains the access list elements which reference thetransaction_cids
tx they belong to by FKMarshalBinary
andUnmarshalBinary
methods forReceipt
. This should probably be upstreamed, they ought to already exist as they are counterparts to analogousTransaction
methods.To add to that last point:
A lot of confusion was due to these methods not existing on
Receipt
and the methods we previously used,EncodeRLP
/DecodeRLP
, now being under documented and overloaded.In particular, the
EncodeRLP
method for an EIP-2718 tx is outputtingrlp(TransactionType || TransactionPayload)
. For EIP-2930 txs this isrlp(0x01 || rlp([chainId, nonce, gasPrice, gasLimit, to, value, data, access_list, yParity, senderR, senderS]))
.This makes sense from the definition of Transaction in EIP-2718:
"Transaction is either TransactionType || TransactionPayload or LegacyTransaction"
So the RLP encoding of Transaction is either
rlp(TransactionType || TransactionPayload)
orrlp(LegacyTransaction)
.But EIP-2718 also states
"LegacyTransaction is rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])"
So strictly following the same logic that is being used for a 2718 Transaction would suggest the output of
EncodeRLP
for a legacy Transaction should berlp(rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s]))
.When I get time I may upstream a patch to the EIP doc to help clarify this as well, but I need to give it some more thought.
In this context it is more appropriate to define
LegacyTransaction
andLegacyReceipt
in EIP-2718 as"LegacyTransaction is [nonce, gasPrice, gasLimit, to, value, data, v, r, s]" and "LegacyReceipt is [status, cumulativeGasUsed, logsBloom, logs]"
Except then the assertion that "the transaction/receipt root in the block header MUST be the root hash of patriciaTrie(rlp(Index) => Transaction)" breaks down as for legacy txs it expects
rlp([nonce, gasPrice, gasLimit, to, value, data, v, r, s])
and for 2718 it expectsTransactionType || TransactionPayload
, notrlp(TransactionType || TransactionPayload)
.