fix incorrect reported txid in txpool rpc #674
Merged
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.
What does it do?
Fixes a bug where the Rpc Tx Pool reports incorrect transaction ids. This PR attempts to fix this issue.
What important points reviewers should know?
Blockscout explorer's pending transactions never align with the actual completed transactions. These incorrect transaction ids end up stuck as phantom pending transactions, until blockscout deems them as failed. This can be observed here: https://moonbase-blockscout.testnet.moonbeam.network/pending-transactions
The bug lies in the conversion from an ethereum::Transaction to ethereum::TransactionMessage and using the TransactionMessage's helper function to get the Tx hash. This helper derives the chain_id from the V field of the signature's RSV. It follows eip155 V values so the chain_id calculation formula causes a mismatch, which in turn causes the final rlp encoding/Tx hash to differ from the actual transaction in the Tx Pool.
The remedy is to directly rlp::encode the ethereum::Transaction structs returned by the runtime_api. Converting them to TransactionMessage is an unnecessary step.
Is there something left for follow-up PRs?
none
What alternative implementations were considered?
none
Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?
none
What value does it bring to the blockchain users?
Accurate pending/queued transaction Rpc.