Skip to content

Commit afa541f

Browse files
shaspitzmpokeMSalopek
authored
feat!: Add DistributionTransmissionChannel to ConsumerAdditionProposal (manual backport #965) (#1031)
feat!: Add DistributionTransmissionChannel to ConsumerAdditionProposal (#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: Marius Poke <marius.poke@posteo.de> Co-authored-by: MSalopek <matija.salopek994@gmail.com>
1 parent 163da4e commit afa541f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3329
-178
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Upgrading a consumer from `v1.2.0-multiden` to `v2.0.0` will NOT require state m
1919

2020
## Notable PRs included in v2.0.0
2121

22+
* (feat!) Add DistributionTransmissionChannel to ConsumerAdditionProposal [#965](https://github.com/cosmos/interchain-security/pull/965)
2223
* (feat/fix) limit vsc matured packets handled per endblocker [#1004](https://github.com/cosmos/interchain-security/pull/1004)
2324
* (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.
2425
* (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)

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ COPY --from=gorelayer-builder /bin/rly /usr/local/bin/
4848
COPY --from=is-builder /go/bin/interchain-security-pd /usr/local/bin/interchain-security-pd
4949
COPY --from=is-builder /go/bin/interchain-security-cd /usr/local/bin/interchain-security-cd
5050
COPY --from=is-builder /go/bin/interchain-security-cdd /usr/local/bin/interchain-security-cdd
51-
51+
COPY --from=is-builder /go/bin/interchain-security-sd /usr/local/bin/interchain-security-sd
5252

5353
# Copy in the shell scripts that run the testnet
5454
ADD ./tests/e2e/testnet-scripts /testnet-scripts

Dockerfile.gaia

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ COPY --from=hermes-builder /usr/bin/hermes /usr/local/bin/
7474
COPY --from=gaia-builder /go/gaia/build/gaiad /usr/local/bin/interchain-security-pd
7575
COPY --from=is-builder /go/bin/interchain-security-cd /usr/local/bin/interchain-security-cd
7676
COPY --from=is-builder /go/bin/interchain-security-cdd /usr/local/bin/interchain-security-cdd
77-
77+
COPY --from=is-builder /go/bin/interchain-security-sd /usr/local/bin/interchain-security-sd
7878

7979
# Copy in the shell scripts that run the testnet
8080
ADD ./tests/e2e/testnet-scripts /testnet-scripts

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ install: go.sum
77
go install $(BUILD_FLAGS) ./cmd/interchain-security-pd
88
go install $(BUILD_FLAGS) ./cmd/interchain-security-cd
99
go install $(BUILD_FLAGS) ./cmd/interchain-security-cdd
10+
go install $(BUILD_FLAGS) ./cmd/interchain-security-sd
1011

1112
# run all tests: unit, integration, diff, and E2E
1213
test:

app/consumer-democracy/app.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ import (
117117

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

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

648-
// Setting the standalone transfer channel ID is only needed for standalone to consumer changeover chains
649-
// who wish to preserve existing IBC transfer denoms. Here's an example.
650-
//
651-
// Note: This setter needs to execute before the ccv channel handshake is initiated.
652-
app.ConsumerKeeper.SetStandaloneTransferChannelID(ctx, "hardcoded-existing-channel-id")
653-
654648
// TODO: should have a way to read from current node home
655649
userHomeDir, err := os.UserHomeDir()
656650
if err != nil {

app/sovereign/ante_handler.go

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package app
2+
3+
import (
4+
errorsmod "cosmossdk.io/errors"
5+
sdk "github.com/cosmos/cosmos-sdk/types"
6+
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
7+
"github.com/cosmos/cosmos-sdk/x/auth/ante"
8+
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
9+
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
10+
)
11+
12+
// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
13+
// channel keeper.
14+
type HandlerOptions struct {
15+
ante.HandlerOptions
16+
17+
IBCKeeper *ibckeeper.Keeper
18+
}
19+
20+
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
21+
if options.AccountKeeper == nil {
22+
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for AnteHandler")
23+
}
24+
if options.BankKeeper == nil {
25+
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for AnteHandler")
26+
}
27+
if options.SignModeHandler == nil {
28+
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
29+
}
30+
31+
sigGasConsumer := options.SigGasConsumer
32+
if sigGasConsumer == nil {
33+
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
34+
}
35+
36+
anteDecorators := []sdk.AnteDecorator{
37+
ante.NewSetUpContextDecorator(),
38+
ante.NewRejectExtensionOptionsDecorator(),
39+
ante.NewMempoolFeeDecorator(),
40+
ante.NewValidateBasicDecorator(),
41+
ante.NewTxTimeoutHeightDecorator(),
42+
ante.NewValidateMemoDecorator(options.AccountKeeper),
43+
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
44+
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper),
45+
// SetPubKeyDecorator must be called before all signature verification decorators
46+
ante.NewSetPubKeyDecorator(options.AccountKeeper),
47+
ante.NewValidateSigCountDecorator(options.AccountKeeper),
48+
ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer),
49+
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
50+
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
51+
ibcante.NewAnteDecorator(options.IBCKeeper),
52+
}
53+
54+
return sdk.ChainAnteDecorators(anteDecorators...), nil
55+
}

0 commit comments

Comments
 (0)