-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes: #XXXX refs: #8896 ## Description - Creates `@agoric/multichain-testing` package outside of the yarn workspace - Provides a containerized, multi-chain testing environment for local and CI testing using [cosmology-tech/starship](https://github.com/cosmology-tech/starship/tree/devnet-0.2.2) - The current `config.yaml` includes agoric, osmosis, cosmos, and hermes relayers between each. A chain registry (served over http), faucet, and block explorer are also provided). - Provides an ava test setup for accessing a chain registry, creating wallets, and requesting faucet funds - Ports utilities from `@agoric/synthetic-chain` and `dapp-agoric-basics` that help towards a smart wallet client that can execute offers. ### Security Considerations ### Scaling Considerations Taking on some tech debt here wrt smart wallet utilities and being DRY, but we plan to address this in future. See #8963 ### Documentation Considerations README.md documentation for running the service is provided. ### Testing Considerations The goal of this PR is to build greater confidence in our software via automated testing with fully-simulated chains. ### Upgrade Considerations
- Loading branch information
Showing
31 changed files
with
6,395 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Multichain E2E Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
# $default-branch | ||
- master | ||
- 'release-*' | ||
- 'dev-*' | ||
tags: | ||
- '@agoric/sdk@*' | ||
|
||
jobs: | ||
multichain-e2e: | ||
runs-on: ubuntu-latest-16core | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
path: ./agoric-sdk | ||
- uses: ./agoric-sdk/.github/actions/restore-node | ||
with: | ||
node-version: 18.x | ||
path: ./agoric-sdk | ||
|
||
- name: Enable Corepack | ||
run: corepack enable | ||
working-directory: ./agoric-sdk/multichain-testing | ||
|
||
- name: Install @agoric/multichain-testing deps | ||
run: yarn install | ||
working-directory: ./agoric-sdk/multichain-testing | ||
|
||
- name: Lint @agoric/multichain-testing | ||
run: yarn lint | ||
working-directory: ./agoric-sdk/multichain-testing | ||
|
||
- name: Setup Starship Infrastructure | ||
id: starship-infra | ||
uses: cosmology-tech/[email protected] | ||
with: | ||
# uses ghcr.io/agoric/agoric-sdk:dev image (latest master) | ||
values: ./agoric-sdk/multichain-testing/config.yaml | ||
port-forward: true | ||
version: 0.2.2 | ||
timeout: 30m | ||
namespace: agoric-multichain | ||
|
||
- name: Fund Provision Pool | ||
run: | | ||
kubectl config set-context --current --namespace=agoric-multichain | ||
kubectl get pods | ||
make fund-provision-pool | ||
working-directory: ./agoric-sdk/multichain-testing | ||
|
||
- name: Ensure ports are forwarded | ||
run: | | ||
curl --fail --retry 3 --retry-delay 10 http://localhost:26657/status || (echo "agoriclocal node is available") | ||
curl --fail --retry 3 --retry-delay 10 http://localhost:8081/chains/agoriclocal || (echo "agoriclocal URL check failed") | ||
curl --fail --retry 3 --retry-delay 10 http://localhost:8081/chains/osmosislocal || (echo "osmosislocal URL check failed") | ||
curl --fail --retry 3 --retry-delay 10 http://localhost:8081/chains/gaialocal || (echo "gaialocal URL check failed") | ||
- name: Run @agoric/multichain-testing E2E Tests | ||
run: yarn test | ||
working-directory: ./agoric-sdk/multichain-testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.tsimp | ||
.yarn/* | ||
!.yarn/patches/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# see https://github.com/cosmology-tech/starship/blob/0e18757b8393357fc66426c5ee23da4ccf760e74/examples/getting-started/Makefile | ||
|
||
NAME = starship-getting-started | ||
FILE = config.yaml | ||
|
||
HELM_REPO = starship | ||
HELM_CHART = devnet | ||
HELM_VERSION = v0.2.2 | ||
|
||
############################################################################### | ||
### All commands ### | ||
############################################################################### | ||
|
||
.PHONY: setup | ||
setup: setup-deps setup-kind | ||
|
||
.PHONY: stop | ||
stop: stop-forward delete | ||
|
||
.PHONY: clean | ||
clean: stop clean-kind | ||
|
||
############################################################################### | ||
### Dependency check ### | ||
############################################################################### | ||
|
||
.PHONY: check | ||
setup-deps: | ||
bash $(CURDIR)/scripts/dev-setup.sh | ||
|
||
############################################################################### | ||
### Helm Charts ### | ||
############################################################################### | ||
|
||
install: | ||
bash $(CURDIR)/scripts/install.sh --config $(FILE) --name $(NAME) --version $(HELM_VERSION) | ||
|
||
delete: | ||
-helm delete $(NAME) | ||
|
||
############################################################################### | ||
### Port forward ### | ||
############################################################################### | ||
|
||
.PHONY: port-forward | ||
port-forward: | ||
bash $(CURDIR)/scripts/port-forward.sh --config=$(FILE) | ||
|
||
.PHONY: stop-forward | ||
stop-forward: | ||
-pkill -f "port-forward" | ||
|
||
############################################################################### | ||
### Local Kind Setup ### | ||
############################################################################### | ||
KIND_CLUSTER=starship | ||
|
||
.PHONY: setup-kind | ||
setup-kind: | ||
kind create cluster --name $(KIND_CLUSTER) | ||
|
||
.PHONY: clean-kind | ||
clean-kind: | ||
kind delete cluster --name $(KIND_CLUSTER) | ||
|
||
############################################################################### | ||
### Agoric Setup ### | ||
############################################################################### | ||
PROVISION_POOL_ADDR=agoric1megzytg65cyrgzs6fvzxgrcqvwwl7ugpt62346 | ||
|
||
fund-provision-pool: | ||
kubectl exec -i agoriclocal-genesis-0 -c validator -- agd tx bank send faucet $(PROVISION_POOL_ADDR) 1000000000uist -y -b block | ||
|
||
ADDR=agoric1ldmtatp24qlllgxmrsjzcpe20fvlkp448zcuce | ||
COIN=1000000000uist | ||
|
||
fund-wallet: | ||
kubectl exec -i agoriclocal-genesis-0 -c validator -- agd tx bank send faucet $(ADDR) $(COIN) -y -b block | ||
|
||
provision-smart-wallet: | ||
kubectl exec -i agoriclocal-genesis-0 -c validator -- agd tx swingset provision-one wallet $(ADDR) SMART_WALLET --from $(ADDR) -y -b block | ||
|
||
# view agoric swingset logs from slog file, until we can set `DEBUG=SwingSet:vat,SwingSet:ls` | ||
tail-slog: | ||
kubectl exec -i agoriclocal-genesis-0 -c validator -- tail -f slog.slog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Starship | ||
|
||
End-to-end testing environment for fully simulated chains, powered by [Starship](https://docs.cosmology.zone/starship). | ||
|
||
|
||
## Configuration | ||
|
||
The current commands will read from [`config.yaml`](./config.yaml) to build a multi-chain teting environment. Currently, the image includes `agoric`, `osmosis`, and `cosmos-hub` chains and a hermes relayer between each. | ||
|
||
The `agoric` software revision includes the vats necessary for building and testing orchestration applications: | ||
- vat-network | ||
- vat-ibc | ||
- vat-localchain | ||
- vat-transfer | ||
- vat-orchestration | ||
|
||
## Initial Setup | ||
|
||
Ensure you have `kubectl`, `kind`, `helm`, and `yq` installed on your machine. For convenience, the following command will install dependencies: | ||
|
||
```sh | ||
make setup-deps | ||
``` | ||
|
||
You will need a `kind` cluster: | ||
|
||
```sh | ||
make setup-kind | ||
``` | ||
|
||
## Getting Started | ||
|
||
```sh | ||
# install helm chart and start starship service | ||
make install | ||
|
||
# NOTE: it takes about 10-12 minutes for the above to finish setting up. Use `watch kubectl get pods` to confirm all pods are up and running before running the next command. | ||
|
||
# expose ports on your local machine. useful for testing dapps | ||
make port-forward | ||
|
||
# stop the containers and port-forwarding | ||
make stop | ||
``` | ||
|
||
To setup finish setting up Agoric, also run: | ||
|
||
```bash | ||
make fund-provision-poool | ||
``` | ||
|
||
## Logs | ||
|
||
You can use the following commmands to view logs: | ||
|
||
```sh | ||
# agoric slogfile | ||
make tail-slog | ||
|
||
# agoric validator logs | ||
kubectl logs agoriclocal-genesis-0 --container=validator --follow | ||
|
||
# relayer logs | ||
kubectl logs hermes-agoric-gaia-0 --container=validator --follow | ||
kubectl logs hermes-agoric-gaia-0 --container=validator --follow | ||
``` | ||
|
||
## Agoric Smart Wallet | ||
|
||
For the steps below, you must import a key to `agd` or create a new one. | ||
|
||
```bash | ||
# create a `user1` key from a random seed | ||
kubectl exec -i agoriclocal-genesis-0 -c validator -- agd keys add user1 | ||
|
||
# get the newly created address | ||
ADDR=$(kubectl exec -i agoriclocal-genesis-0 -c validator -- agd keys show user1 -a) | ||
|
||
# fund the wallet with some tokens | ||
make fund-wallet COIN=20000000ubld ADDR=$ADDR | ||
|
||
# provision the smart wallet | ||
make provision-smart-wallet ADDR=$ADDR | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
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-config.json" | ||
faucet: | ||
enabled: false | ||
ports: | ||
rest: 1317 | ||
rpc: 26657 | ||
exposer: 38087 | ||
grpc: 9090 | ||
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: ["*"] | ||
faucet: | ||
enabled: true | ||
type: starship | ||
ports: | ||
rest: 1315 | ||
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 | ||
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 | ||
|
||
registry: | ||
enabled: true | ||
ports: | ||
rest: 8081 |
Oops, something went wrong.