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

Fix base bridging and a race condition in key funder #3012

Merged
merged 3 commits into from
Dec 1, 2023
Merged
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
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(
tkporter marked this conversation as resolved.
Show resolved Hide resolved
(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
Loading