hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

Allow for input instead of data in eth_call and eth_sendTransaction

Open krzysztof-cywinski opened this issue 1 year ago • 7 comments

  • [x] Because this PR includes a bug fix, relevant tests have been included.

A hardhat node only accepts a data param in inbound eth_call and eth_sendTransaction. This behavior is not according to spec defined here, so I'd file it as a bug. Most RPCs I've tested so far support both input and data.

This behavior creates a problem when one tries to use a hardhat node together with go-ethereum, because the latter sends data as input.

This PR adds support for an input param while retaining support for the data param. If both input and data are provided input takes precedence, because it's aligned with the spec.

krzysztof-cywinski avatar Dec 26 '23 20:12 krzysztof-cywinski

⚠️ No Changeset found

Latest commit: d4e5a9424abb0b8fcedbe81423b9da67e250f729

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Dec 26 '23 20:12 changeset-bot[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hardhat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 26, 2023 8:54pm

vercel[bot] avatar Dec 26 '23 20:12 vercel[bot]

This PR should fix issue https://github.com/NomicFoundation/edr/issues/360

krzysztof-cywinski avatar Dec 27 '23 15:12 krzysztof-cywinski

same p.b +1

xjhweb avatar Jan 01 '24 11:01 xjhweb

@xjhweb any idea how to push this forward? what's the next step?

krzysztof-cywinski avatar Jan 11 '24 12:01 krzysztof-cywinski

Any updates on this?

arrayofone avatar Jan 19 '24 00:01 arrayofone

Applied these patches to my hardhat and it makes calls from modern ethclient code work again.

Confirmed this fixes the issue.

IMO it makes sense to just handle it as input internally everywhere rather than having input and data optional fields be settable and putting the value into data. Then if you want to support passing the data parameter via jsonrpc still just have 1 transformation at the front end into the standardized format.

adasauce avatar Jan 23 '24 14:01 adasauce

Looks like this PR supersedes https://github.com/NomicFoundation/hardhat/pull/4438. @fvictorio does it address the issues in https://github.com/NomicFoundation/hardhat/pull/4438#pullrequestreview-1788349955? The incompatibility with current go-ethereum client is a blocker and I don't know how to work around it without using a fork of one or the other. Thanks.

jchappelow avatar Apr 03 '24 22:04 jchappelow

Oh, this was before the EDR refactor. I guess the provider bits don't apply anymore and there are changes needed in rs code now.

jchappelow avatar Apr 04 '24 05:04 jchappelow

Yes, this will need to be done on the EDR side. This change is important, so we'll try to prioritize it. Sorry that it's taking so long!

fvictorio avatar Apr 04 '24 08:04 fvictorio