foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.31k stars 1.75k forks source link

feat(`forge script`): support EIP-4788 (the beacon root oracle) in local simulation #7938

Open adu-web3 opened 5 months ago

adu-web3 commented 5 months ago

Component

Forge

Describe the feature you would like

Currently if we write foundry script to call the beacon root address like this:

(bool success,) = BEACON_ROOTS.staticcall(abi.encode(_targetTimestamp));

where BEACON_ROOTS refer to 0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02 defined in EIP4788(https://eips.ethereum.org/EIPS/eip-4788#bytecode), the tx can not be fired because of Failed to estimate gas for tx. I guess EIP4788 is not supported by foundry script

Additional context

No response

grandizzy commented 1 month ago

@adu-web3 could you try just using vm.etch cheatcode to deploy smart contract at given address? https://github.com/foundry-rs/forge-std/blob/master/src/Vm.sol#L1703-L1704 Another option would be to fork mainnet in your tests (so the contract will be available).