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

Add a CLI command to generate an agent config from registry content #3720

Open
Tracked by #3552
tkporter opened this issue May 7, 2024 · 0 comments · Fixed by #3985
Open
Tracked by #3552

Add a CLI command to generate an agent config from registry content #3720

tkporter opened this issue May 7, 2024 · 0 comments · Fixed by #3985

Comments

@tkporter
Copy link
Collaborator

tkporter commented May 7, 2024

Problem

See here for full context and design: https://www.notion.so/hyperlanexyz/Hybrid-HaaS-67195982e71b42de92bc83038498583a?pvs=4#a3831e1497b249028ae6bca6a70994a1

Here's the current state:

  • typecript/infra/scripts/update-agent-config.ts is the current way in which we generate agent configs for our mainnet3 and testnet4 deploys
  • Agent configs relating to these envs are shipped with the agents and live here https://github.com/hyperlane-xyz/hyperlane-monorepo/tree/main/rust/config
  • We have CI steps that generate these using the current main of the registry
    agent-configs:
    runs-on: ubuntu-latest
    needs: [yarn-build, checkout-registry]
    strategy:
    fail-fast: false
    matrix:
    environment: [mainnet3, testnet4]
    steps:
    - uses: actions/checkout@v3
    with:
    ref: ${{ github.event.pull_request.head.sha || github.sha }}
    fetch-depth: 0
    - name: yarn-cache
    uses: actions/cache@v3
    with:
    path: |
    **/node_modules
    .yarn
    key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}
    - name: build-cache
    uses: actions/cache@v3
    with:
    path: |
    ./*
    !./rust
    key: ${{ github.event.pull_request.head.sha || github.sha }}
    # A workaround for relative paths not being supported by actions/cache.
    # See https://github.com/actions/upload-artifact/issues/176#issuecomment-1367855630.
    - run: echo "REGISTRY_URI_ABSOLUTE=$(realpath $REGISTRY_URI)" >> $GITHUB_ENV
    - name: registry-cache
    uses: actions/cache@v3
    with:
    path: |
    ${{ env.REGISTRY_URI_ABSOLUTE }}
    key: hyperlane-registry-${{ github.event.pull_request.head.sha || github.sha }}
    - name: Generate ${{ matrix.environment }} agent config
    run: |
    cd typescript/infra
    yarn tsx ./scripts/agents/update-agent-config.ts -e ${{ matrix.environment }}
    CHANGES=$(git status -s)
    if [[ ! -z $CHANGES ]]; then
    echo "Changes found in agent config: $CHANGES"
    exit 1
    fi
    and fail if they're different from the ones in the monorepo
  • In the CLI 2.0, there's no way for CLI users to generate an agent config. This means that a CLI user who deployed to a new chain and has new chain metadata / addresses relating to their chain doesn't have a way to generate an agent config using this and run their own agents

Solution

For now, we'll keep using infra's update-agent-config.ts, and we'll keep the existing CI steps for generating the mainnet3 and testnet4 agent configs. This is because of open design questions around how make sure that transaction overrides that live in infra still make their way into the agent config. This'll be tracked in a separate issue

Also note you'll want to build off the cli-2.0 branch and not main, unless cli-2.0 gets merged into main by the time this gets picked up

For this issue, we want:

  • A CLI command that has very similar behavior as update-agent-config.ts. Something like hyperlane registry agent-config. It should be able to take --chains <list of chains>, where it generates an agent config for each of the provided chains, or alternatively be told to generate an agent config for either all testnets or mainnets.
  • This command creates a config using the chain metadata and addresses in the CLI's registry. Look at other CLI commands to understand how to interact with a registry - the general idea is that the CLI uses the Github registry as a "base" registry, and then applies a local registry on top of that. It should be possible for anyone to run this CLI command pointing to a local copy of the registry and for this to spit out an agent config
  • Should output the agent config to some file as a json
@tkporter tkporter moved this to Backlog in Hyperlane Tasks May 20, 2024
@tkporter tkporter changed the title Migrate infra's update-agent-config.ts to the CLI Add a CLI command to generate an agent config from registry content Jun 6, 2024
@Mo-Hussain Mo-Hussain moved this from Backlog to Sprint in Hyperlane Tasks Jun 7, 2024
@Mo-Hussain Mo-Hussain moved this from Sprint to Next Sprint in Hyperlane Tasks Jun 7, 2024
@Mo-Hussain Mo-Hussain moved this from Next Sprint to In Progress in Hyperlane Tasks Jun 11, 2024
@Mo-Hussain Mo-Hussain moved this from In Progress to In Review in Hyperlane Tasks Jun 12, 2024
github-merge-queue bot pushed a commit that referenced this issue Jun 13, 2024
### Description

- Add support for creating agent configs using the CLI
- registry agent-config command with a required --chains option
- This will pick up local registry data

Example usage:

`hyperlane registry agent-config --chains anvil8545`

<!--
What's included in this PR?
-->


### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

<!--
- Fixes #[issue number here]
-->

- Fixes
#[3720](#3720)

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->
Yes

### Testing

Manual

<!--
What kind of testing have these changes undergone?

None/Manual/Unit Tests
-->
@Mo-Hussain Mo-Hussain moved this from In Review to Done in Hyperlane Tasks Jun 14, 2024
@Mo-Hussain Mo-Hussain reopened this Jun 18, 2024
@github-project-automation github-project-automation bot moved this from Done to Sprint in Hyperlane Tasks Jun 18, 2024
@Mo-Hussain Mo-Hussain moved this from Sprint to In Progress in Hyperlane Tasks Jun 18, 2024
@Mo-Hussain Mo-Hussain moved this from In Progress to In Review in Hyperlane Tasks Jun 19, 2024
@Mo-Hussain Mo-Hussain moved this from In Review to Done in Hyperlane Tasks Jul 5, 2024
@avious00 avious00 moved this from Done to Sprint in Hyperlane Tasks Jul 30, 2024
@avious00 avious00 moved this from Sprint to Backlog in Hyperlane Tasks Jul 30, 2024
@Mo-Hussain Mo-Hussain moved this from Backlog to Sprint in Hyperlane Tasks Aug 14, 2024
@Mo-Hussain Mo-Hussain moved this from Sprint to Backlog in Hyperlane Tasks Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

2 participants