banteg / multicall.py

aggregate results of multiple smart contract calls into one
MIT License
246 stars 106 forks source link

Strange issues using Multicall with Fuse RPCs #58

Closed DefiDebauchery closed 1 year ago

DefiDebauchery commented 1 year ago

Update: After some investigation, it seems that the Parity client that Fuse uses doesn't handle overrides. Out of curiosity, what is the reason that entire bytecode is sent with each request?


relevant pip list

multicall 0.7.0
web3 6.0.0b9

Came across a really strange issue. I'm trying to debug it myself, but also wanted to note it here to get more eyes on it.

For some reason, there's something Multicall is doing that is throwing off Fuse network RPCs. I've tried multiple endpoints with the same results. I intend on looping in the Fuse folks, but would like to actually understand what's going on.

Consider this simple script. Note that BSC Multicall() works fine, and Fuse single Call() works fine, but attempting to Multicall() returns an error. Out of 18 networks I routinely use multicall with, only Fuse is currently exhibiting this behavior.

from web3 import Web3
from multicall import Call, Multicall

fuse = Web3(Web3.HTTPProvider('https://rpc.fuse.io'))
bsc = Web3(Web3.HTTPProvider('https://bsc-dataseed.binance.org/'))

print(Multicall([
    Call('0x7C780b8A63eE9B7d0F985E8a922Be38a1F7B2141', 'nonce()(uint256)', [['bsc', None]]),
], _w3=bsc)())
print(Call('0xe26a8aC2936F338Fd4DAebA4BD22a7ec86465fE1', 'nonce()(uint256)', [['call', None]], _w3=fuse)())
print(Multicall([
    Call('0xe26a8aC2936F338Fd4DAebA4BD22a7ec86465fE1', 'nonce()(uint256)', [['multicall', None]]),
], _w3=fuse)())

The error is

ValueError: {'code': -32602, 'message': 'Invalid parameters: Expected from 1 to 2 parameters.', 'data': '"Got: 3"'}

No other flags, like require_success etc have any effect on it. The only thing I do know is that Multicall 0.4.0 does not have this issue. I'll continue to dig through it (including perhaps iterating through releases to determine when this may have started), but hoping some additional eyes could at least give me something to take back to the Fuse team if I need to.