hardhat
hardhat copied to clipboard
ArbSys does not work on Arbitrum Fork
Version of Hardhat
2.18.1
What happened?
It seems it is not possible to use ArbSys(100) contract methods on Arbitrum forks.
While testing ArbSys(address(100)).arbBlockNumber() it reverts without a reason.
It would be cool to make forks work with all Arbitrum Precompiles: https://docs.arbitrum.io/for-devs/dev-tools-and-resources/precompiles
Minimal reproduction steps
- Fork Arbitrum on an existing block
- Test some solidity code containing
ArbSys(address(100)).arbBlockNumber()(or any other method in that contract)
Search terms
Arbitrum, Fork, ArbSys
Hey @Archethect, thanks for opening this. We are in the middle of a big refactor of the Hardhat network, but after that we want (at some point) to have some mechanism for adding custom precompiles, which should help with this.
I'd like to have following api to support the precompile contracts
const precompiles = [
{
address: "0x...",
gas(input) {
return 100; // gas required for the call
},
run(input) {
return [0x1, 0x2]; // return bytes or throw an error
},
},
];
await hardhat.addPrecompiles(...precompiles);
Any progress on this?
For Hardhat 3 we are building out better support for layer 2s, including precompiles and predeploys.
We are still in early Alpha - Optimism is currently the only supported L2 chain type, but hopefully that will give some insight into the general approach:
https://hardhat.org/hardhat3-alpha