-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ergonomic IGP configuration in CLI (#4635)
### 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: 1. fetch price from Coingecko (prompt user if unable to find) 1. fetch current gas prices via the default RPCs 1. request user to enter an IGP margin in % 1. Calculate the `gasPrice` + `tokenExchangeRate` for you Note that it still sets `overhead` to some preexisting default. ```sh ? 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! ``` ```sh 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, hyperlane-xyz/hyperlane-registry#236 (comment). 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
- Loading branch information
1 parent
6fd0e60
commit efbbf8f
Showing
12 changed files
with
516 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@hyperlane-xyz/cli': minor | ||
--- | ||
|
||
Enable configuration of IGP hooks in the CLI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@hyperlane-xyz/sdk': minor | ||
--- | ||
|
||
Introduce utils that can be reused by the CLI and Infra for fetching token prices from Coingecko and gas prices from EVM/Cosmos chains. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.