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

bug: InvalidFEOpcode when calling getPricesInWei on Arbitrum: ArbGasInfo #7580

Closed
1 of 2 tasks
mikealeonetti opened this issue Apr 5, 2024 · 5 comments
Closed
1 of 2 tasks
Labels
A-compatibility Area: compatibility T-bug Type: bug
Milestone

Comments

@mikealeonetti
Copy link

Component

Anvil

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

  • 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 mikealeonetti added the T-bug Type: bug label Apr 5, 2024
@mattsse
Copy link
Member

mattsse commented Apr 6, 2024

ah yes this makes sense
https://arbiscan.io/address/0x000000000000000000000000000000000000006C#code

support for arb precompiles/deploys are being investigated here: #7498
and some parts of ArbGasInfo precompile can probably be supported natively

@DaniPopes DaniPopes reopened this May 24, 2024
@DaniPopes
Copy link
Member

cc #7754

@zerosnacks zerosnacks added the A-compatibility Area: compatibility label Jul 12, 2024
@zerosnacks zerosnacks changed the title Arbitrum fork InvalidFEOpcode when calling getPricesInWei on Arbitrum: ArbGasInfo bug: InvalidFEOpcode when calling getPricesInWei on Arbitrum: ArbGasInfo Jul 12, 2024
@zerosnacks zerosnacks added this to the v1.0.0 milestone Jul 26, 2024
@cmontecoding
Copy link

Im getting this same issue now that ive migrated my fork tests to Arbitrum

Any update on this or temporary alleveations?

is this a temporary fix: #7498 ?
if so, not sure how i would go about injecting the precompile into anvil

@cmontecoding
Copy link

update:

this can be alleviated with vm.etch as seen here https://book.getfoundry.sh/cheatcodes/etch

@zerosnacks
Copy link
Member

Related: #7498

As noted by @cmontecoding this can be alleviated by using vm.etch / anvil_setCode

There is ongoing research into how we can better support precompiles out of the box in #7262

For now marking this as non actionable as it is better captured by the linked issues

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

No branches or pull requests

5 participants