foundry: bug(`forge script`): buffer overrun while deserializing
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge 0.2.0 (af97b2c 2024-07-18T00:22:15.301937000Z)
What command(s) is the bug in?
forge script
Operating System
macOS (Apple Silicon)
Describe the bug
When I’m trying deploying the contract with forge script, it crashes.
Script is like:
address constant ZERO = address(0xc0b0);
address dummy = new MyContract(ZERO, ZERO);
Error message:
[⠒] Compiling...
No files changed, compilation skipped
Enter keystore password:
Script ran successfully.
## Setting up 1 EVM.
2024-07-18T03:08:39.237259Z ERROR forge_script::transaction: Failed to decode constructor arguments contract=Some("MyContract") signature=constructor(address,address) is_create2=false constructor_args=0000000000000000000000c0b0000000000000000000000000000000000000000000000000000000000000c0b0
Error:
buffer overrun while deserializing
Context:
- buffer overrun while deserializing
It looks like the constructor_args, which should be 64 bytes but 45 byte here, is incorrectly sliced.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 21 (9 by maintainers)
@0xOsiris thank you for details, was able to reproduce with given steps, will check why this happens
anvil --chain-id 31337 --block-time 2results in
(Pretty sure related to using the proxy contract rather than the PBHEntryPoint - https://github.com/worldcoin/world-chain/blob/bd1cd9c1cf79b76162b8551ae61df4180a2ef79e/contracts/src/PBHEntryPoint.sol#L28C5-L31) Most probably similar with https://github.com/foundry-rs/foundry/pull/9050 where we had to use both deployed and creation code to identify proper artifact
Hi @zerosnacks, I fixed the issue by running forge clean and unfortunately can’t reproduce it anymore. My script was similar to the one mentioned in this post, and I was using the latest stable release on Mac (with Apple Silicon)
Sorry 😦 I should have stopped and done a proper write up, my mistake. I ended up using a workaround, and I’ve lost the context of what the issue was. I was doing something a little bizarre so this probably is an edge case.
Whoever comes across this next should do a proper write-up please 😃
I am also running into this. I cannot reopen the issue.
I’m running into the same issue. Seems to be somewhat random across builds that I’ve done.
Unfortunately running
foundryuphasn’t worked for me. The error is periodic in nature for me (i.e., I restart anvil and re-run my deploy script and it goes away). Are there any other fixes?Thanks for flagging @yungwkndllc
Optimistically marking as
resolved, @lmy375 / @diyahir please leave a comment / re-open with a minimal example if this is still an issue you are facing with the latest version of Foundry after runningfoundryuprunning
foundryupfixed this for me