Skip to content
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
1 change: 0 additions & 1 deletion contract/test/agd-lib.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ test('orca-multichain.test style usage', async t => {
const wallets = await ensureAccounts(tools.agd.keys);
t.deepEqual(wallets, {
agoric: 'agoric1v8qxguqqjtfyfwqr8ln2wlu858vkx4860jzf6g',
cosmoshub: 'agoric17th0tvrzmwc2fqpeneuwmrwcm8armyjlgmypuf',

Choose a reason for hiding this comment

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

Why we are removing cosmoshub?

Copy link
Member Author

Choose a reason for hiding this comment

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

The OG setup had 3 chains: agoric, cosmoshub(aka gaia) and osmosis. This meant running at least three relayers - agoric<>osmosis, agoric<>cosmoshub, osmosis<>cosmoshub. By reducing the multichain testing setup to only two chains, we have also reduced the number of relayers to 1. As a result, I have also removed cosmoshub related changes from code (especially multichain tests which fail because cosmoshub isn't present anymore).

Choose a reason for hiding this comment

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

But aren't we then compromising testing with cosmoshub if we are just removing it to save our resources/time?

Copy link
Member Author

Choose a reason for hiding this comment

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

How so? Whatever we test between two chains is just extrapolated to a set of three chains.

Choose a reason for hiding this comment

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

I didn't get it. Provided the test is same but if it's happening on different chains then we should treat it something different. Outcome of test can be different on different chains, or no?

Choose a reason for hiding this comment

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

What is the goal of our test? Is it to generally test multi-chain stuff with any chain?

Choose a reason for hiding this comment

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

So let's say the tests work for a<>b chains and a<>c chains. We are removing c chain because the a<>b is enough as it does the same testing, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have parametrized tests like

test.serial(makeAccountScenario, 'agoric');
test.serial(makeAccountScenario, 'osmosis');

This used to include cosmoshub as well.
This test basically creates new wallets, provisions them, makes an offer using orch contract, and verifies the wallet has that offer. Basically testing if our orchestration contract offer is received on other chains (from what I am inferring from code). It already does it for osmosis, so IMO an agoric testcase and a non-agoric test cases suffices. We can add as many non-agoric chains (supported) as we like but we don't have to. If it works for osmosis, it should work for others

Choose a reason for hiding this comment

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

Hmmmm fair enough

osmosis: 'agoric17hglh4q5k087nthneq0kegk4y838vmt3vk80u3',
});

Expand Down
5 changes: 0 additions & 5 deletions contract/test/orca-contract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,6 @@ test('Start Orca contract using core-eval', async t => {
});

export const chainConfigs = {
cosmoshub: {
chainId: 'gaialocal',
denom: 'uatom',
expectedAddressPrefix: 'cosmos',
},
osmosis: {
chainId: 'osmosislocal',
denom: 'uosmo',
Expand Down
1 change: 0 additions & 1 deletion contract/test/orca-multichain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ const makeCreateAndFundScenario = test.macro({
});

test.serial(makeAccountScenario, 'agoric');
test.serial(makeAccountScenario, 'cosmoshub');
test.serial(makeAccountScenario, 'osmosis');

// use IBC/E7827844CB818EE9C4DB2C159F1543FF62B26213B44CE8029D5CEFE52F0EE596
Expand Down
64 changes: 0 additions & 64 deletions contract/test/snapshots/agd-lib.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -506,70 +506,6 @@ Generated by [AVA](https://avajs.dev).
input: 'swift element zoo argue predict ugly awful alert glance net tourist body',
},
},
{
args: [
'exec',
'-i',
'agoriclocal-genesis-0',
'--container',
'validator',
'--',
'agd',
'keys',
'show',
'--address',
'cosmoshub',
'--keyring-backend',
'test',
],
file: 'kubectl',
opts: {
encoding: 'utf-8',
},
},
{
args: [
'exec',
'-i',
'agoriclocal-genesis-0',
'--container',
'validator',
'--',
'agd',
'--keyring-backend',
'test',
'keys',
'delete',
'cosmoshub',
'-y',
],
file: 'kubectl',
opts: {
encoding: 'utf-8',
},
},
{
args: [
'exec',
'-i',
'agoriclocal-genesis-0',
'--container',
'validator',
'--',
'agd',
'--keyring-backend',
'test',
'keys',
'add',
'cosmoshub',
'--recover',
],
file: 'kubectl',
opts: {
encoding: 'utf-8',
input: 'joke lecture black sniff goddess grain then forum level achieve pen alone',
},
},
{
args: [
'exec',
Expand Down
Binary file modified contract/test/snapshots/agd-lib.test.js.snap
Binary file not shown.
6 changes: 0 additions & 6 deletions contract/test/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { makeE2ETools } from '../tools/e2e-tools.js';
const { entries, fromEntries } = Object;

export const chainConfig = {
cosmoshub: { expectedAddressPrefix: 'cosmos' },
osmosis: { expectedAddressPrefix: 'osmo' },
agoric: { expectedAddressPrefix: 'agoric' },
};
Expand All @@ -21,11 +20,6 @@ export const chainAccounts = {
mnemonic:
'swift element zoo argue predict ugly awful alert glance net tourist body',
},
cosmoshub: {
address: 'agoric17th0tvrzmwc2fqpeneuwmrwcm8armyjlgmypuf',
mnemonic:
'joke lecture black sniff goddess grain then forum level achieve pen alone',
},
osmosis: {
address: 'agoric17hglh4q5k087nthneq0kegk4y838vmt3vk80u3',
mnemonic:
Expand Down
45 changes: 3 additions & 42 deletions e2e-testing/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
chains:
- id: agoriclocal
name: agoric
image: ghcr.io/agoric/agoric-sdk:upgrade-17-dev
image: ghcr.io/agoric/agoric-sdk:dev
numValidators: 1
env:
- name: DEBUG
Expand All @@ -25,8 +25,8 @@ chains:
exposer: 38087
grpc: 9090
resources:
cpu: 1
memory: 4Gi
cpu: 2
memory: 3Gi
- id: osmosislocal
name: osmosis
numValidators: 1
Expand Down Expand Up @@ -55,53 +55,14 @@ chains:
rpc: 26655
grpc: 9093
faucet: 8084
resources:
cpu: 1
memory: 1Gi
- id: gaialocal
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-gaia
type: hermes
replicas: 1
chains:
- osmosislocal
- gaialocal
- name: agoric-osmosis
type: hermes
replicas: 1
chains:
- agoriclocal
- osmosislocal
- name: agoric-gaia
type: hermes
replicas: 1
chains:
- agoriclocal
- gaialocal

explorer:
enabled: false
Expand Down
65 changes: 65 additions & 0 deletions e2e-testing/scripts/dev-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

## see https://github.com/cosmology-tech/starship/blob/b7dc499ee0114a0d5035708d7a92ca37fbdaf257/examples/getting-started/scripts/dev-setup.sh

set -euo pipefail

function color() {
local color=$1
shift
local black=30 red=31 green=32 yellow=33 blue=34 magenta=35 cyan=36 white=37
local color_code=${!color:-$green}
printf "\033[%sm%s\033[0m\n" "$color_code" "$*"
}

# Define a function to install a binary on macOS
install_macos() {
case $1 in
kubectl) brew install kubectl ;;
helm) brew install helm ;;
yq) brew install yq ;;
kind) brew install kind ;;
esac
}

# Define a function to install a binary on Linux
install_linux() {
color green "Installing $1 at ~/.local/bin, please add it to PATH"
mkdir -p ~/.local/bin
case $1 in
kubectl) curl -Lks "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" > ~/.local/bin/kubectl && chmod +x ~/.local/bin/kubectl ;;
helm) curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash ;;
yq) curl -Lks "https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_amd64" > ~/.local/bin/yq && chmod +x ~/.local/bin/yq ;;
kind) curl -Lks https://kind.sigs.k8s.io/dl/v0.18.1/kind-linux-amd64 > ~/.local/bin/kind && chmod +x ~/.local/bin/kind ;;
esac
}

# Define a function to install a binary
install_binary() {
if [[ $(uname -s) == "Darwin" ]]; then
install_macos $1
else
install_linux $1
fi
}

# Define a function to check for the presence of a binary
check_binary() {
if ! command -v $1 &> /dev/null; then
echo "$1 is not installed"
install_binary $1
if ! command -v $1 &> /dev/null; then
color red "Installation of $1 failed, exiting..."
color red "Please install $1 manually, then run me again to verify the installation"
exit 1
fi
fi
}

# Check the binaries
check_binary kubectl
check_binary helm
check_binary yq
check_binary kind

color green "All binaries are installed"
127 changes: 127 additions & 0 deletions e2e-testing/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/bin/bash

## see https://github.com/cosmology-tech/starship/blob/7d63c4678a345789d8331dde7654f67953c5cc2b/examples/getting-started/scripts/install.sh

## Script used to install the helm chart for the devnet from a config file
## Usage:
## ./scripts/install.sh --coinfig <config_file>
## Options:
## -c|--config: config file to use (default: config.yaml)
## -v|--version: helm chart version (default: 0.1.43)

set -euo pipefail

# read config file from args into variable
CONFIGFILE="config.yaml"

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
echo "Script dir: ${SCRIPT_DIR}"

# default values
DRY_RUN=""
TIMEOUT=""
NAMESPACE=""
HELM_REPO="starship"
HELM_CHART="starship/devnet"
HELM_REPO_URL="https://hyperweb-io.github.io/starship/"
HELM_CHART_VERSION="0.2.8"
HELM_NAME="agoric-multichain-testing"

# check_helm function verifies the helm binary is installed
function check_helm() {
if ! command -v helm &> /dev/null; then
echo "helm could not be found; please install it first!!!"
exit
fi
}

# setup_helm function adds the helm repo and updates it
function setup_helm() {
if [ -d "$HELM_CHART" ]; then
echo "using local helm chart"
return
fi
helm repo add ${HELM_REPO} ${HELM_REPO_URL}
helm repo update
helm search repo ${HELM_CHART} --version ${HELM_CHART_VERSION}
}

function set_helm_args() {
if [[ $TIMEOUT ]]; then
args="$args --timeout $TIMEOUT --wait --debug"
fi
if [[ $NAMESPACE ]]; then
args="$args --namespace $NAMESPACE --create-namespace"
fi
if [[ $DRY_RUN ]]; then
args="$args --dry-run --debug"
fi
num_chains=$(yq -r ".chains | length - 1" ${CONFIGFILE})
if [[ $num_chains -lt 0 ]]; then
echo "No chains to parse: num: $num_chains"
return 0
fi
for i in $(seq 0 $num_chains); do
scripts=$(yq -r ".chains[$i].scripts" ${CONFIGFILE})
if [[ "$scripts" == "null" ]]; then
return 0
fi
datadir="$(
cd "$(dirname -- "${CONFIGFILE}")" > /dev/null
pwd -P
)"
for script in $(yq -r ".chains[$i].scripts | keys | .[]" ${CONFIGFILE}); do
args="$args --set-file chains[$i].scripts.$script.data=$datadir/$(yq -r ".chains[$i].scripts.$script.file" ${CONFIGFILE})"
done
done
}

function install_chart() {
args=""
set_helm_args
echo "name: ${HELM_NAME}, args: $args, chart: ${HELM_CHART}, version: ${HELM_CHART_VERSION}"
helm install ${HELM_NAME} ${HELM_CHART} --version ${HELM_CHART_VERSION} -f ${CONFIGFILE} $args
}

while [ $# -gt 0 ]; do
case "$1" in
-c | --config)
CONFIGFILE="$2"
shift 2 # past argument=value
;;
-v | --version)
HELM_CHART_VERSION="$2"
shift 2 # past argument
;;
-t | --timeout)
TIMEOUT="$2"
shift 2 # past argument
;;
-n | --name)
HELM_NAME="$2"
shift 2 # past argument
;;
--namespace)
NAMESPACE="$2"
shift 2 # past argument
;;
--chart)
HELM_CHART="$2"
shift 2 # past argument
;;
--dry-run)
DRY_RUN=1
shift # past argument
;;
-)
echo "Unknown option $1"
exit 1
;;
*) ;;

esac
done

check_helm
setup_helm
install_chart
Loading