Skip to content

Commit

Permalink
refactor: remove unnecessary exported.Proof interface type (#6320)
Browse files Browse the repository at this point in the history
* refactor: remove unnecessary interface type

* add changelog and update migration docs

* Update CHANGELOG.md

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Carlos Rodriguez <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored May 16, 2024
1 parent 6ba52c5 commit fd14522
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 29 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (testing) [\#6070](https://github.com/cosmos/ibc-go/pull/6070) Remove `AssertEventsLegacy` function.
* (core) [\#6138](https://github.com/cosmos/ibc-go/pull/6138) Remove `Router` reference from IBC core keeper and use instead the router on the existing `PortKeeper` reference.
* (core/04-channel) [\#6023](https://github.com/cosmos/ibc-go/pull/6023) Remove emission of non-hexlified event attributes `packet_data` and `packet_ack`.
* (core) [\#6320](https://github.com/cosmos/ibc-go/pull/6320) Remove unnecessary `Proof` interface from `exported` package.

### State Machine Breaking

Expand Down
1 change: 1 addition & 0 deletions docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ There are four sections based on the four potential user groups of this document

The `exported.ChannelI` and `exported.CounterpartyChannelI` interfaces have been removed. Please use the concrete types.
The `exported.ConnectionI` and `exported.CounterpartyConnectionI` interfaces have been removed. Please use the concrete types.
The `exported.Proof` interface has been removed. Please use the `MerkleProof` concrete type.

The functions `GetState()`, `GetOrdering()`, `GetCounterparty()`, `GetConnectionHops()`, `GetVersion()` of the `Channel` type have been removed.
The functions `GetPortID()`, `GetChannelID()` of the `CounterpartyChannel` type have been removed.
Expand Down
8 changes: 0 additions & 8 deletions modules/core/23-commitment/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
"ibc.core.commitment.v1.Path",
(*exported.Path)(nil),
)
registry.RegisterInterface(
"ibc.core.commitment.v1.Proof",
(*exported.Proof)(nil),
)

registry.RegisterImplementations(
(*exported.Root)(nil),
Expand All @@ -37,8 +33,4 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
(*exported.Path)(nil),
&MerklePath{},
)
registry.RegisterImplementations(
(*exported.Proof)(nil),
&MerkleProof{},
)
}
5 changes: 0 additions & 5 deletions modules/core/23-commitment/types/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ func (suite *MerkleTestSuite) TestCodecTypeRegistration() {
sdk.MsgTypeURL(&types.MerklePath{}),
true,
},
{
"success: MerkleProof",
sdk.MsgTypeURL(&types.MerkleProof{}),
true,
},
{
"type not registered on codec",
"ibc.invalid.MsgTypeURL",
Expand Down
2 changes: 0 additions & 2 deletions modules/core/23-commitment/types/merkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ func ApplyPrefix(prefix exported.Prefix, path MerklePath) (MerklePath, error) {
return NewMerklePath(append([]string{string(prefix.Bytes())}, path.KeyPath...)...), nil
}

var _ exported.Proof = (*MerkleProof)(nil)

// VerifyMembership verifies the membership of a merkle proof against the given root, path, and value.
// Note that the path is expected as []string{<store key of module>, <key corresponding to requested value>}.
func (proof MerkleProof) VerifyMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path, value []byte) error {
Expand Down
14 changes: 0 additions & 14 deletions modules/core/exported/commitment.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package exported

import ics23 "github.com/cosmos/ics23/go"

// ICS 023 Types Implementation
//
// This file includes types defined under
Expand Down Expand Up @@ -30,15 +28,3 @@ type Prefix interface {
type Path interface {
Empty() bool
}

// Proof implements spec:CommitmentProof.
// Proof can prove whether the key-value pair is a part of the Root or not.
// Each proof has designated key-value pair it is able to prove.
// Proofs include key but value is provided dynamically at the verification time.
type Proof interface {
VerifyMembership([]*ics23.ProofSpec, Root, Path, []byte) error
VerifyNonMembership([]*ics23.ProofSpec, Root, Path) error
Empty() bool

ValidateBasic() error
}

0 comments on commit fd14522

Please sign in to comment.