Skip to content

Commit

Permalink
Merge branch 'main' into carlos/894-support-valid-denoms-with-slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Rodriguez authored Feb 25, 2022
2 parents 63a46a9 + 04ab3cb commit 2f34abe
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 98 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ Ref: https://keepachangelog.com/en/1.0.0/
* [\#432](https://github.com/cosmos/ibc-go/pull/432) Introduce `MockIBCApp` struct to the mock module. Allows the mock module to be reused to perform custom logic on each IBC App interface function. This might be useful when testing out IBC applications written as middleware.
* [\#380](https://github.com/cosmos/ibc-go/pull/380) Adding the Interchain Accounts module v1
* [\#679](https://github.com/cosmos/ibc-go/pull/679) New CLI command `query ibc-transfer denom-hash <denom trace>` to get the denom hash for a denom trace; this might be useful for debug
* (channel) [\#895](https://github.com/cosmos/ibc-go/pull/895) Adding UnpackAcknowledgement and PackAcknowledgement helper functions to pack or unpack an Acknowledgement to and from a proto Any type


### Bug Fixes

Expand Down
30 changes: 30 additions & 0 deletions docs/migrations/v2-to-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,32 @@ app.UpgradeKeeper.SetUpgradeHandler("v3",
The host and controller submodule params only need to be set if you integrate those submodules.
For example, if a chain chooses not to integrate a controller submodule, it does not need to set the controller params.
### Genesis migrations
If the chain will adopt ICS27 and chooses to upgrade via a genesis export, then the ICS27 parameters must be set during genesis migration.
The migration code required may look like:
```go
controllerGenesisState := icatypes.DefaultControllerGenesis()
// overwrite parameters as desired
controllerGenesisState.Params = icacontrollertypes.Params{
ControllerEnabled: true,
}

hostGenesisState := icatypes.DefaultHostGenesis()
// overwrite parameters as desired
hostGenesisState.Params = icahosttypes.Params{
HostEnabled: true,
AllowMessages: []string{"/cosmos.bank.v1beta1.MsgSend", ...],
}

icaGenesisState := icatypes.NewGenesisState(controllerGenesisState, hostGenesisState)

// set new ics27 genesis state
appState[icatypes.ModuleName] = clientCtx.JSONCodec.MustMarshalJSON(icaGenesisState)
```
## IBC Apps
Expand Down Expand Up @@ -91,6 +117,10 @@ As apart of this release, the mock module now supports middleware testing. Pleas
Please review the [mock](../../testing/mock/ibc_module.go) and [transfer](../../modules/apps/transfer/ibc_module.go) modules as examples. Additionally, [simapp](../../testing/simapp/app.go) provides an example of how `IBCModule` types should now be added to the IBC router in favour of `AppModule`.
### IBC testing package
`TestChain`s are now created with chainID's beginning from an index of 1. Any calls to `GetChainID(0)` will now fail. Please increment all calls to `GetChainID` by 1.
## Relayers
`AppVersion` gRPC has been removed.
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/transfer/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (im IBCModule) OnChanCloseConfirm(
}

// OnRecvPacket implements the IBCModule interface. A successful acknowledgement
// is returned if the packet data is succesfully decoded and the receive application
// is returned if the packet data is successfully decoded and the receive application
// logic returns without error.
func (im IBCModule) OnRecvPacket(
ctx sdk.Context,
Expand Down
2 changes: 1 addition & 1 deletion modules/core/04-channel/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ func (k Keeper) GetChannelClientState(ctx sdk.Context, portID, channelID string)
return connection.ClientId, clientState, nil
}

// GetConnection wraps the conenction keeper's GetConnection function.
// GetConnection wraps the connection keeper's GetConnection function.
func (k Keeper) GetConnection(ctx sdk.Context, connectionID string) (exported.ConnectionI, error) {
connection, found := k.connectionKeeper.GetConnection(ctx, connectionID)
if !found {
Expand Down
34 changes: 0 additions & 34 deletions modules/core/04-channel/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/msgservice"
proto "github.com/gogo/protobuf/proto"

"github.com/cosmos/ibc-go/v3/modules/core/exported"
)
Expand Down Expand Up @@ -52,35 +50,3 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
// The actual codec used for serialization should be provided to x/ibc/core/04-channel and
// defined at the application level.
var SubModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())

// UnpackAcknowledgement unpacks an Any into an Acknowledgement. It returns an error if the
// Any can't be unpacked into an Acknowledgement.
func UnpackAcknowledgement(any *codectypes.Any) (exported.Acknowledgement, error) {
if any == nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrUnpackAny, "protobuf Any message cannot be nil")
}

ack, ok := any.GetCachedValue().(exported.Acknowledgement)
if !ok {
return nil, sdkerrors.Wrapf(sdkerrors.ErrUnpackAny, "cannot unpack Any into Acknowledgement %T", any)
}

return ack, nil
}

// PackAcknowledgement constructs a new Any packed with the given acknowledgement value. It returns
// an error if the acknowledgement can't be casted to a protobuf message or if the concrete
// implemention is not registered to the protobuf codec.
func PackAcknowledgement(acknowledgement exported.Acknowledgement) (*codectypes.Any, error) {
msg, ok := acknowledgement.(proto.Message)
if !ok {
return nil, sdkerrors.Wrapf(sdkerrors.ErrPackAny, "cannot proto marshal %T", acknowledgement)
}

anyAcknowledgement, err := codectypes.NewAnyWithValue(msg)
if err != nil {
return nil, sdkerrors.Wrap(sdkerrors.ErrPackAny, err.Error())
}

return anyAcknowledgement, nil
}
58 changes: 0 additions & 58 deletions modules/core/04-channel/types/codec_test.go

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ buf protoc \
--doc_out=./docs/ibc \
--doc_opt=./docs/protodoc-markdown.tmpl,proto-docs.md \
$(find "$(pwd)/proto" -maxdepth 5 -name '*.proto')
go mod tidy


# move proto files to the right places
cp -r github.com/cosmos/ibc-go/v*/modules/* modules/
Expand Down

0 comments on commit 2f34abe

Please sign in to comment.