Skip to content
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

chore(sui): updateMoveToml when upgrade #381

Merged
merged 7 commits into from
Sep 24, 2024
Merged
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
7 changes: 7 additions & 0 deletions .github/workflows/test-sui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ jobs:
- name: Deploy Utils
run: node sui/deploy-contract deploy Utils

- name: Deploy VersionControl
run: node sui/deploy-contract deploy VersionControl

npty marked this conversation as resolved.
Show resolved Hide resolved
- name: Deploy AxelarGateway
run: node sui/deploy-contract deploy AxelarGateway --signers wallet

Expand Down Expand Up @@ -138,6 +141,7 @@ jobs:
run: node sui/gateway.js approve --proof wallet ethereum 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x6ce0d81b412abca2770eddb1549c9fcff721889c3aab1203dc93866db22ecc4b 0x56570de287d73cd1cb6092bb8fdee6173974955fdef345ae579ee9f475ea7432

- name: Gateway Call Contract
continue-on-error: true
run: node sui/gateway.js call-contract ethereum 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x1234

- name: Gateway Rotate Signers
Expand All @@ -146,9 +150,11 @@ jobs:
###### Command: GMP ######

- name: Execute Outgoing Call Contract
continue-on-error: true
run: node sui/gmp.js sendCall ethereum 0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05 0.1 0x1234

- name: Execute Incoming Call Contract
continue-on-error: true
run: |
channel_id=$(cat axelar-chains-config/info/local.json | jq '.sui.contracts.Example.objects.ChannelId' | sed 's/"//g')
echo "Channel ID: $channel_id"
Expand Down Expand Up @@ -232,6 +238,7 @@ jobs:
&& mv temp.json axelar-chains-config/info/local.json

- name: Post Upgrade Gateway Approval With New Package ID
continue-on-error: true
run: node sui/gateway.js approve --proof wallet ethereum 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-10 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x6ce0d81b412abca2770eddb1549c9fcff721889c3aab1203dc93866db22ecc4b 0x56570de287d73cd1cb6092bb8fdee6173974955fdef345ae579ee9f475ea7432

###### Command: Transfer Object ######
Expand Down
20 changes: 16 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"homepage": "https://github.com/axelarnetwork/axelar-contract-deployments#readme",
"dependencies": {
"@axelar-network/axelar-cgp-solidity": "6.3.1",
"@axelar-network/axelar-cgp-sui": "^0.6.3",
"@axelar-network/axelar-cgp-sui": "^0.6.4",
"@axelar-network/axelar-gmp-sdk-solidity": "5.10.0",
"@axelar-network/interchain-token-service": "1.2.4",
"@cosmjs/cosmwasm-stargate": "^0.32.1",
Expand Down
25 changes: 21 additions & 4 deletions sui/deploy-contract.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Command, Option } = require('commander');
const { TxBuilder, bcsStructs } = require('@axelar-network/axelar-cgp-sui');
const { getLocalDependencies, updateMoveToml, TxBuilder, bcsStructs } = require('@axelar-network/axelar-cgp-sui');
const { ethers } = require('hardhat');
const { toB64 } = require('@mysten/sui/utils');
const { bcs } = require('@mysten/sui/bcs');
Expand All @@ -26,6 +26,7 @@ const {
getItsChannelId,
getSquidChannelId,
checkSuiVersionMatch,
moveDir,
} = require('./utils');

/**
Expand All @@ -41,7 +42,18 @@ const {
* 2. Ensure the corresponding folder exists in the specified path
*
*/
const PACKAGE_DIRS = ['utils', 'gas_service', 'example', 'axelar_gateway', 'operators', 'abi', 'governance', 'its', 'squid'];
const PACKAGE_DIRS = [
'version_control',
'utils',
'gas_service',
'example',
'axelar_gateway',
'operators',
'abi',
'governance',
'its',
'squid',
];

/**
* Package Mapping Object for Command Options and Post-Deployment Functions
Expand Down Expand Up @@ -251,7 +263,7 @@ async function deploy(keypair, client, supportedContract, config, chain, options
}

async function upgrade(keypair, client, supportedPackage, policy, config, chain, options) {
const { packageName } = supportedPackage;
const { packageName, packageDir } = supportedPackage;
options.policy = policy;

if (!chain.contracts[packageName]) {
Expand All @@ -263,7 +275,12 @@ async function upgrade(keypair, client, supportedPackage, policy, config, chain,

validateParameters({ isNonEmptyString: { packageName } });

// TODO: Synchronize dependencies with `sui/move` folder and update `published-at` field if necessary
const packageDependencies = getLocalDependencies(packageDir, moveDir);

for (const { name } of packageDependencies) {
const packageAddress = contractsConfig[name]?.address;
updateMoveToml(packageDir, packageAddress, moveDir);
}

const builder = new TxBuilder(client);
await upgradePackage(client, keypair, supportedPackage, contractConfig, builder, options);
Expand Down
Loading