Closed PatrickAlphaC closed 5 months ago
@PatrickAlphaC thanks for flagging. Will triage this accordingly.
@PatrickAlphaC hmmm i cannot reproduce exactly....
Again --verify
is not supported just yet so that needs to be removed from the cmd. Nonetheless the following command works fine for me:
forge script script/Counter.s.sol --zksync --rpc-url https://sepolia.era.zksync.dev --account yellow --sender $DEFAULT_SENDER --broadcast -vvvv
Steps taken to reproduce:
forge
by re-executing the ./install-foundry-zksync
scriptforge init
forge script script/Counter.s.sol --zksync --rpc-url https://sepolia.era.zksync.dev --account yellow --sender $DEFAULT_SENDER --broadcast -vvvv
Can you share the script you are executing? When I run forge init
this is the script template provided:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Script, console} from "forge-std/Script.sol";
contract CounterScript is Script {
function setUp() public {}
function run() public {
vm.broadcast();
}
}
I just want to confirm we are testing the same thing!
Hey @dutterbutter here are the exact steps to reproduce:
forge init
to create a new project, run forge install
, add testing vars to .env
file & run source .env
)script/Counter.s.sol
file to deploy the Counter contract:// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Script, console} from "forge-std/Script.sol";
+import {Counter} from "../src/Counter.sol";
contract CounterScript is Script {
function setUp() public {}
function run() public {
- vm.broadcast();
+ vm.startBroadcast();
+ Counter counter = new Counter();
+ vm.stopBroadcast();
}
}
forge script script/Counter.s.sol --rpc-url $ZKSYNC_SEPOLIA_RPC_URL --private-key $TEST_PRIVATE_KEY --broadcast --zksync -vvvv
You will see the following error in the terminal output:
Error:
Failed to get EIP-1559 fees
Wanted to provide an update that we're unable to replicate based on the latest set of instructions. I made the changes to script/Counter.s.sol
but no error output.
We've also run this against era_test_node fork seplia-testnet
with the same response:
Script ran successfully.
## Setting up 1 EVM.
==========================
Simulated On-chain Traces:
[0] 0x0000000000000000000000000000000000000000::fallback()
└─ ← <empty revert data>
We're continuing to investigate and also dig deeper into the failure trace (operation is successful though)
@ciaranightingale was your operation successful here?
@MexicanAce Apologies for the delayed response. My output was slightly different & the deployment transaction was unsuccessful. This was my entire terminal output:
Traces:
[35589] CounterScript::run()
├─ [0] VM::startBroadcast()
│ └─ ← ()
├─ [0] → new <unknown>@0x6C3707c761377Ad65adcAC6fAB1Aece61D73d62A
│ └─ ← 864 bytes of code
├─ [0] VM::stopBroadcast()
│ └─ ← ()
└─ ← 0x6C3707c761377Ad65adcAC6fAB1Aece61D73d62A
Script ran successfully.
== Return ==
0: contract Counter 0x6C3707c761377Ad65adcAC6fAB1Aece61D73d62A
## Setting up 1 EVM.
==========================
Simulated On-chain Traces:
[0] 0x0000000000000000000000000000000000000000::fallback()
└─ ← <empty revert data>
Transactions saved to: /Users/ciaranightingale/code/test-delete/broadcast/Counter.s.sol/300/run-latest.json
Sensitive values saved to: /Users/ciaranightingale/code/test-delete/cache/Counter.s.sol/300/run-latest.json
Error:
Failed to get EIP-1559 fees
My forge version is 0.0.2 (baa4428 2024-05-27T00:25:28.651861000Z)
and I'm running this on an Intel Mac Sonoma 14.4.1
. I'm not sure what other information might help in debugging this but let me know if you think of anything and I'd be more than happy to hop on a call if that would help.
@MexicanAce I just reran this using the RPC you provided, and I got the same output as you - it seems strange that an Alchemy RPC doesn't work, as I was previously using an Alchemy RPC, but at least we know why now!
@ciaranightingale during our testing we've noticed that certain RPCs on certain chains would sometimes return an error when a storage value doesn't exist, meanwhile the usual behavior is to return the zero value. Could you perhaps verify if that's the case for alchemy api?
@nbaztec When running the original script:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Script, console} from "forge-std/Script.sol";
import {Counter} from "src/Counter.sol";
contract CounterScript is Script {
function setUp() public {}
function run() public returns (Counter) {
vm.startBroadcast();
Counter counter = new Counter();
vm.stopBroadcast();
return counter;
}
}
This is the output:
Traces:
[35589] CounterScript::run()
├─ [0] VM::startBroadcast()
│ └─ ← ()
├─ [0] → new <unknown>@0x899D06aC80598944eE5Efd2B45378883dd703DaF
│ └─ ← 864 bytes of code
├─ [0] VM::stopBroadcast()
│ └─ ← ()
└─ ← 0x899D06aC80598944eE5Efd2B45378883dd703DaF
Script ran successfully.
== Return ==
0: contract Counter 0x899D06aC80598944eE5Efd2B45378883dd703DaF
## Setting up 1 EVM.
==========================
Simulated On-chain Traces:
[0] 0x0000000000000000000000000000000000000000::fallback()
└─ ← <empty revert data>
Transactions saved to: XX
Sensitive values saved to: XX
Error:
Failed to get EIP-1559 fees
Whereas, if I modify the script to return a var a
that has not been set, the output shows the zero. address. being. returned (notice the contract. address in the previous output return section). The error is the same:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Script, console} from "forge-std/Script.sol";
import {Counter} from "src/Counter.sol";
contract CounterScript is Script {
function setUp() public {}
function run() public returns (Counter) {
Counter a;
vm.startBroadcast();
Counter counter = new Counter();
vm.stopBroadcast();
return a;
}
}
Output:
Traces:
[35594] CounterScript::run()
├─ [0] VM::startBroadcast()
│ └─ ← ()
├─ [0] → new <unknown>@0x899D06aC80598944eE5Efd2B45378883dd703DaF
│ └─ ← 864 bytes of code
├─ [0] VM::stopBroadcast()
│ └─ ← ()
└─ ← 0x0000000000000000000000000000000000000000
Script ran successfully.
== Return ==
0: contract Counter 0x0000000000000000000000000000000000000000
## Setting up 1 EVM.
==========================
Simulated On-chain Traces:
[0] 0x0000000000000000000000000000000000000000::fallback()
└─ ← <empty revert data>
Transactions saved to: XX
Sensitive values saved to: XX
Error:
Failed to get EIP-1559 fees
Is this what you meant for me to verify?
We found the culprit here. There was an issue with Alchemy's zkSync RPC URL. We have reported this issue to them. Ciara and I were using an Alchemy endpoint, while @MexicanAce was using a zksync endpoint which was working properly.
I'm glad that you managed to figure out the RPC issues. Just to expand on my earlier comment to @ciaranightingale
Is this what you meant for me to verify?
In our tests we realized that certain APIs would throw an error if a storage key did not exist.
So sending an eth_getStorageAt
RPC request to an arbitrary address and slot, should ideally return the default zero-value.
{"method":"eth_getStorageAt","params":["0xE592427A0AEce92De3Edee1F18E0157C05861564", "0x1", "latest"],"id":1,"jsonrpc":"2.0"}
Expected (slot is empty):
{"jsonrpc":"2.0","id":1,"result":"0x0000000000000000000000000000000000000000000000000000000000000000"}
But certain APIs would return an error instead of the default 0x0000000000000000000000000000000000000000000000000000000000000000
value. I'm not sure if this is the same issue Alchemy API had, but is good to keep in mind when using foundry and checking if an RPC url works "differently"
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.0.2 (5ae06f9 2024-04-30T00:24:57.466082000Z)
What command(s) is the bug in?
forge script
Operating System
macOS (Intell)
Describe the bug
Zksync Testnet Issues
If you create a default project with
forge init
and try to deploy with a deploy script like such:After running the following script (and entering password for decrypting the
yellow
key), the program crashes with:This can be fixed by adding
--legacy
to the script (making them type0 transactions). You'll then have to updatefoundry.toml
with the following:Otherwise it'll fail with:
And then it will just freeze, and get stuck here forever:
Requested action items
ZkSync Mainne Issues
However, everything works "pretty good" for zksync mainnet, except, my contracts are not being verified. I get this in foundry: