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

cast run crashes when execution transactions from a hardhat node #2687

Closed
2 tasks done
pedroyan opened this issue Aug 10, 2022 · 10 comments
Closed
2 tasks done

cast run crashes when execution transactions from a hardhat node #2687

pedroyan opened this issue Aug 10, 2022 · 10 comments
Assignees
Labels
C-cast Command: cast T-bug Type: bug

Comments

@pedroyan
Copy link

Component

Cast

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (63ed109 2022-08-09T00:03:50.892098571Z)

What command(s) is the bug in?

cast run

Operating System

Linux

Describe the bug

When running cast run with a transaction from a hardhat node, cast crashes

image

Running command with RUST_LOG=backend,node,miner outputs:
image

@pedroyan pedroyan added the T-bug Type: bug label Aug 10, 2022
@onbjerg onbjerg added the C-cast Command: cast label Aug 11, 2022
@onbjerg
Copy link
Member

onbjerg commented Aug 11, 2022

Probably related to us not padding some parameters correctly for Hardhat

@onbjerg onbjerg added this to the v1.0.0 milestone Aug 11, 2022
@pedroyan
Copy link
Author

@onbjerg I think your hypothesis is correct, given how the ethers maintainers fixed their issue when interfacing with hardhat

ethers-io/ethers.js#2982

@onbjerg onbjerg removed this from the v1.0.0 milestone Aug 23, 2022
@pedroyan
Copy link
Author

I'm also getting this problem when deploying some contracts using forge. If I were to guess what's happening, I think the foundry cli tools are not adhering to the RPC spec that says the storage slot in eth_getStorageAt should have a length of 66 (0x + 32 bytes).

The current workaround is to revert the hardhat node to a version that came before this pr (NomicFoundation/hardhat#2581), which accepts arguments that do not strictly follow the spec

@aathan
Copy link
Contributor

aathan commented Sep 11, 2022

I came to report this same thing (errors using the script functionality to deploy to hardhat) and realized this is related to the report I made in hardhat#2581. Not sure if this callsite is the same one that was involved in that older issue (#1297). Would be lovely to not have to hold back hardhat version.

ERROR sharedbackend: Failed to send/recv `storage` err=GetStorage(0x5b73c5498c1e3b4dba84de0f1833c4a029d90519, 2, 
(code: -32602, message: Errors encountered in param 1: Storage slot argument must have a length of 66 ("0x" + 32 bytes), but '0x2' has a length of 3, data: Some(Object({"message": String("Errors encountered in param 1: Storage slot argument must have a length of 66 (\"0x\" + 32 bytes), but '0x2' has a length of 3")})))) address=0x5b73c5498c1e3b4dba84de0f1833c4a029d90519 index=2

@mattsse
Copy link
Member

mattsse commented Sep 11, 2022

@aathan
Copy link
Contributor

aathan commented Sep 11, 2022

I see you've been talking to the HH guys but I honestly believe they made a mistake with the spec. I'm going to post over there...

@pedroyan
Copy link
Author

@aathan you really did the lord's work here by chasing this down on multiple repos in the Ethereum space (including raising this to the ethereum team on their spec), and thanks to that, made the ecosystem a little better for everyone :)

@mattssee - feel free to close this now if you want! Just tested the script that was throwing this error against Hardhat v2.11.2 (which includes NomicFoundation/hardhat#3177) and confirmed that's no longer the case

@aathan
Copy link
Contributor

aathan commented Sep 15, 2022

Thanks for the shoutout @pedroyan . I think there may remain a concern about "QUANTITY" handling across the same constellation of projects (NomicFoundation/hardhat#3164 (comment)). Just something to keep your eyes on. I'll be back if I run into anything that seems related.

@mattsse
Copy link
Member

mattsse commented Sep 15, 2022

awesome, thank you so much @aathan

@mattsse mattsse closed this as completed Sep 15, 2022
@gakonst
Copy link
Member

gakonst commented Sep 18, 2022

indeed - great work tracking this down @aathan, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cast Command: cast T-bug Type: bug
Projects
No open projects
Archived in project
Development

No branches or pull requests

5 participants