Skip to content

Commit

Permalink
feat!: Add DistributionTransmissionChannel to ConsumerAdditionProposal (
Browse files Browse the repository at this point in the history
#965)

* update proto

* remove transfer_channel_id from consumer genesis

* ConsumerAdditionProposal: transfer_channel_id -> distribution_transmission_channel

* send updated ConsumerAdditionProposal

* validate consumer genesis param

* remove StandaloneTransferChannelID from store

* fix TestOnChanOpenAck

* remove state breaking change

* finalize merge and fix issues

* chore: update docs and changelog

* chore: regenerate protos

* re-add integrationt tests around changeover

* mv entry in changelog

* test: add sovereign to consumer changeover e2e (#1025)

* tests: add sovereign to consumer e2e test

* rm unused bash scripts

* partially address review comments

* apply remaining review comments

* chore: apply formatting rules

---------

Co-authored-by: MSalopek <matija.salopek994@gmail.com>
  • Loading branch information
2 people authored and shaspitz committed Jun 16, 2023
1 parent 2395b6f commit b8af5fb
Show file tree
Hide file tree
Showing 44 changed files with 3,419 additions and 178 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state m

## Notable PRs included in v2.0.0

* (feat!) Add DistributionTransmissionChannel to ConsumerAdditionProposal [#965](https://github.com/cosmos/interchain-security/pull/965)
* (feat/fix) limit vsc matured packets handled per endblocker [#1004](https://github.com/cosmos/interchain-security/pull/1004)
* (fix) cosumer key prefix order to avoid complex migrations [#963](https://github.com/cosmos/interchain-security/pull/963) and [#991](https://github.com/cosmos/interchain-security/pull/991). The latter PR is the proper fix.
* (feat) v1->v2 migrations to accommodate a bugfix having to do with store keys, introduce new params, and deal with consumer genesis state schema changes [#975](https://github.com/cosmos/interchain-security/pull/975) and [#997](https://github.com/cosmos/interchain-security/pull/997)
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ COPY --from=hermes-builder /usr/bin/hermes /usr/local/bin/
COPY --from=is-builder /go/bin/interchain-security-pd /usr/local/bin/interchain-security-pd
COPY --from=is-builder /go/bin/interchain-security-cd /usr/local/bin/interchain-security-cd
COPY --from=is-builder /go/bin/interchain-security-cdd /usr/local/bin/interchain-security-cdd

COPY --from=is-builder /go/bin/interchain-security-sd /usr/local/bin/interchain-security-sd

# Copy in the shell scripts that run the testnet
ADD ./tests/e2e/testnet-scripts /testnet-scripts
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.gaia
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ COPY --from=hermes-builder /usr/bin/hermes /usr/local/bin/
COPY --from=gaia-builder /go/gaia/build/gaiad /usr/local/bin/interchain-security-pd
COPY --from=is-builder /go/bin/interchain-security-cd /usr/local/bin/interchain-security-cd
COPY --from=is-builder /go/bin/interchain-security-cdd /usr/local/bin/interchain-security-cdd

COPY --from=is-builder /go/bin/interchain-security-sd /usr/local/bin/interchain-security-sd

# Copy in the shell scripts that run the testnet
ADD ./tests/e2e/testnet-scripts /testnet-scripts
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ install: go.sum
go install $(BUILD_FLAGS) ./cmd/interchain-security-pd
go install $(BUILD_FLAGS) ./cmd/interchain-security-cd
go install $(BUILD_FLAGS) ./cmd/interchain-security-cdd
go install $(BUILD_FLAGS) ./cmd/interchain-security-sd

# run all tests: unit, integration, diff, and E2E
test:
Expand Down
8 changes: 1 addition & 7 deletions app/consumer-democracy/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ import (

const (
AppName = "interchain-security-cd"
upgradeName = "ics-v1-to-v2" // arbitrary name, define your own appropriately named upgrade
upgradeName = "sovereign-changeover" // arbitrary name, define your own appropriately named upgrade
AccountAddressPrefix = "cosmos"
)

Expand Down Expand Up @@ -645,12 +645,6 @@ func New(
// upgrade handler code is application specific. However, as an example, standalone to consumer
// changeover chains should utilize customized upgrade handler code similar to below.

// Setting the standalone transfer channel ID is only needed for standalone to consumer changeover chains
// who wish to preserve existing IBC transfer denoms. Here's an example.
//
// Note: This setter needs to execute before the ccv channel handshake is initiated.
app.ConsumerKeeper.SetStandaloneTransferChannelID(ctx, "hardcoded-existing-channel-id")

// TODO: should have a way to read from current node home
userHomeDir, err := os.UserHomeDir()
if err != nil {
Expand Down
55 changes: 55 additions & 0 deletions app/sovereign/ante_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package app

import (
errorsmod "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/v4/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v4/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, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
}
if options.BankKeeper == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
}
if options.SignModeHandler == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}

sigGasConsumer := options.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
}

anteDecorators := []sdk.AnteDecorator{
ante.NewSetUpContextDecorator(),
ante.NewRejectExtensionOptionsDecorator(),
ante.NewMempoolFeeDecorator(),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
// 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),
}

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

0 comments on commit b8af5fb

Please sign in to comment.