foundry icon indicating copy to clipboard operation
foundry copied to clipboard

bug: `InvalidFEOpcode` when calling `getPricesInWei` on Arbitrum: `ArbGasInfo`

Open mikealeonetti opened this issue 10 months ago • 4 comments

Component

Anvil

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

  • [X] Foundry
  • [ ] Foundryup

What version of Foundry are you on?

forge 0.2.0 (1281421 2024-04-05T00:17:33.105023260Z)

What command(s) is the bug in?

anvil --fork-url https://arbitrum-one.chainnodes.org/key --fork-block-number 195292367 --fork-chain-id 42161 --chain-id 42161

Operating System

Linux

Describe the bug

When I run getPricesInWei on the arbitrum gas info contract at address 0x000000000000000000000000000000000000006C I get the following error:

Error: missing revert data (action="call", data=null, reason=null, transaction={ "data": "0x41b247a8", "to": "0x000000000000000000000000000000000000006C" }, invocation=null, revert=null, code=CALL_EXCEPTION, version=6.11.1)
    at makeError (/home/mike/dev/node/unibalancer/node_modules/ethers/src.ts/utils/errors.ts:694:21)
    at getBuiltinCallException (/home/mike/dev/node/unibalancer/node_modules/ethers/src.ts/abi/abi-coder.ts:118:21)
    at Function.getBuiltinCallException (/home/mike/dev/node/unibalancer/node_modules/ethers/src.ts/abi/abi-coder.ts:235:16)
    at JsonRpcProvider.getRpcError (/home/mike/dev/node/unibalancer/node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:979:32)
    at <anonymous> (/home/mike/dev/node/unibalancer/node_modules/ethers/src.ts/providers/provider-jsonrpc.ts:563:45)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'CALL_EXCEPTION',
  action: 'call',
  data: null,
  reason: null,
  transaction: {
    to: '0x000000000000000000000000000000000000006C',
    data: '0x41b247a8'
  },
  invocation: null,
  revert: null,
  shortMessage: 'missing revert data',
  info: {
    error: { code: -32603, message: 'EVM error InvalidFEOpcode' },
    payload: {
      method: 'eth_call',
      params: [
        {
          to: '0x000000000000000000000000000000000000006c',
          data: '0x41b247a8'
        },
        '0xba3ecd3'
      ],
      id: 3,
      jsonrpc: '2.0'
    }
  }
}

Here is the type script snippet to reproduce

import { Contract, JsonRpcProvider } from "ethers";

const ARB_GASINFO_ADDRESS = "0x000000000000000000000000000000000000006C";

const _abi = [
    {
        inputs: [],
        name: "getPricesInWei",
        outputs: [
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
];

(async function(){
    //const provider = new JsonRpcProvider("https://arb-pokt.nodies.app");
    const provider = new JsonRpcProvider("http://127.0.0.1:8545");
    const contract = new Contract(ARB_GASINFO_ADDRESS, _abi, provider);

    const blockTag = await provider.getBlockNumber();

    console.log( "blockTag=", blockTag );

    const result = await contract.getPricesInWei({
        blockTag
    });

    console.log( "result=", result );
})();

Notably, it works on the live mainnet node.

Thanks so much.

mikealeonetti avatar Apr 05 '24 22:04 mikealeonetti