hyperlane-monorepo
hyperlane-monorepo copied to clipboard
feat: ergonomic IGP configuration in CLI
Description
Re-adding the ability to generate IGP hook configs using the CLI, but repurposing logic found in infra to make the configuration experience more ergonomic. Logic still behind the --advanced
flag.
Enabling this allows IGP configuration in any place that supports hook config e.g.
core
/warp
/hook
init with--advanced
.
We will use metadata in registry to:
- fetch price from Coingecko (prompt user if unable to find)
- fetch current gas prices via the default RPCs
- request user to enter an IGP margin in %
- Calculate the
gasPrice
+tokenExchangeRate
for you
Note that it still sets overhead
to some preexisting default.
? Select hook type interchainGasPaymaster
Creating interchainGasPaymaster...
? Detected owner address as 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 from signer, is this
correct? yes
? Use this same address for the beneficiary? yes
? Select network type Mainnet
? Select local chain for IGP hook bitlayer
? Select remote destination chains for IGP hook alephzero, ancient8
? Enter overhead for alephzero (e.g., 75000) for IGP hook 75000
? Enter overhead for ancient8 (e.g., 75000) for IGP hook 75000
Getting gas token prices for all chains from Coingecko...
Gas price for alephzero is 40.0
Gas token price for alephzero is $0.393347
Gas price for ancient8 is 0.001000252
Gas token price for ancient8 is $2356.71
Gas price for bitlayer is 0.050000007
Gas token price for bitlayer is $60576
? Enter IGP margin percentage (e.g. 10 for 10%) 100
Created interchainGasPaymaster!
Core config is valid, writing to file ./configs/core-config.yaml:
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
defaultIsm:
type: trustedRelayerIsm
relayer: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
defaultHook:
type: aggregationHook
hooks:
- type: merkleTreeHook
- owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
type: interchainGasPaymaster
beneficiary: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
oracleKey: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
overhead:
alephzero: 75000
ancient8: 75000
oracleConfig:
alephzero:
gasPrice: "40000000000"
tokenExchangeRate: "129868"
ancient8:
gasPrice: "1000253"
tokenExchangeRate: "778100236"
requiredHook:
owner: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
type: protocolFee
beneficiary: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
maxProtocolFee: "1000000000000000000"
protocolFee: "0"
✅ Successfully created new core deployment config.
Drive-by changes
Moving reusable infra logic into the SDK, and refactoring CLI+Infra to reuse the underlying logic. For example:
- fetching token prices from coingecko
- fetching gas prices using a chain's RPC
Related issues
Most recently, https://github.com/hyperlane-xyz/hyperlane-registry/pull/236#issuecomment-2383956859. But there have been numerous occasions where it would be nice for users to be self-sufficient in configuring and deploying an IGP hook for their PI deployments/relayer.
Backward compatibility
yes
Testing
- creating igp config with
hyperlane core init --advanced
- making sure infra print-token-prices.ts still works
- making sure infra print-gas-prices.ts still works