Skip to content

Commit

Permalink
Merge pull request #162 from terra-money/upgrade/2.5
Browse files Browse the repository at this point in the history
feat: upgrade 2.5
  • Loading branch information
emidev98 authored Sep 20, 2023
2 parents 5e791b4 + 28273cb commit aa63b57
Show file tree
Hide file tree
Showing 167 changed files with 57,026 additions and 38,866 deletions.
5 changes: 4 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ coverage:
status:
project:
default:
threshold: 1% # allow this much decrease on project
threshold: 10% # allow this much decrease on project
changes: false
patch:
default:
threshold: 10%

comment:
layout: "reach, diff, files"
Expand Down
File renamed without changes.
85 changes: 85 additions & 0 deletions .github/workflows/interchaine2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: interchain E2E

on:
pull_request:
branches:
- main
- release/*
- upgrade/*

permissions:
contents: read
packages: write

env:
GO_VERSION: 1.20.7
TAR_PATH: /tmp/terramoneycore.tar
IMAGE_NAME: terramoneycore

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: interchaintest/go.sum

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and export
uses: docker/build-push-action@v4
with:
context: .
tags: ${{ env.IMAGE_NAME }}:latest
outputs: type=docker,dest=${{ env.TAR_PATH }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.TAR_PATH }}

e2e-tests:
needs: build-docker
runs-on: ubuntu-latest
strategy:
matrix:
# names of `make` commands to run tests
test:
- "test-e2e-pob"
- "test-e2e-pmf"
fail-fast: false

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: interchaintest/go.sum

- name: checkout chain
uses: actions/checkout@v3

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.IMAGE_NAME }}
path: /tmp

- name: Load Docker Image
run: |
docker image load -i ${{ env.TAR_PATH }}
docker image ls -a
- name: Run Test
run: make ${{ matrix.test }}
15 changes: 2 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,9 @@ jobs:
- name: test & coverage report creation
run: |
go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock'
go test -mod=readonly -timeout 10m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./...
if: env.GIT_DIFF

- name: filter out DONTCOVER
run: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
excludelist+=" $(find ./ -type f -name '*.pb.go')"
for filename in ${excludelist}; do
filename=$(echo $filename | sed 's/^./github.com\/terra-money\/core\/v2/g')
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
if: env.GIT_DIFF


- uses: codecov/codecov-action@v1
with:
file: ./coverage.txt # optional
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tools/bin/*
examples/build/*
docs/_build
tools-stamp

tmp-swagger-gen
# Data - ideally these don't exist
examples/basecoin/app/data
baseapp/data/*
Expand All @@ -35,6 +35,9 @@ coverage.txt
profile.out
sim_log_file

_build
.testnet

# Vagrant
.vagrant/
*.box
Expand Down
75 changes: 45 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ifeq (,$(VERSION))
endif
endif

TM_VERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::')
TM_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')

export GO111MODULE = on

Expand Down Expand Up @@ -72,7 +72,7 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=terra \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-X github.com/tendermint/tendermint/version.TMCoreSemVer=$(TM_VERSION)
-X github.com/cometbft/cometbft/version.TMCoreSemVer=$(TM_VERSION)

# DB backend selection
ifeq (cleveldb,$(findstring cleveldb,$(COSMOS_BUILD_OPTIONS)))
Expand Down Expand Up @@ -194,21 +194,7 @@ build-release-arm64: go.sum $(BUILDDIR)/
install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/terrad

gen-swagger-docs:
bash scripts/protoc-swagger-gen.sh

update-swagger-docs: statik
$(BINDIR)/statik -src=client/docs/swagger-ui -dest=client/docs -f -m
@if [ -n "$(git status --porcelain)" ]; then \
echo "Swagger docs are out of sync!";\
exit 1;\
else \
echo "Swagger docs are in sync!";\
fi

apply-swagger: gen-swagger-docs update-swagger-docs

.PHONY: build build-linux install update-swagger-docs apply-swagger
.PHONY: build build-linux install


###############################################################################
Expand All @@ -221,14 +207,11 @@ integration-test-all: init-test-framework \
test-ibc-hooks \
test-vesting-accounts \
test-alliance \
test-tokenfactory
-@rm -rf ./data
-@killall terrad 2>/dev/null
-@killall rly 2>/dev/null
test-tokenfactory

init-test-framework: clean-testing-data install
@echo "Initializing both blockchains..."
./scripts/tests/start.sh
./scripts/tests/init-test-framework.sh

test-relayer:
@echo "Testing relayer..."
Expand All @@ -254,25 +237,50 @@ test-tokenfactory:
@echo "Testing tokenfactory..."
./scripts/tests/tokenfactory/tokenfactory.sh

test-chain-upgrade:
@echo "Testing software upgrade..."
bash ./scripts/tests/chain-upgrade/chain-upgrade.sh

clean-testing-data:
@echo "Killing terrad and removing previous data"
-@pkill terrad 2>/dev/null
-@pkill rly 2>/dev/null
-@pkill terrad_new 2>/dev/null
-@pkill terrad_old 2>/dev/null
-@rm -rf ./data
-@killall terrad 2>/dev/null
-@killall rly 2>/dev/null
-@rm -rf ./_build


.PHONY: integration-test-all init-test-framework test-relayer test-ica test-ibc-hooks test-vesting-accounts test-tokenfactory clean-testing-data

###############################################################################
### Protobuf ###
###############################################################################

proto-all: proto-gen
protoVer=0.13.0
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen:v0.3 sh ./scripts/protocgen.sh
@$(protoImage) sh ./scripts/protocgen.sh

.PHONY: proto-all proto-gen
gen-swagger:
bash scripts/protoc-swagger-gen.sh

update-swagger-docs: statik
$(BINDIR)/statik -src=client/docs/swagger-ui -dest=client/docs -f -m
@if [ -n "$(git status --porcelain)" ]; then \
echo "Swagger docs are out of sync!";\
exit 1;\
else \
echo "Swagger docs are in sync!";\
fi

apply-swagger: gen-swagger update-swagger-docs

proto-all: proto-gen gen-swagger update-swagger-docs apply-swagger

.PHONY: proto-gen gen-swagger update-swagger-docs apply-swagger proto-all

########################################
### Tools & dependencies
Expand Down Expand Up @@ -315,15 +323,21 @@ test-race:
@VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./...

test-cover:
@go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./...
@go test -mod=readonly -timeout 10m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./...

benchmark:
@go test -mod=readonly -bench=. ./...

simulate:
@go test -bench BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true -Seed 1

.PHONY: test test-all test-cover test-unit test-race simulate
test-e2e-pob:
cd interchaintest && go test -race -v -run TestPOB .

test-e2e-pmf:
cd interchaintest && go test -race -v -run TestPMF .

.PHONY: test test-all test-cover test-unit test-race simulate test-e2e-pob test-e2e-pmf

###############################################################################
### Linting ###
Expand All @@ -334,6 +348,7 @@ lint:

lint-fix:
golangci-lint run --fix --out-format=tab --issues-exit-code=0

.PHONY: lint lint-fix

format:
Expand Down
18 changes: 16 additions & 2 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package ante

import (
"github.com/cosmos/cosmos-sdk/client"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
ibcante "github.com/cosmos/ibc-go/v6/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v6/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
"github.com/skip-mev/pob/mempool"
pobante "github.com/skip-mev/pob/x/builder/ante"
pobkeeper "github.com/skip-mev/pob/x/builder/keeper"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
Expand All @@ -20,6 +24,9 @@ type HandlerOptions struct {
IBCkeeper *ibckeeper.Keeper
TxCounterStoreKey storetypes.StoreKey
WasmConfig wasmTypes.WasmConfig
PobBuilderKeeper pobkeeper.Keeper
TxConfig client.TxConfig
PobMempool mempool.Mempool
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
Expand All @@ -43,7 +50,14 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}

auctionDecorator := pobante.NewBuilderDecorator(
options.PobBuilderKeeper,
options.TxConfig.TxEncoder(),
options.PobMempool,
)

anteDecorators := []sdk.AnteDecorator{
auctionDecorator,
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),
Expand Down
Loading

0 comments on commit aa63b57

Please sign in to comment.