openzeppelin-foundry-upgrades icon indicating copy to clipboard operation
openzeppelin-foundry-upgrades copied to clipboard

FOUNDRY_OUT mainnet stimulation failed

Open Sotatek-TruongNguyen2 opened this issue 7 months ago • 7 comments

Image

My current foundry version: 1.0.0 openzeppelin-foundry-upgrades: 0.4.0

I've tried to test out the deployment flow, but i don't know why it ran successfully on local stimulation but failed on-chain. Did it relate to FOUNDRY_OUT env ?

.env

FOUNDRY_OUT="out"

foundry.toml

[profile.default] fs_permissions = [{ access = "read", path = "out" }] out = "out" ast = true build_info = true extra_output = ["storageLayout"] ffi = true

src = "src" test = 'tests' script = 'scripts' libs = ["lib"] optimizer = true optimizer_runs = 200 solc = '0.8.22' evm_version = 'shanghai' bytecode_hash = 'none'

[fuzz] runs = 1000 max_test_rejects = 20000

[rpc_endpoints] mainnet = "${RPC_MAINNET}" sepolia = "${RPC_SEPOLIA}" arbitrum = "${RPC_ARBITRUM}" arbitrum_testnet = "${RPC_ARBITRUM_TESTNET}"

[etherscan] mainnet = { key = "${ETHERSCAN_API_KEY_MAINNET}", chainId = 1 } sepolia = { key = "${ETHERSCAN_API_KEY_MAINNET}", chainId = 11155111 } arbitrum = { key = "${ETHERSCAN_API_KEY_ARBITRUM}", chainId = 42161 } arbitrum_testnet = { key = "${ETHERSCAN_API_KEY_ARBITRUM}", chainId = 421614 }

Sotatek-TruongNguyen2 avatar May 28 '25 09:05 Sotatek-TruongNguyen2

It looks like vm.envOr("FOUNDRY_OUT", "out") may have passed but the revert occurred at some step afterwards. It could be occurring in your contract. Try increasing the verbosity level of the forge command for a more detailed stacktrace.

ericglau avatar May 28 '25 14:05 ericglau

It looks like vm.envOr("FOUNDRY_OUT", "out") may have passed but the revert occurred at some step afterwards. It could be occurring in your contract. Try increasing the verbosity level of the forge command for a more detailed stacktrace.

Here is my command

forge script scripts/DeployAaveV3MarketBatched.sol
--broadcast
--rpc-url http://127.0.0.1:8545
-- --vvvv --force

But the error stills persists anyway. I've also tried to forge clean but looks like there's no difference

== Logs == Aave V3 Batch Deployment sender 0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38

Setting up 1 EVM.

Error: Failed with EvmError: Revert:

[4572] → new HelixPeripheryBatch@0x51BA9C6A67324eDA10edA62943afC97dE65de0D8 ├─ [0] VM::envOr("FOUNDRY_OUT", "out") [staticcall] │ └─ ← [Stop] └─ ← [Revert]

Sotatek-TruongNguyen2 avatar May 28 '25 15:05 Sotatek-TruongNguyen2

This doesn't look like an issue with envOr since according to Foundry docs it should not revert. I'd still suggest further debugging or stack tracing.

ericglau avatar May 28 '25 15:05 ericglau

Image

Here's my code for deployment and testing. I ran successfully when i perform forge test but stills failed on testnet deployment

Sotatek-TruongNguyen2 avatar May 28 '25 15:05 Sotatek-TruongNguyen2

My previous comment still stands. If you could share a sample Foundry project that reproduces this issue, it could give more indication on where the issue is occurring.

ericglau avatar May 28 '25 15:05 ericglau

hard to share as it's an incubated project. But if it's succeed on testing but failed on deployment, what might potentially be the cause ?

Sotatek-TruongNguyen2 avatar May 28 '25 15:05 Sotatek-TruongNguyen2

As I mentioned, it could be related to your contract or scripts. For example, perhaps related to how it interacts with existing onchain contracts if any, or owner addresses. The revert message is generic and does not give any information. You would need to debug.

ericglau avatar May 28 '25 15:05 ericglau