From b90479841d0c0995b38213807b2cd9058a3c9a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Fri, 18 Nov 2022 13:27:53 +0100 Subject: [PATCH] ci: use up to date docker images of core and node (#34) * update celestia node to v0.5.0-rc5 * update celestia core to v0.10.0-rc1 * change chain-id to test * remove fix-genesis.sh (no longer required) * make start-celestia-appd.sh very similar to https://github.com/celestiaorg/celestia-app/blob/93f2c71806d6f5aae21fb656c49e15ba3a5a70ed/scripts/single-node.sh * start-bridge.sh: * update celestia node CLI parameters * fix order of arguments of `wait-for-it.sh` * use gateway port in integration tests --- integration_test/cnc_test.go | 4 +- integration_test/docker/fix-genesis.sh | 13 ------ integration_test/docker/start-bridge.sh | 18 ++++---- .../docker/start-celestia-appd.sh | 42 +++++++++++-------- .../docker/test-docker-compose.yml | 11 +++-- 5 files changed, 41 insertions(+), 47 deletions(-) delete mode 100755 integration_test/docker/fix-genesis.sh diff --git a/integration_test/cnc_test.go b/integration_test/cnc_test.go index 02efc8a..4c88eb5 100644 --- a/integration_test/cnc_test.go +++ b/integration_test/cnc_test.go @@ -26,7 +26,7 @@ func (i *IntegrationTestSuite) SetupSuite() { i.dockerCompose = testcontainers.NewLocalDockerCompose(composeFilePaths, identifier) i.dockerCompose.WaitForService("bridge0", - wait.ForHTTP("/balance").WithPort("26658"). + wait.ForHTTP("/balance").WithPort("26659"). WithStartupTimeout(60*time.Second). WithPollInterval(3*time.Second)) execError := i.dockerCompose.WithCommand([]string{"up", "-d"}).Invoke() @@ -71,7 +71,7 @@ func (i *IntegrationTestSuite) TestNewClient() { } func (i *IntegrationTestSuite) TestDataRoundTrip() { - client, err := cnc.NewClient("http://localhost:26658", cnc.WithTimeout(30*time.Second)) + client, err := cnc.NewClient("http://localhost:26659", cnc.WithTimeout(30*time.Second)) i.NoError(err) i.NotNil(client) diff --git a/integration_test/docker/fix-genesis.sh b/integration_test/docker/fix-genesis.sh deleted file mode 100755 index 8608b8a..0000000 --- a/integration_test/docker/fix-genesis.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -e -if [ "$1" == "--help" ] || [ -z "$2" ]; then - echo "Usage: ./fix_genesis.sh path/to/genesis.json new_token_name" - exit 0 -fi - -# $1 -> path to genesis.json -# $2 -> becomes an token arg in jq -cat $1 | jq --arg token $2 '.app_state.crisis.constant_fee.denom = $token' | sponge $1 -cat $1 | jq --arg token $2 '.app_state.mint.params.mint_denom = $token' | sponge $1 -cat $1 | jq --arg token $2 '.app_state.staking.params.bond_denom = $token' | sponge $1 diff --git a/integration_test/docker/start-bridge.sh b/integration_test/docker/start-bridge.sh index d69c359..11bd4d1 100644 --- a/integration_test/docker/start-bridge.sh +++ b/integration_test/docker/start-bridge.sh @@ -3,14 +3,16 @@ apt-get update apt-get install -y curl jq -./celestia bridge --node.store /bridge init -/wait-for-it.sh -t 30 192.167.10.10:26657/header -- \ +./celestia bridge init --node.store /bridge +/wait-for-it.sh 192.167.10.10:26657 -t 90 -- \ curl -s http://192.167.10.10:26657/block?height=1 | jq '.result.block_id.hash' | tr -d '"' > genesis.hash -export CELESTIA_CUSTOM=ephemeral:`cat genesis.hash` +curl -s http://192.167.10.10:26657/block_by_hash?hash=0x`cat genesis.hash` +echo # newline + +export CELESTIA_CUSTOM=test:`cat genesis.hash` echo $CELESTIA_CUSTOM -./celestia bridge --node.store /bridge --rpc.port 26658 \ - --core.grpc 192.167.10.10:9090 \ - --core.remote tcp://192.167.10.10:26657 \ - --keyring.accname node \ - start +./celestia bridge start \ + --node.store /bridge --gateway \ + --core.ip 192.167.10.10 \ + --keyring.accname validator diff --git a/integration_test/docker/start-celestia-appd.sh b/integration_test/docker/start-celestia-appd.sh index 8420209..6090c34 100755 --- a/integration_test/docker/start-celestia-appd.sh +++ b/integration_test/docker/start-celestia-appd.sh @@ -1,25 +1,31 @@ #!/usr/bin/env bash -chain_id=ephemeral -token=celestia -node_name=node -key_type=test -celestia_appd=/celestia-app/celestia-appd +CHAINID="test" -rm -rf $node_name/config/genesis.json $node_name/config/gentx -pwd -$celestia_appd --home $node_name init $node_name --chain-id $chain_id -$celestia_appd --home $node_name keys add $node_name --keyring-backend $key_type -addr=`$celestia_appd --home $node_name keys show $node_name --address --keyring-backend test` -echo $addr -$celestia_appd --home $node_name add-genesis-account $addr 800000000000$token +rm -rf /root/.celestia-app -apk add moreutils # required for sponge -/fix-genesis.sh $node_name/config/genesis.json $token +# Build genesis file incl account for passed address +coins="1000000000000000utia" +celestia-appd init $CHAINID --chain-id $CHAINID +celestia-appd keys add validator --keyring-backend="test" +# this won't work because the some proto types are decalared twice and the logs output to stdout (dependency hell involving iavl) +celestia-appd add-genesis-account $(celestia-appd keys show validator -a --keyring-backend="test") $coins +celestia-appd gentx validator 5000000000utia \ + --keyring-backend="test" \ + --chain-id $CHAINID \ + --orchestrator-address $(celestia-appd keys show validator -a --keyring-backend="test") \ + --evm-address 0x966e6f22781EF6a6A82BBB4DB3df8E225DfD9488 # private key: da6ed55cb2894ac2c9c10209c09de8e8b9d109b910338d5bf3d747a7e1fc9eb9 +celestia-appd collect-gentxs -$celestia_appd --home $node_name gentx $node_name 5000000000$token --keyring-backend=$key_type --chain-id $chain_id -$celestia_appd --home $node_name collect-gentxs +# Set proper defaults and change ports +# If you encounter: `sed: -I or -i may not be used with stdin` on MacOS you can mitigate by installing gnu-sed +# https://gist.github.com/andre3k1/e3a1a7133fded5de5a9ee99c87c6fa0d?permalink_comment_id=3082272#gistcomment-3082272 +sed -i'.bak' 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ~/.celestia-app/config/config.toml +sed -i'.bak' 's/timeout_commit = "25s"/timeout_commit = "1s"/g' ~/.celestia-app/config/config.toml +sed -i'.bak' 's/timeout_propose = "3s"/timeout_propose = "1s"/g' ~/.celestia-app/config/config.toml +sed -i'.bak' 's/index_all_keys = false/index_all_keys = true/g' ~/.celestia-app/config/config.toml +sed -i'.bak' 's/mode = "full"/mode = "validator"/g' ~/.celestia-app/config/config.toml -sed -i $node_name/config/config.toml -e 's/"full"/"validator"/' -$celestia_appd --home $node_name --rpc.laddr tcp://0.0.0.0:26657 start +# Start the celestia-app +celestia-appd start diff --git a/integration_test/docker/test-docker-compose.yml b/integration_test/docker/test-docker-compose.yml index f37dba1..e669132 100644 --- a/integration_test/docker/test-docker-compose.yml +++ b/integration_test/docker/test-docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: core0: container_name: core0 - image: "ghcr.io/celestiaorg/celestia-app-ephemeral:latest" + image: "ghcr.io/celestiaorg/celestia-app:v0.10.0-rc1" entrypoint: [ "/bin/bash" ] @@ -12,8 +12,7 @@ services: ] volumes: - ${PWD}/docker/start-celestia-appd.sh:/start-celestia-appd.sh:ro - - ${PWD}/docker/fix-genesis.sh:/fix-genesis.sh:ro - - keyring-volume:/celestia-app/node/keyring-test + - keyring-volume:/root/.celestia-app/keyring-test networks: localnet: ipv4_address: 192.167.10.10 @@ -22,7 +21,7 @@ services: container_name: bridge0 depends_on: - core0 - image: "ghcr.io/celestiaorg/celestia-node:sha-25652db" + image: "ghcr.io/celestiaorg/celestia-node:0.5.0-rc5" entrypoint: [ "/bin/bash" ] @@ -35,10 +34,10 @@ services: - keyring-volume:/bridge/keys/keyring-test/:ro expose: - - "26658/tcp" + - "26659/tcp" ports: - - "26658:26658" + - "26659:26659" networks: localnet: