-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat:update StorageGasOracle
in igpDeployer
#3101
Conversation
🦋 Changeset detectedLatest commit: 474bc96 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
will review once build is fixed |
StorageGasOracle
in igpDeployer
StorageGasOracle
in igpDeployer
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3101 +/- ##
==========================================
- Coverage 67.51% 0.00% -67.52%
==========================================
Files 101 1 -100
Lines 1022 16 -1006
Branches 106 0 -106
==========================================
- Hits 690 0 -690
+ Misses 292 16 -276
+ Partials 40 0 -40
|
export function prettyRemoteGasDataConfig( | ||
chain: ChainName, | ||
config: RemoteGasData, | ||
): string { | ||
return `\tRemote: (${chain})\n${prettyRemoteGasData(config)}`; | ||
} | ||
|
||
export function prettyRemoteGasData(data: RemoteGasData): string { | ||
return `\tToken exchange rate: ${prettyTokenExchangeRate( | ||
data.tokenExchangeRate, | ||
)}\n\tGas price: ${data.gasPrice.toString()} (${ethers.utils.formatUnits( | ||
data.gasPrice, | ||
'gwei', | ||
)} gwei)`; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is gwei
always the gas unit?
do we need to account for decimals here?
getTokenExchangeRate( | ||
base: ChainName, | ||
quote: ChainName, | ||
cacheThemAll: ChainName[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is technically a breaking change
the variable name is also unclear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it chainsToCache
or does it mean something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this optional? I would have no idea from the name how to call getTokenPrice
after this change
const toQuery = chains.filter((c) => !this.cache.isFresh(c)); | ||
const toQuery = cacheThemAll.filter((c) => !this.cache.isFresh(c)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont understand this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coingecko api takes it a list of tickers and the TokenPriceCache
caches them. But earlier, we used to cache pairwise for origin and destination which is much slower as we're waiting 5s between every coingecko api, this expedites it by making an api call with all the tickers the first time.
typescript/sdk/src/ism/multisig.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is another breaking change
why not reuse these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is breaking, you just commented on the whole file?
.changeset/loud-chairs-watch.md
Outdated
- `createIgpConfig` | ||
- `buildMultisigIsmConfigs`, `buildAggregationIsmConfigs`, etc | ||
- `buildRoutingOverAggregationIsmConfig` routing over aggregation of msgId and merkleTree (_current deployement_) | ||
- test configs: infra -> sdk (for configureGasOracle.hardhat-test.ts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Infra and/or test related changes don't need to be noted in the changeset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
typescript/cli/src/config/hooks.ts
Outdated
hookConfig: HookConfig, | ||
): Promise<any> { | ||
if (hookConfig.type === HookType.INTERCHAIN_GAS_PAYMASTER) { | ||
return await processIgpConfig(multiProvider, hookConfig as IgpConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason to return await
instead of just return
is if you explicitly want to force errors to throw here instead of above, which isn't the case since you aren't using a try/catch in this function
export type TestChains = keyof typeof testConfigs; | ||
export const testChainNames = Object.keys(testConfigs) as TestChains[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate of existing code in typescript/sdk/src/consts/chains.ts
test1: '0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65', | ||
test2: '0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc', | ||
test3: '0x976EA74026E726554dB657fA54763abd0C3a0aa9', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not start splitting up consts across the src/consts/
and src/config
directories please. Can you find a home for these in consts
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
getTokenExchangeRate( | ||
base: ChainName, | ||
quote: ChainName, | ||
cacheThemAll: ChainName[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it chainsToCache
or does it mean something else?
typescript/sdk/src/ism/multisig.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this? another breaking change
oracleKey: Address; | ||
overhead: ChainMap<number>; | ||
overhead: ChainMap<BigNumber>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change this? imo we want this to be as serializable as possible
gasOracleType: ChainMap<GasOracleContractType>; | ||
oracleConfig: StorageGasOraclesConfig; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why change this again? this is another breaking change
.changeset/loud-chairs-watch.md
Outdated
- `createIgpConfig` | ||
- `buildMultisigIsmConfigs`, `buildAggregationIsmConfigs`, etc | ||
- `buildRoutingOverAggregationIsmConfig` routing over aggregation of msgId and merkleTree (_current deployement_) | ||
- test configs: infra -> sdk (for configureGasOracle.hardhat-test.ts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
const configsToSet: Record< | ||
Address, | ||
StorageGasOracle.RemoteGasDataConfigStruct[] | ||
> = {}; | ||
|
||
for (const remote of remotes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be a map instead?
for (const remote of remotes) { | ||
const desiredGasData = gasOracleConfig[remote]; | ||
if (desiredGasData.type !== GasOracleContractType.StorageGasOracle) { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we throw in this case?
.gasOracle; | ||
const gasOracle = StorageGasOracle__factory.connect( | ||
gasOracleAddress, | ||
this.multiProvider.getSigner(chain), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be signer instead of provider
getTokenExchangeRate( | ||
base: ChainName, | ||
quote: ChainName, | ||
cacheThemAll: ChainName[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this optional? I would have no idea from the name how to call getTokenPrice
after this change
const [price] = await this.getTokenPrices([chain]); | ||
async getTokenPrice( | ||
chain: ChainName, | ||
cacheThemAll: ChainName[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto, can this be optional?
### Description HyperlaneIGPDeployer supports configuring storageGasOracle if provided. HyperlaneIgpDeployer takes in `IgpConfig & Partial<OracleConfig>` Note: storageGasOracle cannot be configured in CLI yet. Note: this is a more minimal version of #3101 where more breaking changes were made. ### Drive-by changes None ### Related issues - fixes hyperlane-xyz/issues#820 ### Backward compatibility Yes ### Testing Unit
### Description HyperlaneIGPDeployer supports configuring storageGasOracle if provided. HyperlaneIgpDeployer takes in `IgpConfig & Partial<OracleConfig>` Note: storageGasOracle cannot be configured in CLI yet. Note: this is a more minimal version of hyperlane-xyz#3101 where more breaking changes were made. ### Drive-by changes None ### Related issues - fixes hyperlane-xyz/issues#820 ### Backward compatibility Yes ### Testing Unit
Description
oracleConfig
andoverhead
to hooks configoverhead
,tokenExchangeRate
(optional - use 1e10 as default),gasPrice
(optional - useprovider.getPrice()
as default)IGPConfig
(ZOD) toIGPConfig
(SDK)getStorageGasOracleConfigs
- fetches nested storage gas oracle from within the coreConfig (e.g. core -> defaultHook -> routingHook -> igp -> oracleConfig)createIgpConfig
buildMultisigIsmConfigs
,buildAggregationIsmConfigs
, etcbuildRoutingOverAggregationIsmConfig
routing over aggregation of msgId and merkleTree (current deployment)deployer.configureStorageGasOracle
)Note: because of the commonJS issues with the cli package, I can't import {ethers} from hardhat which means i cannot test
getGasPrice()
in the CLI.Drive-by changes
Related issues
Backward compatibility
Yes, refactoring and config changes
Testing
Hardhat/manual