Skip to content

Commit

Permalink
Merge remote-tracking branch 'hl/main' into pb/zksync
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbalaji committed Nov 8, 2024
2 parents 0287f49 + fa42482 commit 8631e01
Show file tree
Hide file tree
Showing 56 changed files with 3,120 additions and 1,567 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-olives-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Redeploy to alephzeroevmmainnet, chilizmainnet, flowmainnet, immutablezkevmmainnet, metal, polynomialfi, rarichain, rootstockmainnet, superpositionmainnet. Deploy to flame, prom.
7 changes: 7 additions & 0 deletions .changeset/dry-ties-approve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@hyperlane-xyz/infra': minor
'@hyperlane-xyz/cli': minor
'@hyperlane-xyz/sdk': minor
---

Add support for updating the mailbox proxy admin owner
7 changes: 7 additions & 0 deletions .changeset/empty-needles-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@hyperlane-xyz/utils': major
'@hyperlane-xyz/sdk': major
---

Upgrade Viem to 2.2 and Solana Web3 to 1.9
Rename `chainMetadataToWagmiChain` to `chainMetadataToViemChain`
5 changes: 5 additions & 0 deletions .changeset/happy-suits-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': minor
---

Deploy to abstracttestnet and treasuretopaz
5 changes: 5 additions & 0 deletions .changeset/new-olives-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': patch
---

feat: use message context in hook reader IGP derivation
5 changes: 5 additions & 0 deletions .changeset/unlucky-pillows-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': major
---

Remove getCoingeckoTokenPrices (use CoinGeckoTokenPriceGetter instead)
2 changes: 1 addition & 1 deletion .registryrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4e52093acfe3dc75a35771905f3a7757b368ac50
d71eb5f42616998f77ce01079fd06a8e118966f7
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Domain::TimeUpdated).timestamp().not_null())
.col(ColumnDef::new(Domain::Name).text().not_null())
.col(ColumnDef::new(Domain::NativeToken).text().not_null())
.col(ColumnDef::new(Domain::ChainId).big_unsigned().unique_key())
.col(ColumnDef::new(Domain::ChainId).big_unsigned())
.col(ColumnDef::new(Domain::IsTestNet).boolean().not_null())
.col(ColumnDef::new(Domain::IsDeprecated).boolean().not_null())
.to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion rust/main/agents/scraper/src/db/generated/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl ColumnTrait for Column {
Self::TimeUpdated => ColumnType::DateTime.def(),
Self::Name => ColumnType::Text.def(),
Self::NativeToken => ColumnType::Text.def(),
Self::ChainId => ColumnType::BigInteger.def().null().unique(),
Self::ChainId => ColumnType::BigInteger.def().null(),
Self::IsTestNet => ColumnType::Boolean.def(),
Self::IsDeprecated => ColumnType::Boolean.def(),
}
Expand Down
165 changes: 140 additions & 25 deletions rust/main/config/testnet_config.json

Large diffs are not rendered by default.

27 changes: 24 additions & 3 deletions typescript/cli/src/config/core.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { stringify as yamlStringify } from 'yaml';

import { CoreConfigSchema, HookConfig, IsmConfig } from '@hyperlane-xyz/sdk';
import {
CoreConfigSchema,
HookConfig,
IsmConfig,
OwnableConfig,
} from '@hyperlane-xyz/sdk';

import { CommandContext } from '../context/types.js';
import { errorRed, log, logBlue, logGreen } from '../logger.js';
Expand All @@ -18,6 +23,9 @@ import {
} from './hooks.js';
import { createAdvancedIsmConfig, createTrustedRelayerConfig } from './ism.js';

const ENTER_DESIRED_VALUE_MSG = 'Enter the desired';
const SIGNER_PROMPT_LABEL = 'signer';

export async function createCoreDeployConfig({
context,
configFilePath,
Expand All @@ -31,16 +39,17 @@ export async function createCoreDeployConfig({

const owner = await detectAndConfirmOrPrompt(
async () => context.signer?.getAddress(),
'Enter the desired',
ENTER_DESIRED_VALUE_MSG,
'owner address',
'signer',
SIGNER_PROMPT_LABEL,
);

const defaultIsm: IsmConfig = advanced
? await createAdvancedIsmConfig(context)
: await createTrustedRelayerConfig(context, advanced);

let defaultHook: HookConfig, requiredHook: HookConfig;
let proxyAdmin: OwnableConfig;
if (advanced) {
defaultHook = await createHookConfig({
context,
Expand All @@ -52,9 +61,20 @@ export async function createCoreDeployConfig({
selectMessage: 'Select required hook type',
advanced,
});
proxyAdmin = {
owner: await detectAndConfirmOrPrompt(
async () => context.signer?.getAddress(),
ENTER_DESIRED_VALUE_MSG,
'ProxyAdmin owner address',
SIGNER_PROMPT_LABEL,
),
};
} else {
defaultHook = await createMerkleTreeConfig();
requiredHook = await createProtocolFeeConfig(context, advanced);
proxyAdmin = {
owner,
};
}

try {
Expand All @@ -63,6 +83,7 @@ export async function createCoreDeployConfig({
defaultIsm,
defaultHook,
requiredHook,
proxyAdmin,
});
logBlue(`Core config is valid, writing to file ${configFilePath}:\n`);
log(indentYamlOrJson(yamlStringify(coreConfig, null, 2), 4));
Expand Down
16 changes: 12 additions & 4 deletions typescript/cli/src/config/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
ChainMap,
ChainMetadata,
ChainName,
CoinGeckoTokenPriceGetter,
HookConfig,
HookConfigSchema,
HookType,
IgpHookConfig,
MultiProtocolProvider,
getCoingeckoTokenPrices,
getGasPrice,
getLocalStorageGasOracleConfig,
} from '@hyperlane-xyz/sdk';
Expand Down Expand Up @@ -305,9 +305,17 @@ async function getIgpTokenPrices(
) {
const isTestnet =
context.chainMetadata[Object.keys(filteredMetadata)[0]].isTestnet;
const fetchedPrices = isTestnet
? objMap(filteredMetadata, () => '10')
: await getCoingeckoTokenPrices(filteredMetadata);

let fetchedPrices: ChainMap<string>;
if (isTestnet) {
fetchedPrices = objMap(filteredMetadata, () => '10');
} else {
const tokenPriceGetter = new CoinGeckoTokenPriceGetter({
chainMetadata: filteredMetadata,
});
const results = await tokenPriceGetter.getAllTokenPrices();
fetchedPrices = objMap(results, (v) => v.toString());
}

logBlue(
isTestnet
Expand Down
1 change: 1 addition & 0 deletions typescript/cli/src/deploy/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface DeployParams {
interface ApplyParams extends DeployParams {
deployedCoreAddresses: DeployedCoreAddresses;
}

/**
* Executes the core deploy command.
*/
Expand Down
43 changes: 43 additions & 0 deletions typescript/cli/src/tests/commands/core.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { $ } from 'zx';

import { CoreConfig } from '@hyperlane-xyz/sdk';

import { readYamlOrJson } from '../../utils/files.js';

import { ANVIL_KEY, REGISTRY_PATH } from './helpers.js';

/**
Expand All @@ -19,3 +23,42 @@ export async function hyperlaneCoreDeploy(
--verbosity debug \
--yes`;
}

/**
* Reads a Hyperlane core deployment on the specified chain using the provided config.
*/
export async function hyperlaneCoreRead(chain: string, coreOutputPath: string) {
return $`yarn workspace @hyperlane-xyz/cli run hyperlane core read \
--registry ${REGISTRY_PATH} \
--config ${coreOutputPath} \
--chain ${chain} \
--verbosity debug \
--yes`;
}

/**
* Updates a Hyperlane core deployment on the specified chain using the provided config.
*/
export async function hyperlaneCoreApply(
chain: string,
coreOutputPath: string,
) {
return $`yarn workspace @hyperlane-xyz/cli run hyperlane core apply \
--registry ${REGISTRY_PATH} \
--config ${coreOutputPath} \
--chain ${chain} \
--key ${ANVIL_KEY} \
--verbosity debug \
--yes`;
}

/**
* Reads the Core deployment config and outputs it to specified output path.
*/
export async function readCoreConfig(
chain: string,
coreConfigPath: string,
): Promise<CoreConfig> {
await hyperlaneCoreRead(chain, coreConfigPath);
return readYamlOrJson(coreConfigPath);
}
Loading

0 comments on commit 8631e01

Please sign in to comment.