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

455 add back ibc #461

Merged
merged 7 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
13 changes: 13 additions & 0 deletions chain/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ smoketest:
FROM +build
RUN make smoketest

smoketest-ibc-prep:
FROM +build
WORKDIR /workbench
GIT CLONE --branch v7.1.0 https://github.com/cosmos/gaia gaia
RUN cd gaia && make install && cd ..
GIT CLONE --branch andrew/tendermint_v0.37 https://github.com/cosmos/relayer relayer
RUN cd relayer && make install && cd ..

smoketest-ibc:
FROM +smoketest-ibc-prep
WORKDIR /empowerchain/chain
RUN make smoketest-ibc

lint:
FROM +build
RUN make lint
Expand Down
26 changes: 21 additions & 5 deletions chain/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ smoketest: install
./scripts/test/smoke_poe.sh
./scripts/test/smoke_plastic_credit.sh

smoketest-ibc: install
./scripts/test/smoke_ibc.sh

###############################################################################
### Proto ###
###############################################################################
Expand Down Expand Up @@ -183,12 +186,25 @@ serve:
@echo "=========== Serving now ============"
@echo

kill:
serve-ibc:
@echo
@echo "======= Serve full IBC stack ========="
@echo
./scripts/serve_ibc.sh
@echo
@echo "=========== Serving now ============"
@echo

kill-all:
@echo "Killing empowerd and removing previous data"
-@rm -rf ./tmp/empowerchain-local-1
-@pkill empowerd 2>/dev/null


-@rm -rf /tmp/empowerchain-local-1
@echo "Killing gaiad and removing previous data"
-@pkill gaiad 2>/dev/null
-@rm -rf /tmp/gaia-local-1
@echo "Killing relayer and removing previous data"
-@pkill rly 2>/dev/null
-@rm -rf /tmp/relayer-stuff
###############################################################################
### Linting ###
###############################################################################
Expand All @@ -198,7 +214,7 @@ lint:
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout=10m

format:
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run ./... --fix
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --fix

###############################################################################
### Avoid "make: 'x' is up to date. ###
Expand Down
48 changes: 48 additions & 0 deletions chain/app/ante.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package app

import (
"cosmossdk.io/errors"
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/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
// channel keeper.
type HandlerOptions struct {
ante.HandlerOptions

IBCKeeper *ibckeeper.Keeper
}

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

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

return sdk.ChainAnteDecorators(anteDecorators...), nil
}
Loading