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

fix: changed hardhat_setCode code type #327

Merged
merged 2 commits into from
Aug 20, 2024

Conversation

vbar
Copy link
Contributor

@vbar vbar commented Aug 14, 2024

What πŸ’»

Changed hardhat_setCode code parameter type to string encoding of a hex number.

Why βœ‹

Fixes #325 .

Evidence πŸ“·

$ mocha test/helpers/setCode.ts 


  setCode
    βœ” should allow setting the code of a given address (115ms)
    accepted parameter types for code
      βœ” should not accept strings that are not 0x-prefixed
      βœ” should not accept non-hex strings


  3 passing (525ms)

Notes πŸ“

Note that the hardhat testsuite had been modified to pass the test: its original sample code doesn't pass test node checks.

@AnastasiiaVashchuk
Copy link
Contributor

Note that the hardhat testsuite had been modified to pass the test: its original sample code doesn't pass test node checks.

why?

@vbar
Copy link
Contributor Author

vbar commented Aug 20, 2024

Note that the hardhat testsuite had been modified to pass the test: its original sample code doesn't pass test node checks.

why?

Because the sample string in https://github.com/eqlabs/hardhat/blob/86b2a7ed005fb1be01079b4ba498080a052948a7/packages/hardhat-network-helpers/test/helpers/setCode.ts#L20 (and https://github.com/eqlabs/hardhat/blob/86b2a7ed005fb1be01079b4ba498080a052948a7/packages/hardhat-network-helpers/test/helpers/setCode.ts#L22 ) has encodes data of length that isn't a multiple of 32.

@vbar
Copy link
Contributor Author

vbar commented Aug 20, 2024

The specific change is eqlabs/hardhat@1374bfc .

@AnastasiiaVashchuk AnastasiiaVashchuk merged commit 2041018 into matter-labs:main Aug 20, 2024
10 checks passed
DanielSchiavini added a commit to vyperlang/titanoboa-zksync that referenced this pull request Sep 19, 2024
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.

hardhat_setCode has incorrect parameter type
2 participants