Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

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
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants