From c027d0f06ed14e96bbedc5cee6af0da0aad2054c Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 10:42:53 -0500 Subject: [PATCH 01/42] add deployment script + adjust some values in utils.js to enable it to work with httpcalls --- .github/workflows/test-stellar.yaml | 215 ++++++++++++++++++++++++++++ stellar/generate-bindings.js | 2 +- stellar/utils.js | 10 +- 3 files changed, 222 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test-stellar.yaml diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml new file mode 100644 index 00000000..c2ba1468 --- /dev/null +++ b/.github/workflows/test-stellar.yaml @@ -0,0 +1,215 @@ +name: Test Stellar + +on: pull_request + +jobs: + check-relevant-changes: + name: Check for Relevant Changes + runs-on: blacksmith-2vcpu-ubuntu-2204 + outputs: + run_tests: ${{ steps.filter.outputs.sui == 'true' || steps.filter.outputs.common == 'true' || steps.filter.outputs.github == 'true' }} + steps: + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + sui: + - 'stellar/**' + common: + - 'common/**' + github: + # - '.github/actions/setup-stellar/**' + - '.github/workflows/test-stellar.yaml' + - name: Summarize Changes + run: | + echo "Changes in stellar: ${{ steps.filter.outputs.sui }}" + echo "Changes in common: ${{ steps.filter.outputs.common }}" + echo "Changes in github: ${{ steps.filter.outputs.github }}" + + test-stellar: + name: Test Stellar + needs: check-relevant-changes + if: ${{ needs.check-relevant-changes.outputs.run_tests == 'true' }} + runs-on: blacksmith-2vcpu-ubuntu-2204 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' # Hardcoded to ensure consistency. + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + shell: bash + run: npm ci + + - name: Install stable toolchain + uses: dtolnay/rust-toolchain + with: + toolchain: 1.81.0 + + - name: Install Stellar CLI + shell: bash + run: | + cargo install --locked stellar-cli --features opt --version ~21 + + - name: Pull stellar/quickstart docker image + run: | + docker pull stellar/quickstart + + - name: Setup Stellar standalone network + run: | + docker run -d --rm -it \ + -p 8000:8000 \ + --name stellar \ + stellar/quickstart:testing \ + --local \ + --enable-soroban-rpc \ + --protocol-version 21 + + RPC_URL="http://localhost:8000" + NETWORK_PASSPHRASE="Standalone Network ; February 2017" + + - name: Add as configured network + run: | + stellar network add standalone \ + --rpc-url $RPC_URL \ + --network-passphrase $NETWORK_PASSPHRASE + + - name: Setup Stellar wallet + run: | + stellar keys generate test \ + --rpc-url $RPC_URL \ + --network-passphrase $NETWORK_PASSPHRASE + STELLAR_PRIVATE_KEY=$(stellar keys show test) + STELLAR_ADDRESS=$(stellar keys address test) + echo "STELLAR_PRIVATE_KEY=${STELLAR_PRIVATE_KEY}" >> $GITHUB_ENV + echo "STELLAR_ADDRESS=${STELLAR_ADDRESS}" >> $GITHUB_ENV + + - name: Prepare local.json + run: | + echo '{ + "chains": { + "stellar": { + "name": "Stellar", + "axelarId": "stellar", + "networkType": "localnet", + "chainType": "stellar", + "tokenSymbol": "XLM", + "rpc": "http://127.0.0.1:8000", + "horizonRpc": "http://127.0.0.1:8000", + "contracts": { + "AxelarGateway": {} + } + } + } + }' > ./axelar-chains-config/info/local.json + + - name: Start Stellar network + run: | + stellar network container start local + + - name: Wait for Stellar network + uses: nev7n/wait_for_response@v1 + with: + url: 'http://localhost:8000' + responseCode: 200 + timeout: 60000 + interval: 1000 + + # Create .env file with default hardhat private key that's prefunded + - name: Prepare .env + run: | + echo "PRIVATE_KEY=STELLAR_PRIVATE_KEY" >> .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 stellar/faucet.js + + ###### Compile Wasm Contracts ###### + + - name: Checkout axelar-cgp-soroban repo + uses: actions/checkout@v4 + with: + repository: axelarnetwork/axelar-cgp-soroban + + - name: Compile WASM contracts + run: | + stellar contract build --manifest-path=axelar-cgp-soroban/Cargo.toml + cd axelar-cgp-soroban + ./optmize.sh + cd .. + WASM_DIR=axelar-cgp-soroban/target/wasm32-unknown-unknown/release + echo "WASM_DIR=${WASM_DIR}" >> $GITHUB_ENV + + ###### Command: Deploy Contract ###### + + - name: Deploy axelar_gateway + run: | + CONTRACT=axelar_gateway + node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --initialize + + - name: Deploy axelar_operators + run: | + CONTRACT=axelar_operators + node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --initialize + + ###### Command: Gateway ###### + # - name: Gateway Approve + # run: | + # node stellar/gateway approve avalanche 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 0x4F4495243837681061C4743b74B3eEdf548D56A5 wallet 0x1234 + + + - name: Gateway Call Contract + run: node stellar/gateway.js call-contract avalanche 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x1234 + + - name: Gateway Rotate Signers + run: | + node stellar/gateway rotate --new-nonce test --signers wallet + node stellar/gateway rotate --new-nonce test2 --current-nonce test --signers wallet + + - name: Upgrade gateway contract + run: | + CONTRACT=axelar_gateway + node stellar/deploy-contract.js upgrade $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm + + ###### Command: Operators ###### + + - name: Store Capability Object in Operators + run: node sui/operators.js storeCap + + - name: Add Operator + run: node sui/operators.js add $SUI_ADDRESS + + - name: Collect Gas with Operator + run: node sui/operators.js collectGas --amount 1 + + - name: Refund Gas with Operator + run: node sui/operators.js refund 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 --amount 1 + + - name: Remove Operator + run: node sui/operators.js remove $SUI_ADDRESS + + ###### Command: Generate Keypair ###### + - name: Generate Keypair + run: node sui/generate-keypair.js + + + ###### Command: Generate Bindings ##### + - name: generate operators bindings + run: | + CONTRACT=axelar_operators + node stellar/generate-bindings.js --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --contract-id $(jq .chains.stellar.contracts.$CONTRACT.address axelar-chains-config/info/local.json) --output-dir ./stellar/bindings/$CONTRACT + + - name: generate gateway bindings + run: | + CONTRACT=axelar_gateway + node stellar/generate-bindings.js --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --contract-id $(jq .chains.stellar.contracts.$CONTRACT.address axelar-chains-config/info/local.json) --output-dir ./stellar/bindings/$CONTRACT diff --git a/stellar/generate-bindings.js b/stellar/generate-bindings.js index aa17f6e4..6708b5a2 100644 --- a/stellar/generate-bindings.js +++ b/stellar/generate-bindings.js @@ -37,7 +37,7 @@ function main() { program.action((options) => { const config = loadConfig(options.env); - processCommand(options, config, config.stellar); + processCommand(options, config, config.chains.stellar); }); program.parse(); diff --git a/stellar/utils.js b/stellar/utils.js index b664365b..3a5f3062 100644 --- a/stellar/utils.js +++ b/stellar/utils.js @@ -24,7 +24,7 @@ const stellarCmd = 'stellar'; function getNetworkPassphrase(networkType) { switch (networkType) { case 'local': - return Networks.SANDBOX; + return Networks.STANDALONE; case 'futurenet': return Networks.FUTURENET; case 'testnet': @@ -147,7 +147,7 @@ async function sendTransaction(tx, server, action, options = {}) { } async function broadcast(operation, wallet, chain, action, options = {}) { - const server = new SorobanRpc.Server(chain.rpc); + const server = new SorobanRpc.Server(chain.rpc, { allowHttp: true }); if (options.estimateCost) { const tx = await buildTransaction(operation, server, wallet, chain.networkType, options); @@ -167,8 +167,10 @@ function getAssetCode(balance, chain) { async function getWallet(chain, options) { const keypair = Keypair.fromSecret(options.privateKey); const address = keypair.publicKey(); - const provider = new SorobanRpc.Server(chain.rpc); - const horizonServer = new Horizon.Server(chain.horizonRpc); + const provider = new SorobanRpc.Server(chain.rpc, { + allowHttp: true, + }); + const horizonServer = new Horizon.Server(chain.horizonRpc, { allowHttp: true }); printInfo('Wallet address', address); const account = await provider.getAccount(address); From 1e7b9558854a78a7b318880ad6b97e01be5f9f84 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 10:50:37 -0500 Subject: [PATCH 02/42] remove unneeded contracts field --- .github/workflows/test-stellar.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index c2ba1468..b4bb8041 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -102,9 +102,7 @@ jobs: "tokenSymbol": "XLM", "rpc": "http://127.0.0.1:8000", "horizonRpc": "http://127.0.0.1:8000", - "contracts": { - "AxelarGateway": {} - } + "contracts": {} } } }' > ./axelar-chains-config/info/local.json From 3994fe1e90d2bc43f42f9cb25e47306318d4ab0e Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 10:51:54 -0500 Subject: [PATCH 03/42] remove unused comment --- .github/workflows/test-stellar.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index b4bb8041..df5c62cc 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -129,9 +129,6 @@ jobs: - name: Display local.json run: cat ./axelar-chains-config/info/local.json - # - name: Request SUI from faucet - # run: node stellar/faucet.js - ###### Compile Wasm Contracts ###### - name: Checkout axelar-cgp-soroban repo From 807da9c2b599cab5ec24c43ffce22929f2ca3de6 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 11:00:45 -0500 Subject: [PATCH 04/42] add operator contract actions --- .github/workflows/test-stellar.yaml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index df5c62cc..01ad7f29 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -158,6 +158,7 @@ jobs: node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --initialize ###### Command: Gateway ###### + # FIXME: # - name: Gateway Approve # run: | # node stellar/gateway approve avalanche 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 0x4F4495243837681061C4743b74B3eEdf548D56A5 wallet 0x1234 @@ -178,20 +179,24 @@ jobs: ###### Command: Operators ###### - - name: Store Capability Object in Operators - run: node sui/operators.js storeCap + - name: Execute is_operator action + run: node stellar/operators.js --action is_operator --args $STELLAR_ADDRESS - - name: Add Operator - run: node sui/operators.js add $SUI_ADDRESS + - name: Execute add_operator action + run: node stellar/operators.js --action add_operator --args $STELLAR_ADDRESS - - name: Collect Gas with Operator - run: node sui/operators.js collectGas --amount 1 + - name: Execute remove_operator action + run: node stellar/operators.js --action remove_operator --args $STELLAR_ADDRESS - - name: Refund Gas with Operator - run: node sui/operators.js refund 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 --amount 1 + - name: Execute refund action + run: node stellar/operators.js --action refund - - name: Remove Operator - run: node sui/operators.js remove $SUI_ADDRESS + - name: Execute execute action + run: node stellar/operators.js --action execute + + # TODO: currently fails + # - name: is_operator with estimate_cost + # run: node stellar/operators.js --action is_operator --args $STELLAR_ADDRESS --estimate-cost ###### Command: Generate Keypair ###### - name: Generate Keypair From 2a8987e227400d112ce4e04688b48d4fd67d5e53 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 11:07:13 -0500 Subject: [PATCH 05/42] remove commented out item --- .github/workflows/test-stellar.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 01ad7f29..db9d1324 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -19,7 +19,6 @@ jobs: common: - 'common/**' github: - # - '.github/actions/setup-stellar/**' - '.github/workflows/test-stellar.yaml' - name: Summarize Changes run: | From d2bed2b20c248a320063993449bff908dd2a5fd0 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 11:11:53 -0500 Subject: [PATCH 06/42] replace all instances of sui with stellar --- .github/workflows/test-stellar.yaml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index db9d1324..d196cf9e 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -7,14 +7,14 @@ jobs: name: Check for Relevant Changes runs-on: blacksmith-2vcpu-ubuntu-2204 outputs: - run_tests: ${{ steps.filter.outputs.sui == 'true' || steps.filter.outputs.common == 'true' || steps.filter.outputs.github == 'true' }} + run_tests: ${{ steps.filter.outputs.stellar == 'true' || steps.filter.outputs.common == 'true' || steps.filter.outputs.github == 'true' }} steps: - uses: actions/checkout@v4 - uses: dorny/paths-filter@v3 id: filter with: filters: | - sui: + stellar: - 'stellar/**' common: - 'common/**' @@ -22,7 +22,7 @@ jobs: - '.github/workflows/test-stellar.yaml' - name: Summarize Changes run: | - echo "Changes in stellar: ${{ steps.filter.outputs.sui }}" + echo "Changes in stellar: ${{ steps.filter.outputs.stellar }}" echo "Changes in common: ${{ steps.filter.outputs.common }}" echo "Changes in github: ${{ steps.filter.outputs.github }}" @@ -197,10 +197,6 @@ jobs: # - name: is_operator with estimate_cost # run: node stellar/operators.js --action is_operator --args $STELLAR_ADDRESS --estimate-cost - ###### Command: Generate Keypair ###### - - name: Generate Keypair - run: node sui/generate-keypair.js - ###### Command: Generate Bindings ##### - name: generate operators bindings From a5d4a25148bc5988c5b2232d0b602ff30b102ed2 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 11:15:00 -0500 Subject: [PATCH 07/42] fix linting complaints --- .github/workflows/test-stellar.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index d196cf9e..444a2936 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -162,7 +162,6 @@ jobs: # run: | # node stellar/gateway approve avalanche 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 0x4F4495243837681061C4743b74B3eEdf548D56A5 wallet 0x1234 - - name: Gateway Call Contract run: node stellar/gateway.js call-contract avalanche 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x1234 @@ -197,7 +196,6 @@ jobs: # - name: is_operator with estimate_cost # run: node stellar/operators.js --action is_operator --args $STELLAR_ADDRESS --estimate-cost - ###### Command: Generate Bindings ##### - name: generate operators bindings run: | From 931d7701b48109521e5a3eb1500b6a279b4c4749 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 11:19:37 -0500 Subject: [PATCH 08/42] modify uses statement .yaml --- .github/workflows/test-stellar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 444a2936..dc7f0d28 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -47,7 +47,7 @@ jobs: run: npm ci - name: Install stable toolchain - uses: dtolnay/rust-toolchain + uses: dtolnay/rust-toolchain@stable with: toolchain: 1.81.0 From 10f26a0658aab6267a7d3b7754f8f2e690c7f7e6 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 11:31:19 -0500 Subject: [PATCH 09/42] make env vars persistent --- .github/workflows/test-stellar.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index dc7f0d28..ce9bb5bd 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -72,6 +72,8 @@ jobs: RPC_URL="http://localhost:8000" NETWORK_PASSPHRASE="Standalone Network ; February 2017" + echo "RPC_URL=${RPC_URL}" >> $GITHUB_ENV + echo "NETWORK_PASSPHRASE=${NETWORK_PASSPHRASE}" >> $GITHUB_ENV - name: Add as configured network run: | From 16f147e761805c96f60b2356c50c7183ff255b21 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 11:47:35 -0500 Subject: [PATCH 10/42] cleanup errors in various commands --- .github/workflows/test-stellar.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index ce9bb5bd..38936479 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -78,14 +78,15 @@ jobs: - name: Add as configured network run: | stellar network add standalone \ - --rpc-url $RPC_URL \ - --network-passphrase $NETWORK_PASSPHRASE + --rpc-url "$RPC_URL" \ + --network-passphrase "$NETWORK_PASSPHRASE" - name: Setup Stellar wallet run: | stellar keys generate test \ - --rpc-url $RPC_URL \ - --network-passphrase $NETWORK_PASSPHRASE + --rpc-url "$RPC_URL" \ + --network-passphrase "$NETWORK_PASSPHRASE" + STELLAR_PRIVATE_KEY=$(stellar keys show test) STELLAR_ADDRESS=$(stellar keys address test) echo "STELLAR_PRIVATE_KEY=${STELLAR_PRIVATE_KEY}" >> $GITHUB_ENV @@ -98,10 +99,10 @@ jobs: "stellar": { "name": "Stellar", "axelarId": "stellar", - "networkType": "localnet", + "networkType": "local", "chainType": "stellar", "tokenSymbol": "XLM", - "rpc": "http://127.0.0.1:8000", + "rpc": "http://127.0.0.1:8000/soroban/rpc", "horizonRpc": "http://127.0.0.1:8000", "contracts": {} } @@ -123,9 +124,8 @@ jobs: # Create .env file with default hardhat private key that's prefunded - name: Prepare .env run: | - echo "PRIVATE_KEY=STELLAR_PRIVATE_KEY" >> .env + echo "PRIVATE_KEY=$STELLAR_PRIVATE_KEY" >> .env echo 'ENV=local' >> .env - # echo 'SKIP_EXISTING = true' >> .env - name: Display local.json run: cat ./axelar-chains-config/info/local.json From 9a692fa1080f41fdb59155ea0a101af09f3fe2cf Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 12:52:55 -0500 Subject: [PATCH 11/42] rename vars + don't double start network the docker container seems to already start the network (port 8000 is taken), so remove that step from the pipeline --- .github/workflows/test-stellar.yaml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 38936479..16521f00 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -70,14 +70,14 @@ jobs: --enable-soroban-rpc \ --protocol-version 21 - RPC_URL="http://localhost:8000" + RPC_URL="http://localhost:8000/soroban/rpc" NETWORK_PASSPHRASE="Standalone Network ; February 2017" echo "RPC_URL=${RPC_URL}" >> $GITHUB_ENV echo "NETWORK_PASSPHRASE=${NETWORK_PASSPHRASE}" >> $GITHUB_ENV - name: Add as configured network run: | - stellar network add standalone \ + stellar network add local \ --rpc-url "$RPC_URL" \ --network-passphrase "$NETWORK_PASSPHRASE" @@ -109,10 +109,6 @@ jobs: } }' > ./axelar-chains-config/info/local.json - - name: Start Stellar network - run: | - stellar network container start local - - name: Wait for Stellar network uses: nev7n/wait_for_response@v1 with: @@ -121,7 +117,6 @@ jobs: timeout: 60000 interval: 1000 - # Create .env file with default hardhat private key that's prefunded - name: Prepare .env run: | echo "PRIVATE_KEY=$STELLAR_PRIVATE_KEY" >> .env @@ -141,7 +136,7 @@ jobs: run: | stellar contract build --manifest-path=axelar-cgp-soroban/Cargo.toml cd axelar-cgp-soroban - ./optmize.sh + ./optimize.sh cd .. WASM_DIR=axelar-cgp-soroban/target/wasm32-unknown-unknown/release echo "WASM_DIR=${WASM_DIR}" >> $GITHUB_ENV From afdf8588fb07c6ba2a8f2db8b24784c07a8a2f07 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 13:12:21 -0500 Subject: [PATCH 12/42] do not wait for network it makes a head request which doesn't work (for some reason). curl -i works, curl -I does not --- .github/workflows/test-stellar.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 16521f00..14837416 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -109,14 +109,6 @@ jobs: } }' > ./axelar-chains-config/info/local.json - - name: Wait for Stellar network - uses: nev7n/wait_for_response@v1 - with: - url: 'http://localhost:8000' - responseCode: 200 - timeout: 60000 - interval: 1000 - - name: Prepare .env run: | echo "PRIVATE_KEY=$STELLAR_PRIVATE_KEY" >> .env From 6ea5983ebd44cb887c1c924e4436ce58974a30ff Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 13:46:56 -0500 Subject: [PATCH 13/42] use binary install to save compilation time --- .github/workflows/test-stellar.yaml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 14837416..f35ddd21 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -34,6 +34,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + path: "." - name: Setup Node.js uses: actions/setup-node@v4 @@ -51,17 +53,24 @@ jobs: with: toolchain: 1.81.0 + # install binary to save lengthy compilation time - name: Install Stellar CLI shell: bash run: | - cargo install --locked stellar-cli --features opt --version ~21 - - - name: Pull stellar/quickstart docker image + # query release page to find URL of the latest release of the soroban-cli tool + URL=$(curl -s https://api.github.com/repos/stellar/stellar-cli/releases/latest | jq -r .assets[].browser_download_url | grep 'soroban.*x86_64-unknown-linux') + wget $URL + tar -xzf $(basename $URL) + mkdir bin + mv soroban bin/ + + # the cargo install defines these as aliases, so mimic that behaviour + ln -s bin/soroban bin/stellar + PATH=$PATH:bin/ + + - name: Setup Stellar local network run: | docker pull stellar/quickstart - - - name: Setup Stellar standalone network - run: | docker run -d --rm -it \ -p 8000:8000 \ --name stellar \ From cca6b78b6a4060a846bf27c5f4223411e00d3555 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 13:56:49 -0500 Subject: [PATCH 14/42] properly set path in gh action --- .github/workflows/test-stellar.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index f35ddd21..958fdb6b 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -53,20 +53,21 @@ jobs: with: toolchain: 1.81.0 - # install binary to save lengthy compilation time + # install binary to avoid lengthy compilation process - name: Install Stellar CLI shell: bash run: | + cargo binstall stellar-cli # query release page to find URL of the latest release of the soroban-cli tool URL=$(curl -s https://api.github.com/repos/stellar/stellar-cli/releases/latest | jq -r .assets[].browser_download_url | grep 'soroban.*x86_64-unknown-linux') - wget $URL + wget -q $URL tar -xzf $(basename $URL) mkdir bin mv soroban bin/ # the cargo install defines these as aliases, so mimic that behaviour ln -s bin/soroban bin/stellar - PATH=$PATH:bin/ + echo "bin" >> $GITHUB_PATH - name: Setup Stellar local network run: | From d31b558fcde72312dce6b225228052f5a9de7f47 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 14:00:00 -0500 Subject: [PATCH 15/42] fix linting error --- .github/workflows/test-stellar.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 958fdb6b..8e9d7ee5 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -35,7 +35,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - path: "." + path: '.' - name: Setup Node.js uses: actions/setup-node@v4 @@ -57,7 +57,6 @@ jobs: - name: Install Stellar CLI shell: bash run: | - cargo binstall stellar-cli # query release page to find URL of the latest release of the soroban-cli tool URL=$(curl -s https://api.github.com/repos/stellar/stellar-cli/releases/latest | jq -r .assets[].browser_download_url | grep 'soroban.*x86_64-unknown-linux') wget -q $URL From 1b864ca0440b299a774a62a6166351a554d1f0e9 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 14:07:40 -0500 Subject: [PATCH 16/42] absolute path for adding to path --- .github/workflows/test-stellar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 8e9d7ee5..07c354cf 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -66,7 +66,7 @@ jobs: # the cargo install defines these as aliases, so mimic that behaviour ln -s bin/soroban bin/stellar - echo "bin" >> $GITHUB_PATH + echo $(readlink -f bin) >> "$GITHUB_PATH" - name: Setup Stellar local network run: | From e621a91cdce62c6712323ccaafdfd26b44ca7798 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 14:16:03 -0500 Subject: [PATCH 17/42] use pwd instead --- .github/workflows/test-stellar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 07c354cf..531078fe 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -66,7 +66,7 @@ jobs: # the cargo install defines these as aliases, so mimic that behaviour ln -s bin/soroban bin/stellar - echo $(readlink -f bin) >> "$GITHUB_PATH" + echo "$PWD/bin" >> "$GITHUB_PATH" - name: Setup Stellar local network run: | From 72e084997429945a5287d9410904beab14672d82 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 14:21:57 -0500 Subject: [PATCH 18/42] cleanup docs + try vague change to make paths work --- .github/workflows/test-stellar.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 531078fe..75eae5f7 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -57,16 +57,21 @@ jobs: - name: Install Stellar CLI shell: bash run: | - # query release page to find URL of the latest release of the soroban-cli tool + # Query latest release from official Stellar repo URL=$(curl -s https://api.github.com/repos/stellar/stellar-cli/releases/latest | jq -r .assets[].browser_download_url | grep 'soroban.*x86_64-unknown-linux') + + # download + extract binary wget -q $URL tar -xzf $(basename $URL) + + # setup bin/ directory mkdir bin mv soroban bin/ # the cargo install defines these as aliases, so mimic that behaviour ln -s bin/soroban bin/stellar - echo "$PWD/bin" >> "$GITHUB_PATH" + + echo "${PWD}/bin" >> "${GITHUB_PATH}" - name: Setup Stellar local network run: | From aa323442d40041d9ac9ce8a3281a883f96b33e2c Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 14:23:49 -0500 Subject: [PATCH 19/42] use github workspace instead --- .github/workflows/test-stellar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 75eae5f7..bf4ba87f 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -71,7 +71,7 @@ jobs: # the cargo install defines these as aliases, so mimic that behaviour ln -s bin/soroban bin/stellar - echo "${PWD}/bin" >> "${GITHUB_PATH}" + echo "$GITHUB_WORKSPACE/bin" >> "${GITHUB_PATH}" - name: Setup Stellar local network run: | From 1d2b132c52ecdadc6e23f3d85ed24582c8dd85f7 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 14:31:19 -0500 Subject: [PATCH 20/42] debugging --- .github/workflows/test-stellar.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index bf4ba87f..0c388063 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -91,6 +91,9 @@ jobs: - name: Add as configured network run: | + ls + echo $GITHUB_PATH + echo $PATH stellar network add local \ --rpc-url "$RPC_URL" \ --network-passphrase "$NETWORK_PASSPHRASE" From 187b2898b67e7796ed808b8e61d213d8f455ca61 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 14:35:10 -0500 Subject: [PATCH 21/42] more debugging --- .github/workflows/test-stellar.yaml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 0c388063..c6d7a3ac 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -73,6 +73,22 @@ jobs: echo "$GITHUB_WORKSPACE/bin" >> "${GITHUB_PATH}" + # test if it works + + stellar --version + + - name: Add as configured network + run: | + ls + ls bin/ + echo $GITHUB_PATH + echo $PATH + echo $PWD + echo $GITHUB_WORKSPACE + stellar network add local \ + --rpc-url "$RPC_URL" \ + --network-passphrase "$NETWORK_PASSPHRASE" + - name: Setup Stellar local network run: | docker pull stellar/quickstart @@ -89,14 +105,6 @@ jobs: echo "RPC_URL=${RPC_URL}" >> $GITHUB_ENV echo "NETWORK_PASSPHRASE=${NETWORK_PASSPHRASE}" >> $GITHUB_ENV - - name: Add as configured network - run: | - ls - echo $GITHUB_PATH - echo $PATH - stellar network add local \ - --rpc-url "$RPC_URL" \ - --network-passphrase "$NETWORK_PASSPHRASE" - name: Setup Stellar wallet run: | From 519380ff33d795c6484e63729d94c8dafdac9fa2 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 14:36:51 -0500 Subject: [PATCH 22/42] remove failing comp --- .github/workflows/test-stellar.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index c6d7a3ac..9f887516 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -73,10 +73,6 @@ jobs: echo "$GITHUB_WORKSPACE/bin" >> "${GITHUB_PATH}" - # test if it works - - stellar --version - - name: Add as configured network run: | ls From 06bf4a766a59cbeef77b5f44d6813750270a99d4 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 14:47:38 -0500 Subject: [PATCH 23/42] just trying anything --- .github/workflows/test-stellar.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 9f887516..a7d1b4c0 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -37,6 +37,11 @@ jobs: with: path: '.' + - name: Checkout axelar-cgp-soroban repo + uses: actions/checkout@v4 + with: + repository: axelarnetwork/axelar-cgp-soroban + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -71,9 +76,12 @@ jobs: # the cargo install defines these as aliases, so mimic that behaviour ln -s bin/soroban bin/stellar - echo "$GITHUB_WORKSPACE/bin" >> "${GITHUB_PATH}" + echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH + echo "$GITHUB_WORKSPACE/bin/stellar" >> $GITHUB_PATH + echo "$GITHUB_WORKSPACE/bin/soroban" >> $GITHUB_PATH - name: Add as configured network + shell: bash run: | ls ls bin/ @@ -140,11 +148,6 @@ jobs: ###### Compile Wasm Contracts ###### - - name: Checkout axelar-cgp-soroban repo - uses: actions/checkout@v4 - with: - repository: axelarnetwork/axelar-cgp-soroban - - name: Compile WASM contracts run: | stellar contract build --manifest-path=axelar-cgp-soroban/Cargo.toml From ccd3cba9a28ffd138dab438a9c168985e886f0ec Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 15:01:08 -0500 Subject: [PATCH 24/42] setup nested repo --- .github/workflows/test-stellar.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index a7d1b4c0..906c596d 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -34,13 +34,12 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - path: '.' - name: Checkout axelar-cgp-soroban repo uses: actions/checkout@v4 with: repository: axelarnetwork/axelar-cgp-soroban + path: axelar-cgp-soroban - name: Setup Node.js uses: actions/setup-node@v4 @@ -109,7 +108,6 @@ jobs: echo "RPC_URL=${RPC_URL}" >> $GITHUB_ENV echo "NETWORK_PASSPHRASE=${NETWORK_PASSPHRASE}" >> $GITHUB_ENV - - name: Setup Stellar wallet run: | stellar keys generate test \ From b73971b36b393a841111afa2a9d5b835e28e2bf8 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 15:04:51 -0500 Subject: [PATCH 25/42] give up on it --- .github/workflows/test-stellar.yaml | 31 ++++++++++++++++------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 906c596d..1facd560 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -79,19 +79,6 @@ jobs: echo "$GITHUB_WORKSPACE/bin/stellar" >> $GITHUB_PATH echo "$GITHUB_WORKSPACE/bin/soroban" >> $GITHUB_PATH - - name: Add as configured network - shell: bash - run: | - ls - ls bin/ - echo $GITHUB_PATH - echo $PATH - echo $PWD - echo $GITHUB_WORKSPACE - stellar network add local \ - --rpc-url "$RPC_URL" \ - --network-passphrase "$NETWORK_PASSPHRASE" - - name: Setup Stellar local network run: | docker pull stellar/quickstart @@ -108,8 +95,17 @@ jobs: echo "RPC_URL=${RPC_URL}" >> $GITHUB_ENV echo "NETWORK_PASSPHRASE=${NETWORK_PASSPHRASE}" >> $GITHUB_ENV + - name: Add as configured network + shell: bash + run: | + PATH=$PATH:$PWD/bin/ + stellar network add local \ + --rpc-url "$RPC_URL" \ + --network-passphrase "$NETWORK_PASSPHRASE" + - name: Setup Stellar wallet run: | + PATH=$PATH:$PWD/bin/ stellar keys generate test \ --rpc-url "$RPC_URL" \ --network-passphrase "$NETWORK_PASSPHRASE" @@ -148,6 +144,7 @@ jobs: - name: Compile WASM contracts run: | + PATH=$PATH:$PWD/bin/ stellar contract build --manifest-path=axelar-cgp-soroban/Cargo.toml cd axelar-cgp-soroban ./optimize.sh @@ -159,11 +156,13 @@ jobs: - name: Deploy axelar_gateway run: | + PATH=$PATH:$PWD/bin/ CONTRACT=axelar_gateway node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --initialize - name: Deploy axelar_operators run: | + PATH=$PATH:$PWD/bin/ CONTRACT=axelar_operators node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --initialize @@ -174,15 +173,19 @@ jobs: # node stellar/gateway approve avalanche 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 0x4F4495243837681061C4743b74B3eEdf548D56A5 wallet 0x1234 - name: Gateway Call Contract - run: node stellar/gateway.js call-contract avalanche 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x1234 + run: | + PATH=$PATH:$PWD/bin/ + node stellar/gateway.js call-contract avalanche 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x1234 - name: Gateway Rotate Signers run: | + PATH=$PATH:$PWD/bin/ node stellar/gateway rotate --new-nonce test --signers wallet node stellar/gateway rotate --new-nonce test2 --current-nonce test --signers wallet - name: Upgrade gateway contract run: | + PATH=$PATH:$PWD/bin/ CONTRACT=axelar_gateway node stellar/deploy-contract.js upgrade $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm From e44d82cb7ef054f9de7881a86322ee360735d10d Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 15:18:46 -0500 Subject: [PATCH 26/42] don't use relative path for symlink --- .github/workflows/test-stellar.yaml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 1facd560..09d3b97c 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -73,11 +73,9 @@ jobs: mv soroban bin/ # the cargo install defines these as aliases, so mimic that behaviour - ln -s bin/soroban bin/stellar + ln -s $PWD/bin/soroban bin/stellar echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH - echo "$GITHUB_WORKSPACE/bin/stellar" >> $GITHUB_PATH - echo "$GITHUB_WORKSPACE/bin/soroban" >> $GITHUB_PATH - name: Setup Stellar local network run: | @@ -98,14 +96,12 @@ jobs: - name: Add as configured network shell: bash run: | - PATH=$PATH:$PWD/bin/ stellar network add local \ --rpc-url "$RPC_URL" \ --network-passphrase "$NETWORK_PASSPHRASE" - name: Setup Stellar wallet run: | - PATH=$PATH:$PWD/bin/ stellar keys generate test \ --rpc-url "$RPC_URL" \ --network-passphrase "$NETWORK_PASSPHRASE" @@ -144,7 +140,6 @@ jobs: - name: Compile WASM contracts run: | - PATH=$PATH:$PWD/bin/ stellar contract build --manifest-path=axelar-cgp-soroban/Cargo.toml cd axelar-cgp-soroban ./optimize.sh @@ -156,13 +151,11 @@ jobs: - name: Deploy axelar_gateway run: | - PATH=$PATH:$PWD/bin/ CONTRACT=axelar_gateway node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --initialize - name: Deploy axelar_operators run: | - PATH=$PATH:$PWD/bin/ CONTRACT=axelar_operators node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --initialize @@ -173,19 +166,15 @@ jobs: # node stellar/gateway approve avalanche 0x32034b47cb29d162d9d803cc405356f4ac0ec07fe847ace431385fe8acf3e6e5-2 0x4F4495243837681061C4743b74B3eEdf548D56A5 wallet 0x1234 - name: Gateway Call Contract - run: | - PATH=$PATH:$PWD/bin/ - node stellar/gateway.js call-contract avalanche 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x1234 + run: node stellar/gateway.js call-contract avalanche 0x4F4495243837681061C4743b74B3eEdf548D56A5 0x1234 - name: Gateway Rotate Signers run: | - PATH=$PATH:$PWD/bin/ node stellar/gateway rotate --new-nonce test --signers wallet node stellar/gateway rotate --new-nonce test2 --current-nonce test --signers wallet - name: Upgrade gateway contract run: | - PATH=$PATH:$PWD/bin/ CONTRACT=axelar_gateway node stellar/deploy-contract.js upgrade $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm From bc86cd1f078d25f5942ddea9977e9725adc4d0d9 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 15:22:00 -0500 Subject: [PATCH 27/42] add missing target for rust + docs --- .github/workflows/test-stellar.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 09d3b97c..10866c0b 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -32,6 +32,12 @@ jobs: if: ${{ needs.check-relevant-changes.outputs.run_tests == 'true' }} runs-on: blacksmith-2vcpu-ubuntu-2204 steps: + + # this sets up nested repos: https://github.com/actions/checkout?tab=readme-ov-file#checkout-multiple-repos-nested + # axelar-contract-deployments + # - axelar-cgp-soroban + # + # future steps depend on this directory structure - name: Checkout code uses: actions/checkout@v4 @@ -56,6 +62,7 @@ jobs: uses: dtolnay/rust-toolchain@stable with: toolchain: 1.81.0 + targets: wasm32-unknown-unknown # install binary to avoid lengthy compilation process - name: Install Stellar CLI From 84ff7635ead259d8d8368d42ed4680cd1d591060 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 15:31:33 -0500 Subject: [PATCH 28/42] inspect .env --- .github/workflows/test-stellar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 10866c0b..2b0a6222 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -32,7 +32,6 @@ jobs: if: ${{ needs.check-relevant-changes.outputs.run_tests == 'true' }} runs-on: blacksmith-2vcpu-ubuntu-2204 steps: - # this sets up nested repos: https://github.com/actions/checkout?tab=readme-ov-file#checkout-multiple-repos-nested # axelar-contract-deployments # - axelar-cgp-soroban @@ -153,6 +152,7 @@ jobs: cd .. WASM_DIR=axelar-cgp-soroban/target/wasm32-unknown-unknown/release echo "WASM_DIR=${WASM_DIR}" >> $GITHUB_ENV + cat .env ###### Command: Deploy Contract ###### From 3b65c214d9f3ca899f6ceb493fd625f1c5f7db04 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 16:18:10 -0500 Subject: [PATCH 29/42] switch order around --- .github/workflows/test-stellar.yaml | 34 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 2b0a6222..2d06aaf8 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -106,17 +106,6 @@ jobs: --rpc-url "$RPC_URL" \ --network-passphrase "$NETWORK_PASSPHRASE" - - name: Setup Stellar wallet - run: | - stellar keys generate test \ - --rpc-url "$RPC_URL" \ - --network-passphrase "$NETWORK_PASSPHRASE" - - STELLAR_PRIVATE_KEY=$(stellar keys show test) - STELLAR_ADDRESS=$(stellar keys address test) - echo "STELLAR_PRIVATE_KEY=${STELLAR_PRIVATE_KEY}" >> $GITHUB_ENV - echo "STELLAR_ADDRESS=${STELLAR_ADDRESS}" >> $GITHUB_ENV - - name: Prepare local.json run: | echo '{ @@ -134,11 +123,6 @@ jobs: } }' > ./axelar-chains-config/info/local.json - - name: Prepare .env - run: | - echo "PRIVATE_KEY=$STELLAR_PRIVATE_KEY" >> .env - echo 'ENV=local' >> .env - - name: Display local.json run: cat ./axelar-chains-config/info/local.json @@ -152,10 +136,24 @@ jobs: cd .. WASM_DIR=axelar-cgp-soroban/target/wasm32-unknown-unknown/release echo "WASM_DIR=${WASM_DIR}" >> $GITHUB_ENV - cat .env - ###### Command: Deploy Contract ###### + - name: Setup Stellar wallet + run: | + stellar keys generate test \ + --rpc-url "$RPC_URL" \ + --network-passphrase "$NETWORK_PASSPHRASE" + + STELLAR_PRIVATE_KEY=$(stellar keys show test) + STELLAR_ADDRESS=$(stellar keys address test) + echo "STELLAR_PRIVATE_KEY=${STELLAR_PRIVATE_KEY}" >> $GITHUB_ENV + echo "STELLAR_ADDRESS=${STELLAR_ADDRESS}" >> $GITHUB_ENV + - name: Prepare .env + run: | + echo "PRIVATE_KEY = '$STELLAR_PRIVATE_KEY'" >> .env + echo "ENV = 'local'" >> .env + + ###### Command: Deploy Contract ###### - name: Deploy axelar_gateway run: | CONTRACT=axelar_gateway From 7df3f61ecad1b00f8f35df9c4b03eef087dce844 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 16:50:28 -0500 Subject: [PATCH 30/42] yes env to skip confirmation --- .github/workflows/test-stellar.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 2d06aaf8..8e10d439 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -152,6 +152,7 @@ jobs: run: | echo "PRIVATE_KEY = '$STELLAR_PRIVATE_KEY'" >> .env echo "ENV = 'local'" >> .env + echo "YES = 'true'" ###### Command: Deploy Contract ###### - name: Deploy axelar_gateway From 76e910c31ed1d846cf236a9816976872c6fe1474 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 16:56:07 -0500 Subject: [PATCH 31/42] put it in the env --- .github/workflows/test-stellar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 8e10d439..9f092074 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -152,7 +152,7 @@ jobs: run: | echo "PRIVATE_KEY = '$STELLAR_PRIVATE_KEY'" >> .env echo "ENV = 'local'" >> .env - echo "YES = 'true'" + echo "YES = 'true'" >> .env ###### Command: Deploy Contract ###### - name: Deploy axelar_gateway From 56bbf73502e674e460abe274d5429fd89526c008 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 7 Nov 2024 17:16:33 -0500 Subject: [PATCH 32/42] comment out misbehaving lines --- .github/workflows/test-stellar.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 9f092074..f05438dc 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -195,11 +195,13 @@ jobs: - name: Execute remove_operator action run: node stellar/operators.js --action remove_operator --args $STELLAR_ADDRESS - - name: Execute refund action - run: node stellar/operators.js --action refund + # TODO: needs gas-service contract + # - name: Execute refund action + # run: node stellar/operators.js --action refund - - name: Execute execute action - run: node stellar/operators.js --action execute + # FIXME: find proper way to execute this + # - name: Execute execute action + # run: node stellar/operators.js --action execute --target $STELLAR_ADDRESS --method "is_operator" # TODO: currently fails # - name: is_operator with estimate_cost From 09dcf8ab13d7b48b53644e731447f5fd5cabd8c4 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Mon, 25 Nov 2024 11:22:51 -0500 Subject: [PATCH 33/42] update protocol version --- .github/workflows/test-stellar.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index f05438dc..c9735bc2 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -33,6 +33,7 @@ jobs: runs-on: blacksmith-2vcpu-ubuntu-2204 steps: # this sets up nested repos: https://github.com/actions/checkout?tab=readme-ov-file#checkout-multiple-repos-nested + # # axelar-contract-deployments # - axelar-cgp-soroban # @@ -92,7 +93,7 @@ jobs: stellar/quickstart:testing \ --local \ --enable-soroban-rpc \ - --protocol-version 21 + --protocol-version 22 RPC_URL="http://localhost:8000/soroban/rpc" NETWORK_PASSPHRASE="Standalone Network ; February 2017" From b92c7ae6133e32c08110b42bd30f2285e8ff3c0b Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Mon, 25 Nov 2024 11:46:47 -0500 Subject: [PATCH 34/42] add explicit funding for stellar wallet eventually `generate` will not fund by default, so do it manually + depend on the faucet to do so --- .github/workflows/test-stellar.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index c9735bc2..b82dac1b 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -132,9 +132,11 @@ jobs: - name: Compile WASM contracts run: | stellar contract build --manifest-path=axelar-cgp-soroban/Cargo.toml + cd axelar-cgp-soroban ./optimize.sh cd .. + WASM_DIR=axelar-cgp-soroban/target/wasm32-unknown-unknown/release echo "WASM_DIR=${WASM_DIR}" >> $GITHUB_ENV @@ -149,6 +151,9 @@ jobs: echo "STELLAR_PRIVATE_KEY=${STELLAR_PRIVATE_KEY}" >> $GITHUB_ENV echo "STELLAR_ADDRESS=${STELLAR_ADDRESS}" >> $GITHUB_ENV + - name: Fund Stellar wallet + run: node stellar/faucet --recipient $STELLAR_ADDRESS + - name: Prepare .env run: | echo "PRIVATE_KEY = '$STELLAR_PRIVATE_KEY'" >> .env From 38227fa5a23974bdb9e76d30d702ca274486def6 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Mon, 25 Nov 2024 14:51:56 -0500 Subject: [PATCH 35/42] pull stellar not soroban --- .github/workflows/test-stellar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index b82dac1b..1f283fd0 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -69,7 +69,7 @@ jobs: shell: bash run: | # Query latest release from official Stellar repo - URL=$(curl -s https://api.github.com/repos/stellar/stellar-cli/releases/latest | jq -r .assets[].browser_download_url | grep 'soroban.*x86_64-unknown-linux') + URL=$(curl -s https://api.github.com/repos/stellar/stellar-cli/releases/latest | jq -r .assets[].browser_download_url | grep 'stellar.*x86_64-unknown-linux') # download + extract binary wget -q $URL From 4f3d91096f8c87a05be93d6e342685fe6540ccdd Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Tue, 26 Nov 2024 10:08:18 -0500 Subject: [PATCH 36/42] install sellar cli properly --- .github/workflows/test-stellar.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 1f283fd0..e0ea6027 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -68,6 +68,10 @@ jobs: - name: Install Stellar CLI shell: bash run: | + # setup bin/ directory + mkdir bin + cd bin + # Query latest release from official Stellar repo URL=$(curl -s https://api.github.com/repos/stellar/stellar-cli/releases/latest | jq -r .assets[].browser_download_url | grep 'stellar.*x86_64-unknown-linux') @@ -75,13 +79,6 @@ jobs: wget -q $URL tar -xzf $(basename $URL) - # setup bin/ directory - mkdir bin - mv soroban bin/ - - # the cargo install defines these as aliases, so mimic that behaviour - ln -s $PWD/bin/soroban bin/stellar - echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH - name: Setup Stellar local network From 59462c48cb1c64f8d46e3f1e56b29994a1719eb2 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Wed, 11 Dec 2024 11:07:14 -0500 Subject: [PATCH 37/42] accomodate pulling from CF --- .github/workflows/test-stellar.yaml | 30 +++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index e0ea6027..8fb830a6 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -124,17 +124,31 @@ jobs: - name: Display local.json run: cat ./axelar-chains-config/info/local.json - ###### Compile Wasm Contracts ###### - - - name: Compile WASM contracts + ###### Acquire WASM Contracts ###### + - name: Configure CF credentials + run: | + cd $HOME; mkdir ~/.aws; touch ~/.aws/credentials; touch ~/.aws/config + echo "[default] + aws_access_key_id = ${{ secrets.cf-bucket-access-key-id }} + aws_secret_access_key = ${{ secrets.cf-bucket-secret-access-key }}" > ~/.aws/credentials + echo "[default] + region=auto + output=json" > ~/.aws/config + + - name: Fetch WASM contracts from CF + env: + S3_BUCKET_NAME: ${{ vars.CF_BUCKET_NAME }} + ENDPOINT_URL: ${{ secrets.cf-endpoint-url }} + CF_BUCKET_ROOT_KEY: ${{ vars.CF_BUCKET_ROOT_KEY }} run: | - stellar contract build --manifest-path=axelar-cgp-soroban/Cargo.toml + export CF_WASM_BUCKET_ROOT_KEY="${CF_BUCKET_ROOT_KEY}/${{ env.PACKAGE_NAME }}/${{ env.PACKAGE_VERSION }}/wasm" + for name in axelar_gateway axelar_operators axelar_gas_service; do + aws s3api get-object --bucket $S3_BUCKET_NAME --key "$CF_WASM_BUCKET_ROOT_KEY/$FILE_KEY" --body "$name.optimized.wasm" --acl public-read --endpoint-url $ENDPOINT_URL + done - cd axelar-cgp-soroban - ./optimize.sh - cd .. + ls - WASM_DIR=axelar-cgp-soroban/target/wasm32-unknown-unknown/release + WASM_DIR=./ echo "WASM_DIR=${WASM_DIR}" >> $GITHUB_ENV - name: Setup Stellar wallet From e06b235e979b5abe792a594f1390e8c745f51be7 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Fri, 13 Dec 2024 11:04:08 -0500 Subject: [PATCH 38/42] add version file + update for changes --- .github/workflows/test-stellar.yaml | 6 ++++-- stellar/version | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 stellar/version diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 8fb830a6..65c6760d 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -141,9 +141,11 @@ jobs: ENDPOINT_URL: ${{ secrets.cf-endpoint-url }} CF_BUCKET_ROOT_KEY: ${{ vars.CF_BUCKET_ROOT_KEY }} run: | - export CF_WASM_BUCKET_ROOT_KEY="${CF_BUCKET_ROOT_KEY}/${{ env.PACKAGE_NAME }}/${{ env.PACKAGE_VERSION }}/wasm" + PACKAGE_VERSION=${cat stellar/version} for name in axelar_gateway axelar_operators axelar_gas_service; do - aws s3api get-object --bucket $S3_BUCKET_NAME --key "$CF_WASM_BUCKET_ROOT_KEY/$FILE_KEY" --body "$name.optimized.wasm" --acl public-read --endpoint-url $ENDPOINT_URL + CF_WASM_BUCKET_ROOT_KEY="${CF_BUCKET_ROOT_KEY}/$name/$PACKAGE_VERSION/wasm" + FILE_KEY=axelar-cgp-soroban-wasm-$name-$PACKAGE_VERSION + aws s3api get-object --bucket $S3_BUCKET_NAME --key "$CF_WASM_BUCKET_ROOT_KEY/$FILE_KEY" --acl public-read --endpoint-url $ENDPOINT_URL done ls diff --git a/stellar/version b/stellar/version new file mode 100644 index 00000000..7da0a952 --- /dev/null +++ b/stellar/version @@ -0,0 +1 @@ +a90ac0b9d2d66533f32df8a9e5e15e483ec59c5d From e6533e20514a498d8e0bd86c27af1bd3f92be590 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Fri, 13 Dec 2024 11:08:12 -0500 Subject: [PATCH 39/42] remove --initialize --- .github/workflows/test-stellar.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 65c6760d..d698a926 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -177,12 +177,12 @@ jobs: - name: Deploy axelar_gateway run: | CONTRACT=axelar_gateway - node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --initialize + node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm - name: Deploy axelar_operators run: | CONTRACT=axelar_operators - node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm --initialize + node stellar/deploy-contract deploy $CONTRACT --wasm-path $WASM_DIR/$CONTRACT.optimized.wasm ###### Command: Gateway ###### # FIXME: From 66db0f755d2766f3374a3606c50f3a0f8410cc2b Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Fri, 13 Dec 2024 11:08:59 -0500 Subject: [PATCH 40/42] add more contract names --- .github/workflows/test-stellar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index d698a926..7a3cc472 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -142,7 +142,7 @@ jobs: CF_BUCKET_ROOT_KEY: ${{ vars.CF_BUCKET_ROOT_KEY }} run: | PACKAGE_VERSION=${cat stellar/version} - for name in axelar_gateway axelar_operators axelar_gas_service; do + for name in axelar_gateway axelar_operators axelar_gas_service interchain_token interchain_token_service example; do CF_WASM_BUCKET_ROOT_KEY="${CF_BUCKET_ROOT_KEY}/$name/$PACKAGE_VERSION/wasm" FILE_KEY=axelar-cgp-soroban-wasm-$name-$PACKAGE_VERSION aws s3api get-object --bucket $S3_BUCKET_NAME --key "$CF_WASM_BUCKET_ROOT_KEY/$FILE_KEY" --acl public-read --endpoint-url $ENDPOINT_URL From dcd889e22c58f167f3347ba571a53a9391310a50 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 19 Dec 2024 11:42:48 -0500 Subject: [PATCH 41/42] named variable + use () for cat --- .github/workflows/test-stellar.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 7a3cc472..7e3bb85d 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -141,8 +141,9 @@ jobs: ENDPOINT_URL: ${{ secrets.cf-endpoint-url }} CF_BUCKET_ROOT_KEY: ${{ vars.CF_BUCKET_ROOT_KEY }} run: | - PACKAGE_VERSION=${cat stellar/version} - for name in axelar_gateway axelar_operators axelar_gas_service interchain_token interchain_token_service example; do + PACKAGE_VERSION=$(cat stellar/version) + CONTRACTS=("axelar_gateway" "axelar_operators" "axelar_gas_service" "interchain_token" "interchain_token_service" "example") + for name in CONTRACTS; do CF_WASM_BUCKET_ROOT_KEY="${CF_BUCKET_ROOT_KEY}/$name/$PACKAGE_VERSION/wasm" FILE_KEY=axelar-cgp-soroban-wasm-$name-$PACKAGE_VERSION aws s3api get-object --bucket $S3_BUCKET_NAME --key "$CF_WASM_BUCKET_ROOT_KEY/$FILE_KEY" --acl public-read --endpoint-url $ENDPOINT_URL From abd26c1858ce9559aca390f87af1e949abe43eb7 Mon Sep 17 00:00:00 2001 From: Laith Bahodi Date: Thu, 19 Dec 2024 11:46:34 -0500 Subject: [PATCH 42/42] same variable formatting --- .github/workflows/test-stellar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-stellar.yaml b/.github/workflows/test-stellar.yaml index 7e3bb85d..e8f04434 100644 --- a/.github/workflows/test-stellar.yaml +++ b/.github/workflows/test-stellar.yaml @@ -138,7 +138,7 @@ jobs: - name: Fetch WASM contracts from CF env: S3_BUCKET_NAME: ${{ vars.CF_BUCKET_NAME }} - ENDPOINT_URL: ${{ secrets.cf-endpoint-url }} + ENDPOINT_URL: ${{ secrets.CF-ENDPOINT-URL }} CF_BUCKET_ROOT_KEY: ${{ vars.CF_BUCKET_ROOT_KEY }} run: | PACKAGE_VERSION=$(cat stellar/version)