-
Notifications
You must be signed in to change notification settings - Fork 28
fix(cosmwasm): coordinator migration defaults to multisig prover/chain map #1066
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 files reviewed, 1 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important change, thank you! Left some comments
cosmwasm/migrate/coordinator.ts
Outdated
|
||
const chain_contracts: ChainContracts[] = []; | ||
|
||
for (let i = 0; i < chain_endpoints.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use iterator
cosmwasm/migrate/coordinator.ts
Outdated
interface GatewayConfig { | ||
verifier: string; | ||
} | ||
function check_for_duplicates(chains: ChainContracts[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCase
cosmwasm/migrate/coordinator.ts
Outdated
console.log('Executing migration...', migrate_options); | ||
if (options.proposal) { | ||
await submitProposal(client, config, migrate_options, proposal); | ||
await submitProposal(client, config, migrate_options, proposal, options.fees); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the fee
from migrate
method argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I'll use that
cosmwasm/migrate/coordinator.ts
Outdated
await submitProposal(client, config, migrate_options, proposal, options.fees); | ||
console.log('Migration proposal successfully submitted'); | ||
} else { | ||
await client.migrate(sender_address, coordinator_address, Number(code_id), migration_msg, options.fees); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
cosmwasm/migrate/coordinator.ts
Outdated
try { | ||
const chain_contracts: ChainContracts[] = []; | ||
chains.forEach((c) => { | ||
if (c.prover_address && !provers.has(c.prover_address)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and in other places in this PR
--msg "{\"coordinator\": \"$COORDINATOR_ADDRESS\", \"default_authorized_provers\": {\"chain1\": \"prover1\", \"chain2\":\"prover2\",...}}" \ | ||
--fetchCodeId \ | ||
--deposit $DEPOSIT_VALUE | ||
``` | ||
|
||
The `default_authorized_provers` object should correspond to the chain/prover pairs located at `axelar.contracts.MultisigProver` in `$ENV.json`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on this? Why the default_authorized_provers
is not read automatically from the config if it's needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it's important to take XRPL
, Solana
, Sui
and Stellar
Provers into account.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. I'll modify it so that it is read from the config. I'll make sure it takes into account XRPL
, Solana
, Sui
and Stellar
Description
The multisig contract maintains a
chain->prover
map, and the coordinator maintains a separateprover->chain
map. In order to keep these maps consistent after migration, the migration script will default to using the multsig's map if they differ.How is This Done
The script now queries the multisig contract first when constructing the coordinator's migration message. During migration, the coordinator will default to using the prover/chain pair found in the multisig. This script assumes multisig version 2.3 has been deployed.
Reference
Corresponding change in Amplifier:
axelarnetwork/axelar-amplifier#1058
Testing
This has been tested both on a custom devnet, and on devnet-amplifier. The results of running this migration on devnet-amplifier have been saved to
devnet-amplifier.json
.Note
Adds a multisig migration path (to v2.3.1) and upgrades the coordinator migration to sync prover mappings from multisig, enforce uniqueness, support ignoreChains/direct modes, and update docs/config accordingly.
prover->chain
, enforces uniqueness (provers/verifiers/gateways), supportsignoreChains
,--direct
, and fee param; updates titles to v2.1.1 and logs; camelCases types/vars.multisig.ts
with migration to v2.3.1; extracts default provers from config; supports direct/proposal execution and fee param.migrate.ts
addsignoreChains
and--direct
; wires fee through; routes to coordinator or multisig migrators.proposal
withdirect
; addsignoreChains
.axelar-chains-config/info/devnet-amplifier.json
: bumps Router/Multisig/Coordinator codeIds and proposal ids/hashes (reflecting new deployments).releases/cosmwasm/2025-09-Coordinator-v2.1.0.md
: marks devnet as completed, updates multisig to v2.3.1, revises migration steps to use new scripts/flags and notesignoreChains
caution.Written by Cursor Bugbot for commit ca73407. This will update automatically on new commits. Configure here.
Greptile Overview
Updated On: 2025-10-02 17:29:09 UTC
Summary
This PR addresses a critical data consistency issue between the multisig and coordinator contracts in the CosmWasm migration system. The multisig contract maintains a `chain->prover` mapping while the coordinator maintains a separate `prover->chain` mapping, which could become inconsistent during migrations.The key change is refactoring the coordinator migration script to query the multisig contract first and use its mapping as the authoritative source when constructing the coordinator's migration message. This ensures both contracts will have consistent mappings after migration completes.
The implementation adds several safety mechanisms:
ignoreChains
parameter to exclude problematic chains during migrationThe changes also include code cleanup (removing unused imports, renaming unused parameters) and documentation updates to reflect the new migration strategy. The devnet-amplifier configuration shows successful execution of this migration approach, updating contract code IDs for coordinator v2.1.0, multisig v2.3.1, and router v1.3.0.
Important Files Changed
Changed Files
Confidence score: 4/5
Sequence Diagram