Status of EVM_RPC L2 support?

Hi, I am trying to get fee history from supported L2s, using the EVM_RPC canister and am seeing very mixed results.

Some times… ok

2024-07-15 12:25:25.454614 UTC: [Canister 7hfb6-caaaa-aaaar-qadga-cai] DEBUG .../mod.rs:185 [parallel_call]: will call provider: Ankr

2024-07-15 12:25:25.454614 UTC: [Canister 7hfb6-caaaa-aaaar-qadga-cai] TRACE_HTTP .../eth_rpc.rs:816 Calling url: https://rpc.ankr.com/base, with payload: {"jsonrpc":"2.0","method":"eth_feeHistory","id":37,"params":["0x4","latest",[]]}

2024-07-15 12:25:28.766707 UTC: [Canister bkyz2-fmaaa-aaaaa-qaaaq-cai] Fee history result: Ok((Consistent(Ok(Some(FeeHistory { reward: [], gasUsedRatio: [0.13932819487179487, 0.15907986666666668, 0.2015082769230769, 0.15850429743589745], oldestBlock: Nat(17128486), baseFeePerGas: [Nat(8342279), Nat(8336806), Nat(8335289), Nat(8342258), Nat(8340624)] }))),))

Next time, same code, InvalidHttpJsonRpcResponse:

2024-07-15 12:26:25.594063 UTC: [Canister 7hfb6-caaaa-aaaar-qadga-cai] DEBUG .../mod.rs:185 [parallel_call]: will call provider: Ankr

2024-07-15 12:26:25.594063 UTC: [Canister 7hfb6-caaaa-aaaar-qadga-cai] TRACE_HTTP .../eth_rpc.rs:816 Calling url: https://rpc.ankr.com/base, with payload: {"jsonrpc":"2.0","method":"eth_feeHistory","id":38,"params":["0x4","latest",[]]}

2024-07-15 12:26:28.193404 UTC: [Canister bkyz2-fmaaa-aaaaa-qaaaq-cai] Fee history result: Ok((Consistent(Err(HttpOutcallError(InvalidHttpJsonRpcResponse { status: 200, body: "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":0,\"message\":\"we can't execute this request\"},\"id\":null}", parsingError: Some("invalid type: null, expected u64 at line 1 column 87") }))),))

Same call, but to mainnet instead of an L2 seems to be reliably working.

...

let rpc_providers = RpcServices::EthMainnet(Some(vec![EthMainnetService::Ankr]));
// let rpc_providers = RpcServices::Optimism(Some(vec![L2MainnetService::Ankr]));
// let rpc_providers = RpcServices::BaseMainnet(Some(vec![L2MainnetService::Ankr]));
// let rpc_providers = RpcServices::ArbitrumOne(Some(vec![L2MainnetService::Ankr]));

let result = EVM_RPC
    .eth_fee_history(
        rpc_providers,
        None,
        FeeHistoryArgs {
            blockCount: ETH_AVG_FEE_HISTORY_BLOCK_COUNT.into(),
            newestBlock: BlockTag::Latest,
            rewardPercentiles: None,
        },
        ETH_DEFAULT_CALL_CYCLES_128,
    )
    .await;

...

What is the current status of the L2 support in the EVM_RPC canister @rvanasa @gregory-demay? Should optimism/base/arbitrum be working as stably as mainnet and sepolia?

I recommend just doing raw JSON RPC requests

Skipping the Candid interface

Thank you for the logs and source code for context!

L2 chains are supposed to be stable, so this seems like a new issue. Does this only happen with Ankr, or do you also run into this with other providers?

I ran the same RPC call on all chains and providers, see the test repo here:

It seems it is only Optimism having issues. But, in this test I look only to see if I get an Ok or Err back, I don’t look at the Ok contents. Will look closer tomorrow.

Log:

βœ…, EthMainnet(Some([Alchemy]))
βœ…, EthMainnet(Some([BlockPi]))
βœ…, EthMainnet(Some([Cloudflare]))
βœ…, EthMainnet(Some([PublicNode]))
βœ…, EthMainnet(Some([Ankr]))
βœ…, EthSepolia(Some([Alchemy]))
βœ…, EthSepolia(Some([BlockPi]))
βœ…, EthSepolia(Some([PublicNode]))
βœ…, EthSepolia(Some([Ankr]))
πŸ›‘, Optimism(Some([Alchemy])), Err: (CanisterError, "IC0503: Canister 7hfb6-caaaa-aaaar-qadga-cai trapped explicitly: failed to decode call arguments: Custom(Fail to decode argument 0\n\nCaused by:\n Subtyping error: Unknown variant field 4_140_450_540)")
πŸ›‘, Optimism(Some([BlockPi])), Err: (CanisterError, "IC0503: Canister 7hfb6-caaaa-aaaar-qadga-cai trapped explicitly: failed to decode call arguments: Custom(Fail to decode argument 0\n\nCaused by:\n Subtyping error: Unknown variant field 4_140_450_540)")
πŸ›‘, Optimism(Some([PublicNode])), Err: (CanisterError, "IC0503: Canister 7hfb6-caaaa-aaaar-qadga-cai trapped explicitly: failed to decode call arguments: Custom(Fail to decode argument 0\n\nCaused by:\n Subtyping error: Unknown variant field 4_140_450_540)")
πŸ›‘, Optimism(Some([Ankr])), Err: (CanisterError, "IC0503: Canister 7hfb6-caaaa-aaaar-qadga-cai trapped explicitly: failed to decode call arguments: Custom(Fail to decode argument 0\n\nCaused by:\n Subtyping error: Unknown variant field 4_140_450_540)")
βœ…, BaseMainnet(Some([Alchemy]))
βœ…, BaseMainnet(Some([BlockPi]))
βœ…, BaseMainnet(Some([PublicNode]))
βœ…, BaseMainnet(Some([Ankr]))
βœ…, ArbitrumOne(Some([Alchemy]))
βœ…, ArbitrumOne(Some([BlockPi]))
βœ…, ArbitrumOne(Some([PublicNode]))
βœ…, ArbitrumOne(Some([Ankr]))
1 Like

Cool, thanks. Yeah, that definitely is an option if issues are not resolved otherwise. Now it seems it is mostly an issue with the Optimism rpc, see above.

1 Like

@rvanasa I took a closer look at the returned results. Some additional issues appeared.

βœ…, EthMainnet(Some([Alchemy]))
βœ…, EthMainnet(Some([BlockPi]))
βœ…, EthMainnet(Some([Cloudflare]))
βœ…, EthMainnet(Some([PublicNode]))
βœ…, EthMainnet(Some([Ankr]))
βœ…, EthSepolia(Some([Alchemy]))
βœ…, EthSepolia(Some([BlockPi]))
βœ…, EthSepolia(Some([PublicNode]))
βœ…, EthSepolia(Some([Ankr]))
πŸ›‘, Optimism(Some([Alchemy])), Err: (CanisterError, "IC0503: Canister 7hfb6-caaaa-aaaar-qadga-cai trapped explicitly: failed to decode call arguments: Custom(Fail to decode argument 0\n\nCaused by:\n Subtyping error: Unknown variant field 4_140_450_540)")
πŸ›‘, Optimism(Some([BlockPi])), Err: (CanisterError, "IC0503: Canister 7hfb6-caaaa-aaaar-qadga-cai trapped explicitly: failed to decode call arguments: Custom(Fail to decode argument 0\n\nCaused by:\n Subtyping error: Unknown variant field 4_140_450_540)")
πŸ›‘, Optimism(Some([PublicNode])), Err: (CanisterError, "IC0503: Canister 7hfb6-caaaa-aaaar-qadga-cai trapped explicitly: failed to decode call arguments: Custom(Fail to decode argument 0\n\nCaused by:\n Subtyping error: Unknown variant field 4_140_450_540)")
πŸ›‘, Optimism(Some([Ankr])), Err: (CanisterError, "IC0503: Canister 7hfb6-caaaa-aaaar-qadga-cai trapped explicitly: failed to decode call arguments: Custom(Fail to decode argument 0\n\nCaused by:\n Subtyping error: Unknown variant field 4_140_450_540)")
πŸ›‘, BaseMainnet(Some([Alchemy])), Consistent result / Err: HttpOutcallError(InvalidHttpJsonRpcResponse { status: 401, body: "{\"jsonrpc\":\"2.0\",\"id\":9,\"error\":{\"code\":-32600,\"message\":\"Must be authenticated!\"}}", parsingError: None })
βœ…, BaseMainnet(Some([BlockPi]))
βœ…, BaseMainnet(Some([PublicNode]))
πŸ›‘, BaseMainnet(Some([Ankr])), Consistent result / Err: HttpOutcallError(InvalidHttpJsonRpcResponse { status: 200, body: "{\"jsonrpc\":\"2.0\",\"error\":{\"code\":0,\"message\":\"we can't execute this request\"},\"id\":null}", parsingError: Some("invalid type: null, expected u64 at line 1 column 87") })
πŸ›‘, ArbitrumOne(Some([Alchemy])), Consistent result / Err: HttpOutcallError(InvalidHttpJsonRpcResponse { status: 401, body: "{\"jsonrpc\":\"2.0\",\"id\":13,\"error\":{\"code\":-32600,\"message\":\"Must be authenticated!\"}}", parsingError: None })
βœ…, ArbitrumOne(Some([BlockPi]))
βœ…, ArbitrumOne(Some([PublicNode]))
βœ…, ArbitrumOne(Some([Ankr]))
1 Like

Oh. I might have made a typo there. Optimism should be OptimismMainnet, right? The other issues would remain though.

Thank you for the detailed information! We will monitor and look for ways to address these errors in the next release.

Had an almost clean run after fixing the Optimism type typo. Login issues with Alchemy, all else looks good.

βœ…, EthMainnet(Some([Alchemy]))
βœ…, EthMainnet(Some([BlockPi]))
βœ…, EthMainnet(Some([Cloudflare]))
βœ…, EthMainnet(Some([PublicNode]))
βœ…, EthMainnet(Some([Ankr]))
βœ…, EthSepolia(Some([Alchemy]))
βœ…, EthSepolia(Some([BlockPi]))
βœ…, EthSepolia(Some([PublicNode]))
βœ…, EthSepolia(Some([Ankr]))
πŸ›‘, OptimismMainnet(Some([Alchemy])), Consistent result / Err: HttpOutcallError(InvalidHttpJsonRpcResponse { status: 401, body: "{\"jsonrpc\":\"2.0\",\"id\":9,\"error\":{\"code\":-32600,\"message\":\"Must be authenticated!\"}}", parsingError: None })
βœ…, OptimismMainnet(Some([BlockPi]))
βœ…, OptimismMainnet(Some([PublicNode]))
βœ…, OptimismMainnet(Some([Ankr]))
πŸ›‘, BaseMainnet(Some([Alchemy])), Consistent result / Err: HttpOutcallError(InvalidHttpJsonRpcResponse { status: 401, body: "{\"jsonrpc\":\"2.0\",\"id\":13,\"error\":{\"code\":-32600,\"message\":\"Must be authenticated!\"}}", parsingError: None })
βœ…, BaseMainnet(Some([BlockPi]))
βœ…, BaseMainnet(Some([PublicNode]))
βœ…, BaseMainnet(Some([Ankr]))
πŸ›‘, ArbitrumOne(Some([Alchemy])), Consistent result / Err: HttpOutcallError(InvalidHttpJsonRpcResponse { status: 401, body: "{\"jsonrpc\":\"2.0\",\"id\":17,\"error\":{\"code\":-32600,\"message\":\"Must be authenticated!\"}}", parsingError: None })
βœ…, ArbitrumOne(Some([BlockPi]))
βœ…, ArbitrumOne(Some([PublicNode]))
βœ…, ArbitrumOne(Some([Ankr]))
1 Like

That is good to see! For now, I would encourage using the other RPC providers instead of Alchemy, since we’ve seen various issues with rate limits in addition to auth-related errors.

Relevant forum topic:

1 Like