Skip to content

Conversation

SDavidson1177
Copy link
Contributor

@SDavidson1177 SDavidson1177 commented Oct 2, 2025

Description

This is a script that checks whether or not the coordinator v2's migration succeeded with respect to the multisig contract. In particular, it checks that every prover/chain pair in the coordinator can be found in the multisig contract. For more details, please see the Synchronizing Prover-to-Chain Map section of ARC-8.

testing

This script has been tested on devnet-amplifier.


Note

Introduces a read-only migration check that validates coordinator vs multisig prover/chain mappings, adds a check CLI command, refactors logging/types, and updates release docs.

  • CosmWasm Migration (Coordinator)
    • Verification logic: Add constructCoordinatorChainProverPairs, constructMultisigChainProverPairs, coordinatorStoresMultisigAddress, and checkCoordinatorToVersion2_1 to compare coordinator and multisig prover mappings and multisig address.
    • API tweaks: queryChainsFromRouter now uses CosmWasmClient; internal contract fields use snake_case (chain_name, prover_address, etc.).
    • Logging: Replace console.log/error with printInfo/printError and improve messages.
    • Exports: Add checkMigration entrypoint for version-matched checks.
  • CLI
    • Add check command in migrate.ts (via addAmplifierQueryContractOptions, mainQueryProcessor) to run coordinator migration verification with optional --coordinator/--multisig.
  • Types
    • Add MigrationCheckOptions and ProtocolContracts to support verification.
  • Multisig Migration
    • Swap console logging for printInfo/printError.
  • Docs
    • Update releases/cosmwasm/2025-09-Coordinator-v2.1.1.md with a new post-migration check step and command usage.
    • Minor comment formatting fixes in Hedera release notes.

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

Greptile Overview

Updated On: 2025-10-02 18:48:49 UTC

Summary

This PR introduces a post-migration verification system for coordinator v2.1.0 migrations in the CosmWasm ecosystem. The implementation adds functionality to check that coordinator migrations succeeded correctly by validating consistency between the coordinator and multisig contracts.

The changes span four files:

  1. Type definitions are added in types.ts to support migration checking with MigrationCheckOptions and ProtocolContracts interfaces
  2. Core verification logic is implemented in coordinator.ts with functions to query and compare prover/chain pairs between coordinator and multisig contracts
  3. CLI integration is added in migrate.ts through a new check command that provides a user-friendly interface for running migration verification
  4. Documentation is updated in the release notes to include step-by-step instructions for using the verification tool

The verification system works by querying both the coordinator and multisig contracts to retrieve their respective prover/chain mappings, then ensuring every prover/chain pair in the coordinator can be found in the multisig contract. This addresses requirements from ARC-8 to ensure protocol state consistency after coordinator migrations. The implementation uses read-only CosmWasmClient operations and follows existing patterns in the codebase for contract interaction and CLI structure.

Important Files Changed

Changed Files
Filename Score Overview
cosmwasm/migrate/types.ts 5/5 Adds type definitions for migration check functionality with MigrationCheckOptions and ProtocolContracts interfaces
cosmwasm/migrate/coordinator.ts 4/5 Implements core migration verification logic with functions to compare prover/chain pairs between coordinator and multisig contracts
releases/cosmwasm/2025-09-Coordinator-v2.1.0.md 5/5 Adds documentation for the new migration check command in the release checklist
cosmwasm/migrate/migrate.ts 4/5 Integrates migration check functionality into CLI with new 'check' command and proper option handling

Confidence score: 4/5

  • This PR is safe to merge with proper review of the migration verification logic
  • Score reflects solid implementation but complex verification logic that should be validated thoroughly
  • Pay close attention to cosmwasm/migrate/coordinator.ts for the chain/prover comparison logic

Sequence Diagram

sequenceDiagram
    participant User
    participant "Migration Script"
    participant CosmWasmClient
    participant Router
    participant Coordinator
    participant Multisig
    participant Gateway
    
    User->>+"Migration Script": "Execute check command"
    "Migration Script"->>+CosmWasmClient: "Create client connection"
    
    Note over "Migration Script": "Get chain endpoints and addresses"
    "Migration Script"->>+Router: "Query chains: {}"
    Router-->>-"Migration Script": "Return chain endpoints"
    
    "Migration Script"->>+Coordinator: "Query raw 'protocol' data"
    Coordinator-->>-"Migration Script": "Return protocol contracts"
    
    Note over "Migration Script": "Verify coordinator stores correct multisig address"
    
    loop "For each chain endpoint"
        "Migration Script"->>+Coordinator: "Query chain_contracts_info: {chain_name}"
        Coordinator-->>-"Migration Script": "Return chain contracts (including prover)"
        
        "Migration Script"->>+Multisig: "Query authorized_caller: {chain_name}"
        Multisig-->>-"Migration Script": "Return prover address for chain"
        
        Note over "Migration Script": "Compare coordinator prover vs multisig prover"
    end
    
    Note over "Migration Script": "Validate state consistency"
    alt "All provers match"
        "Migration Script"->>User: "✅ Migration succeeded!"
    else "Provers don't match or missing chains"
        "Migration Script"->>User: "❌ State of coordinator v2 is not consistent"
    end
Loading

@SDavidson1177 SDavidson1177 requested a review from a team as a code owner October 2, 2025 18:47
@SDavidson1177 SDavidson1177 changed the title Feat/coordinator migration check feat(cosmwasm): coordinator v2 migration check Oct 2, 2025
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.

4 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

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.

Lgtm, thanks! 👍

Base automatically changed from fix/coordinator-migration-default-provers to main October 10, 2025 18:44
@SDavidson1177 SDavidson1177 merged commit 7df4c3a into main Oct 10, 2025
10 checks passed
@SDavidson1177 SDavidson1177 deleted the feat/coordinator-migration-check branch October 10, 2025 19: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.

2 participants