Skip to content

Commit

Permalink
Upgrate to cosmos-sdk v0.50 and ibc-go v8 (#170)
Browse files Browse the repository at this point in the history
* Draft upgrate to cosmos-sdk v0.50 and ibc-go v8

* Change dependencies compatible with cosmos-sdk 0.50

* Change Dec to LegacyDec

* Fix some lints

* Fix bugs

* Fix test and lint

* Fix: Fix workflow to run all interchaintest tests as expected (#174)

* fix running wrong test in Makefile, also catching bug when upload contract

* add missing field in init message of xcsV2

* fix interchaintest

* fix interchaintest ictest-ibc

---------

Co-authored-by: nghuyenthevinh2000 <[email protected]>

* Fix conflicts

* Go mod tidy

* Make lint

* Update interchaintest

* Fix linys

* Fix dockerfile

* Fix bech32 addr prefix

* Fix interchaintest

* Fix missing light clients

* Fix lint

---------

Co-authored-by: Tuan Tran <[email protected]>
Co-authored-by: nghuyenthevinh2000 <[email protected]>
  • Loading branch information
3 people authored Apr 22, 2024
1 parent 2aec475 commit 4048791
Show file tree
Hide file tree
Showing 68 changed files with 3,402 additions and 3,571 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \
-trimpath \
-o /feeapp/bin/feeappd \
/feeapp/cmd/feeappd/main.go
/feeapp/cmd/feeappd

# --------------------------------------------------------
# Runner
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ LEDGER_ENABLED ?= true
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
TM_VERSION := $(shell go list -m github.com/cometbft/cometbft | sed 's:.* ::')
DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.0.0-rc8
BUF_IMAGE=bufbuild/buf@sha256:3cb1f8a4b48bd5ad8f09168f10f607ddc318af202f5c057d52a45216793d85e5 #v1.4.0
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(BUF_IMAGE)
BUILDDIR ?= $(CURDIR)/build
HTTPS_GIT := https://github.com/osmosis-labs/fee-abstraction.git

Expand Down Expand Up @@ -128,11 +129,14 @@ ictest-host-zone-proposal:
cd tests/interchaintest && go test -timeout=25m -race -v -run TestHostZoneProposal .

ictest-feeabs:
cd tests/interchaintest && go test -timeout=25m -race -v -run TestFeeabs .
cd tests/interchaintest && go test -timeout=25m -race -v -run '^TestFeeAbs$$' .

ictest-query-osmosis-twap:
cd tests/interchaintest && go test -timeout=25m -race -v -run TestQueryOsmosisTwap .

# ictest-feeabs-ibc-transfer:
# cd tests/interchaintest && go test -timeout=25m -race -v -run TestIBCTransferWithFeeAbs .

# Executes all tests via interchaintest after compling a local image as juno:local
ictest-all: ictest-basic ictest-ibc ictest-packet-forward ictest-host-zone-proposal ictest-query-osmosis-twap ictest-feeabs

Expand Down
20 changes: 10 additions & 10 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package app

import (
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper"

sdkerrors "cosmossdk.io/errors"
"cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/types"
errorstypes "github.com/cosmos/cosmos-sdk/types/errors"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

feeabsante "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/ante"
Expand All @@ -19,23 +19,23 @@ type HandlerOptions struct {
ante.HandlerOptions

IBCKeeper *ibckeeper.Keeper
FeeAbskeeper feeabskeeper.Keeper
FeeAbsKeeper feeabskeeper.Keeper
}

// NewAnteHandler returns an AnteHandler that checks and increments sequence
// numbers, checks signatures & account numbers, and deducts fees from the first
// signer.
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, sdkerrors.Wrap(errorstypes.ErrLogic, "account keeper is required for ante builder")
return nil, errors.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder")
}

if options.BankKeeper == nil {
return nil, sdkerrors.Wrap(errorstypes.ErrLogic, "bank keeper is required for ante builder")
return nil, errors.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder")
}

if options.SignModeHandler == nil {
return nil, sdkerrors.Wrap(errorstypes.ErrLogic, "sign mode handler is required for ante builder")
return nil, errors.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}

sigGasConsumer := options.SigGasConsumer
Expand All @@ -46,12 +46,12 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
ante.RejectExtensionOptionsDecorator{},
feeabsante.NewFeeAbstrationMempoolFeeDecorator(options.FeeAbskeeper),
feeabsante.NewFeeAbstrationMempoolFeeDecorator(options.FeeAbsKeeper),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
feeabsante.NewFeeAbstractionDeductFeeDecorate(options.AccountKeeper, options.BankKeeper, options.FeeAbskeeper, options.FeegrantKeeper),
feeabsante.NewFeeAbstractionDeductFeeDecorate(options.AccountKeeper, options.BankKeeper, options.FeeAbsKeeper, options.FeegrantKeeper),
// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
ante.NewValidateSigCountDecorator(options.AccountKeeper),
Expand Down
Loading

0 comments on commit 4048791

Please sign in to comment.