foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Deserialization Error when use forge create command to deploy a smart contract

Open ryancz opened this issue 2 years ago • 8 comments

Component

Forge

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

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (dbd935b 2023-10-17T00:31:15.757185000Z)

What command(s) is the bug in?

forge create Counter --interactive

Operating System

macOS (Intel)

Describe the bug

forge create Counter --interactive
[⠒] Compiling...
No files changed, compilation skipped
Error: 
Deserialization Error: EOF while parsing a value at line 1 column 0. Response: 

If I switch foundry version to nightly-87bc53fc6c874bd4c92d97ed180b949e3a36d78c, the error will disappear:

foundryup --version nightly-87bc53fc6c874bd4c92d97ed180b949e3a36d78c

forge clean
forge build
forge create Counter --interactive                                  
[⠊] Compiling...
No files changed, compilation skipped
Enter private key: 
Deployer: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
Deployed to: 0x8464135c8F25Da09e49BC8782676a84730C318bC
Transaction hash: 0xee994a6e2e480bcedda5484e6f6340014c552e8c2b0139cc78bbc819f7ce4f5f

ryancz avatar Oct 17 '23 07:10 ryancz

Getting the same error when running forge script. Were you able to resolve it?

➜ forge --version                                                                                                     
forge 0.2.0 (f5c9199 2023-12-01T00:23:15.670999000Z)

wottpal avatar Dec 05 '23 11:12 wottpal

Same error as you guys.

forge 0.2.0 (88ae503 2023-12-17T00:19:58.880993000Z)

Potentially related: https://github.com/foundry-rs/foundry/issues/6265

PaulRBerg avatar Dec 17 '23 16:12 PaulRBerg

Ok I think I have figured it out. It's a silly error, related to Infura.

This is the full command I have tried to run:

$ FOUNDRY_PROFILE=optimized \
forge script script/DeployDeterministicCore3.s.sol \
--broadcast \
--rpc-url "https://bnbsmartchain-mainnet.infura.io/v3/MY_API_KEY_HERE" \
--sig "run(string,address,address,uint256)" \
--verify \
"ChainID 56, Version 1.1.1" \
0x6666cA940D2f4B65883b454b7Bc7EEB039f64fa3 \
0x33511f69A784Fd958E6713aCaC7c9dCF1A5578E8 \
300 \
-vvvv

When I switched the RPC URL to the following:

https://bsc-dataseed.bnbchain.org

The script started to work. And it also worked with any other BNB URL taken from here.

So it looks like Infura BNB is acting strangely.

Have you, by chance, also tried to use Infura BNB, @wottpal, @ryancz?

PaulRBerg avatar Dec 17 '23 17:12 PaulRBerg

Oh, just opened BSCScan and saw this:

Block data is currently not up to date as the network is experience a surge due to inscriptions. We are working to resolve this.

SCR-20231217-qssz

PaulRBerg avatar Dec 17 '23 17:12 PaulRBerg

👀 our build is seeing this as well

jac18281828 avatar Jan 08 '24 21:01 jac18281828

Got the same error when I updated the deployment script which based on Scaffold-ETH 2

tolak avatar Jan 30 '24 09:01 tolak

I am also experiencing the same error when deploying a contract using forge create to sepolia network

forge verions - forge 0.2.0 (88ae503 2023-12-17T00:18:48.520002484Z)

forge create --private-key $PRIVATE_KEY --verifier-url $SEPOLIA_URL --etherscan-api-key $ETHERSCAN_API_KEY --rpc-url $SEPOLIA_RPC src/MiBarrioNFT.sol:MiBarrio

Here is the RPC and etherscan URLs I used: (they are public ones)

SEPOLIA_URL=https://api-sepolia.etherscan.io/api SEPOLIA_RPC=https://sepolia.infura.io/v3/

divine-comedian avatar Feb 04 '24 14:02 divine-comedian

Got the same error when I updated the deployment script which based on Scaffold-ETH 2

My problem turned out caused by network proxy

tolak avatar Feb 06 '24 07:02 tolak

Marking this as out of scope as it is a spotty Infura RPC related issue

Failed to reproduce:

forge create Counter --keystore <REDACTED> --rpc-url <RPC_URL>
[⠊] Compiling...
No files changed, compilation skipped
Enter keystore password:
Deployer: 0x4dF398704f3aAe761A83289044ab7121bB90c83E
Deployed to: 0x72BddCdDFA0181e88c2b85929Be380b7AF9df818
Transaction hash: 0x412e4fac479ccd75e839f1457ddb3dc2b87b79cc227dacd7025887bc6c6f4231

Where RPC_URL is an Alchemy URL

zerosnacks avatar Jul 04 '24 13:07 zerosnacks