Skip to content

Commit

Permalink
Merge branch 'main' into kunal/cli-hook-config
Browse files Browse the repository at this point in the history
  • Loading branch information
aroralanuk authored Dec 1, 2023
2 parents e11ece2 + 9fc0866 commit 4e4d246
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 322 deletions.
15 changes: 9 additions & 6 deletions typescript/infra/config/environments/mainnet3/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,17 @@ export const ethereumChainNames = Object.keys(
ethereumMainnetConfigs,
) as MainnetChains[];

// Remove mantapacific, as it's not considered a "blessed"
// chain. It's not included in the scraper domains table,
// and we don't relay to mantapacific on the Hyperlane or RC contexts.
const hyperlaneContextRelayChains = ethereumChainNames.filter(
(chainName) => chainName !== chainMetadata.mantapacific.name,
);

// Hyperlane & RC context agent chain names.
export const agentChainNames: AgentChainNames = {
// Run validators for all chains.
[Role.Validator]: supportedChainNames,
// Only run relayers for Ethereum chains at the moment.
[Role.Relayer]: ethereumChainNames,
// Remove mantapacific for now, as it's not included in the scraper domains table
[Role.Scraper]: ethereumChainNames.filter(
(chainName) => chainName !== chainMetadata.mantapacific.name,
),
[Role.Relayer]: hyperlaneContextRelayChains,
[Role.Scraper]: hyperlaneContextRelayChains,
};
2 changes: 1 addition & 1 deletion typescript/infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@aws-sdk/client-kms": "3.48.0",
"@aws-sdk/client-s3": "^3.74.0",
"@cosmjs/amino": "^0.31.3",
"@eth-optimism/sdk": "^1.7.0",
"@eth-optimism/sdk": "^3.1.6",
"@ethersproject/experimental": "^5.7.0",
"@ethersproject/hardware-wallets": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
Expand Down
29 changes: 20 additions & 9 deletions typescript/infra/scripts/funding/fund-keys-from-deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,10 @@ class ContextFunder {
// Funds all the roles in this.rolesToFund
// Returns whether a failure occurred.
async fund(): Promise<boolean> {
let failureOccurred = false;

const chainKeys = this.getChainKeys();
const promises = Object.entries(chainKeys).map(async ([chain, keys]) => {
const chainKeyEntries = Object.entries(chainKeys);
const promises = chainKeyEntries.map(async ([chain, keys]) => {
let failureOccurred = false;
if (keys.length > 0) {
if (!this.skipIgpClaim) {
failureOccurred ||= await gracefullyHandleError(
Expand All @@ -418,14 +418,25 @@ class ContextFunder {
const failure = await this.attemptToFundKey(key, chain);
failureOccurred ||= failure;
}
return failureOccurred;
});

try {
await Promise.all(promises);
} catch (e) {
error('Unhandled error when funding key', { error: format(e) });
failureOccurred = true;
}
// A failure occurred if any of the promises rejected or
// if any of them resolved with true, indicating a failure
// somewhere along the way
const failureOccurred = (await Promise.allSettled(promises)).reduce(
(failureAgg, result, i) => {
if (result.status === 'rejected') {
error('Funding promise for chain rejected', {
chain: chainKeyEntries[i][0],
error: format(result.reason),
});
return true;
}
return result.value || failureAgg;
},
false,
);

return failureOccurred;
}
Expand Down
Loading

0 comments on commit 4e4d246

Please sign in to comment.