Skip to content

Conversation

SDavidson1177
Copy link
Contributor

@SDavidson1177 SDavidson1177 commented Oct 10, 2025

Description

The wasm module needs to give the coordinator v2 permission to instantiate gateways, verifiers and provers. This script submits a proposal to add the coordinator address to the allowed list of instantiators for a particular code id.

Usage

Please refer to step 5 in the Deployment section of 2025-09-Coordinator-v2.1.1.md

Testing

This script has been successfully tested on devnet-amplifier. (proposal ID 1223)


Note

Adds a new CLI command and proposal encoder to append the Coordinator to allowed instantiators for a given code ID.

  • CosmWasm tooling:
    • New proposal type: Implement encodeUpdateInstantiateConfigProposal in cosmwasm/utils.js (with UpdateInstantiateConfigProposal) to update instantiate permissions.
    • Coordinator helper: Add instantiatePermissions in cosmwasm/migrate/coordinator.ts to build and submit the update-instantiate-config proposal.
    • CLI: Introduce coordinator-instantiate-permissions command in cosmwasm/migrate/migrate.ts to grant the Coordinator instantiate rights for a given code_id using current permissions JSON; bump tool version to 1.1.0.
    • Types: Extend MigrationOptions with optional title/description; add InstantiatePermission interface.
  • Docs:
    • Update releases/cosmwasm/2025-09-Coordinator-v2.1.1.md with an optional step and command to give the Coordinator instantiate permissions and minor wording fixes.
  • Misc:
    • Fix error string in cosmwasm/migrate/multisig.ts; minor comment tweak in solana/template.env.

Written by Cursor Bugbot for commit 09cd735. This will update automatically on new commits. Configure here.

@SDavidson1177 SDavidson1177 requested a review from a team as a code owner October 10, 2025 19:57
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR adds a new command coordinator-instantiate-permissions that creates governance proposals to grant the Coordinator v2 contract permission to instantiate Gateway, Verifier, and Prover contracts.

Key changes:

  • New instantiatePermissions function in coordinator.ts that builds and submits an UpdateInstantiateConfigProposal
  • New CLI command that validates current permissions and prevents duplicate grants
  • Added encodeUpdateInstantiateConfigProposal helper in utils.js to encode the proposal
  • Updated documentation with step-by-step instructions for granting instantiate permissions
  • Minor bug fix in multisig.ts error message

Issues found:

  • Typo: premissions instead of permissions in parameter names (3 occurrences)
  • Hardcoded magic number 4 instead of using AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES constant
  • Uses console.log instead of printInfo in one location

Confidence Score: 4/5

  • This PR is safe to merge with minor spelling fixes needed
  • The implementation is solid with good validation logic and error handling. The typos in parameter names and style issues don't affect functionality. The core logic correctly validates permissions before creating proposals, preventing duplicate grants. Successfully tested on devnet (proposal ID 1223).
  • cosmwasm/migrate/migrate.ts needs spelling corrections for parameter names

Important Files Changed

File Analysis

Filename Score Overview
cosmwasm/migrate/coordinator.ts 4/5 Added instantiatePermissions function to grant coordinator permission to instantiate contracts. Uses hardcoded magic number instead of AccessType constant.
cosmwasm/migrate/migrate.ts 3/5 Added coordinator-instantiate-permissions command with validation logic. Has typo in parameter names (premissions instead of permissions).
cosmwasm/utils.js 4/5 Added encodeUpdateInstantiateConfigProposal function to support updating instantiate permissions. Uses console.log instead of printInfo.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as migrate.ts
    participant Validator as coordinatorInstantiatePermissions
    participant Helper as instantiatePermissions
    participant Utils as utils.js
    participant Chain as CosmWasm Chain

    User->>CLI: coordinator-instantiate-permissions <code_id> <current_permissions>
    CLI->>Validator: Parse arguments and options
    Validator->>Validator: Validate code_id is a number
    Validator->>Validator: Parse current_permissions JSON
    Validator->>Validator: Check if permission == 'Everybody'
    Validator->>Validator: Check if coordinator already in addresses[]
    Validator->>Helper: instantiatePermissions(...)
    Helper->>Helper: Add coordinator to permitted addresses
    Helper->>Helper: Build updateMsg with permission: 4
    Helper->>Utils: encodeUpdateInstantiateConfigProposal(options)
    Utils->>Utils: Create UpdateInstantiateConfigProposal
    Utils-->>Helper: Return encoded proposal
    alt not dry run
        Helper->>Utils: submitProposal(proposal)
        Utils->>Chain: Submit governance proposal
        Chain-->>Utils: Proposal ID
        Utils-->>Helper: Success
        Helper-->>User: Migration proposal successfully submitted
    else dry run
        Helper-->>User: Display proposal message only
    end
Loading

6 files reviewed, 5 comments

Edit Code Review Agent Settings | Greptile

cursor[bot]

This comment was marked as outdated.

Copy link

blacksmith-sh bot commented Oct 16, 2025

1 Job Failed:

Rust Linting / rust-lints failed on "Run cargo clippy (devnet-amplifier)"
[...]
  GITHUB_REPO_NAME: axelarnetwork/axelar-contract-deployments
  CARGO_HOME: /home/runner/.cargo
  CARGO_INCREMENTAL: 0
  CARGO_TERM_COLOR: always
  CACHE_ON_FAILURE: false
error: failed to get `gateway-event-stack` as a dependency of package `cli v0.1.0 (/home/runner/_work/axelar-contract-deployments/axelar-contract-deployments/solana)`

Caused by:
  failed to load source for dependency `gateway-event-stack`

Caused by:
  Unable to update /home/runner/_work/axelar-contract-deployments/axelar-contract-deployments/solana/axelar-amplifier-solana/crates/gateway-event-stack

Caused by:
  failed to read `/home/runner/_work/axelar-contract-deployments/axelar-contract-deployments/solana/axelar-amplifier-solana/crates/gateway-event-stack/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
Error: Process completed with exit code 101.

Summary: 7 successful workflows, 1 failed workflow

Last updated: 2025-10-16 15:30:03 UTC

Copy link
Contributor

@kulikthebird kulikthebird left a comment

Choose a reason for hiding this comment

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

We'll need the command that modifies instantiatePermission - especially when migrating to Coordinator v2. The nice thing is that we can use this script in other contexts, too. I left some comments, Thanks! 🚀


addAmplifierOptions(
program
.command('coordinator-instantiate-permissions')
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this command to the submit-proposal.js as it can be used outside of the migration context, too.

We have provided a script that submits a proposal to append the coordinator's address to the list of allowed addresses for a given code id. A proposal will not be created if the coordinator is already allowed to instantiate that contract. To execute that script, run:
```bash
ts-node cosmwasm/migrate/migrate.ts coordinator-instantiate-permissions <code id> "'$(axelard q wasm code-info <code id> --node <node rpc> --output json | jq -c .instantiate_permission)'" --deposit 100000000 -e devnet-amplifier -t $TITLE -d $DESCRIPTION -m $MNEMONIC
Copy link
Contributor

Choose a reason for hiding this comment

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

When the script is moved, pls update that code too


CLUSTER="devnet";
COMMIT_HASH="a26968488efd41c979d6aa3d56ce85bc1c1556d4"; # https://github.com/axelarnetwork/axelar-amplifier-solana/commit/a26968488efd41c979d6aa3d56ce85bc1c1556d4
COMMIT_HASH="a26968488efd41c979d6aa3d56ce85bc1c1556d4"; # https://github.com/axelarnetwork/axelar-amplifier-solana/commit/a26968488efd41c979d6aa3d56ce85bc1c1556d4 # skip-check
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove solana related updates from this PR

program
.command('coordinator-instantiate-permissions')
.argument('<code_id>', 'coordinator will have instantiate permissions for this code id')
.argument('<current_permissions>', 'current instantiate permissions for given contract')
Copy link
Contributor

Choose a reason for hiding this comment

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

Get the current permisions within the script via query

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that it is better to query this from within the script. I was looking extensively however, and I don't think the stargate api allows this. I will look again tomorrow to see if there is a way around this

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.

2 participants