Skip to content

chore(orchestration): create scaffold for swap anything asyncFlow #11304

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
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
13 changes: 13 additions & 0 deletions .github/workflows/multichain-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:
- orchestration-staking-hermes
- orchestration-queries-go-relayer
- orchestration-queries-hermes
- swap-on-osmosis
workflow_call:

jobs:
Expand Down Expand Up @@ -106,3 +107,15 @@ jobs:
config: config.yaml
test_command: yarn test:queries
test_suite_name: orchestration-queries-hermes

swap-on-osmosis:
name: Swap on Osmosis XCS contract
if: |
github.event_name == 'workflow_call' ||
github.event_name == 'pull_request' ||
(github.event_name == 'workflow_dispatch' && inputs.test_type == 'swap-on-osmosis')
uses: ./.github/workflows/multichain-e2e-template.yml
Copy link
Member

Choose a reason for hiding this comment

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

so this starts another set of nodes? How long does that take? It appears that landing this would slow down ci for all PRs going forward. Can you estimate how much?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The Swap on Osmosis XCS contract job takes proximally 21 minutes
https://github.com/Agoric/agoric-sdk/actions/runs/15276953486/job/42965699219?pr=11304

Copy link
Member

Choose a reason for hiding this comment

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

Does it run in parallel with other jobs? Or in series?

p.s. I see it runs in parallel.

with:
config: config.xcs-swap-anything.yaml
test_command: yarn test:xcs
test_suite_name: swap-on-osmosis
4 changes: 4 additions & 0 deletions multichain-testing/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ start*
eval-*
# ci logs for archive upload
logs/
# osmosis xcs configuration
*-pool-config.json
wasm-artifacts/
xcs-contracts-info.json
1 change: 1 addition & 0 deletions multichain-testing/ava.rest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export default {
'!test/fast-usdc/**/*.test.*',
'!test/queries/**/*.test.*',
'!test/staking/**/*.test.*',
'!test/xcs-swap-anything/**/*.test.*',
],
};
1 change: 1 addition & 0 deletions multichain-testing/ava.staking.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import mainConfig from './ava.config.js';
export default {
...mainConfig,
files: ['test/staking/**/*.test.ts'],
timeout: '300s',
};
6 changes: 6 additions & 0 deletions multichain-testing/ava.xcs.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import mainConfig from './ava.config.js';

export default {
...mainConfig,
files: ['test/xcs-swap-anything/**/*.test.ts'],
};
125 changes: 125 additions & 0 deletions multichain-testing/config.xcs-swap-anything.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: agoric-multichain-testing
version: 0.2.20

chains:
- id: agoriclocal
name: agoric
image: ghcr.io/agoric/agoric-sdk:dev
numValidators: 1
env:
- name: DEBUG
value: SwingSet:vat,SwingSet:ls
genesis:
app_state:
staking:
params:
unbonding_time: '2m'
swingset:
params:
bootstrap_vat_config: '@agoric/vm-config/decentral-itest-orchestration-chains-config.json'
Copy link
Member

Choose a reason for hiding this comment

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

why the -chains- config?

config.yaml and the others use decentral-itest-orchestration-config.json.

scripts:
updateConfig:
file: scripts/update-config.sh
faucet:
enabled: true
type: starship
ports:
rest: 1317
rpc: 26657
exposer: 38087
grpc: 9090
faucet: 8082
resources:
cpu: 1
memory: 4Gi
- id: osmosislocal
name: osmosis
numValidators: 1
genesis:
app_state:
staking:
params:
unbonding_time: '2m'
interchain_accounts:
host_genesis_state:
params:
host_enabled: true
allow_messages: ['*']
interchainquery:
host_port: 'icqhost'
params:
host_enabled: true
allow_queries:
- /cosmos.bank.v1beta1.Query/Balance
- /cosmos.bank.v1beta1.Query/AllBalances
scripts:
updateConfig:
file: scripts/update-config-logs.sh
faucet:
enabled: true
type: starship
ports:
rest: 1315
rpc: 26655
grpc: 9093
faucet: 8084
resources:
cpu: 1
memory: 1Gi
- id: cosmoshublocal
name: cosmoshub
numValidators: 1
genesis:
app_state:
staking:
params:
unbonding_time: '2m'
interchain_accounts:
host_genesis_state:
params:
host_enabled: true
allow_messages: ['*']
faucet:
enabled: true
type: starship
ports:
rest: 1314
rpc: 26654
grpc: 9092
faucet: 8083
resources:
cpu: 1
memory: 1Gi

relayers:
- name: osmosis-cosmoshub
type: hermes
replicas: 1
chains:
- osmosislocal
- cosmoshublocal
- name: agoric-osmosis
type: hermes
replicas: 1
chains:
- agoriclocal
- osmosislocal
config:
global:
log_level: 'debug'
telemetry:
enabled: true
- name: agoric-cosmoshub
type: hermes
replicas: 1
chains:
- agoriclocal
- cosmoshublocal

explorer:
enabled: false

registry:
enabled: true
ports:
rest: 8081
9 changes: 6 additions & 3 deletions multichain-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
"test:main": "ava --config ava.rest.config.js",
"test:fast-usdc": "ava --config ava.fusdc.config.js",
"test:queries": "ava --config ava.queries.config.js",
"test:staking": "ava --config ava.staking.config.js"
"test:staking": "ava --config ava.staking.config.js",
"test:xcs": "ava --config ava.xcs.config.js"
},
"packageManager": "[email protected]",
"devDependencies": {
"@agoric/cosmic-proto": "dev",
"@agoric/fast-usdc": "dev",
"@cosmjs/amino": "npm:^0.32.4",
"@cosmjs/cosmwasm-stargate": "^0.33.1",
"@cosmjs/crypto": "^0.33.0",
"@cosmjs/proto-signing": "^0.33.0",
"@cosmjs/stargate": "^0.33.0",
Expand All @@ -33,6 +35,7 @@
"eslint-config-prettier": "^10.1.1",
"execa": "^9.5.2",
"fs-extra": "^11.2.0",
"osmojs": "^16.15.0",
"starshipjs": "2.4.1",
"ts-blank-space": "^0.4.4",
"typescript": "~5.8.2"
Expand Down Expand Up @@ -94,8 +97,8 @@
"@agoric/xsnap-lockdown": "portal:../packages/xsnap-lockdown",
"@agoric/zoe": "portal:../packages/zoe",
"@agoric/zone": "portal:../packages/zone",
"@cosmjs/proto-signing@npm:0.32.3": "npm:@cosmjs/proto-signing@0.33.0",
Copy link
Member

Choose a reason for hiding this comment

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

Why are the @npm:0.32.3 suffix and the npm:@cosmjs/proto-signing@ prefix no longer necessary?

"@cosmjs/stargate@npm:0.32.3": "npm:@cosmjs/stargate@0.33.0"
"@cosmjs/proto-signing": "0.33.1",
"@cosmjs/stargate": "0.33.1"
},
"license": "Apache-2.0"
}
66 changes: 66 additions & 0 deletions multichain-testing/scripts/update-config-logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

I'm struggling to see the purpose of this script. How about a sentence or two of file comments?


CHAIN_ID="${CHAIN_ID:=osmosis}"
CHAIN_DIR="${CHAIN_DIR:=$HOME/.osmosisd}"
KEYS_CONFIG="${KEYS_CONFIG:=configs/keys.json}"

set -eux

ls $CHAIN_DIR

echo "Update config.toml file"
Copy link
Member

Choose a reason for hiding this comment

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

Update in what way? For what purpose?

We don't need a comment to say that the config.toml file is being changed; that much is obvious. Please let's use comments to say what the code doesn't say.

sed -i -e 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' $CHAIN_DIR/config/config.toml
sed -i -e 's/index_all_keys = false/index_all_keys = true/g' $CHAIN_DIR/config/config.toml
sed -i -e 's/seeds = ".*"/seeds = ""/g' $CHAIN_DIR/config/config.toml
sed -i -e 's#cors_allowed_origins = \[\]#cors_allowed_origins = \["*"\]#g' $CHAIN_DIR/config/config.toml
sed -i -e 's/index_all_keys = false/index_all_keys = true/g' $CHAIN_DIR/config/config.toml

echo "Update client.toml file"
sed -i -e 's#keyring-backend = "os"#keyring-backend = "test"#g' $CHAIN_DIR/config/client.toml
sed -i -e 's#output = "text"#output = "json"#g' $CHAIN_DIR/config/client.toml
sed -i -e "s#chain-id = \"\"#chain-id = \"$CHAIN_ID\"#g" $CHAIN_DIR/config/client.toml

echo "Update app.toml file"
sed -i -e "s#minimum-gas-prices = \".*\"#minimum-gas-prices = \"0$DENOM\"#g" $CHAIN_DIR/config/app.toml
sed -i -e "s#pruning = \".*\"#pruning = \"default\"#g" $CHAIN_DIR/config/app.toml
sed -i -e 's/enable-unsafe-cors = false/enable-unsafe-cors = true/g' $CHAIN_DIR/config/app.toml
sed -i -e 's/enabled-unsafe-cors = false/enabled-unsafe-cors = true/g' $CHAIN_DIR/config/app.toml
sed -i -e 's/enable = false/enable = true/g' $CHAIN_DIR/config/app.toml
sed -i -e 's/swagger = false/swagger = true/g' $CHAIN_DIR/config/app.toml
sed -i -e 's/enable = false/enable = true/g' $CHAIN_DIR/config/app.toml
sed -i -e 's/enabled = false/enabled = true/g' $CHAIN_DIR/config/app.toml

function get_next_line_number() {
local txt=$1
local file=$2
local line_number=$(grep -n "$txt" $file | cut -d: -f1 | head -1)
echo $((line_number + 1))
}

line_number=$(get_next_line_number "Address defines the API server to listen on." $CHAIN_DIR/config/app.toml)
sed -i -e "${line_number}s#address = \".*\"#address = \"tcp://0.0.0.0:1317\"#g" $CHAIN_DIR/config/app.toml

line_number=$(get_next_line_number "Address defines the gRPC server address to bind to." $CHAIN_DIR/config/app.toml)
sed -i -e "${line_number}s#address = \".*\"#address = \"0.0.0.0:9090\"#g" $CHAIN_DIR/config/app.toml

line_number=$(get_next_line_number "Address defines the gRPC-web server address to bind to." $CHAIN_DIR/config/app.toml)
sed -i -e "${line_number}s#address = \".*\"#address = \"0.0.0.0:9091\"#g" $CHAIN_DIR/config/app.toml

if [ "$METRICS" == "true" ]; then
sed -i -e "s/prometheus = false/prometheus = true/g" $CHAIN_DIR/config/config.toml

line_number=$(get_next_line_number "PrometheusRetentionTime, when positive, enables a Prometheus metrics sink." $CHAIN_DIR/config/app.toml)
sed -i -e "${line_number}s/prometheus-retention-time = 0/prometheus-retention-time = 3600/g" $CHAIN_DIR/config/app.toml
fi

echo "Update consensus params in config.toml"
sed -i -e "s#timeout_propose = \".*\"#timeout_propose = \"$TIMEOUT_PROPOSE\"#g" $CHAIN_DIR/config/config.toml
sed -i -e "s#timeout_propose_delta = \".*\"#timeout_propose_delta = \"$TIMEOUT_PROPOSE_DELTA\"#g" $CHAIN_DIR/config/config.toml
sed -i -e "s#timeout_prevote = \".*\"#timeout_prevote = \"$TIMEOUT_PREVOTE\"#g" $CHAIN_DIR/config/config.toml
sed -i -e "s#timeout_prevote_delta = \".*\"#timeout_prevote_delta = \"$TIMEOUT_PREVOTE_DELTA\"#g" $CHAIN_DIR/config/config.toml
sed -i -e "s#timeout_precommit = \".*\"#timeout_precommit = \"$TIMEOUT_PRECOMMIT\"#g" $CHAIN_DIR/config/config.toml
sed -i -e "s#timeout_precommit_delta = \".*\"#timeout_precommit_delta = \"$TIMEOUT_PRECOMMIT_DELTA\"#g" $CHAIN_DIR/config/config.toml
sed -i -e "s#timeout_commit = \".*\"#timeout_commit = \"$TIMEOUT_COMMIT\"#g" $CHAIN_DIR/config/config.toml

echo "Update config.toml file log level"
sed -i -E 's/^(log_level\s*=\s*)".*"/\1"debug"/' $CHAIN_DIR/config/config.toml
Comment on lines +65 to +66
Copy link
Member

Choose a reason for hiding this comment

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

I think I saw some explanation of why log_level should be debug here; considering moving it to a comment here.

18 changes: 18 additions & 0 deletions multichain-testing/test/xcs-swap-anything/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Spin up Environment
```sh
cd agoric-sdk/multichain-testing
make start FILE=config.xcs-swap-anything.yaml
make osmosis-xcs-setup
make create-osmosis-pool

## Configure the osmosis registries
Copy link
Member

Choose a reason for hiding this comment

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

Is this supposed to be a markdown heading?

It's currently a shell comment inside a fenced block.

cd agoric-sdk/multichain-testing/test/xcs-swap-anything
make tx-chain-channel-links
make tx-bec32-prefixes
```

## Run tests
```sh
cd agoric-sdk/multichain-testing
yarn ava test/xcs-swap-anything/swap-anything.test.ts
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash
# Usage: ./download_specific_files.sh <owner> <repo> <branch> <folder> <destination> <file1> <file2> ...

set -euo pipefail

owner="$1"
repo="$2"
branch="$3"
folder="$4"
dest="$5"
shift 5
files_to_download=("$@")

api_url="https://api.github.com/repos/$owner/$repo/contents/$folder?ref=$branch"
mkdir -p "$dest"

curl -s "$api_url" | jq -r '.[] | select(.type=="file") | .name + " " + .download_url' \
| while read -r filename url; do
for wanted in "${files_to_download[@]}"; do
if [[ "$filename" == "$wanted" ]]; then
echo "Downloading $filename..."
curl -sL "$url" -o "$dest/$filename"
fi
done
done

echo "✅ Selected files downloaded to $dest"
Loading
Loading