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

feat(cli): Add hyperlane warp apply #4094

Merged
merged 16 commits into from
Jul 5, 2024
Merged

feat(cli): Add hyperlane warp apply #4094

merged 16 commits into from
Jul 5, 2024

Conversation

ltyu
Copy link
Contributor

@ltyu ltyu commented Jul 3, 2024

Description

  • Adds hyperlane warp apply

Related issues

Backward compatibility

Yes

Testing

Manual

To test: yarn hyperlane warp apply --warp

Copy link

changeset-bot bot commented Jul 3, 2024

🦋 Changeset detected

Latest commit: 4ea996e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@hyperlane-xyz/cli Minor
@hyperlane-xyz/sdk Minor
@hyperlane-xyz/helloworld Minor
@hyperlane-xyz/infra Minor
@hyperlane-xyz/core Minor
@hyperlane-xyz/ccip-server Minor
@hyperlane-xyz/utils Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (f733379) to head (4ea996e).
Report is 11 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #4094   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files          1       1           
  Lines         14      14           
=====================================
  Misses        14      14           
Components Coverage Δ
core ∅ <ø> (∅)
hooks ∅ <ø> (∅)
isms ∅ <ø> (∅)
token ∅ <ø> (∅)
middlewares ∅ <ø> (∅)

@ltyu ltyu marked this pull request as ready for review July 3, 2024 20:31
typescript/sdk/src/deploy/schemas.ts Outdated Show resolved Hide resolved
typescript/cli/src/commands/warp.ts Outdated Show resolved Hide resolved
typescript/cli/src/deploy/warp.ts Outdated Show resolved Hide resolved
@ltyu ltyu enabled auto-merge July 5, 2024 17:40
@ltyu ltyu disabled auto-merge July 5, 2024 17:40
@ltyu ltyu enabled auto-merge July 5, 2024 17:41
@ltyu ltyu added this pull request to the merge queue Jul 5, 2024
Copy link
Contributor

@jmrossy jmrossy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly lgtm, just a few comments

Comment on lines +341 to +345
// Convert warpCoreConfig.tokens[] into a mapping of { [chainName]: Config }
// This allows O(1) reads within the loop
const warpCoreByChain = Object.fromEntries(
warpCoreConfig.tokens.map((token) => [token.chainName, token]),
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine but realistically if n < 1000-ish if really doesn't matter if it's O(1), O(n), or even O(n^2)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True that

Copy link
Contributor Author

@ltyu ltyu Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly did it because i like reasoning with similar data shapes. I thought it would be hard to compare an array with an object

// Update Warp
config.ismFactoryAddresses = addresses[
chain
] as ProxyFactoryFactoriesAddresses;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a cast needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because addresses[chain] returns a Record<string, string> which seems to be no specific enough

Type 'Record<string, string>' is missing the following properties from type '{ staticMerkleRootMultisigIsmFactory: string; staticMessageIdMultisigIsmFactory: string; staticAggregationIsmFactory: string; staticAggregationHookFactory: string; domainRoutingIsmFactory: string; }': staticMerkleRootMultisigIsmFactory, staticMessageIdMultisigIsmFactory, staticAggregationIsmFactory, staticAggregationHookFactory, domainRoutingIsmFactoryts(2739)

Comment on lines +378 to +380
} catch (e) {
logRed(`Warp config on ${chain} failed to update.`, e);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you certain it's better to continue updating the rest if there's a failure instead of stopping and letting the user debug the issue?

Copy link
Contributor Author

@ltyu ltyu Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not certain. But i'm open to changing this as requirements change. As of now, there are none.

The reason I did this was done is, we are only doing ism updates, which are mostly isolated for each chain. When updating an ISM we may also deploy one, which is committed right away. Then after deploying, we set a warp route's ISM as a transaction.

If we revert here because an update failed in another chain, we've potentially deployed an ISM for no reason.

Merged via the queue into main with commit 7089994 Jul 5, 2024
36 checks passed
@ltyu ltyu deleted the ltyu/warp-apply-cli branch July 5, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants