hyperlane-xyz / hyperlane-monorepo

The home for Hyperlane core contracts, sdk packages, and other infrastructure
https://hyperlane.xyz
Other
305 stars 337 forks source link

Auto-detect multicall contracts using a default address #3631

Open daniel-savu opened 5 months ago

daniel-savu commented 5 months ago

Instead of manually configuring the address of the multicall contract for each chain, check whether the bytecode deployed at the default multicall address is the expected one. If no contract is detected, default to not using batching.

However this would require adding a useBatching config item, and we'd still need a multicallAddress config item for new chains, so I'm wondering if this improvement is actually worth it @tkporter.

yorhodes commented 5 months ago

Instead of manually configuring the address of the multicall contract for each chain, check whether the bytecode deployed at the default multicall address is the expected one. If no contract is detected, default to not using batching.

I think this is already supported in the ethers lib https://github.com/gakonst/ethers-rs/blob/master/ethers-contract/src/multicall/middleware.rs#L202-L218

daniel-savu commented 5 months ago

we're on a fork of ethers 1.0.2 which doesn't have that middleware :( chatted to @tkporter that we could pull that into our fork