Skip to content

Commit

Permalink
Revert "feat: adding Pack/Unpack acknowledgement helper fns (cosmos#895
Browse files Browse the repository at this point in the history
…)" (cosmos#973)

This reverts commit 843b459.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
colin-axner and mergify[bot] authored Feb 23, 2022
1 parent 9fcf254 commit 08d38d4
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 94 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
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.

0 comments on commit 08d38d4

Please sign in to comment.