Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/ibc proto migration #5704

Closed
wants to merge 62 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
e59c32d
proto: remove cdc from ICS05
fedekunze Feb 26, 2020
6ef884f
proto: start ICS07 proto files
fedekunze Feb 26, 2020
85cc953
proto: ICS20 types
fedekunze Feb 26, 2020
d172449
proto: ICS07 messages
fedekunze Feb 26, 2020
796fe70
proto: ICS04 messages
fedekunze Feb 26, 2020
8a38c3e
proto: various ICS proto definitions
fedekunze Feb 26, 2020
a1c9ae0
proto: fixes
fedekunze Feb 26, 2020
fad6b52
godocs for ICS 07 proto file
fedekunze Feb 27, 2020
8b83fb1
proto: generate files
fedekunze Feb 27, 2020
43e38d6
merge ICS23 changes
fedekunze Mar 2, 2020
d574210
merge ibc-alpha changes
fedekunze Mar 23, 2020
5510c34
ibc: protobuf changes
fedekunze Mar 23, 2020
2d251e4
codec: move ibc client proto interfaces
fedekunze Mar 23, 2020
fc70c2e
ibc: fix some msgs and types
fedekunze Mar 23, 2020
8da8960
proto: cycles and other fixes
fedekunze Mar 24, 2020
0db08a3
proto: changes and fixes
fedekunze Mar 24, 2020
5a5816f
update types
fedekunze Mar 24, 2020
fa84a19
merge ibc-alpha changes
fedekunze Mar 24, 2020
ff66afb
fix dep cycle
fedekunze Mar 25, 2020
dfe061d
codec/std: add msgs
fedekunze Mar 25, 2020
3475fca
commitment: proto changes
fedekunze Mar 25, 2020
ee12807
fix dep cycle with Status and Order
fedekunze Mar 25, 2020
daf8f01
add tmtypes proto3 to third party
fedekunze Mar 25, 2020
ccdb13b
fixes fixes fixes
fedekunze Mar 27, 2020
94a62ca
revert GetDestination{Channel.Port}
fedekunze Mar 27, 2020
01d4651
cleanup
fedekunze Mar 27, 2020
934a576
fixes
fedekunze Mar 27, 2020
a4749e3
util funcs for tm <-> proto
fedekunze Mar 27, 2020
ea46b7f
more cleanup
fedekunze Mar 27, 2020
cff3c94
more util funcs
fedekunze Mar 30, 2020
c8229a3
more fixes
fedekunze Mar 30, 2020
610fafc
Merge branch 'ibc-alpha' of https://github.com/cosmos/cosmos-sdk into…
fedekunze Mar 31, 2020
ced1d63
more test fixes
fedekunze Mar 31, 2020
077a13f
fixes
fedekunze Mar 31, 2020
554de2d
remove PacketData and PacketAck interfaces
fedekunze Apr 1, 2020
ba1cb08
FINALLY! build
fedekunze Apr 1, 2020
2ecbb5b
fix some tests
fedekunze Apr 1, 2020
c5d00b5
fix more tests
fedekunze Apr 1, 2020
8b3400f
lint
fedekunze Apr 2, 2020
3c38a61
proto cleanup
fedekunze Apr 2, 2020
048b8d1
Merge branch 'ibc-alpha' of https://github.com/cosmos/cosmos-sdk into…
fedekunze Apr 2, 2020
2614026
try fix ics07 errors
fedekunze Apr 2, 2020
5079c78
lint
fedekunze Apr 2, 2020
80ec515
merge ibc-alpha
fedekunze Apr 3, 2020
cced361
Merge branch 'ibc-alpha' of https://github.com/cosmos/cosmos-sdk into…
fedekunze Apr 3, 2020
48828f0
Merge branch 'ibc-alpha' of github.com:cosmos/cosmos-sdk into fedekun…
fedekunze Apr 3, 2020
773a6ec
merge tm-proto
fedekunze Apr 6, 2020
9bd476f
fixes
fedekunze Apr 6, 2020
99cab85
minor updates
fedekunze Apr 7, 2020
bc0f744
merge ibc-alpha changes
fedekunze Apr 8, 2020
9dd94c0
update proto files
fedekunze Apr 8, 2020
c8669df
build
fedekunze Apr 8, 2020
f8d64c8
updates from downstream
fedekunze Apr 14, 2020
0d62302
update proto deps
fedekunze Apr 14, 2020
524cce4
fix ics07 test
fedekunze Apr 14, 2020
e5d4641
changes from master
fedekunze Apr 16, 2020
dd9df29
fix build
fedekunze Apr 16, 2020
6dac284
test fixes
fedekunze Apr 16, 2020
4d3058a
updates from downstream
fedekunze Apr 21, 2020
1b7b9c8
fixes
fedekunze Apr 21, 2020
e422b08
proto ics09
fedekunze Apr 21, 2020
8d794fa
changes from master
fedekunze Apr 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove PacketData and PacketAck interfaces
  • Loading branch information
fedekunze committed Apr 1, 2020
commit 554de2df19024233f42046a9759c6c412d222ee9
2 changes: 1 addition & 1 deletion x/ibc/04-channel/exported/exported.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type PacketI interface {
GetSourceChannel() string
GetDestPort() string
GetDestChannel() string
GetData() PacketDataI
GetData() []byte
ValidateBasic() error
}

Expand Down
4 changes: 2 additions & 2 deletions x/ibc/04-channel/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ var _ sdk.Msg = MsgAcknowledgement{}

// NewMsgAcknowledgement constructs a new MsgAcknowledgement
func NewMsgAcknowledgement(
packet Packet, ack PacketAck, proof commitmenttypes.MerkleProof,
packet Packet, ack []byte, proof commitmenttypes.MerkleProof,
proofHeight uint64, signer sdk.AccAddress,
) MsgAcknowledgement {
return MsgAcknowledgement{
Expand Down Expand Up @@ -485,7 +485,7 @@ func (msg MsgAcknowledgement) ValidateBasic() error {
if err := msg.Proof.ValidateBasic(); err != nil {
return sdkerrors.Wrap(err, "proof ack cannot be nil")
}
if len(msg.Acknowledgement.GetPacketAcknowledgementI().GetBytes()) > 100 {
if len(msg.Acknowledgement) > 100 {
return sdkerrors.Wrap(ErrAcknowledgementTooLong, "acknowledgement cannot exceed 100 bytes")
}
if msg.ProofHeight == 0 {
Expand Down
34 changes: 16 additions & 18 deletions x/ibc/04-channel/types/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
)

//CommitPacket
func CommitPacket(data exported.PacketDataI) []byte {
bz := sdk.Uint64ToBigEndian(data.GetTimeoutHeight())
func CommitPacket(data []byte, timeoutHeight uint64) []byte {
bz := sdk.Uint64ToBigEndian(timeoutHeight)
bz = append(bz, data...)
return tmhash.Sum(bz)
}

Expand All @@ -25,17 +26,12 @@ var _ exported.PacketI = (*Packet)(nil)
// NewPacket creates a new Packet instance. It panics if the provided
// packet data interface is not registered.
func NewPacket(
data exported.PacketDataI,
data []byte,
sequence uint64, sourcePort, sourceChannel,
destinationPort, destinationChannel string,
) Packet {
var packetData *PacketData
if err := packetData.SetPacketDataI(data); err != nil {
panic(err)
}

return Packet{
Data: *packetData,
Data: data,
Sequence: sequence,
SourcePort: sourcePort,
SourceChannel: sourceChannel,
Expand All @@ -60,17 +56,19 @@ func (p Packet) GetDestPort() string { return p.DestinationPort }
func (p Packet) GetDestChannel() string { return p.DestinationChannel }

// GetData returns the concrete packet data type as an interface.
func (p Packet) GetData() exported.PacketDataI {
return p.Data.GetPacketDataI()
func (p Packet) GetData() []byte {
return p.Data
}

// FIXME: add type
// Type exports Packet.Data.Type
func (p Packet) Type() string {
return p.Data.GetPacketDataI().Type()
return ""
}

// FIXME: add timeout
// GetTimeoutHeight implements PacketI interface
func (p Packet) GetTimeoutHeight() uint64 { return p.Data.GetPacketDataI().GetTimeoutHeight() }
func (p Packet) GetTimeoutHeight() uint64 { return 0 }

// ValidateBasic implements PacketI interface
func (p Packet) ValidateBasic() error {
Expand Down Expand Up @@ -101,11 +99,11 @@ func (p Packet) ValidateBasic() error {
if p.Sequence == 0 {
return sdkerrors.Wrap(ErrInvalidPacket, "packet sequence cannot be 0")
}
if p.Data.GetPacketDataI().GetTimeoutHeight() == 0 {
return sdkerrors.Wrap(ErrInvalidPacket, "packet timeout cannot be 0")
}
if len(p.Data.GetPacketDataI().GetBytes()) == 0 {
// if p.Data.GetPacketDataI().GetTimeoutHeight() == 0 {
// return sdkerrors.Wrap(ErrInvalidPacket, "packet timeout cannot be 0")
// }
if len(p.Data) == 0 {
return sdkerrors.Wrap(ErrInvalidPacket, "packet data bytes cannot be empty")
}
return p.Data.GetPacketDataI().ValidateBasic()
return nil
}
Loading