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): Support agent config generation for all chains #3985

Merged
merged 3 commits into from
Jul 5, 2024

Conversation

Mo-Hussain
Copy link
Contributor

@Mo-Hussain Mo-Hussain commented Jun 18, 2024

Description

  • Support generating agent config for all supported chains
  • Add user prompts: prompt user whether they want to zero the IGP addresses if not provided, prompt user whether they want to generate agent config anyway when schema validation fails
  • Support skipping prompts, useful for CI

Example usage:

Specific chains

$yarn hyperlane registry agent-config --chains anvil8545
Hyperlane CLI

Creating agent config...
interchainGasPaymaster address is missing for anvil8545
? Would you like to set the interchainGasPaymaster address to 0x0 for anvil8545? yes

Agent config is invalid, this is possibly due to required contracts not being deployed. See details below:
Validation error: Required at "chains.anvil8545.merkleTreeHook"
? Would you like to continue anyway? yes

Writing agent config to file ./configs/agent-config.json
✅ Agent config successfully written to ./configs/agent-config.json

All chains

$yarn hyperlane registry agent-config
Hyperlane CLI

Creating agent config...
?
No chains provided, would you like to generate the agent config for all supported chains? yes
interchainGasPaymaster address is missing for sketchpad
? Would you like to set the interchainGasPaymaster address to 0x0 for sketchpad? yes
interchainGasPaymaster address is missing for anvil8545
? Would you like to set the interchainGasPaymaster address to 0x0 for anvil8545? yes

Agent config is invalid, this is possibly due to required contracts not being deployed. See details below:
Validation error: Required at "chains.anvil8545.merkleTreeHook"; Invalid at "chains.sketchpad.interchainSecurityModule"
? Would you like to continue anyway? yes

Writing agent config to file ./configs/agent-config.json
✅ Agent config successfully written to ./configs/agent-config.json

Skip prompts:

$yarn hyperlane registry agent-config --skipPrompts
Hyperlane CLI

Creating agent config...

No chains provided, generating agent config for all supported chains

Agent config is invalid, this is possibly due to required contracts not being deployed. See details below:
Validation error: Required at "chains.anvil8545.merkleTreeHook"; Required at "chains.anvil8545.interchainGasPaymaster"; Invalid at "chains.sketchpad.interchainGasPaymaster"; Invalid at "chains.sketchpad.interchainSecurityModule"
Creating agent config anyway...

Writing agent config to file ./configs/agent-config.json
✅ Agent config successfully written to ./configs/agent-config.json

Drive-by changes

Related issues

Backward compatibility

Testing

Manual

Copy link

changeset-bot bot commented Jun 18, 2024

⚠️ No Changeset found

Latest commit: 69a0ecf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@Mo-Hussain Mo-Hussain requested a review from tkporter June 18, 2024 11:44
Copy link

codecov bot commented Jun 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (8c8f39a) to head (69a0ecf).
Report is 1 commits behind head on main.

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

Copy link
Collaborator

@tkporter tkporter left a comment

Choose a reason for hiding this comment

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

Lgtm! but should def move to the existing skipConfirmation

typescript/cli/src/commands/registry.ts Outdated Show resolved Hide resolved
typescript/cli/src/config/agent.ts Outdated Show resolved Hide resolved
typescript/cli/src/config/agent.ts Show resolved Hide resolved
typescript/cli/src/commands/registry.ts Outdated Show resolved Hide resolved
typescript/cli/src/config/agent.ts Outdated Show resolved Hide resolved
@Mo-Hussain Mo-Hussain force-pushed the mo/create-agent-config-command branch from ae928fc to 125a0a6 Compare June 26, 2024 15:28
typescript/cli/src/config/agent.ts Outdated Show resolved Hide resolved
typescript/cli/src/config/agent.ts Outdated Show resolved Hide resolved
typescript/cli/src/config/agent.ts Outdated Show resolved Hide resolved
Base automatically changed from cli-2.0 to main June 27, 2024 13:52
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.

Approved with minor comments

typescript/cli/src/config/agent.ts Outdated Show resolved Hide resolved
typescript/cli/src/config/agent.ts Outdated Show resolved Hide resolved
typescript/cli/src/config/agent.ts Outdated Show resolved Hide resolved
@Mo-Hussain Mo-Hussain force-pushed the mo/create-agent-config-command branch from 125a0a6 to 69a0ecf Compare July 4, 2024 16:42
@paulbalaji paulbalaji enabled auto-merge July 5, 2024 10:33
@paulbalaji paulbalaji added this pull request to the merge queue Jul 5, 2024
Merged via the queue into main with commit cb225b8 Jul 5, 2024
35 of 36 checks passed
@paulbalaji paulbalaji deleted the mo/create-agent-config-command branch July 5, 2024 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a CLI command to generate an agent config from registry content
4 participants