Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/test-sui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,6 @@ jobs:
ts-node sui/gmp.js execute ethereum 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-3 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x1234

###### Command: ITS ######
- name: ITS Pause
run: ts-node sui/contract.js pause InterchainTokenService -y

- name: ITS Unpause
run: ts-node sui/contract.js unpause InterchainTokenService -y

- name: ITS Pause
run: ts-node sui/contract.js pause InterchainTokenService --functions all -y

Expand Down
44 changes: 42 additions & 2 deletions sui/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,57 @@ const CONTRACT_INFO = {
singletonName: 'InterchainTokenService',
moduleName: 'interchain_token_service',
defaultFunctions: {
versions: [0, 0, 0, 0, 0, 0, 0, 0, 0],
versions: [
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
],
functionNames: [
'register_coin',
'register_coin_from_info',
'register_coin_from_metadata',
'register_custom_coin',
'link_coin',
'register_coin_metadata',
'deploy_remote_interchain_token',
'send_interchain_transfer',
'receive_interchain_transfer',
'receive_interchain_transfer_with_data',
'receive_deploy_interchain_token',
'receive_link_coin',
'give_unregistered_coin',
'give_unlinked_coin',
'remove_unlinked_coin',
'mint_as_distributor',
'mint_to_as_distributor',
'burn_as_distributor',
'add_trusted_chains',
'remove_trusted_chains',
'register_transaction',
'set_flow_limit',
'set_flow_limit_as_token_operator',
'transfer_distributorship',
'transfer_operatorship',
'remove_treasury_cap',
'restore_treasury_cap',
'allow_function',
'disallow_function',
'migrate_coin_metadata',
'deploy_remote_interchain_token',
'send_interchain_transfer',
'receive_interchain_transfer',
'receive_interchain_transfer_with_data',
'receive_deploy_interchain_token',
'give_unregistered_coin',
'mint_as_distributor',
'mint_to_as_distributor',
'burn_as_distributor',
'add_trusted_chains',
'remove_trusted_chains',
'set_flow_limit',
'set_flow_limit_as_token_operator',
'transfer_distributorship',
'transfer_operatorship',
'allow_function',
'disallow_function',
Copy link

Choose a reason for hiding this comment

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

Bug: Interchain Functions Array Contains Duplicates

The InterchainTokenService.defaultFunctions.functionNames array contains duplicate entries. Many functions, including 'deploy_remote_interchain_token', 'send_interchain_transfer', and 'receive_interchain_transfer', appear twice. This duplication can cause unexpected behavior when processing these functions, such as during allow/disallow or pause/unpause operations, as they may be processed multiple times.

Fix in Cursor Fix in Web

],
},
},
Expand Down
4 changes: 4 additions & 0 deletions sui/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,10 @@ async function migrate(keypair, client, supportedPackage, config, chain, options
target: `${contractConfig.address}::interchain_token_service::migrate`,
arguments: [InterchainTokenService, ownerCap],
});
await builder.moveCall({
target: `${contractConfig.address}::discovery::register_transaction`,
arguments: [InterchainTokenService, RelayerDiscovery],
});
Comment on lines +475 to +478
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

Copy link

Choose a reason for hiding this comment

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

Bug: Redundant Transaction Registration Causes Gas Waste

A duplicate moveCall to discovery::register_transaction with identical arguments (InterchainTokenService, RelayerDiscovery) is executed. This wastes gas and may cause transaction failures or unexpected behavior if the registration is not idempotent.

Fix in Cursor Fix in Web


await builder.moveCall({
target: `${contractConfig.address}::discovery::register_transaction`,
Expand Down
Loading