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

feat(core): Transaction::decode() sets the hash #2303

Merged
merged 1 commit into from Apr 1, 2023

Conversation

achillelamb
Copy link
Contributor

Fixes: #1849

Motivation

As stated in issue #1849, when the function decode(rlp) is used to build a transaction from its rlp serialization (i.e. raw transaction) the field hash of the resulting Transaction is not set (set to default value, hash 0x0).

Solution

The hash field of the returned Transaction is calculated as the keccak256 of the rlp bytes.

The test for the correctness of this change can be run with

cargo test --package ethers-core types::transaction::response::tests::decode_tx_assert_hash

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Collaborator

@prestwich prestwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

concept ack, running checks

@prestwich
Copy link
Collaborator

tests and build work, CI issues are unrelated. Gonna go ahead and merge

@prestwich prestwich merged commit d80e82a into gakonst:master Apr 1, 2023
12 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RLP decoding a transaction does not set hash
2 participants