Skip to content

Commit

Permalink
feat: testing (#61)
Browse files Browse the repository at this point in the history
* saving progress

* added the transaction builder

* lint and prettier

* added object cache

* fixed some bugs

* added some structs, adding squid structs next

* added all the move types

* fix an error

* prettier

* adding publish options in TxBuilder

* fixed some issues after testing

* add ts of relevant utils

* use npx tsc instead

* run compile properly

* remove previous scripts

* add an index.ts

* fix imports

* update bcs pure types

* remove last change as it does not work

* add address to bcs

* shorten typeName calculation as per euro's request

* prettier

* add run.sh back

* add coverage.sh back

* get eslint to work

* prettier

* allow execution of scripts

* stash

* stash

* added deployment test

* fix package scripts

* prettier and include mocha

* remove .env dependancy

* added a test to rotate signers

* Add a revert util and test

* prettier

* run imp i to fix tests

* update with a event detecting utils

* seperate tests

* make lint happy

* made lint happy

* update package-lock

---------

Co-authored-by: Milap Sheth <[email protected]>
  • Loading branch information
Foivos and milapsheth authored Jul 10, 2024
1 parent 5788ac4 commit 9e77328
Show file tree
Hide file tree
Showing 18 changed files with 1,938 additions and 700 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"mocha": true
},
"rules": {
"no-unused-expressions": "off"
"no-unused-expressions": "off",
"@typescript-eslint/no-var-requires": "off",
}
}
82 changes: 82 additions & 0 deletions .github/workflows/test-js.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Javascript Tests

on:
pull_request:
push:
branches:
- main
- releases/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
SUI_VERSION: mainnet-v1.25.3

jobs:
test-js:
runs-on: ubuntu-latest

steps:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev
- name: Cache Sui binaries
id: cache-sui
uses: actions/cache/restore@v4
with:
path: sui-binaries-skip/
key: sui-${{ env.SUI_VERSION }}

- name: Download and Install Sui
if: steps.cache-sui.outputs.cache-hit != 'true'
run: |
curl -L -o sui-${SUI_VERSION}-ubuntu-x86_64.tgz https://github.com/MystenLabs/sui/releases/download/${SUI_VERSION}/sui-${SUI_VERSION}-ubuntu-x86_64.tgz
tar -xvf sui-${SUI_VERSION}-ubuntu-x86_64.tgz
mkdir -p sui-binaries
mv ./sui ./sui-binaries/
mv ./sui-debug ./sui-binaries/
mv ./sui-test-validator ./sui-binaries/
rm -rf sui-${SUI_VERSION}-ubuntu-x86_64.tgz
- name: Save Sui binaries
if: steps.cache-sui.outputs.cache-hit != 'true'
id: cache-sui-save
uses: actions/cache/save@v4
with:
path: sui-binaries/
key: ${{ steps.cache-sui.outputs.cache-primary-key }}

- name: Add Sui binaries to PATH
run: |
sudo cp ./sui-binaries/sui /usr/local/bin/sui
sudo cp ./sui-binaries/sui-debug /usr/local/bin/sui-debug
sudo cp ./sui-binaries/sui-test-validator /usr/local/bin/sui-test-validator
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Run Localnet
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: Test
run: npm run test-js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Move Tests

on:
pull_request:
Expand All @@ -15,7 +15,7 @@ env:
SUI_VERSION: mainnet-v1.25.3

jobs:
test:
test-move:
runs-on: ubuntu-latest

steps:
Expand Down
3 changes: 3 additions & 0 deletions .mocharc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exit: true
spec: test/**/*.js
timeout: 300000
1 change: 1 addition & 0 deletions move/axelar_gateway/Move.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "AxelarGateway"
version = "0.1.0"
published-at = "0xe44f3fb828db14a0dd991de2aed9c987ee49faf7c31bf819b986a058a38e9935"
edition = "2024.beta"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion move/gas_service/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "C1DEC087FF16954984395BB68E2E81D4A38E64A7F0BAB88AAF73A121C563E2D4"
manifest_digest = "A020C8D244BDE64D6F5F3107506F682AEA99E933953DE1FB01352999724E43EB"
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
dependencies = [
{ name = "Sui" },
Expand Down
3 changes: 2 additions & 1 deletion move/gas_service/Move.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
[package]
name = "GasService"
version = "0.1.0"
published-at = "0x9249adc3fac09edb21a0848af2ccf4901ffb3689124bc91d67bc613903ca643c"
edition = "2024.beta"

[dependencies]
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.25.3" }

[addresses]
gas_service = "0x105"
gas_service = "0x9249adc3fac09edb21a0848af2ccf4901ffb3689124bc91d67bc613903ca643c"
2 changes: 1 addition & 1 deletion move/governance/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "4F26118CD341A5D382F6D63184C33AE0DEFBC380DA34B844908B98C7C2B228D9"
manifest_digest = "9DC4C192CAEBB80F2FBB1DC3CCEC7F9714E98AF18EBC9396F08BDB826A59E4F3"
deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3"
dependencies = [
{ name = "Abi" },
Expand Down
3 changes: 2 additions & 1 deletion move/governance/Move.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "Governance"
version = "0.1.0"
published-at = "0x0cba440261d721bde9c85eafe18aae673ee72702fa95da567675b34224f5ad77"
edition = "2024.beta"

[dependencies]
Expand All @@ -9,4 +10,4 @@ AxelarGateway = { local = "../axelar_gateway" }
Abi = { local = "../abi" }

[addresses]
governance = "0x101"
governance = "0x0cba440261d721bde9c85eafe18aae673ee72702fa95da567675b34224f5ad77"
2 changes: 1 addition & 1 deletion move/its/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "8EB070D5A26ADEEBB191384EDCD8FE28EE8539D051B47C110ACB2E1BC0675B6A"
manifest_digest = "C47498B72EFC749BF4D0D66D86BC3702ADBFBD16CF406FA05127DAD55FBE28C4"
deps_digest = "060AD7E57DFB13104F21BE5F5C3759D03F0553FC3229247D9A7A6B45F50D03A3"
dependencies = [
{ name = "AxelarGateway" },
Expand Down
3 changes: 2 additions & 1 deletion move/its/Move.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "ITS"
version = "0.1.0"
published-at = "0x89967fea5cc3bdf2d44cabe901aca920aa2a0485ca9a479f9932814c55d5f9b3"
edition = "2024.beta"

[dependencies]
Expand All @@ -9,4 +10,4 @@ AxelarGateway = { local = "../axelar_gateway" }
Governance = { local = "../governance" }

[addresses]
its = "0x102"
its = "0x89967fea5cc3bdf2d44cabe901aca920aa2a0485ca9a479f9932814c55d5f9b3"
2 changes: 1 addition & 1 deletion move/squid/Move.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[move]
version = 2
manifest_digest = "9568F12CBDAE1FD019A32A5F77C0B7CF8038887E8FAFE61D45CD75757251E932"
manifest_digest = "384A3D94552582FBDD012034F0BE9AC30A837A35416FCCFBA340F7C3597FB0D3"
deps_digest = "F9B494B64F0615AED0E98FC12A85B85ECD2BC5185C22D30E7F67786BB52E507C"
dependencies = [
{ name = "AxelarGateway" },
Expand Down
3 changes: 2 additions & 1 deletion move/squid/Move.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "Squid"
version = "0.1.0"
published-at = "0x742acc52f94b86d3a2a4fdc39b1e0d75812f05253f88443754326c1e31cae873"
edition = "2024.beta"

[dependencies]
Expand All @@ -10,4 +11,4 @@ AxelarGateway = { local = "../axelar_gateway" }
ITS = { local = "../its" }

[addresses]
squid = "0x104"
squid = "0x742acc52f94b86d3a2a4fdc39b1e0d75812f05253f88443754326c1e31cae873"
Loading

0 comments on commit 9e77328

Please sign in to comment.