diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 886c629b1d..2f6a00a918 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -26,7 +26,7 @@ on: - "**-v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+" - "**-v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" - "**-v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" - + pull_request: types: - opened @@ -179,6 +179,52 @@ jobs: timeout-minutes: 3 run: just run-smoke-cli + ibc-bridge-test: + needs: [ run_checker, composer, conductor, sequencer, sequencer-relayer ] + if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'astriaorg/astria') && (github.event_name == 'merge_group' || needs.run_checker.outputs.run_docker == 'true') + runs-on: buildjet-8vcpu-ubuntu-2204 + steps: + - uses: actions/checkout@v4 + - name: Install just + uses: taiki-e/install-action@just + - name: Install kind + uses: helm/kind-action@v1 + with: + install_only: true + - name: Log in to GHCR + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Setup IBC Bridge Test Environment + timeout-minutes: 5 + run: | + TAG=sha-$(git rev-parse --short HEAD) + just deploy cluster + kubectl create secret generic regcred --from-file=.dockerconfigjson=$HOME/.docker/config.json --type=kubernetes.io/dockerconfigjson + echo -e "\n\nDeploying with astria images tagged $TAG" + just deploy ibc-test-infra $TAG + just build-and-load-bridge-tester-image $TAG + - name: Run IBC Bridge Tester + timeout-minutes: 2 + run: | + TAG=sha-$(git rev-parse --short HEAD) + printlogs() { + echo "IBC Transfer Test failed, printing logs..." + kubectl describe job bridge-tester-chart -n astria-dev-cluster + kubectl logs job/bridge-tester-chart --all-containers -n astria-dev-cluster + exit 1 + } + just deploy bridge-tester $TAG + # timeout before the gh job times out so we can print logs + kubectl wait --for=condition=complete --timeout=90s job/bridge-tester-chart -n astria-dev-cluster || printlogs + JOB_STATUS=$(kubectl get job bridge-tester-chart -n astria-dev-cluster -o jsonpath='{.status.succeeded}') + if [ "$JOB_STATUS" != "1" ]; then + printlogs + else + echo "IBC Transfer Test passed" + fi docker: if: ${{ always() && !cancelled() }} diff --git a/charts/README.md b/charts/README.md index ced4dedb97..e2bafbf0e5 100644 --- a/charts/README.md +++ b/charts/README.md @@ -148,7 +148,7 @@ to `local`. You can now deploy the chart with your local image. ### Dev vs Prod -All of our charts should run against both the lastest code in monorepo AND +All of our charts should run against both the latest code in monorepo AND against the latest release. Sometimes, there are configuration changes between releases though. To manage this in various templates you will see the following pattern (especially in config maps and genesis files): @@ -183,8 +183,8 @@ To deploy and run this: ## Examining Deployments [k9s](https://k9scli.io/) is a useful utility for inspecting deployed -containers, logs and services. Additionally you may interact directly with the -kubernetes API some helpful commands below. +containers, logs and services. Additionally, you may interact directly with the +kubernetes API using some helpful commands below. ### Helpful commands diff --git a/charts/bridge-test/.helmignore b/charts/bridge-test/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /dev/null +++ b/charts/bridge-test/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/bridge-test/Chart.yaml b/charts/bridge-test/Chart.yaml new file mode 100644 index 0000000000..7beb394e73 --- /dev/null +++ b/charts/bridge-test/Chart.yaml @@ -0,0 +1,28 @@ +apiVersion: v2 +name: bridge-test +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "0.1.0" + +maintainers: + - name: steezeburger + url: astria.org diff --git a/charts/bridge-test/files/scripts/test-ibc-transfer.sh b/charts/bridge-test/files/scripts/test-ibc-transfer.sh new file mode 100644 index 0000000000..d3e836ba95 --- /dev/null +++ b/charts/bridge-test/files/scripts/test-ibc-transfer.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +get_evm_balance() { + HEX_NUM=$(curl -X POST "$evm_url" -s -d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"$evm_to_address\", \"latest\"],\"id\":1}" -H 'Content-Type: application/json' | jq -r '.result') + # strip 0x + HEX_NUM=$(echo "$HEX_NUM" | sed 's/^0x//') + # capitalize all lowercase letters + HEX_NUM=$(echo "$HEX_NUM" | tr '[:lower:]' '[:upper:]') + # print as integer + echo "ibase=16; $HEX_NUM" | bc +} + +addKeyForCelestiaAccount() { + # add key for the celestia dev account using the mnemonic + echo "Adding key for the celestia dev account..." + echo "$celestia_dev_account_mnemonic" | celestia-appd keys add \ + "$celestia_dev_account_key_name" \ + --home "$home_dir" \ + --keyring-backend="$keyring_backend" \ + --recover +} + +performIBCTransfer() { + # perform ibc transfer + echo "Performing IBC transfer..." + celestia-appd tx ibc-transfer transfer \ + transfer \ + channel-0 \ + "$bridge_account_address_bech32" \ + 53000utia \ + --memo="{\"rollupAddress\":\"$evm_to_address\"}" \ + --chain-id="$celestia_chain_id" \ + --node="$celestia_node_url" \ + --from="$celestia_dev_account_address" \ + --fees=26000utia \ + --yes \ + --log_level=debug \ + --home "$home_dir" \ + --keyring-backend="$keyring_backend" +} + +initial_balance=$(get_evm_balance) + +addKeyForCelestiaAccount +performIBCTransfer + +# FIXME - should probably poll w/ timeout instead of sleeping? +sleep 30 + +final_balance=$(get_evm_balance) +expected_balance=$(echo "$initial_balance + 53000000000000000" | bc) +if [ "$(echo "$final_balance == $expected_balance" | bc)" -eq 0 ]; then + echo "IBC Transfer failed!" + echo "Expected balance $expected_balance, got $final_balance" + exit 1 +else + echo "IBC Transfer successful!" +fi diff --git a/charts/bridge-test/templates/_helpers.tpl b/charts/bridge-test/templates/_helpers.tpl new file mode 100644 index 0000000000..ad997565bb --- /dev/null +++ b/charts/bridge-test/templates/_helpers.tpl @@ -0,0 +1,23 @@ +{{/* +Namespace to deploy elements into. +*/}} +{{- define "bridge-test.namespace" -}} +{{- default .Release.Namespace .Values.namespaceOverride | trunc 63 | trimSuffix "-" -}} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "bridge-test.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} diff --git a/charts/bridge-test/templates/configmap.yaml b/charts/bridge-test/templates/configmap.yaml new file mode 100644 index 0000000000..c31803c370 --- /dev/null +++ b/charts/bridge-test/templates/configmap.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: bridge-test-env + namespace: {{ include "bridge-test.namespace" . }} +data: + home_dir: "/home/celestia" + keyring_backend: "test" + bridge_account_address: "{{ .Values.bridgeAccount.address }}" + bridge_account_address_bech32: "{{ .Values.bridgeAccount.bech32 }}" + evm_to_address: "{{ .Values.evmToAddress }}" + evm_url: "{{ .Values.evmURL }}" + celestia_chain_id: "{{ .Values.celestiaChainID }}" + celestia_node_url: "{{ .Values.celestiaNodeURL }}" + celestia_dev_account_address: "{{ .Values.celestiaDevAccount.address }}" + celestia_dev_account_mnemonic: "{{ .Values.celestiaDevAccount.mnemonic }}" + celestia_dev_account_key_name: "{{ .Values.celestiaDevAccount.name }}" +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: bridge-test-scripts + namespace: {{ include "bridge-test.namespace" . }} +data: + test-ibc-transfer.sh: | + {{- .Files.Get "files/scripts/test-ibc-transfer.sh" | nindent 4 }} diff --git a/charts/bridge-test/templates/job.yaml b/charts/bridge-test/templates/job.yaml new file mode 100644 index 0000000000..391e47288d --- /dev/null +++ b/charts/bridge-test/templates/job.yaml @@ -0,0 +1,41 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "bridge-test.fullname" . }} + labels: + app: astria-dev-cluster + namespace: {{ include "bridge-test.namespace" . }} +spec: + template: + metadata: + name: {{ include "bridge-test.fullname" . }} + labels: + app: astria-dev-cluster + spec: + initContainers: + - name: init-bridge-account + image: {{ .Values.bridgeTesterUtilityImage }} + command: [ "astria-go", "sequencer", "bridge", "init", {{ .Values.evmRollupName }} ] + args: + - --privkey={{ .Values.bridgeAccount.privkey }} + - --sequencer-chain-id={{ .Values.sequencerChainId }} + - --sequencer-url={{ .Values.sequencerURL }} + - --asset={{ .Values.asset }} + - --fee-asset={{ .Values.feeAsset }} + - --log-level=debug + containers: + - name: test-ibc-transfer + image: {{ .Values.bridgeTesterUtilityImage }} + command: [ "/scripts/test-ibc-transfer.sh" ] + volumeMounts: + - mountPath: /scripts/ + name: bridge-test-scripts-volume + envFrom: + - configMapRef: + name: bridge-test-env + volumes: + - name: bridge-test-scripts-volume + configMap: + name: bridge-test-scripts + defaultMode: 0777 + restartPolicy: Never diff --git a/charts/bridge-test/values.yaml b/charts/bridge-test/values.yaml new file mode 100644 index 0000000000..66b0dc9545 --- /dev/null +++ b/charts/bridge-test/values.yaml @@ -0,0 +1,38 @@ +replicaCount: 1 + +# this image is overridden in ci/cd with the image built in ci/cd +bridgeTesterUtilityImage: ghcr.io/astriaorg/bridge-tester-utility:local + +imagePullSecrets: [] +nameOverride: "" +namespaceOverride: "" +fullnameOverride: "" + +# must match rollup name used in evm rollup chart values +evmRollupName: "astria" +# this is a shared dev address +evmToAddress: "0xaC21B97d35Bf75A7dAb16f35b111a50e78A72F30" +# evm execution api url +evmURL: "http://astria-evm-service.astria-dev-cluster.svc.cluster.local:8545" + +sequencerURL: "http://node0-sequencer-rpc-service.astria-dev-cluster.svc.cluster.local:26657" +# must match chain id used in sequencer chart values +sequencerChainId: "sequencer-test-chain-0" +asset: "transfer/channel-0/utia" +feeAsset: "nria" + +# sequencer bridge account. is funded during sequencer genesis. +bridgeAccount: + address: "6f85297e587b61b37695a1ac17189b3e907e318e" + bech32: "astria1d7zjjljc0dsmxa545xkpwxym86g8uvvwhtezcr" + privkey: "6015fbe1c365d3c5ef92dc891db8c5bb26ad454bec2db4762b96e9f8b2430285" + pubkey: "b78aa61c65f21e5fe0f31d221819053fa2286dd6eff83fc490e3ee746f144626" + +celestiaChainID: "celestia-local-0" +celestiaNodeURL: "http://celestia-app-service.astria-dev-cluster.svc.cluster.local:26657" + +# this account should be funded during celestia genesis +celestiaDevAccount: + name: "dev-account" + address: "celestia1m0ksdjl2p5nzhqy3p47fksv52at3ln885xvl96" + mnemonic: "enrich avocado local net will avoid dizzy truth column excuse ready lesson" diff --git a/charts/celestia-local/Chart.yaml b/charts/celestia-local/Chart.yaml index 244995a093..25b27f7bea 100644 --- a/charts/celestia-local/Chart.yaml +++ b/charts/celestia-local/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.4.0 +version: 0.5.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/celestia-local/files/scripts/init-celestia-appd.sh b/charts/celestia-local/files/scripts/init-celestia-appd.sh index 7b9402651f..4f0a427a15 100755 --- a/charts/celestia-local/files/scripts/init-celestia-appd.sh +++ b/charts/celestia-local/files/scripts/init-celestia-appd.sh @@ -29,6 +29,30 @@ celestia-appd gentx \ --chain-id "$chainid" \ --home "$home_dir" +# add ibc account +echo "$ibc_account_mnemonic" | celestia-appd keys add \ + "$ibc_account_key_name" \ + --home "$home_dir" \ + --keyring-backend="$keyring_backend" \ + --recover +ibc_account_key=$(celestia-appd keys show "$ibc_account_key_name" -a --keyring-backend="$keyring_backend" --home "$home_dir") +celestia-appd add-genesis-account \ + "$ibc_account_key" \ + --home "$home_dir" \ + "$coins" + +# add account used for development and testing +echo "$dev_account_mnemonic" | celestia-appd keys add \ + "$dev_account_key_name" \ + --home "$home_dir" \ + --keyring-backend="$keyring_backend" \ + --recover +dev_account_key=$(celestia-appd keys show "$dev_account_key_name" -a --keyring-backend="$keyring_backend" --home "$home_dir") +celestia-appd add-genesis-account \ + "$dev_account_key" \ + --home "$home_dir" \ + "$coins" + celestia-appd collect-gentxs --home "$home_dir" # Enable transaction indexing diff --git a/charts/celestia-local/files/scripts/start-celestia-appd.sh b/charts/celestia-local/files/scripts/start-celestia-appd.sh index e3d8a82c3b..334e39156c 100755 --- a/charts/celestia-local/files/scripts/start-celestia-appd.sh +++ b/charts/celestia-local/files/scripts/start-celestia-appd.sh @@ -26,5 +26,6 @@ exec celestia-appd start --home "${home_dir}" \ --grpc.address "0.0.0.0:$celestia_app_grpc_port" \ --rpc.laddr "tcp://0.0.0.0:$celestia_app_host_port" \ --api.enable \ + --api.enabled-unsafe-cors \ --grpc.enable \ --grpc-web.enable diff --git a/charts/celestia-local/templates/configmap.yaml b/charts/celestia-local/templates/configmap.yaml index 174f92ee3e..c1630791d6 100644 --- a/charts/celestia-local/templates/configmap.yaml +++ b/charts/celestia-local/templates/configmap.yaml @@ -16,6 +16,10 @@ data: bridge_rpc_port: "{{ .Values.ports.bridgeRPC }}" celestia_app_host_port: "{{ .Values.ports.celestiaAppHostPort }}" celestia_app_grpc_port: "{{ .Values.ports.celestiaAppGrpcPort }}" + ibc_account_mnemonic: "{{ .Values.ibcAccountMnemonic }}" + ibc_account_key_name: "{{ .Values.ibcAccountKeyName }}" + dev_account_mnemonic: "{{ .Values.devAccountMnemonic }}" + dev_account_key_name: "{{ .Values.devAccountName }}" --- apiVersion: v1 kind: ConfigMap diff --git a/charts/celestia-local/templates/deployment.yaml b/charts/celestia-local/templates/deployment.yaml index 91b740cc4d..42fb310e23 100644 --- a/charts/celestia-local/templates/deployment.yaml +++ b/charts/celestia-local/templates/deployment.yaml @@ -63,6 +63,8 @@ spec: name: app-rpc - containerPort: {{ .Values.ports.celestiaAppGrpcPort }} name: app-grpc + - containerPort: {{ .Values.ports.celestiaAppRestPort }} + name: app-rest - name: celestia-bridge command: [ "/scripts/start-bridge.sh" ] image: {{ .Values.celestiaNodeImage }} diff --git a/charts/celestia-local/templates/ingress.yaml b/charts/celestia-local/templates/ingress.yaml index 72ed4a93f1..978a3fd8d8 100644 --- a/charts/celestia-local/templates/ingress.yaml +++ b/charts/celestia-local/templates/ingress.yaml @@ -6,6 +6,9 @@ metadata: labels: app: celestia-local-network annotations: + nginx.ingress.kubernetes.io/enable-cors: "true" + # allow requests from bridge web app + nginx.ingress.kubernetes.io/cors-allow-origin: "http://localhost:3000" nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" spec: @@ -51,3 +54,13 @@ spec: name: celestia-app-service port: name: app-rpc + - host: rest.app.celestia.localdev.me + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: celestia-app-service + port: + name: app-rest diff --git a/charts/celestia-local/templates/service.yaml b/charts/celestia-local/templates/service.yaml index dff906974a..50d52107f5 100644 --- a/charts/celestia-local/templates/service.yaml +++ b/charts/celestia-local/templates/service.yaml @@ -29,3 +29,6 @@ spec: - name: app-grpc port: {{ .Values.ports.celestiaAppGrpcPort }} targetPort: app-grpc + - name: app-rest + port: {{ .Values.ports.celestiaAppRestPort }} + targetPort: app-rest diff --git a/charts/celestia-local/values.yaml b/charts/celestia-local/values.yaml index 396e81778f..c98d2840e8 100644 --- a/charts/celestia-local/values.yaml +++ b/charts/celestia-local/values.yaml @@ -15,7 +15,7 @@ storage: persistentVolumeName: "celestia-shared-storage" path: "/data/celestia-data" -celestiaAppImage: "ghcr.io/celestiaorg/celestia-app:v1.8.0" +celestiaAppImage: "ghcr.io/celestiaorg/celestia-app:v1.9.0" celestiaNodeImage: "ghcr.io/celestiaorg/celestia-node:v0.13.4" podSecurityContext: @@ -37,10 +37,19 @@ validatorMnemonic: connect soon random stable toddler tired glove drastic comfor coins: "10000000000000000000000000utia" # Staking amount validatorStake: "5000000000utia" +# ibc account +ibcAccountKeyName: "ibc-account" +# mnemonic for ibc account, so we can add its key and get them funded during genesis +ibcAccountMnemonic: globe elegant people render embark whisper pumpkin local thing shallow front surround domain wave drill peasant duck midnight call slight ball segment token will +# a dev account to aid in development and testing. can use mnemonic to import into Keplr +# address celestia1m0ksdjl2p5nzhqy3p47fksv52at3ln885xvl96 +devAccountName: "dev-account" +devAccountMnemonic: enrich avocado local net will avoid dizzy truth column excuse ready lesson # Default service ports ports: celestiaAppHostPort: 26657 celestiaAppGrpcPort: 9090 + celestiaAppRestPort: 1317 bridgeRPC: 26658 bridgeHTTP: 26659 diff --git a/charts/deploy.just b/charts/deploy.just index 463e3ded7a..e00aaff400 100644 --- a/charts/deploy.just +++ b/charts/deploy.just @@ -82,7 +82,7 @@ deploy-sequencers: (deploy-sequencer "node0") (deploy-sequencer "node1") (deploy deploy-hermes-local: helm install hermes-local-chart ./charts/hermes \ -n astria-dev-cluster \ - -f dev/values/hermes/local.yml + -f dev/values/hermes/local.yaml delete-hermes-local: @just delete chart hermes-local diff --git a/charts/evm-rollup/Chart.yaml b/charts/evm-rollup/Chart.yaml index c0d1b8ccbb..3655046926 100644 --- a/charts/evm-rollup/Chart.yaml +++ b/charts/evm-rollup/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.23.1 +version: 0.23.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to @@ -34,5 +34,7 @@ maintainers: url: astria.org - name: quasystaty1 url: astria.org + - name: steezeburger + url: astria.org - name: joroshiba url: astria.org diff --git a/charts/hermes/Chart.yaml b/charts/hermes/Chart.yaml index c25069bfc6..5f27586f67 100644 --- a/charts/hermes/Chart.yaml +++ b/charts/hermes/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.3.0 +version: 0.4.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to @@ -26,5 +26,7 @@ appVersion: "1.8.2" maintainers: - name: wafflesvonmaple url: astria.org + - name: steezeburger + url: astria.org - name: joroshiba url: astria.org diff --git a/charts/hermes/files/config.toml b/charts/hermes/files/config.toml index 84bac59ace..cdc9a90ce2 100644 --- a/charts/hermes/files/config.toml +++ b/charts/hermes/files/config.toml @@ -57,7 +57,6 @@ account_prefix = '{{ $chain.accountPrefix }}' key_name = '{{ $chain.key.name }}' store_prefix = '{{ $chain.storePrefix }}' ccv_consumer_chain = {{ default false $chain.ccvConsumerChain }} -ccv_consumer_chain = {{ default false $chain.trustedNode }} {{- if eq $chain.eventSource.mode "push" }} event_source = { mode = 'push', url = '{{ $chain.eventSource.url }}', batch_delay='{{ $chain.eventSource.batchDelay }}' } {{- else if eq $chain.eventSource.mode "pull" }} diff --git a/charts/hermes/templates/deployment.yaml b/charts/hermes/templates/deployment.yaml index 90a082c54b..b3452a1b8f 100644 --- a/charts/hermes/templates/deployment.yaml +++ b/charts/hermes/templates/deployment.yaml @@ -54,6 +54,11 @@ spec: name: telemetry - containerPort: {{ .Values.ports.tracingServer }} name: tracing + # TODO - implement a readiness probe so we can wait on hermes startup correctly +{{/* readinessProbe:*/}} +{{/* httpGet:*/}} +{{/* path: /channels*/}} +{{/* port: {{ .Values.ports.rest }}*/}} volumes: - name: {{ include "hermes.fullname" . }}-config-volume configMap: diff --git a/charts/hermes/values.yaml b/charts/hermes/values.yaml index 73e5bc4bec..6da9886614 100644 --- a/charts/hermes/values.yaml +++ b/charts/hermes/values.yaml @@ -13,7 +13,7 @@ nameOverride: "" # the destination chain assets createChannel: enabled: false - chainA: '' # For local test is equencer-test-chain-0 + chainA: '' # For local test is sequencer-test-chain-0 portA: '' # likely "transfer" chainB: '' # For default local test celestia-local-0 portB: '' # likely "transfer" @@ -96,7 +96,7 @@ chains: # secret: # resourceName: projects/$PROJECT_ID/secrets/celestia-ibc-relay-key/versions/latest # gasPrice: 0.12 - # denom: 'utia' + # gasDenom: 'utia' # gasMultiplier: 1.1 # clockDrift: 20s # maxBlockTime: 10s diff --git a/dev/bridgetester.just b/dev/bridgetester.just new file mode 100644 index 0000000000..0396c84dba --- /dev/null +++ b/dev/bridgetester.just @@ -0,0 +1,70 @@ +# deploy infra for an ibc bridge smoke test +@deploy-ibc-test-infra tag=defaultTag: + echo "Deploying ingress controller..." && just deploy-ingress-controller > /dev/null + just wait-for-ingress-controller > /dev/null + echo "Deploying local celestia instance..." && just deploy celestia-local > /dev/null + helm dependency update ./charts/sequencer > /dev/null + helm dependency update ./charts/evm-rollup > /dev/null + echo "Setting up single astria sequencer..." && helm install \ + -n astria-validator-single single-sequencer-chart charts/sequencer \ + -f ./dev/values/validators/all.yml \ + -f ./dev/values/validators/single.yml \ + {{ if tag != '' { replace('--set images.sequencer.devTag=# --set sequencer-relayer.images.sequencerRelayer.devTag=#', '#', tag) } else { '' } }} \ + --create-namespace > /dev/null + just wait-for-sequencer > /dev/null + echo "Starting EVM rollup..." && helm install -n astria-dev-cluster astria-chain-chart ./charts/evm-rollup \ + -f ./dev/values/rollup/dev.yaml \ + -f ./dev/values/rollup/ibc-bridge-test.yaml \ + {{ if tag != '' { replace('--set images.conductor.devTag=# --set images.composer.devTag=#', '#', tag) } else { '' } }} \ + --set config.blockscout.enabled=false \ + --set config.faucet.enabled=false > /dev/null + just wait-for-dev-rollup > /dev/null + echo "Deploying Hermes and creating IBC channel..." + just deploy hermes-local > /dev/null + kubectl wait -n astria-dev-cluster deployment hermes-local-chart --for=condition=Available=True --timeout=300s + +# delete infra used for the ibc bridge test +delete-ibc-test-infra: + -just delete celestia-local + -just delete sequencer + -just delete rollup + -just delete hermes-local + -just delete bridge-tester + +# deploy a bridge tester chart that runs a job to test the ibc bridge +deploy-bridge-tester tag='local' namespace=defaultNamespace: + helm install --debug bridge-tester-chart ./charts/bridge-test \ + --namespace {{namespace}} \ + --set bridgeTesterUtilityImage=ghcr.io/astriaorg/bridge-tester-utility:{{tag}} + +# delete the bridge tester release +delete-bridge-tester namespace=defaultNamespace: + helm uninstall bridge-tester-chart --namespace {{namespace}} + +########### +# helpers # +########### + +# NOTE - can't build for darwin because base images don't support it +default_target_platform := 'linux/amd64' + +# build bridge tester utility image, load into cluster +build-and-load-bridge-tester-image tag='local' target_platform=default_target_platform: + docker buildx build \ + --load \ + --platform {{target_platform}} \ + -f dev/containerfiles/bridgetesterutility.Dockerfile \ + -t ghcr.io/astriaorg/bridge-tester-utility:{{tag}} . + just load-image ghcr.io/astriaorg/bridge-tester-utility:{{tag}} + +# build the astria-geth image and load into cluster. NOTE - assumes astria-geth is sibling directory to monorepo +build-and-load-astria-geth: + @echo "building astria-geth local docker image..." + cd ../astria-geth && docker buildx build -f Dockerfile -t ghcr.io/astriaorg/astria-geth:local . + just load-image ghcr.io/astriaorg/astria-geth:local + +# load astria-go and astria-geth images into cluster +load-images: + #just load-image ghcr.io/astriaorg/astria-go:local + just load-image ghcr.io/astriaorg/bridge-tester-utility:local + just load-image ghcr.io/astriaorg/astria-geth:local diff --git a/dev/containerfiles/bridgetesterutility.Dockerfile b/dev/containerfiles/bridgetesterutility.Dockerfile new file mode 100644 index 0000000000..83d755ebd3 --- /dev/null +++ b/dev/containerfiles/bridgetesterutility.Dockerfile @@ -0,0 +1,44 @@ +FROM ubuntu:22.04 + +# This is a utility image for testing the bridge. +# It contains the Celestia app and the Astria CLI, plus some bash utilities for testing. + +# dependencies needed for testing +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + bc \ + jq \ + sed \ + ca-certificates \ + coreutils \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /home + +ARG CELESTIA_VERSION=v1.9.0 +ARG ASTRIA_VERSION=nightly-2024-07-10 + +# download architecture-specific binaries +ARG TARGETPLATFORM +RUN echo "TARGETPLATFORM: $TARGETPLATFORM" +RUN if [ "$TARGETPLATFORM" = "darwin/arm64" ]; then \ + curl -L "https://github.com/celestiaorg/celestia-app/releases/download/$CELESTIA_VERSION/celestia-app_Darwin_arm64.tar.gz" -o celestia-appd.tar.gz; \ + curl -L "https://github.com/astriaorg/astria-cli-go/releases/download/$ASTRIA_VERSION/astria-go-$ASTRIA_VERSION-darwin-arm64.tar.gz" -o astria-go.tar.gz; \ + elif [ "$TARGETPLATFORM" = "darwin/amd64" ]; then \ + curl -L "https://github.com/celestiaorg/celestia-app/releases/download/$CELESTIA_VERSION/celestia-app_Darwin_x86_64.tar.gz" -o celestia-appd.tar.gz; \ + curl -L "https://github.com/astriaorg/astria-cli-go/releases/download/$ASTRIA_VERSION/astria-go-$ASTRIA_VERSION-darwin-amd64.tar.gz" -o astria-go.tar.gz; \ + elif [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + curl -L "https://github.com/celestiaorg/celestia-app/releases/download/$CELESTIA_VERSION/celestia-app_Linux_x86_64.tar.gz" -o celestia-appd.tar.gz; \ + curl -L "https://github.com/astriaorg/astria-cli-go/releases/download/$ASTRIA_VERSION/astria-go-$ASTRIA_VERSION-linux-amd64.tar.gz" -o astria-go.tar.gz; \ + else \ + echo "Unsupported architecture"; \ + echo "TARGETPLATFORM: $TARGETPLATFORM"; \ + exit 1; \ + fi + +# untar and move to bin +RUN tar -xzvf celestia-appd.tar.gz && mv celestia-appd /usr/local/bin/celestia-appd && \ + tar -xzvf astria-go.tar.gz && mv astria-go /usr/local/bin/astria-go && \ + chmod +x /usr/local/bin/celestia-appd /usr/local/bin/astria-go + +CMD ["echo", "This is the bridge tester utility image!"] diff --git a/dev/values/hermes/local.yml b/dev/values/hermes/local.yaml similarity index 63% rename from dev/values/hermes/local.yml rename to dev/values/hermes/local.yaml index c3c4d930e8..f9d7d0f789 100644 --- a/dev/values/hermes/local.yml +++ b/dev/values/hermes/local.yaml @@ -1,3 +1,5 @@ +image: "ghcr.io/astriaorg/hermes:0.2.0" + createChannel: enabled: true chainA: sequencer-test-chain-0 @@ -5,14 +7,18 @@ createChannel: chainB: celestia-local-0 portB: transfer +secretProvider: + enabled: false + chains: sequencer-test-chain-0: type: Astria rpcAddr: http://node0-sequencer-rpc-service.astria-dev-cluster.svc.cluster.local:26657 grpcAddr: http://node0-sequencer-grpc-service.astria-dev-cluster.svc.cluster.local:8080 - accountPrefix: not_used rpcTimeout: 15s - storePrefix: ibc_data + ccvConsumerChain: false + accountPrefix: not_used + storePrefix: ibc-data key: name: astria-wallet devContent: @@ -28,37 +34,42 @@ chains: gasPrice: 1 gasDenom: nria trustThreshold: 2/3 + trustingPeriod: 14days celestia-local-0: type: CosmosSdk compatMode: "0.34" rpcAddr: http://celestia-app-service.astria-dev-cluster.svc.cluster.local:26657 grpcAddr: http://celestia-app-service.astria-dev-cluster.svc.cluster.local:9090 - eventSource: - mode: push - url: http://celestia-app-service.astria-dev-cluster.svc.cluster.local:26657/websocket - batchDelay: 500ms rpcTimeout: 15s + ccvConsumerChain: false accountPrefix: celestia + storePrefix: ibc key: name: celestia + # ibc account key devContent: - private_key: 8241386890823ca14743e5d4d583f879a5236af29f454ed4da6fe62b8439e2ab - public_key: 03b0effa59e7eee365a888b4d2fa4c9be82a4925df255d4443151d61b11ac63714 - address: [39, 166, 219, 243, 73, 131, 245, 143, 2, 206, 64, 203, 217, 165, 252, 194, 189, 5, 171, 220] + private_key: cd8fe707b8e4743e681e0bc91d11583a9fc816ae34ad9cb844174b1e4afbae56 + public_key: 02b4348667a0b25ccb662c71dc0920d46f1d67a14424665f0162266b5747eb1b07 + address: [111, 5, 223, 20, 76, 255, 226, 98, 86, 19, 67, 73, 207, 27, 16, 245, 78, 102, 228, 160] address_type: Cosmos - account: celestia1y7ndhu6fs06c7qkwgr9anf0uc27st27uwdj6vq + account: celestia1duza79zvll3xy4sngdyu7xcs748xde9q2fcae0 secret: resourceName: projects/$PROJECT_ID/secrets/celestia-ibc-relay-key/versions/latest filename: celestia.json key: token - denom: "utia" - gasPrice: 0.1 - gasMultiplier: 1.5 - defaultGas: "100000" - maxGas: "400000" + eventSource: + mode: push + url: ws://celestia-app-service.astria-dev-cluster.svc.cluster.local:26657/websocket + batchDelay: 200ms + gasDenom: "utia" + gasPrice: 0.0026 + gasMultiplier: 1.2 + defaultGas: "1000000" + maxGas: "10000000" maxMsgNum: 30 - maxTxSize: "180000" + maxTxSize: "2097152" clockDrift: 5s maxBlockTime: 30s - trustThreshold: 1/3 + trustThreshold: 2/3 + trustingPeriod: 14days diff --git a/dev/values/rollup/ibc-bridge-test.yaml b/dev/values/rollup/ibc-bridge-test.yaml new file mode 100644 index 0000000000..825e2e4451 --- /dev/null +++ b/dev/values/rollup/ibc-bridge-test.yaml @@ -0,0 +1,10 @@ +# this file contains overrides that are used for the ibc bridge tests + +config: + rollup: + genesis: + bridgeAddresses: + - bridgeAddress: "astria1d7zjjljc0dsmxa545xkpwxym86g8uvvwhtezcr" + startHeight: 1 + assetDenom: "transfer/channel-0/utia" + assetPrecision: 6 diff --git a/dev/values/validators/all.yml b/dev/values/validators/all.yml index 621ce1d11e..0b482a4e62 100644 --- a/dev/values/validators/all.yml +++ b/dev/values/validators/all.yml @@ -33,6 +33,9 @@ genesis: # This account is used for bridge in smoke test. - address: astria13ahqz4pjqfmynk9ylrqv4fwe4957x2p0h5782u balance: "48" + # address of the bridge account. needs funds to sign bridge init tx + - address: astria1d7zjjljc0dsmxa545xkpwxym86g8uvvwhtezcr + balance: "69000000" resources: cometbft: diff --git a/justfile b/justfile index b9a98f653a..e6fc5e91f5 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,5 @@ import 'charts/deploy.just' +import 'dev/bridgetester.just' default: @just --list