hyperlane-monorepo icon indicating copy to clipboard operation
hyperlane-monorepo copied to clipboard

Migrate from enums to ERC-165 interface detection

Open yorhodes opened this issue 9 months ago • 0 comments

Problem

The SDK module readers are littered with try/catch to distinguish between contracts which share similar but different interfaces. This causes false positive errors and is a hack in lieu of a union discriminator.

Solution

https://eips.ethereum.org/EIPS/eip-165 is designed specifically for this problem. Simply ask the contract if it supports the interface before querying the desired function.

Downsides

  • This may be less tenable in other VMs
  • This implies relayer changes

yorhodes avatar May 21 '24 14:05 yorhodes