Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade 2.5 #162

Merged
merged 74 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
a6c78f8
wip: upgrade 2.5
emidev98 Aug 16, 2023
c0fb1c0
wip: resolve conflicts
emidev98 Aug 16, 2023
79788b0
wip: upgrade 2.5 compile
emidev98 Aug 17, 2023
39bc7f2
fix: keepers, genesis and remove intertx
emidev98 Aug 18, 2023
3aed359
wip: tokens factory
emidev98 Aug 22, 2023
5d7df2e
wip: tokens factory
emidev98 Aug 23, 2023
cfd91c3
feat: added tokenfactory migration
javiersuweijie Aug 24, 2023
0717cb2
fix: missing fee pool for test
javiersuweijie Aug 24, 2023
1b34256
fix: simulate
javiersuweijie Aug 24, 2023
ba54074
fix: cobra commands
emidev98 Aug 24, 2023
fc6eb15
fix: leveldb and integration tests
emidev98 Aug 24, 2023
c5eb4db
fix: integration tests
emidev98 Aug 25, 2023
b826d41
feat: token factory tests
emidev98 Aug 28, 2023
1af15e5
tests: token factory
emidev98 Aug 28, 2023
f16c7dc
feat: packet forward middleware
emidev98 Aug 28, 2023
2b25fc3
chore: lint nosec
emidev98 Aug 29, 2023
b921a2f
feat: tokens factory testing
emidev98 Aug 29, 2023
926010f
feat: add pob
javiersuweijie Aug 29, 2023
0ab9ebb
test: increase coverage
emidev98 Aug 29, 2023
839dd8b
fix: added go sum and update makefile
javiersuweijie Aug 29, 2023
881322c
Merge pull request #163 from terra-money/feat/pob
emidev98 Aug 29, 2023
78af1b7
fix: ignore reflection
javiersuweijie Aug 29, 2023
608d360
fix: genesis tests
emidev98 Aug 29, 2023
a25e378
Merge branch 'upgrade/2.5' of https://github.com/terra-money/core int…
emidev98 Aug 29, 2023
405564d
fix: NewAuctionMempool not declared by package mempool
emidev98 Aug 29, 2023
e239fc8
fix: gosec mempool warning
javiersuweijie Aug 29, 2023
512093c
Merge branch 'upgrade/2.5' of github.com:terra-money/core into upgrad…
javiersuweijie Aug 29, 2023
3902f3e
merge conflicts
javiersuweijie Aug 29, 2023
d0f5c9e
tests: create token with metadata
emidev98 Aug 29, 2023
9220bc5
fix: pfm integration + e2e
javiersuweijie Aug 30, 2023
6ada68d
test: e2e for pfm
javiersuweijie Aug 30, 2023
df5c6d2
test: extend token factory query and execute
emidev98 Aug 30, 2023
9d05c3b
Merge pull request #164 from terra-money/fix/pfm-integration
emidev98 Aug 30, 2023
e58aa1d
tests: authority tokens factory
emidev98 Aug 30, 2023
308a104
wip: bank hooks
emidev98 Aug 30, 2023
8438c9d
wip: bank hooks
emidev98 Aug 31, 2023
faed2c3
feat: ibc-hooks wrap error
emidev98 Sep 1, 2023
3d4b9d8
fix: token factory contract keeper
emidev98 Sep 4, 2023
c632c5d
feat: send coins from module to module without calling hooks
emidev98 Sep 4, 2023
8de72eb
Merge pull request #165 from terra-money/feat/bank/hooks
emidev98 Sep 4, 2023
0b67991
feat: package mempool
emidev98 Sep 4, 2023
fa40790
test: types and nils
emidev98 Sep 4, 2023
6372b59
fix: added ica controller params
javiersuweijie Sep 4, 2023
ed569fe
Merge pull request #167 from terra-money/fix/enable-interchain-contro…
emidev98 Sep 4, 2023
e4cb3e4
test: coverage
emidev98 Sep 4, 2023
8dc3ea0
feat: upgrade handler for IBC client
emidev98 Sep 5, 2023
9e8c18e
feat: codecov patch threshold
emidev98 Sep 5, 2023
9f014ca
feat: swagger gen and dark theme
emidev98 Sep 5, 2023
720da1a
fix: store upgrades
emidev98 Sep 5, 2023
a317072
fix: chain upgrade script
emidev98 Sep 5, 2023
56a6d13
test: export/import genesis
emidev98 Sep 5, 2023
3247c23
fix: test init genesis on migration
emidev98 Sep 6, 2023
2e314f3
feat: chain upgrade with local terrad and delete intertx
emidev98 Sep 6, 2023
4dd00f8
feat: module version
emidev98 Sep 6, 2023
1575599
feat: upgrade bank module migration
emidev98 Sep 6, 2023
5925086
fix: use bank module for bank subspace
javiersuweijie Sep 6, 2023
48221af
Merge pull request #170 from terra-money/fix/bank-subspace
emidev98 Sep 6, 2023
8b60aa4
feat: add deprecated WithKeyTable
emidev98 Sep 6, 2023
477d061
fix: token factory and wasm migration
emidev98 Sep 7, 2023
20d00e8
feat: include upgrade into integration test and swagger
emidev98 Sep 7, 2023
3c0b0af
Merge pull request #169 from terra-money/feat/mod/ver
emidev98 Sep 7, 2023
2cea25b
feat: upgrade token factory to 0.47sdk
emidev98 Sep 7, 2023
67a83ce
feat: upgrade alliance module to v3
emidev98 Sep 7, 2023
89fa67d
feat: alliance to v3 adjusting gov models
emidev98 Sep 8, 2023
068a50b
feat: alliance v0.3.1
emidev98 Sep 8, 2023
029192c
Merge pull request #171 from terra-money/feat/ally/v3
emidev98 Sep 8, 2023
35490f9
Merge pull request #172 from terra-money/release/v2.4
emidev98 Sep 12, 2023
e94e19b
fix: missing upgrade plan for pisco
javiersuweijie Sep 13, 2023
62e69ac
Merge pull request #173 from terra-money/fix/pisco-upgrade-2.5
tuky191 Sep 13, 2023
e908c37
fix: upgrade alliance
javiersuweijie Sep 14, 2023
083c8ec
Merge pull request #174 from terra-money/fix/2.5-alliance
tuky191 Sep 14, 2023
dbd599b
fix: added pob queries to swagger and init module with default params
javiersuweijie Sep 18, 2023
1a2a6f0
fix: alliance delegation test
emidev98 Sep 18, 2023
28273cb
Merge pull request #175 from terra-money/fix/pob-swagger-and-genesis
emidev98 Sep 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading