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

Forge script can't skip --skip-simulation #8349

Closed
1 of 2 tasks
protectdefi opened this issue Jul 4, 2024 · 6 comments
Closed
1 of 2 tasks

Forge script can't skip --skip-simulation #8349

protectdefi opened this issue Jul 4, 2024 · 6 comments
Labels
T-bug Type: bug

Comments

@protectdefi
Copy link

protectdefi commented Jul 4, 2024

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

Nightly (2024-07-04)

What command(s) is the bug in?

forge script --skip-simulation

Operating System

Windows

Describe the bug

Original title:

help please my god ,Forge script can't skip --skip-simulation,i use buildbear sandbox for mainnet environment,but on foundry scirpt --debug, can't write transaction on mainnet contract error ,cause foundry auto simulation onchain , the sandbox can just send tx to it , then execute

//mainnet fork
interface IERC20 {
    function balanceOf(address account) external view returns (uint256);
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    function approve(address spender, uint256 amount) external returns (bool);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function decimals() external view returns (uint8);

}
contract DeployScript is Script {
    function run() public {
        uint256 deployerPrivateKey = uint256(bytes32(0x0000000000000000000000000000000000000000000000000000000000000011));
        vm.startBroadcast(deployerPrivateKey);
        testUsdt(0xdAC17F958D2ee523a2206206994597C13D831ec7);
        vm.stopBroadcast();
    }
    function testUsdt(address usdt) internal {
        IERC20(usdt).approve(0x1c1B442EF033F2CD7906Db8ee4c4feEDCF647228, 300e6);
    }

//forge script script/Deploy.s.sol --fork-url https://rpc.buildbear.io/favourite-hawkeye-90f2d77c --private-key "0x0000000000000000000000000000000000000000000000000000000000000011" -vvvvv --broadcast --legacy --skip-simulation --slow --debug
// sandbox explorer: https://explorer.buildbear.io/favourite-hawkeye-90f2d77c/transactions
//sandbox  faucet: https://faucet.buildbear.io/favourite-hawkeye-90f2d77c
@protectdefi protectdefi added the T-bug Type: bug label Jul 4, 2024
@protectdefi
Copy link
Author

protectdefi commented Jul 4, 2024

forge script script/Deploy.s.sol --fork-url https://rpc.buildbear.io/favourite-hawkeye-90f2d77c --private-key "0x0000000000000000000000000000000000000000000000000000000000000011" -vvvvv --broadcast --legacy --skip-simulation --slow
[⠑] Compiling...
[⠃] Compiling 1 files with Solc 0.8.26
[⠊] Solc 0.8.26 finished in 4.45s
Compiler run successful!
Traces:
  [191338] → new DeployScript@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
    └─ ← [Return] 845 bytes of code

  [33137] DeployScript::run()
    ├─ [0] VM::startBroadcast(<pk>)
    │   └─ ← [Return]
    ├─ [26953] 0xdAC17F958D2ee523a2206206994597C13D831ec7::approve(0x1c1B442EF033F2CD7906Db8ee4c4feEDCF647228, 300000000 [3e8])
    │   ├─ emit Approval(owner: 0x252Dae0A4b9d9b80F504F6418acd2d364C0c59cD, spender: 0x1c1B442EF033F2CD7906Db8ee4c4feEDCF647228, value: 300000000 [3e8])
    │   └─ ← [Stop]
    └─ ← [Revert] EvmError: Revert


Error:
script failed: empty revert data

@amateur-dev
Copy link

Checking on this :)

@DaniPopes DaniPopes changed the title help please my god ,Forge script can't skip --skip-simulation,i use buildbear sandbox for mainnet environment,but on foundry scirpt --debug, can't write transaction on mainnet contract error ,cause foundry auto simulation onchain , the sandbox can just send tx to it , then execute Forge script can't skip --skip-simulation Jul 4, 2024
@zerosnacks
Copy link
Member

zerosnacks commented Jul 4, 2024

Duplicate of #6825

@zerosnacks zerosnacks marked this as a duplicate of #8349 Jul 4, 2024
@zerosnacks zerosnacks closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2024
@zerosnacks zerosnacks marked this as a duplicate of #6825 Jul 4, 2024
@zerosnacks
Copy link
Member

For additional context see: #6825 (comment) + #5776 (comment)

--skip-simulation avoids using the provided URL to do gas estimation. It does not prevent foundry from simulating the script locally. The latter is not possible to disable, as we must simulate the script to gather all the transactions to broadcast. If the local simulation fails, the whole script fails.

@protectdefi
Copy link
Author

有关其他上下文,请参见: #6825(评论) + #5776(评论)

--skip-simulation避免使用提供的URL进行气体估算。它不会阻止铸造厂在本地模拟脚本。后者无法禁用,因为我们必须模拟脚本以收集要广播的所有事务。如果本地仿真失败,则整个脚本将失败。

how to fix it ,sir?

@zerosnacks
Copy link
Member

zerosnacks commented Jul 5, 2024

how to fix it ,sir?

Unfortunately there is no way currently to "fix" it in the sense that the local simulation is a hard requirement. #6825 aims to improve that experience. For now the local simulation must pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
None yet
Development

No branches or pull requests

3 participants