Skip to content
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

Fixes required to run warp check/read/apply #5204

Open
wants to merge 1 commit into
base: nambrot/TRUMP-base-solanamainnet
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions typescript/cli/src/context/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
42 changes: 39 additions & 3 deletions typescript/cli/src/deploy/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ import {
Address,
ProtocolType,
assert,
hexOrBase58ToHex,
objFilter,
objKeys,
objMap,
Expand Down Expand Up @@ -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)
Expand All @@ -638,10 +651,33 @@ async function updateExistingWarpRoute(
staticMessageIdWeightedMultisigIsmFactory,
} = registryAddresses[chain];

// @ts-ignore
const remoteRouters: Record<string, { address: string }> =
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,
Expand All @@ -656,7 +692,7 @@ async function updateExistingWarpRoute(
},
contractVerifier,
);
transactions.push(...(await evmERC20WarpModule.update(config)));
transactions.push(...(await evmERC20WarpModule.update(addedConfig)));
});
}),
);
Expand Down
14 changes: 7 additions & 7 deletions typescript/cli/src/read/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
22 changes: 11 additions & 11 deletions typescript/infra/scripts/check/check-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions typescript/sdk/src/token/EvmERC20WarpRouteReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ export class EvmERC20WarpRouteReader extends HyperlaneReader {
async deriveWarpRouteConfig(
warpRouteAddress: Address,
): Promise<HypTokenRouterConfig> {
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);
Expand Down
18 changes: 9 additions & 9 deletions typescript/sdk/src/token/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading