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

Add aliases for TypedTransaction tags that work with Hardhat #2518

Merged
merged 3 commits into from Jul 25, 2023

Conversation

aakoshh
Copy link
Contributor

@aakoshh aakoshh commented Jul 21, 2023

Motivation

@cryptoAtwill was testing an API that used ethers_core::types::TypedTransaction on the server side to decode the JSON-RPC parameters of an eth_estimateGas call sent by Hardhat when he noticed that it was rejected due to the tag not being recognised. The reason was that ethers expects "type": "0x02" while Hardhat sends "type": "0x2".

I noticed that some of the tests actually contain "0x2" but it's not used, so I thought this is a bug.

Solution

The simple solution in this PR is to add an alias to the TypedTransaction variants, so both padded and non-padded versions are accepted.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Collaborator

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

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

LGTM, can you please rebase to latest master where CI is fixed?

@aakoshh aakoshh force-pushed the fix-typed-transaction-tag-0x2 branch from 3e082f4 to f3be43a Compare July 25, 2023 12:33
Copy link
Collaborator

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

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

Thanks!

@DaniPopes DaniPopes merged commit d3c185a into gakonst:master Jul 25, 2023
19 checks passed
aathan pushed a commit to aathan/ethers-rs that referenced this pull request Jul 27, 2023
…#2518)

* Add aliases for TypedTransaction tags that work with Hardhat

* Ignore TypedTransaction test in legacy mode.

* Fix formatting errors.
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.

None yet

2 participants