diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8adcb9dc72..9deffe53d6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -536,7 +536,7 @@ jobs: if: env.GIT_DIFF run: | cd simapp - go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./... + go test -mod=readonly -timeout 30m -tags='norace ledger test_ledger_mock' ./... - name: tests simapp v1 if: env.GIT_DIFF run: | @@ -562,10 +562,28 @@ jobs: go.sum **/go.mod **/go.sum + - name: tests simapp + if: env.GIT_DIFF + run: | + cd simapp/v2 + go test -mod=readonly -timeout 30m -tags='norace ledger test_ledger_mock' ./... - name: simapp-v2-smoke-test if: env.GIT_DIFF run: | - ./scripts/simapp-v2-init.sh + COSMOS_BUILD_OPTIONS=v2 make install + ./scripts/init-simapp-v2.sh + simdv2 start & + SIMD_PID=$! + cnt=0 + while ! simdv2 query block --type=height 5; do + cnt=$((cnt + 1)) + if [ $cnt -gt 30 ]; then + kill -9 "$SIMD_PID" + exit 1 + fi + sleep 1 + done + kill -9 "$SIMD_PID" test-collections: runs-on: ubuntu-latest diff --git a/.github/workflows/v2-test.yml b/.github/workflows/v2-test.yml index 7433a47a13..9bde9c3f39 100644 --- a/.github/workflows/v2-test.yml +++ b/.github/workflows/v2-test.yml @@ -1,4 +1,4 @@ -name: v2 core Tests +name: v2 core Tests on: pull_request: merge_group: @@ -37,7 +37,7 @@ jobs: - name: test & coverage report creation if: env.GIT_DIFF run: | - cd server/v2 && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock' + cd server/v2 && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock' stf: runs-on: ubuntu-latest strategy: @@ -60,9 +60,9 @@ jobs: - name: test & coverage report creation if: env.GIT_DIFF run: | - cd server/v2/stf && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock' - - appamanger: + cd server/v2/stf && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock' + + appmanager: runs-on: ubuntu-latest strategy: fail-fast: false @@ -84,4 +84,28 @@ jobs: - name: test & coverage report creation if: env.GIT_DIFF run: | - cd server/v2/appmanager && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock' \ No newline at end of file + cd server/v2/appmanager && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock' + + cometbft: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + check-latest: true + cache: true + cache-dependency-path: go.sum + - uses: technote-space/get-diff-action@v6.1.2 + id: git_diff + with: + PATTERNS: | + server/v2/cometbft/**/*.go + server/v2/cometbft/go.mod + server/v2/cometbft/go.sum + - name: test & coverage report creation + if: env.GIT_DIFF + run: | + cd server/v2/cometbft && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock' diff --git a/scripts/build/testing.mk b/scripts/build/testing.mk index 8289d538ac..98f1afe2a6 100644 --- a/scripts/build/testing.mk +++ b/scripts/build/testing.mk @@ -6,6 +6,8 @@ #? init-simapp: Initializes a single local node network init-simapp: ./scripts/init-simapp.sh +init-simapp-v2: + ./scripts/init-simapp-v2.sh #? test: Run `make test-unit` test: test-unit diff --git a/scripts/init-simapp-v2.sh b/scripts/init-simapp-v2.sh new file mode 100755 index 0000000000..a4788dfee8 --- /dev/null +++ b/scripts/init-simapp-v2.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +SIMD_BIN=${SIMD_BIN:=$(which simdv2 2>/dev/null)} + +if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run 'COSMOS_BUILD_OPTIONS=v2 make install' before"; exit 1; fi +echo "using $SIMD_BIN" +SIMD_HOME=$($SIMD_BIN config home) +if [ -d "$SIMD_HOME" ]; then rm -rv $SIMD_HOME; fi +$SIMD_BIN config set client chain-id simapp-v2-chain +$SIMD_BIN config set client keyring-backend test +$SIMD_BIN config set client keyring-default-keyname alice +$SIMD_BIN config set app api.enable true +$SIMD_BIN keys add alice --indiscreet +$SIMD_BIN keys add bob --indiscreet +$SIMD_BIN init simapp-v2-node --chain-id simapp-v2-chain +# to change the voting_period +jq '.app_state.gov.params.voting_period = "600s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json +jq '.app_state.gov.params.expedited_voting_period = "300s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json +jq '.app_state.mint.minter.inflation = "0.300000000000000000"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json # to change the inflation +$SIMD_BIN genesis add-genesis-account alice 5000000000stake --keyring-backend test +$SIMD_BIN genesis add-genesis-account bob 5000000000stake --keyring-backend test +$SIMD_BIN genesis gentx alice 1000000stake --chain-id demo +$SIMD_BIN genesis collect-gentxs \ No newline at end of file diff --git a/scripts/init-simapp.sh b/scripts/init-simapp.sh index b7f0894956..d3995197fd 100755 --- a/scripts/init-simapp.sh +++ b/scripts/init-simapp.sh @@ -2,9 +2,9 @@ SIMD_BIN=${SIMD_BIN:=$(which simd 2>/dev/null)} -if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run make install before"; exit 1; fi -echo "using $SIMD_BIN" -if [ -d "$($SIMD_BIN config home)" ]; then rm -rv $($SIMD_BIN config home); fi +if [ -z "$SIMD_BIN" ]; then echo "SIMD_BIN is not set. Make sure to run 'make install' before"; exit 1; fi +SIMD_HOME=$($SIMD_BIN config home) +if [ -d "$SIMD_HOME" ]; then rm -rv $SIMD_HOME; fi $SIMD_BIN config set client chain-id demo $SIMD_BIN config set client keyring-backend test $SIMD_BIN config set client keyring-default-keyname alice @@ -12,6 +12,10 @@ $SIMD_BIN config set app api.enable true $SIMD_BIN keys add alice --indiscreet $SIMD_BIN keys add bob --indiscreet $SIMD_BIN init test --chain-id demo +# to change the voting_period +jq '.app_state.gov.params.voting_period = "600s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json +jq '.app_state.gov.params.expedited_voting_period = "300s"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json +jq '.app_state.mint.minter.inflation = "0.300000000000000000"' $SIMD_HOME/config/genesis.json > temp.json && mv temp.json $SIMD_HOME/config/genesis.json # to change the inflation $SIMD_BIN genesis add-genesis-account alice 5000000000stake --keyring-backend test $SIMD_BIN genesis add-genesis-account bob 5000000000stake --keyring-backend test $SIMD_BIN genesis gentx alice 1000000stake --chain-id demo diff --git a/scripts/simapp-v2-init.sh b/scripts/simapp-v2-init.sh deleted file mode 100755 index 7d22970e46..0000000000 --- a/scripts/simapp-v2-init.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -x - -ROOT=$PWD - -SIMD="$ROOT/build/simdv2" -CONFIG="${CONFIG:-$HOME/.simappv2/config}" - -COSMOS_BUILD_OPTIONS=v2 make build - -if [ -d "$($SIMD config home)" ]; then rm -rv $($SIMD config home); fi - -$SIMD init simapp-v2-node --chain-id simapp-v2-chain - -cd "$CONFIG" - -# to change the voting_period -jq '.app_state.gov.voting_params.voting_period = "600s"' genesis.json > temp.json && mv temp.json genesis.json - -# to change the inflation -jq '.app_state.mint.minter.inflation = "0.300000000000000000"' genesis.json > temp.json && mv temp.json genesis.json - -$SIMD config set client chain-id simapp-v2-chain -$SIMD keys add test_validator --indiscreet -VALIDATOR_ADDRESS=$($SIMD keys show test_validator -a --keyring-backend test) - -$SIMD genesis add-genesis-account "$VALIDATOR_ADDRESS" 1000000000stake -$SIMD genesis gentx test_validator 1000000000stake --keyring-backend test -$SIMD genesis collect-gentxs - -$SIMD start & -SIMD_PID=$! - -cnt=0 -while ! $SIMD query block --type=height 5; do - cnt=$((cnt + 1)) - if [ $cnt -gt 30 ]; then - kill -9 "$SIMD_PID" - exit 1 - fi - sleep 1 -done - -kill -9 "$SIMD_PID"