Skip to content

Commit

Permalink
Merge branch 'main' into chore/toolfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Johnson authored Mar 17, 2023
2 parents 6ded8a6 + 1cb525b commit 074728f
Show file tree
Hide file tree
Showing 55 changed files with 4,777 additions and 194 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/buildtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: test quicksilver
run: |
make test-unit-cover
cat coverage.txt | grep .pb.go -v | grep .pb.gw.go -v | grep osmosis-types -v | grep -l 'DONTCOVER' -v > coverage_nogen.txt
cat coverage.txt | grep .pb.go -v | grep .pb.gw.go -v | grep osmosis-types -v | grep test -v | grep -l 'DONTCOVER' -v > coverage_nogen.txt
- name: "Go vulnerability checks"
continue-on-error: true #temp-till we upgrade to v1.20
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: test-e2e

on:
push:
branches:
- "main"
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
-
name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
-
name: Check out repository code
uses: actions/checkout@v3
-
name: Get git diff
uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
**/**.wasm
Dockerfile
go.mod
go.sum
-
name: Get data from build cache
uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-docker-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-docker-${{ matrix.go-version }}-
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build e2e init chain image
run: make docker-build-e2e-init-chain
-
name: Test e2e short
run: make test-e2e-short
2 changes: 1 addition & 1 deletion .github/workflows/simulation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ jobs:
go-version: 1.19

- name: Run simulation tests
run: make test-sim-ci
run: make test-sim-ci
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ FROM alpine:3.17
COPY --from=builder /src/app/build/quicksilverd /usr/local/bin/quicksilverd
RUN adduser -S -h /quicksilver -D quicksilver -u 1000
USER quicksilver

CMD ["quicksilverd", "start"]
69 changes: 68 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
DOCKER_BUILDKIT=1
COSMOS_BUILD_OPTIONS ?= ""
PACKAGES_NOSIMULATION=$(shell go list ./... | grep -v '/simulation')
PACKAGES_SIM=github.com/ingenuity-build/quicksilver/simulation
PACKAGES_SIM=github.com/ingenuity-build/quicksilver/test/simulation
PACKAGES_E2E=$(shell go list ./... | grep '/e2e')
VERSION=$(shell git describe --tags | head -n1)
DOCKER_VERSION ?= $(VERSION)
TMVERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
Expand Down Expand Up @@ -324,6 +325,72 @@ else
go test -short -mod=readonly $(ARGS) $(EXTRA_ARGS) $(TEST_PACKAGES)
endif

test-import:
@go test -short ./tests/importer -v --vet=off --run=TestImportBlocks --datadir tmp \
--blockchain blockchain
rm -rf tests/importer/tmp

test-rpc:
./scripts/integration-test-all.sh -t "rpc" -q 1 -z 1 -s 2 -m "rpc" -r "true"

test-rpc-pending:
./scripts/integration-test-all.sh -t "pending" -q 1 -z 1 -s 2 -m "pending" -r "true"

RUNNER_BASE_IMAGE_DISTROLESS := gcr.io/distroless/static-debian11
RUNNER_BASE_IMAGE_ALPINE := alpine:3.16
RUNNER_BASE_IMAGE_NONROOT := gcr.io/distroless/static-debian11:nonroot
docker-build-debug:
@DOCKER_BUILDKIT=1 $(DOCKER) build -t quicksilver:${COMMIT} --build-arg BASE_IMG_TAG=debug --build-arg RUNNER_IMAGE=$(RUNNER_BASE_IMAGE_ALPINE) -f test/e2e/e2e.Dockerfile .
@DOCKER_BUILDKIT=1 $(DOCKER) tag quicksilver:${COMMIT} quicksilver:debug

docker-build-e2e-init-chain:
@DOCKER_BUILDKIT=1 docker build -t quicksilver-e2e-init-chain:debug --build-arg E2E_SCRIPT_NAME=chain --platform=linux/x86_64 -f test/e2e/initialization/init.Dockerfile .

docker-build-e2e-init-node:
@DOCKER_BUILDKIT=1 docker build -t quicksilver-e2e-init-node:debug --build-arg E2E_SCRIPT_NAME=node --platform=linux/x86_64 -f test/e2e/initialization/init.Dockerfile .

build-e2e-script:
mkdir -p $(BUILDDIR)
go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/ ./test/e2e/initialization/$(E2E_SCRIPT_NAME)

# test-e2e runs a full e2e test suite
# deletes any pre-existing QUICKSILVER containers before running.
#
# Deletes Docker resources at the end.
# Utilizes Go cache.
test-e2e: e2e-setup test-e2e-ci e2e-remove-resources

# TODO
# currently skipping upgrades

# test-e2e-ci runs a full e2e test suite
# does not do any validation about the state of the Docker environment
# As a result, avoid using this locally.
test-e2e-ci:
@VERSION=$(VERSION) QUICKSILVER_E2E=True QUICKSILVER_E2E_DEBUG_LOG=False QUICKSILVER_E2E_SKIP_UPGRADE=True QUICKSILVER_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E)

# test-e2e-debug runs a full e2e test suite but does
# not attempt to delete Docker resources at the end.
test-e2e-debug: e2e-setup
@VERSION=$(VERSION) QUICKSILVER_E2E=True QUICKSILVER_E2E_DEBUG_LOG=True QUICKSILVER_E2E_SKIP_UPGRADE=True QUICKSILVER_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) QUICKSILVER_E2E_SKIP_CLEANUP=True go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1

# test-e2e-short runs the e2e test with only short tests.
# Does not delete any of the containers after running.
# Deletes any existing containers before running.
# Does not use Go cache.
test-e2e-short: e2e-setup
@VERSION=$(VERSION) QUICKSILVER_E2E=True QUICKSILVER_E2E_DEBUG_LOG=True QUICKSILVER_E2E_SKIP_UPGRADE=True QUICKSILVER_E2E_SKIP_IBC=True QUICKSILVER_E2E_SKIP_STATE_SYNC=True QUICKSILVER_E2E_SKIP_CLEANUP=True go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1

e2e-setup: e2e-check-image-sha e2e-remove-resources
@echo Finished e2e environment setup, ready to start the test

e2e-check-image-sha:
test/e2e/scripts/run/check_image_sha.sh

e2e-remove-resources:
test/e2e/scripts/run/remove_stale_resources.sh


.PHONY: run-tests test test-all test-import test-rpc $(TEST_TARGETS)

SIM_NUM_BLOCKS ?= 500
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ For subsequent tests run the following if you want to start with fresh state:

Quicksilver utilises code and logic that originated from other projects; as an open-source project ourselves, we believe that appropriate attribution is necessary, in order to combat plagiarism.

The following modules were lifted and reused in almost entirety from Osmosis (<https://github.com/osmosis-labs/osmosis>), under the terms of the Apache 2.0 License, and we are grateful for their contribution:
The following modules and packages were lifted and reused in almost entirety from Osmosis (<https://github.com/osmosis-labs/osmosis>), under the terms of the Apache 2.0 License, and we are grateful for their contribution:

x/mint
x/epochs
x/tokenfactory
test/e2e

We're also using CosmWasm, developed over the course of years with lead from Confio and support from the whole of Cosmos.

8 changes: 8 additions & 0 deletions cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ func RegisterDenoms() {
func SetWasmConfig(config *sdk.Config) {
config.SetAddressVerifier(wasmtypes.VerifyAddressLen())
}

func SetupConfig() {
config := sdk.GetConfig()
SetBech32Prefixes(config)
SetBip44CoinType(config)
SetWasmConfig(config)
config.Seal()
}
11 changes: 1 addition & 10 deletions cmd/quicksilverd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import (

"github.com/cosmos/cosmos-sdk/server"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/ingenuity-build/quicksilver/app"
cmdcfg "github.com/ingenuity-build/quicksilver/cmd/config"
)

func main() {
setupConfig()
cmdcfg.SetupConfig()
cmdcfg.RegisterDenoms()

userHomeDir, err := os.UserHomeDir()
Expand All @@ -34,11 +33,3 @@ func main() {
}
}
}

func setupConfig() {
config := sdk.GetConfig()
cmdcfg.SetBech32Prefixes(config)
cmdcfg.SetBip44CoinType(config)
cmdcfg.SetWasmConfig(config)
config.Seal()
}
Loading

0 comments on commit 074728f

Please sign in to comment.