From 68a48fe1d72173b0dafa77b879840387ab055257 Mon Sep 17 00:00:00 2001 From: npty Date: Mon, 19 Aug 2024 16:30:08 +0700 Subject: [PATCH] feat: init sui test scripts --- .github/workflows/test-sui.yaml | 99 ++++++++++++++++++++++ .github/workflows/test.yaml | 140 -------------------------------- sui/test/commands.test.js | 9 -- 3 files changed, 99 insertions(+), 149 deletions(-) create mode 100644 .github/workflows/test-sui.yaml delete mode 100644 .github/workflows/test.yaml delete mode 100644 sui/test/commands.test.js diff --git a/.github/workflows/test-sui.yaml b/.github/workflows/test-sui.yaml new file mode 100644 index 00000000..24aa2855 --- /dev/null +++ b/.github/workflows/test-sui.yaml @@ -0,0 +1,99 @@ +name: Test Sui + +on: pull_request + +env: + SUI_VERSION: mainnet-v1.25.3 + +jobs: + test-evm: + runs-on: blacksmith-2vcpu-ubuntu-2204 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Node.js + uses: useblacksmith/setup-node@v5 + with: + node-version: 18.x + cache: 'npm' + + - name: Install + run: npm ci + + - name: Setup Sui CLI and install dependencies + uses: ./.github/actions/setup-sui + with: + SUI_VERSION: ${{ env.SUI_VERSION } + + - name: Spin up Sui Network + run: nohup sh -c "sui-test-validator" > nohup.out 2> nohup.err < /dev/null & + + - name: Sleep for 30 seconds + run: sleep 30s + shell: bash + + - name: Prepare local.json + run: | + echo '{ + "sui": { + "name": "Sui", + "axelarId": "sui", + "networkType": "localnet", + "tokenSymbol": "SUI", + "rpc": "http://127.0.0.1:9000", + "faucetUrl": "http://127.0.0.1:9123", + "contracts": { + "AxelarGateway": {} + } + } + }' > ./axelar-chains-config/info/local.json + + # Create .env file with default hardhat private key that's prefunded + - name: Prepare .env + run: | + echo 'PRIVATE_KEY=suiprivkey1qyw6c8t5ws65fcvlcw5rhyt2jd8d6ad6e526shgktlm0x3aelq9rx2lp4wq' >> .env + echo 'ENV=local' >> .env + echo 'SKIP_EXISTING = true' >> .env + + - name: Display local.json + run: cat ./axelar-chains-config/info/local.json + + - name: Request SUI from faucet + run: node sui/faucet.js + + ###### Command: Deploy Contract ###### + + - name: Deploy AxelarGateway + run: node sui/deploy-contract deploy AxelarGateway --signers wallet + + - name: Deploy GasService + run: node sui/deploy-contract deploy GasService + + - name: Deploy Operators + run: node sui/deploy-contract deploy Operators + + - name: Deploy Test + run: node sui/deploy-contract deploy Test + + ###### Command: Gas Service ###### + + - name: Pay Gas + run: node sui/gas-service.js payGas --amount 100 ethereum 0x6f24A47Fc8AE5441Eb47EFfC3665e70e69Ac3F05 0xba76c6980428A0b10CFC5d8ccb61949677A61233 0x1234 + + - name: Refund Gas + run: node sui/gas-service.js refund 0x2 --amount 1 + + - name: Collect Gas + run: node sui/gas-service.js collectGas --amount 0.1 + + ###### Command: GMP ###### + + ###### Command: Gateway ###### + + ###### Command: Operators ###### + + ###### Command: Multisig ###### + + ###### Command: Operators ###### diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index d773b858..00000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,140 +0,0 @@ -name: Test - -on: pull_request - -jobs: - test: - runs-on: blacksmith-2vcpu-ubuntu-2204 - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Install Node.js - uses: useblacksmith/setup-node@v5 - with: - node-version: 18.x - cache: 'npm' - - - name: Install - run: npm ci - - - name: Spin up Hardhat Network - run: npx hardhat node & - - - name: Prepare local.json - run: | - echo '{ - "chains": { - "test": { - "name": "Test", - "id": "test", - "axelarId": "test", - "chainId": 31337, - "rpc": "http://127.0.0.1:8545", - "tokenSymbol": "TEST", - "contracts": { - "AxelarGasService": { - "collector": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" - }, - "InterchainGovernance": { - "minimumTimeDelay": 3600 - }, - "AxelarServiceGovernance": { - "minimumTimeDelay": 3600, - "multisig": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" - }, - "Multisig": { - "signers": [ - "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", - "0x70997970C51812dc3A010C7d01b50e0d17dc79C8", - "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" - ], - "threshold": 2 - } - } - } - } - }' > ./axelar-chains-config/info/local.json - - # Create .env file with default hardhat private key that's prefunded - - name: Prepare .env - run: | - echo 'PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' >> .env - echo 'ENV=local' >> .env - echo 'CHAINS=test' >> .env - - - name: Display local.json - run: cat ./axelar-chains-config/info/local.json - - - name: Deploy ConstAddressDeployer - run: node evm/deploy-contract.js -c ConstAddressDeployer -m create -y - - - name: Deploy Create3Deployer - run: node evm/deploy-contract.js -c Create3Deployer -m create2 -y - - - name: Deploy AxelarAmplifierGateway - run: node evm/deploy-amplifier-gateway.js --deployMethod create3 -s "AxelarAmplifierGateway v5.8" --owner 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --keyID 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --domainSeparator 0x361b9fa2ae14de79d4b32164841b42ebc840b9d3ddb98cba1a45dc79a13214fc -y - - - name: Deploy AxelarGateway - run: node evm/deploy-gateway-v6.2.x.js --deployMethod create3 -s "AxelarGateway v6.2" --governance 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --mintLimiter 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --keyID 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -y - - - name: Call Method on Gateway - run: node evm/gateway.js --action callContract --destinationChain test2 -y - - - name: Deploy InterchainGovernance using create - run: node evm/deploy-contract.js -c InterchainGovernance -m create -y - - - name: Deploy InterchainGovernance using create2 - run: node evm/deploy-contract.js -c InterchainGovernance -m create2 -y - - - name: Deploy InterchainGovernance using create3 - run: node evm/deploy-contract.js -c InterchainGovernance -m create3 -y - - - name: Transfer gateway governance - run: node evm/gateway.js --action transferGovernance -y - - - name: Generate governance upgrade proposal - run: node evm/governance.js --targetContractName AxelarGateway --action upgrade --proposalAction schedule --date 2100-01-01T12:00:00 - - - name: Deploy AxelarServiceGovernance using create3 - run: node evm/deploy-contract.js -c AxelarServiceGovernance -m create3 -y - - - name: Deploy Multisig using create3 - run: node evm/deploy-contract.js -c Multisig -m create3 -y - - - name: Deploy Operators using create3 - run: node evm/deploy-contract.js -c Operators -m create3 -y - - - name: Deploy AxelarGasService using create2 - run: node evm/deploy-upgradable.js -c AxelarGasService -m create2 -y - - - name: Deploy ITS using create2 - run: node evm/deploy-its.js -s "v1.0.0" -m create2 -y - - - name: Deploy new ITS implementation - run: node evm/deploy-its.js -s "v1.1.0" -m create2 --reuseProxy -y - - - name: Upgrade ITS using create2 - run: node evm/deploy-its.js -m create2 -u -y - - - name: InterchainTokenFactory deploy interchain token on current chain - run: node evm/interchainTokenFactory.js --action deployInterchainToken --name "test" --symbol "TST" --decimals 18 --minter 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --salt "salt" -y - - - name: InterchainTokenService deploy interchain token on current chain - run: node evm/its.js --action deployInterchainToken --name "test" --symbol "TST" --decimals 18 --minter 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 --destinationChain '' --gasValue 0 --salt "salt" -y - - - name: Add gasOptions to local.json - run: | - jq '.chains.test += {"gasOptions": {"gasLimit": 8000000}} | .chains.test.contracts.AxelarGateway += {"gasOptions": {"gasLimit": 8000000}}' ./axelar-chains-config/info/local.json > temp.json && mv temp.json ./axelar-chains-config/info/local.json - - - name: Redeploy AxelarGateway with gasOptions - run: node evm/deploy-gateway-v6.2.x.js -m create3 -s "AxelarGateway v6.2" --governance 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --mintLimiter 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --keyID 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -y - - - name: Redeploy ITS with gasOptions in Chain Config - run: node evm/deploy-its.js -s "v1.0.0" -m create2 -y - - - name: Redeploy ITS with gasOptions override via CLI - run: | - node evm/deploy-its.js -s "v1.0.0" -m create2 -y --gasOptions \ - '{"gasLimit": 9000000,"gasPriceAdjustment": 1.1}' diff --git a/sui/test/commands.test.js b/sui/test/commands.test.js deleted file mode 100644 index b051e403..00000000 --- a/sui/test/commands.test.js +++ /dev/null @@ -1,9 +0,0 @@ -describe('Test Sui Commands', () => { - describe('Deploy Contracts', () => {}); - - describe('Gas Service', () => {}); - - describe('GMP', () => {}); - - describe('Gateway', () => {}); -});