From 89c8523e77107d882ec4f820a43f6009749ba568 Mon Sep 17 00:00:00 2001 From: nambrot Date: Sun, 19 Jan 2025 20:03:32 -0500 Subject: [PATCH] Fixes required to run warp check/read/apply --- typescript/cli/src/context/context.ts | 4 ++ typescript/cli/src/deploy/warp.ts | 42 +++++++++++++++++-- typescript/cli/src/read/warp.ts | 14 +++---- typescript/infra/scripts/check/check-utils.ts | 22 +++++----- .../sdk/src/token/EvmERC20WarpRouteReader.ts | 11 +++++ typescript/sdk/src/token/deploy.ts | 18 ++++---- 6 files changed, 81 insertions(+), 30 deletions(-) diff --git a/typescript/cli/src/context/context.ts b/typescript/cli/src/context/context.ts index d3bb47d3a9..1bdfc7861c 100644 --- a/typescript/cli/src/context/context.ts +++ b/typescript/cli/src/context/context.ts @@ -257,6 +257,10 @@ export async function requestAndSaveApiKeys( apiKeys[chain] = chainMetadata[chain]!.blockExplorers![0]!.apiKey!; continue; } + // if its blockscout, dont prompt for api key + if (chainMetadata[chain]?.blockExplorers?.[0]?.family === 'blockscout') { + continue; + } const wantApiKey = await confirm({ default: false, message: `Do you want to use an API key to verify on this (${chain}) chain's block explorer`, diff --git a/typescript/cli/src/deploy/warp.ts b/typescript/cli/src/deploy/warp.ts index e94bd709da..304dfb47e9 100644 --- a/typescript/cli/src/deploy/warp.ts +++ b/typescript/cli/src/deploy/warp.ts @@ -57,6 +57,7 @@ import { Address, ProtocolType, assert, + hexOrBase58ToHex, objFilter, objKeys, objMap, @@ -615,11 +616,23 @@ async function updateExistingWarpRoute( coreBuildArtifact, ExplorerLicenseType.MIT, ); - const transactions: AnnotatedEV5Transaction[] = []; + // whether the warp deploy config specifies remote routers + const specifiesRemoteRouters = Object.values(warpDeployConfig).some( + (_) => !!_.remoteRouters, + ); + + const transactions: AnnotatedEV5Transaction[] = []; await promiseObjAll( objMap(warpDeployConfig, async (chain, config) => { await retryAsync(async () => { + if ( + multiProvider.getChainMetadata(chain).protocol !== + ProtocolType.Ethereum + ) { + logGray(`Skipping non-Ethereum chain ${chain}`); + return; + } logGray(`Update existing warp route for chain ${chain}`); const deployedConfig = warpCoreConfigByChain[chain]; if (!deployedConfig) @@ -638,10 +651,33 @@ async function updateExistingWarpRoute( staticMessageIdWeightedMultisigIsmFactory, } = registryAddresses[chain]; + // @ts-ignore + const remoteRouters: Record = + Object.fromEntries( + Object.entries(warpCoreConfigByChain) + .filter(([otherchain]) => otherchain != chain) + .map(([otherChain, otherChainConfig]) => [ + multiProvider.getDomainId(otherChain)!.toString(), + { + address: warpDeployConfig[otherChain]?.foreignDeployment + ? hexOrBase58ToHex( + warpDeployConfig[otherChain]!.foreignDeployment!, + ) + : otherChainConfig.addressOrDenom!, + }, + ]), + ); + + const destinationGas = objMap(remoteRouters, () => '64000'); + + const addedConfig = { + ...config, + ...(!specifiesRemoteRouters ? { remoteRouters, destinationGas } : {}), + }; const evmERC20WarpModule = new EvmERC20WarpModule( multiProvider, { - config, + config: addedConfig, chain, addresses: { deployedTokenRoute, @@ -656,7 +692,7 @@ async function updateExistingWarpRoute( }, contractVerifier, ); - transactions.push(...(await evmERC20WarpModule.update(config))); + transactions.push(...(await evmERC20WarpModule.update(addedConfig))); }); }), ); diff --git a/typescript/cli/src/read/warp.ts b/typescript/cli/src/read/warp.ts index 169593c5e9..0f4e623936 100644 --- a/typescript/cli/src/read/warp.ts +++ b/typescript/cli/src/read/warp.ts @@ -98,13 +98,13 @@ export async function runWarpRouteRead({ .filter(([_, address]) => !isAddressEvm(address)) .map(([chain]) => chain); if (nonEvmChains.length > 0) { - const chainList = nonEvmChains.join(', '); - logRed( - `${chainList} ${ - nonEvmChains.length > 1 ? 'are' : 'is' - } non-EVM and not compatible with the cli`, - ); - process.exit(1); + // const chainList = nonEvmChains.join(', '); + // logRed( + // `${chainList} ${ + // nonEvmChains.length > 1 ? 'are' : 'is' + // } non-EVM and not compatible with the cli`, + // ); + // process.exit(1); } const config = await promiseObjAll( diff --git a/typescript/infra/scripts/check/check-utils.ts b/typescript/infra/scripts/check/check-utils.ts index ef7a2b1215..61d5c5efb5 100644 --- a/typescript/infra/scripts/check/check-utils.ts +++ b/typescript/infra/scripts/check/check-utils.ts @@ -239,17 +239,17 @@ export async function getGovernor( : []; if (nonEvmChains.length > 0) { - const chainList = nonEvmChains.join(', '); - console.log( - `${chainList} ${ - nonEvmChains.length > 1 ? 'are' : 'is' - } non-EVM and not compatible with warp checker tooling`, - ); - throw Error( - `${chainList} ${ - nonEvmChains.length > 1 ? 'are' : 'is' - } non-EVM and not compatible with warp checker tooling`, - ); + // const chainList = nonEvmChains.join(', '); + // console.log( + // `${chainList} ${ + // nonEvmChains.length > 1 ? 'are' : 'is' + // } non-EVM and not compatible with warp checker tooling`, + // ); + // throw Error( + // `${chainList} ${ + // nonEvmChains.length > 1 ? 'are' : 'is' + // } non-EVM and not compatible with warp checker tooling`, + // ); } const app = new HypERC20App( diff --git a/typescript/sdk/src/token/EvmERC20WarpRouteReader.ts b/typescript/sdk/src/token/EvmERC20WarpRouteReader.ts index 0908378462..1aa26771a1 100644 --- a/typescript/sdk/src/token/EvmERC20WarpRouteReader.ts +++ b/typescript/sdk/src/token/EvmERC20WarpRouteReader.ts @@ -65,6 +65,17 @@ export class EvmERC20WarpRouteReader extends HyperlaneReader { async deriveWarpRouteConfig( warpRouteAddress: Address, ): Promise { + if (this.chain === 'solanamainnet') { + return { + type: TokenType.synthetic, + name: 'OFFICIAL TRUMP', + symbol: 'TRUMP', + decimals: 6, + totalSupply: '0', + owner: '0xa7ECcdb9Be08178f896c26b7BbD8C3D4E844d9Ba', + mailbox: '6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN', + }; + } // Derive the config type const type = await this.deriveTokenType(warpRouteAddress); const baseMetadata = await this.fetchMailboxClientConfig(warpRouteAddress); diff --git a/typescript/sdk/src/token/deploy.ts b/typescript/sdk/src/token/deploy.ts index 29aeac28ef..2b48eeee4e 100644 --- a/typescript/sdk/src/token/deploy.ts +++ b/typescript/sdk/src/token/deploy.ts @@ -181,15 +181,15 @@ abstract class TokenDeployer< async deploy(configMap: WarpRouteDeployConfig) { let tokenMetadata: TokenMetadata | undefined; - try { - tokenMetadata = await TokenDeployer.deriveTokenMetadata( - this.multiProvider, - configMap, - ); - } catch (err) { - this.logger.error('Failed to derive token metadata', err, configMap); - throw err; - } + // try { + // tokenMetadata = await TokenDeployer.deriveTokenMetadata( + // this.multiProvider, + // configMap, + // ); + // } catch (err) { + // this.logger.error('Failed to derive token metadata', err, configMap); + // throw err; + // } const resolvedConfigMap = objMap(configMap, (_, config) => ({ ...tokenMetadata,