Skip to content

Conversation

Foivos
Copy link
Contributor

@Foivos Foivos commented Sep 5, 2025

Greptile Summary

Updated On: 2025-09-05 09:23:24 UTC

This PR adds a crucial registration step to the InterchainTokenService (ITS) upgrade process on Sui. When the ITS contract is upgraded, it now re-registers itself with the RelayerDiscovery service to maintain proper integration with the Axelar network.

The change mirrors the existing pattern in the postDeployIts function, which registers the ITS with RelayerDiscovery during initial deployment (lines 358-363). Without this change, upgraded ITS contracts would lose their registration with the discovery service, potentially breaking relayer functionality.

The implementation adds a discovery::register_transaction move call to the InterchainTokenService migration case in the upgrade function. This ensures that after migration completes, the upgraded ITS contract is properly registered and discoverable by relayers, maintaining the same state that existed before the upgrade.

This change is part of the broader contract upgrade infrastructure in the Sui deployment system, specifically targeting the migration logic that handles contract state transitions during upgrades.

Important Files Changed

Changed Files
Filename Score Overview
sui/deploy-contract.js 4/5 Added RelayerDiscovery registration call to ITS migration function to maintain post-upgrade discoverability

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it adds a necessary registration step that mirrors existing deployment logic
  • Score reflects the straightforward nature of the change and its alignment with established patterns in the codebase
  • No files require special attention beyond standard code review

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as "deploy-contract CLI"
    participant Config as "Config Manager"
    participant Wallet as "Wallet Manager"
    participant Client as "Sui Client"
    participant TxBuilder as "Transaction Builder"
    participant Blockchain as "Sui Blockchain"

    User->>CLI: "node deploy-contract migrate InterchainTokenService"
    CLI->>Config: "loadConfig(options.env)"
    Config-->>CLI: "configuration loaded"
    CLI->>Config: "getChainConfig(config.chains, options.chainName)"
    Config-->>CLI: "chain configuration"
    CLI->>Wallet: "getWallet(sui, options)"
    Wallet-->>CLI: "[keypair, client]"
    CLI->>Wallet: "printWalletInfo(keypair, client, sui, options)"
    
    CLI->>CLI: "validateParameters(chain.contracts[packageName])"
    CLI->>TxBuilder: "new TxBuilder(client)"
    TxBuilder-->>CLI: "builder instance"
    
    alt packageName is "InterchainTokenService"
        CLI->>TxBuilder: "moveCall(interchain_token_service::migrate)"
        CLI->>TxBuilder: "moveCall(discovery::register_transaction)"
        CLI->>TxBuilder: "broadcastFromTxBuilder(builder, keypair, message, options)"
        TxBuilder->>Client: "build and sign transaction"
        Client->>Blockchain: "broadcast transaction"
        Blockchain-->>Client: "transaction result"
        Client-->>TxBuilder: "result"
        TxBuilder-->>CLI: "migration complete"
    else packageName is "AxelarGateway"
        CLI->>CLI: "GatewayCli.migrate(keypair, client, config, chain, contractConfig, null, options)"
        CLI->>Client: "broadcast(client, keypair, result.tx, result.message, options)"
        Client->>Blockchain: "broadcast transaction"
        Blockchain-->>Client: "transaction result"
        Client-->>CLI: "migration complete"
    else unsupported package
        CLI-->>User: "Error: Post-upgrade migration not supported"
    end
    
    CLI->>Config: "saveConfig(config, options.env)"
    CLI-->>User: "Migration completed successfully"
Loading

Note

Registers InterchainTokenService with RelayerDiscovery during migration and broadens ITS default pause/unpause function coverage; minor CI workflow cleanup.

  • Sui migration:
    • Register InterchainTokenService with discovery::register_transaction after interchain_token_service::migrate in sui/deploy-contract.js.
  • Pause/Unpause CLI:
    • Expand InterchainTokenService default functions and align versions in sui/contract.js to support granular pausing/unpausing across many functions.
  • CI:
    • Remove redundant ITS pause/unpause steps in .github/workflows/test-sui.yaml.

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

@Foivos Foivos requested a review from a team as a code owner September 5, 2025 09:22
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.

1 file reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment on lines +496 to +499
await builder.moveCall({
target: `${contractConfig.address}::discovery::register_transaction`,
arguments: [InterchainTokenService, RelayerDiscovery],
});
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Should verify RelayerDiscovery exists before using it to prevent runtime errors

cursor[bot]

This comment was marked as outdated.

@Foivos Foivos requested a review from a team as a code owner September 10, 2025 10:05
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@drewstaylor
Copy link
Member

@Foivos I tried updating the npm snapshot, not sure why it causes everything to fail even after updating lock file. I'll stay out of your way now 😏

cursor[bot]

This comment was marked as outdated.

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.

3 participants