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

[v2] sdk v0.47.x migration & ibc v7 #93

Merged
merged 64 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
6b168a9
update app to v2
harish551 Jul 21, 2023
b748fad
upgrade to sdk v0.47 & ibc-go v7
harish551 Jul 26, 2023
55602af
update ibc storekey
harish551 Jul 26, 2023
388d6db
cosmos-sdk v0.47 updates, improvements & cleanup
harish551 Jul 28, 2023
584bfca
update go version
harish551 Jul 28, 2023
ea76f13
merge updates from main
harish551 Sep 6, 2023
7cfc331
add v2 upgrade handler
harish551 Sep 6, 2023
13fa18a
update sdkerrors to errorsmod
harish551 Sep 6, 2023
38d1a07
update github workflows
harish551 Sep 6, 2023
584dde9
fix github workflows
harish551 Sep 6, 2023
3f03547
fix lint issues
harish551 Sep 7, 2023
f51a205
fix lint issues
harish551 Sep 7, 2023
dffd21b
gofumpted
harish551 Sep 7, 2023
0fc4934
fix tests
harish551 Sep 7, 2023
2b996b3
lint
harish551 Sep 7, 2023
3ab397d
fix tests
harish551 Sep 7, 2023
d1d83bc
Merge pull request #85 from OmniFlix/harish551/sdk-v0.47.x-migration
harish551 Sep 7, 2023
1aa9102
add update params message
harish551 Sep 7, 2023
dfcee6b
add migrations
harish551 Sep 7, 2023
a136f58
removed unused handler
harish551 Sep 12, 2023
59e21e7
seperated params and legacy params
harish551 Sep 12, 2023
46f6eea
add store migration logic
harish551 Sep 12, 2023
47c6b83
add update params message and it's types
harish551 Sep 12, 2023
94419ef
add params store key for module
harish551 Sep 12, 2023
4aaf5ef
update init genesis to panic on error
harish551 Sep 12, 2023
6da5314
include subspace argument in alloc module call
harish551 Sep 12, 2023
1e2b409
fix lint
harish551 Sep 12, 2023
6636926
fix codec register msg
harish551 Sep 12, 2023
800e2a0
Merge pull request #90 from OmniFlix/harish551/x-alloc-params-migration
harish551 Sep 12, 2023
1d6eb90
update protos
harish551 Sep 12, 2023
145fff7
add paramset in exported types for migration
harish551 Sep 14, 2023
ae21c7e
seperated legacy fuciton of params
harish551 Sep 14, 2023
c6e87db
add msg types for update params
harish551 Sep 14, 2023
3ee47b9
updated params get & set fuctions to fetch data from module store
harish551 Sep 14, 2023
0bc7d8c
fix lint
harish551 Sep 14, 2023
f48b2d2
add upgrade params msg
harish551 Sep 14, 2023
a5896b3
fix params grpc query
harish551 Sep 14, 2023
5ddc059
fix itc keeper init
harish551 Sep 14, 2023
5db5a89
add & register migration
harish551 Sep 14, 2023
dd2688d
register params msg with codec
harish551 Sep 14, 2023
0406a30
migration tests
harish551 Sep 14, 2023
7dc85c2
fix lint
harish551 Sep 14, 2023
79afefa
fix sdk msg implementation
harish551 Sep 14, 2023
b77ba38
feat: x/itc params migration
harish551 Sep 14, 2023
68fcc76
merge updates from main
harish551 Sep 14, 2023
b2e703a
refactor: remove unused legacy handler
harish551 Sep 19, 2023
1b15ab7
replace gogo protobuf with cosmos gogoproto
harish551 Sep 19, 2023
693d69c
add update params msg protos
harish551 Sep 19, 2023
30d4e79
add update params related types
harish551 Sep 19, 2023
7b88c50
add updateParams message
harish551 Sep 19, 2023
c56ea62
add & register migration
harish551 Sep 19, 2023
b7663d5
lint
harish551 Sep 19, 2023
059831c
feat: x/marketplace params migration (#94)
harish551 Sep 22, 2023
81d8cfe
feat: x/streampay params migration
harish551 Sep 22, 2023
cf83223
fix streampay module initialization
harish551 Sep 22, 2023
1d87a6a
feat: onft params migration
harish551 Sep 23, 2023
f4a159f
feat: update upgrade handler sdk & ibc migrations
harish551 Sep 23, 2023
67c1a2a
add consensus and crisis modules to store upgrades
harish551 Sep 23, 2023
a622b3c
update go lint config
harish551 Sep 23, 2023
64e343e
fix lint issues
harish551 Sep 23, 2023
b36c1ff
fix lint issues
harish551 Sep 23, 2023
cac4089
remove min commission decorator
harish551 Oct 4, 2023
f150ffd
add migration test for alloc params
harish551 Oct 4, 2023
483179f
fix params migration issue
harish551 Oct 4, 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
63 changes: 41 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,65 @@ name: omniflixhub
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
push:
branches:
- master
- main
- development
tags:
- v*
pull_request:
branches:
- master
- main
- development
- "**"
push:
branches:
- "main"
- "v[0-9]**"
workflow_dispatch:

env:
GO_VERSION: "1.20.5"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
# This workflow makes x86_64 binaries for mac, windows, and linux.

jobs:
build:
name: omniflixhub ${{ matrix.arch }} for ${{ matrix.targetos }}
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ amd64, arm64 ]
targetos: [ darwin, linux ]
name: omniflixhub ${{ matrix.arch }} for ${{ matrix.targetos }}
include:
- targetos: darwin
arch: arm64

steps:
- uses: actions/checkout@v2
- name: Setup go
uses: actions/setup-go@v1
- name: Check out repository code
uses: actions/checkout@v4
- name: Get git diff
uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.wasm
!tests/**
**/**.go !**/*_test.go
go.mod
go.sum
Makefile
.github/workflows/build.yml
- name: Setup Golang
uses: actions/setup-go@v4
if: env.GIT_DIFF
with:
go-version: 1.18
go-version: ${{env.GO_VERSION}}
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}

- name: Compile
- name: Download Dependencies
if: env.GIT_DIFF
run: go mod download
- name: Build omnniflixhubd
if: env.GIT_DIFF
run: |
go mod download
cd cmd/omniflixhubd
go build .

- uses: actions/upload-artifact@v2
GOWRK=off go build cmd/omniflixhubd/main.go
- uses: actions/upload-artifact@v3
with:
name: omniflixhubd ${{ matrix.targetos }} ${{ matrix.arch }}
path: cmd/omniflixhubd/omniflixhubd
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,31 @@ on:
- master
- main
pull_request:
paths:
- '**.go'

env:
GO_VERSION: '1.20.0'

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.20.0
go-version: ${{env.GO_VERSION}}
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout 5m0s
args: --timeout 10m
16 changes: 9 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ linters:
- unused

issues:
gofumpt:
# Module path which contains the source code being formatted.
# Default: ""
module-path: github.com/cosmos/interchain-security
# Choose whether to use the extra rules.
# Default: false
extra-rules: true
exclude-rules:
- text: "Use of weak random number generator"
linters:
Expand All @@ -54,11 +47,20 @@ issues:
- text: "leading space"
linters:
- nolintlint
- path: "legacy"
text: "SA1019:"
linters:
- staticcheck

max-issues-per-linter: 10000
max-same-issues: 10000

linters-settings:
gosec:
excludes:
- G404
- G101
- G601
gocritic:
disabled-checks:
- appendAssign
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ env:

before:
hooks:
- go mod tidy -compat=1.19
- go mod tidy -compat=1.20

builds:
- main: ./cmd/omniflixhubd
Expand Down
55 changes: 48 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,29 @@ APP_NAME = OmniFlixHub
DAEMON_NAME = omniflixhubd
LEDGER_ENABLED ?= true

PACKAGES=$(shell go list ./... | grep -v '/simulation')
VERSION := $(shell echo $(shell git describe --tags --always) | sed 's/^v//')
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
COSMOS_SDK := $(shell grep -i cosmos-sdk go.mod | awk '{print $$2}')

# don't override user values
ifeq (,$(VERSION))
VERSION := $(shell git describe --exact-match 2>/dev/null)
# if VERSION is empty, then populate it with branch's name and raw commit hash
ifeq (,$(VERSION))
VERSION := $(BRANCH)-$(COMMIT)
endif
endif

PACKAGES_SIMTEST=$(shell go list ./... | grep -v '/simulation')
LEDGER_ENABLED ?= true
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
BFT_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')
DOCKER := $(shell which docker)
BUILDDIR ?= $(CURDIR)/build

GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1-2)
REQUIRE_GO_VERSION = 1.20

export GO111MODULE = on

build_tags = netgo
ifeq ($(LEDGER_ENABLED),true)
Expand All @@ -30,6 +49,13 @@ ifeq ($(LEDGER_ENABLED),true)
endif
endif
endif

ifeq (cleveldb,$(findstring cleveldb,$(OMNIFLIXHUB_BUILD_OPTIONS)))
build_tags += gcc cleveldb
else ifeq (rocksdb,$(findstring rocksdb,$(OMNIFLIXHUB_BUILD_OPTIONS)))
build_tags += gcc rocksdb
endif

build_tags += $(BUILD_TAGS)
build_tags := $(strip $(build_tags))

Expand All @@ -44,27 +70,42 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=${APP_NAME} \
-X github.com/cosmos/cosmos-sdk/version.AppName=${DAEMON_NAME} \
-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),cosmos-sdk $(COSMOS_SDK)"
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
-X github.com/cometbft/cometbft/version.TMCoreSemVer=$(BFT_VERSION)

ifeq (cleveldb,$(findstring cleveldb,$(OMNIFLIXHUB_BUILD_OPTIONS)))
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
else ifeq (rocksdb,$(findstring rocksdb,$(OMNIFLIXHUB_BUILD_OPTIONS)))
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=rocksdb
endif

ifeq (,$(findstring nostrip,$(OMNIFLIXHUB_BUILD_OPTIONS)))
ldflags += -w -s
endif

ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))

BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'

ifeq (,$(findstring nostrip,$(ONFT_BUILD_OPTIONS)))
BUILD_FLAGS += -trimpath
endif

all: go.sum install

install: go.sum
go install $(BUILD_FLAGS) ./cmd/omniflixhubd/
go install -mod=readonly $(BUILD_FLAGS) ./cmd/omniflixhubd
build:
go build $(BUILD_FLAGS) -o ./build/omniflixhubd ./cmd/omniflixhubd/
go build $(BUILD_FLAGS) -o ${BUILDDIR}/${DAEMON_NAME} ./cmd/omniflixhubd

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify

lint:
@echo "--> Running linter"
@golangci-lint run
@golangci-lint run --timeout 10m
@go mod verify


Expand Down
29 changes: 16 additions & 13 deletions app/ante_handler.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package app

import (
"github.com/OmniFlix/omniflixhub/app/decorators"
errorsmod "cosmossdk.io/errors"
"github.com/cosmos/cosmos-sdk/codec"
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"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand All @@ -18,19 +19,19 @@ type HandlerOptions struct {

GovKeeper govkeeper.Keeper
IBCKeeper *ibckeeper.Keeper
TxCounterStoreKey sdk.StoreKey
TxCounterStoreKey storetypes.StoreKey
Codec codec.BinaryCodec
}

func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
}
if options.BankKeeper == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.SignModeHandler == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}

sigGasConsumer := options.SigGasConsumer
Expand All @@ -40,22 +41,24 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // Outermost AnteDecorator, SetUpContext must be called first
decorators.NewMinCommissionDecorator(options.Codec),
ante.NewRejectExtensionOptionsDecorator(),
decorators.NewMinimumInitialDepositDecorator(options.Codec, options.GovKeeper),
ante.NewMempoolFeeDecorator(),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
ante.NewDeductFeeDecorator(
options.AccountKeeper,
options.BankKeeper,
options.FeegrantKeeper,
options.TxFeeChecker,
),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewAnteDecorator(options.IBCKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
Expand Down
Loading
Loading