-
Notifications
You must be signed in to change notification settings - Fork 679
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
Add versions to packet and create Eureka packet commitment #6986
Conversation
@@ -122,6 +129,10 @@ message Packet { | |||
ibc.core.client.v1.Height timeout_height = 7 [(gogoproto.nullable) = false]; | |||
// block timestamp (in nanoseconds) after which the packet times out | |||
uint64 timeout_timestamp = 8; | |||
// which IBC version to use to commit this packet | |||
IBCVersion ibc_version = 9; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we store ibcversion under client id prefixed key in state and look it up when necessary instead of putting it in packet? We could just write a single byte value for it and migrating away from it when classic is dropped would be easier? This would need us to forbid new connections/channels on a eureka client tho I believe.
Just a thought that came to me initially looking at this packet field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we could do it this way, and I am open to that. There are a couple reasons I like having the IBC Version in the packet.
One minor reason is that we could use the same client for Eureka and Classic. Of course, we could disable this if we choose to in other ways.
The major reason is that I think having these versions explicitly defined in the Packet will make it easier for us to upgrade in the future. If we have ProtocolVersion stored on a per-client basis, the entire chain and all applications on it have to make a synchronous decision to move to the next protocol. If it's a per-packet basis, one application can decide to upgrade if the sender supports the new version. If the receiver doesn't then it just doesn't get received and we time out. i think in general having version in the packet and being permissive to version-related failures to relay will make the system more easily upgradable over time than a prenegotiated version.
cc: @colin-axner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this is an enum that is not actually being hashed into the commitment. So it is really taking a small amount of space in the packet. The packet is also only in the transaction bytes, it is not stored on chain except for a couple edge-cases.
// NOTE: sdk.Uint64ToBigEndian sets the uint64 to a slice of length 8. | ||
func CommitPacket(cdc codec.BinaryCodec, packet Packet) []byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codec was never used in a version of IBC. Think it was used in early pre-launch implementations but got changed before launch. the function signature never changed tho
// which IBC version to use to commit this packet | ||
IBCVersion protocol_version = 9; | ||
// version which application should use to process the packet data | ||
string app_version = 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with this to move forward, but I feel the app_version should be inside the packet data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can do that in a multi packet data version
// This will be treated as a classic packet | ||
IBC_VERSION_UNSPECIFIED = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, should we assign classic to 0? Would be encoding compliant with the existing structure, I'm fairly sure (empty fields not encoded), but it doesn't matter so much since this is just go api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proto makes me suffix this enum with UNSPECIFIED. idk if it can be overridden.
Agreed, this is just inside the chain doesn't go over the protocol so it doesn't matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ORDER_NONE_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "NONE"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// which IBC version to use to commit this packet | ||
IBCVersion protocol_version = 9; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea here being rather than introspecting the channel-id, we have the sender specify a version?
For other reviewers, you should think of the packet type as our go api and the commitment structure as the spec requirement. 2 ibc implementations could use different internal packet types and still be spec compliant
…a/add-version-to-packet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't spot anything wired, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love the encompassing commit packet, left some initial comments/qs
timeoutBuf := sdk.Uint64ToBigEndian(packet.GetTimeoutTimestamp()) | ||
|
||
// only hash the timeout height if it is non-zero. This will allow us to remove it entirely in the future | ||
if !reflect.DeepEqual(timeoutHeight, clienttypes.ZeroHeight()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does height have an Eq
in its interface we could use?
@@ -35,6 +55,51 @@ func CommitPacket(cdc codec.BinaryCodec, packet Packet) []byte { | |||
return hash[:] | |||
} | |||
|
|||
// CommitEurekaPacket returns the Eureka packet commitment bytes. The commitment consists of: | |||
// sha256_hash(timeout_timestamp + timeout_height.RevisionNumber + timeout_height.RevisionHeight + sha256_hash(data)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mention hasing of version?
// NOTE: sdk.Uint64ToBigEndian sets the uint64 to a slice of length 8. | ||
func CommitPacket(cdc codec.BinaryCodec, packet Packet) []byte { | ||
func CommitClassicPacket(packet Packet) []byte { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two called by CommitPacket
should now be able to be made private no?
@@ -64,6 +64,7 @@ var ( | |||
disabledTimeout = clienttypes.ZeroHeight() | |||
validPacketData = []byte("testdata") | |||
unknownPacketData = []byte("unknown") | |||
validVersion = "ics-20" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guessing this is passed someplace as packet app version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in packet_test.go, just put the vars in one place rather than splitting them across files. We already use these vars in that test file
buf = append(buf, destinationHash[:]...) | ||
|
||
// hash the version only if it is nonempty | ||
if packet.AppVersion != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where would have empty app version? do we need validation for this field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any version validation in the handshakes.
I'm not sure if we should be allowing it to be empty. Maybe we shouldn't, but i was thinking a blank version would imply use your default version. So if transfer receives a blank version, it tries to unmarshal data into ics20-v1 packet for example
IBC_VERSION_CLASSIC = 1; | ||
// IBC version 2 implements the Eureka protocol | ||
IBC_VERSION_EUREKA = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looked over this with @chatton since it overlaps with our work. He made a good point that Eureka name is leaking into the codebase. I think long term, referring to this as v1 and v2 packet commitment structures would be more intuitive. Otherwise you keep adding codenames for every version (which I find to be very confusing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, switched to v2 for Eureka and v1 for classic. With this context, I think it still makes sense to leave the 0 enum as UNSPECIFIED but treat it as a v1 packet. What do you think?
I prefer that to zero indexing the IBC_Version_1 enum
// NOTE: The commitment MUSTs be a fixed length preimage to prevent relayers from being able | ||
// to malleate the packet fields and create a commitment hash that matches the original packet. | ||
func CommitPacket(packet Packet) []byte { | ||
switch packet.ProtocolVersion { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we aren't proving the protocol version a relayer could provide the opposite version that a packet was sent on. Unsure how likely the impact would be, but certainly creates some opportunity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it was a eureka packet would fail on chan lookup and if a classic on counterparty lookup? this is assuming we don't allow chans/conns on eureka clients though, unsure for allowing them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would only matter if there was a hash collision between classic packets and eureka packets. Since we changed the commitment algorithm, I don't think that's possible here.
The same exact packet fields with the only thing changed being the ProtocolVersion would lead to different commitments, since the commitment algorithm is different even for the existing fields (and we newly hash dest identifiers)
And additionally two different packets hashing to the same hash by swapping out the ProtocolVersion would break the sha256 preimage collision so we don't need to worry about that.
I have thought about the issue of future maintainer adding a third version. And this third version commits packets in the exact same way as v2. In this case, if the future maintainer is not careful, they can allow relayers to modify the version on receive.
I could signal the possibility of that footgun here by explicitly hashing protocol version. But that would only be a hint for right behavior, since future maintainers may not do it (if they don't change commitment hashes in between the next versions, they will need to hash in the protocol version)
destinationHash := sha256.Sum256([]byte(packet.GetDestChannel())) | ||
buf = append(buf, destinationHash[:]...) | ||
|
||
// hash the version only if it is nonempty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? What's wrong with hashing the version even if it is empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do this, thought to save on the compute if hash is empty. More relevant for VM implementations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better not to have branching in the code when not necessary. A single hash isn't gonna make or break it. So can we hash even if it is empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, sweet!
|
Merging to not block future PRs. I believe I've answered people's questions. If there are followups, please open new issues or discuss on the eureka channel |
* Cherry-pick: Add MsgRegisterCounterparty Struct and Handler from ibc-lite (#6982) * feat(lite): counterparty client logic (#6307) * imp: added counterparty client store * imp: added provide counterparty to proto * imp: ran 'make proto-all' * imp: added logic to counterparty client * imp: fix proto * imp: fix proto * imp: ran 'make proto-all' * feat: finished counterparty client logic * change counterparty to include custom prefix * fix imports * import fixes, review suggestions * rm lite comment * applying review suggestions * add creator tests * addressing aditya review * Update proto/ibc/core/client/v1/client.proto Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * Update modules/core/02-client/types/msgs.go Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * Update modules/core/keeper/msg_server.go Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * addressing jim review * refactor(proto): use counterparty type in MsgProvideCounterparty. Validate Counterparty type. * refactor(keys): move Counterparty key to 02-client keys.go * feat(core): delete creator after registering counterparty. * chore(core): make GetCreator return a boolean if not found. * tests(02-client): add tests for counterparty validation. * tests(02-client): add tests for msg_server provide counterparty handler. * nit(core): remove stale key for counterparty in host. * Update modules/core/02-client/keeper/keeper_test.go --------- Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com> Co-authored-by: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Co-authored-by: Stefano Angieri <stefano@interchain.io> Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * chore: move status checks from connection verify_* functions to 02-client verify_* functions. (#7006) * chore: split out packet handling rpcs (#7007) * chore: split out packet handling rpcs * add keeper, expected interfaces, merkle tweaks. * add verify functions of client keeper. * self review * Add versions to packet and create Eureka packet commitment (#6986) * add versions to packet and separate commitment function * use IBC Version to switch hashing * fix build and tests, found bug in switch logic * add documentation * improve code docstrings * address jim review * rename eureka to v2 * feat(tests): add helper functions, keeper test suite. (#7052) * feat(tests): add helper functions, keeper test suite. * wire up packet server in app --------- Co-authored-by: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> * feat(core/eureka): add packet handler (#7048) * send packet eureka * test progress * add tests * lint * nit * lint moar * refactor tests * feat(core/eureka): add recv handler (#7041) * feat(core/eureka): add recv handler. * review: address feedback, self review. * tests(core/packet-server): add tests for recv. * chore: make lint-fix. * chore: address review nits. * feat(core/eureka): add timeout handler (#7060) * timeout eureka implementation * test progress * continued progress with tests * tests * cleanup and docs * use sentinel channel in sendPacket events * address review * test review fixes * lint * feat(core/eureka): add writeack, ack handler. (#7049) * feat(core/eureka): add writeack, ack handler. * tests(core/packet-server): add tests for write acknowledgement. * chore: add packet protocol version checks to both. * fix: add check for packet receipt being present. * tests(core/packet-server): add tests for ack. * tests: address review, add FreezeClient helper to endpoint. * feat(core): Wire packet handler to core message server (#7091) * chore: return app version in handlers * add expected keeper interface for packet handler functions. * add switch in msg_server to dispatch based on protocol version. * guard TimeoutExecuted with version check for time being. * rename interface. * inline timeoutExecuted * slipped WriteAck. * use msg-server entrypoints for packet flow in testing. * use endpoint.SendPacket in recv test. * feat(eureka): fix condition in commit packet, added test for zero timeout height (#7109) * fix condition in commit packet, added test for zero timeout height, change some error messages and add some more comments * error for verify functions * refactor: reduce channel lookup for timeout flow (#7149) * imp: require stricter usage of app version in packet (#7146) * fix: add validation of protocol version and app version to packet validatebasic * Update modules/core/04-channel/types/packet_test.go * Update modules/core/04-channel/types/packet.go Co-authored-by: Carlos Rodriguez <carlos@interchain.io> --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> * chore: remove unnecessary comments (#7155) * imp: add tests for BuildMerklePath, make merkle path non-nullable in counterparty (#7160) * refactor: regenerate merkle path as non-nullable + add tests to build merkle path * fix: avoid mutating prefix provided * fix test build --------- Co-authored-by: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> * chore: add godoc to packet server handlers (#7156) * chore: add godoc * Apply suggestions from code review --------- Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> * feat(eureka): add tests for `MsgProvideCounterparty` (#7179) * add tests for MsgProvideCounterparty ValidateBasic * address review comments * add submodule to logger (#7196) * add submodule for logger * add submodule in keys.go * tests: msg server tests for eureka (#7162) * test: TestAcknowledgePacketV2 * fix up recv tests * add timeout v2 tests * imp: use expErr instead of expPass --------- Co-authored-by: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Co-authored-by: Carlos Rodriguez <carlos@interchain.io> * Validate MerklePathPrefix and Path (#7193) * merkle validation funcs * add merkle prefix validation and testing * address comments --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> * add helper to retrieve handler and module based on protocol version (#7198) * add helper to retrieve handler and module based on protocol version * address self review comments * returning values instead of binding vars * chore: clean up case for v1. --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * feat(eureka): Add gRPC query for Counterparty for a given client identifier (#7120) * chore: add grpc query for counterParty * chpre: made changes to the proto * chore: updated goDoc * chore: added creator to the respone * fix: fixes in the grpc_query * fixes * improve implementation and add tests * trying to fix weird linter error * fix build * chore: make counterparty field of response a non pointer. * chore: simplify logic, remove uneeded ifs * chore(tests): use expError pattern. --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * feat(eureka): add CLI to submit `MsgProvideCounterparty` (#7118) * wip * wip * chore: added description * fix: fixed lint issues * address my self-review * lint * accept hex-encoded strings for merkle path prefix * fix build error --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> * Use client and counterparty terminology in packet server (#7195) * Use client and counterparty terminology in packet server rather than channel * add counterparty not found error * add ErrCounterpartyNotFound * improve comment --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> * chore: require app version be non-empty when protocol version is version 2 (#7209) * chore: require app version be non-empty when protocol version is version 2. * chore(tests): use constructor instead of direct struct initialization. * chore(tests): update usages in msg_server, packet_server tests to use non-empty app version. * chore(tests): add case for latest height err case. (#7212) * feat(events): dont emit channel information for eureka handlers) (#7230) * feat(02-client/cli): add query for client counterparty. (#7235) * feat(02-client/cli): add query for client counterparty. * chore: mirror grpc name. * Apply suggestions from code review Co-authored-by: Carlos Rodriguez <carlos@interchain.io> --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> * chore: move handler implementations into a relay.go file. (#7271) Co-authored-by: Aditya <adityasripal@gmail.com> * refactor: Move Counterparty to packet server (#7280) * refactor: move Counterparty to packet-server Co-authored-by: Aditya <adityasripal@gmail.com> * chore: remove old structs/impls Co-authored-by: Aditya <adityasripal@gmail.com> * nit(tests): use second client id to check counterparty isn't found. --------- Co-authored-by: Aditya <adityasripal@gmail.com> * chore(packet-server): add queryServer to packet-server (#7283) * chore(packet-server): add queryServer to packet-server * chore(packet-server): return error if non of creator/counterparty is stored. * feat(packet-server): add client. (#7284) * Add PacketV2 Protos and CommitmentV2 function (#7287) * chore: adding proto for packetV2 * chore: adding commitV2 hash fn * chore: addressing PR feedback * chore: removed accidental comment * chore: add conversion function from PacketV1 to PacketV2 (#7292) * chore: adding proto for packetV2 * chore: adding commitV2 hash fn * chore: addressing PR feedback * chore: add conversion function from PacketV1 to PacketV2 * chore: added check for protocol version * go mod tidy and remove function * chore: default to json encoding in conversion * pr feedback --------- Co-authored-by: chatton <cian@interchain.io> * refactor: change counterparty structure. (#7328) * refactor: change counterparty structure. * refactor: add channel id to Counterparty. * refactor: use client identifier in relay functions. * chore: suffix _id to identifier. * chore: move PacketV2 to channel/v2 proto and rename it to Packet (#7357) * chore: move PacketV2 to channel/v2 * remove file accidentally added * chore: created packet.go for v2 * rename * Add fallback function to grab counterparty for non-eureka channels (#7358) * Add channel keeper v2 (#7377) * chore: add scaffolding for channel keeper v2 * Update modules/core/04-channel/v2/keeper/keeper.go Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * chore: Added SendPacket RPC skeleton and relative proto message (#7364) * chore: Added SendPacket RPC skeleton * chore: register new message * linter * add v2 codec.go * rename alias * linter * Add new keys and getter / setter functions (#7378) * chore: adding keys and keeper getter and setter functions * chore: use BigEndian for sequence in keys * chore: add MsgRecvPacket skeleton (#7379) * chore: add MsgRecvPacket skeleton * Add RPC proto definition for RecvPacket * chore: add MsgTimeout skeleton (#7380) * add MsgTimeout skeleton * missing saved file * restore docstring * chore: add Acknowledgement message proto. (#7381) * chore: add Acknowledgment message! * chore: fix proto mess * random fixes * chore: Add PacketV2 ValidateBasic() function (#7389) * chore: Add PacketV2 ValidateBasic() function * remove unused function * PR feedback * Added tests * linter * solve import cycle * create ValidateBasic for PacketData * refactor: Add CreateChannel rpc (#7382) * refactor: add protos + implementation + validation + tests for CreateChannel rpc. * Update proto/ibc/core/packetserver/v1/tx.proto Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * chore: move signer as final arg --------- Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * chore: adding implementation for SendPacket message server (#7383) * chore: adding implementation for SendPacket message server * chore: adding issue links * chore: add additional issue link * chore: using sourceID * chore: adding commented aliasing code * chore: adding tests for aliasing and required functions * chore: moved IBCModule interface into api directort * Adding router v2 (#7392) * chore: adding router v2 * chore: addressing PR feedback * chore: address PR feedback and fix linter * Add mock ibc module v2 (#7398) * chore: adding router v2 * chore: addressing PR feedback * chore: address PR feedback and fix linter * chore: adding mock v2 module * chore: add RecvPacket to V2 (#7399) * chore: add RecvPacket to V2 * fix wrong log * Update modules/core/04-channel/v2/keeper/relay.go Co-authored-by: Cian Hatton <cian@interchain.io> * PR feeback --------- Co-authored-by: Cian Hatton <cian@interchain.io> * chore: create helper function for counterparty falllback. (#7405) * chore: create helper function for counterparty falllback. * Fix source/dest ID * Update modules/core/04-channel/v2/keeper/relay.go Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * Update modules/core/04-channel/v2/keeper/relay.go Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> --------- Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> * chore: Add Timeout to Channel Keeper (#7400) * chore: Add Timeout to Channel Keeper * reintroduce method * linter * pr feedback * use helper fn * chore: register v2 msg service and rename (#7407) * Wire up simapp to use mock v2 modules (#7401) * chore: adding router v2 * chore: addressing PR feedback * chore: address PR feedback and fix linter * chore: adding mock v2 module * chore: adding mock application wiring in simapp * chore: fix linter * chore: add pluming necessary for testing CreateChannel (#7406) * chore: add pluming necessary for testings. * chore: docustring for event func. * chore: wire up call to emit in msg_server * chore: fix linter mess. * chore: review touch ups. * chore: add OnRecvPacket to IBCModule V2 interface (#7415) * chore: add OnTimeoutPacket to IBCModule V2 interface (#7418) * refactor: host keys apis to use uint64 sequence and fmt big endian bytes internally (#7419) * feat: create channel before invoking provide counterparty. (#7420) * chore: clean up ProvideCounterparty tx. (#7422) * chore: clean up msgprovidecounterparty. * Update modules/core/keeper/msg_server_test.go Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> --------- Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> * Rename Id Fields to Channel for Packet V2 (#7428) * change id fields to channel * Apply suggestions from code review Co-authored-by: Damian Nolan <damiannolan@gmail.com> --------- Co-authored-by: Damian Nolan <damiannolan@gmail.com> * packetserver: Rename Counterparty to Channel (#7429) * chore: clean up msgprovidecounterparty. * Update modules/core/keeper/msg_server_test.go Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> * rename counterparty to channel in packetserver * change var names * chore: fix merge mess. --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * feat: add acknowledgePacket handler to channel/v2 (#7412) * chore: add commitment.go with temporary commit acknowledgement func * feat: impl acknowledgePacket handler in channel/v2 * nit: vanity nits * chore: add placeholder event func and logs * chore: fix conflict and address todo * nit: update to pointer recvr args * chore: update ids in log * channel/v2: Rename Counterparty to Channel (#7432) * rename counterparty to channel in v2 folder * rename getV1Channel to getV2Channel * fix var naming err from last pr * Implement MsgSendPacket RPC handler and tests (#7413) * chore: added application callback to SendPacketV2 rpc * chore: adding additional msg server tests * chore: adding additional tests * chore: address PR feedback * chore: rename sourceID to sourceChannel * chore: ensure correct usage of ids. (#7433) * chore: cleanup ids in eureka branch (#7434) * chore: sourceID -> channelID * chore: clientID -> channelID * chore: move tx's to channel/v2 (#7435) * chore: move tx's to channel/v2 * Use channel identifier when setting creator. * chore: Add OnAcknowledgmentPacket to IBCModule V2 Interface (#7438) * Add OnAcknowledgmentPacket to IBCModule V2 Interface * chore: fix typo * nit: reorder proto msgs (#7446) * chore: fix naming of parameters sourceID/destinationID (#7448) * Add OnAcknowledgmentPacket to IBCModule V2 Interface * chore: fix typo * chore: PR feedback * chore: fix wrong merge conflict resolution * Implement v2 RecvPacket rpc handler (#7421) * chore: added application callback to SendPacketV2 rpc * chore: adding additional msg server tests * chore: adding additional tests * chore: adding on recv handler * chore: add recv packet happy path * chore: added test for failed recv result * chore: adding additional tests * chore: misc cleanup on self review * chore: moved fn into packet.go and added no-op telemetry v2 functions * chore: addressing PR feedback * chore: add issue links * chore: ensure no-op case works as intended * chore: add NoOp test case * chore: fix ack v2 commitment * chore: PR feedback --------- Co-authored-by: bznein <nikolas.degiorgis@interchain.io> * chore: Move initialization of next sequence send to create channel rpc handler. (#7449) * chore: Implement v2 Acknowledgement rpc handler (#7452) * chore: added application callback to SendPacketV2 rpc * chore: adding additional msg server tests * chore: adding additional tests * chore: adding on recv handler * chore: add recv packet happy path * chore: added test for failed recv result * chore: adding additional tests * chore: misc cleanup on self review * chore: moved fn into packet.go and added no-op telemetry v2 functions * chore: implement Acknowledgment RPC handler * chore: add MsgAcknowledgment and test skeleton * wip * chore: fix set packet ack * add more test cases * merge conflicts * unneeded file! * removed duplicate method * revert error checking * chore: linter * PR feedback * typo --------- Co-authored-by: chatton <cian@interchain.io> * chore: replace stale references to clientId. (#7457) * fix: start error code from 2. (#7458) * chore: add cli/tx for create channel. (#7460) * chore: remove stale references to packet-server in channel/v2. (#7451) * Remove duplication of ConvertToErrorEvents (#7467) * chore: move convert to errors to internal directory * chore: removed empty file * chore: add ValidateBasic for MsgSendPacket (#7468) * Add helper functions for MsgSendPacket, MsgRecvPacket and MsgAcknowledgePacket (#7465) * chore: added msg send packet fucntion on endpoint * chore: added MsgRecvPacket to endpoint * chore: modify ack test to use new endpoint send and recv functions * chore: refactored msg ack to use new endpoint fn * chore: added test case to verify proof failure * Update testing/endpoint_v2.go Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * chore: add ValidateBasic and test for MsgRecvPacket (#7470) * chore: add ValidateBasic and test for MsgRecvPacket * merge * chore: address reviews. --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * chore: Implement v2 Timeout rpc handler (#7463) * msgTimeout test * better wording for comment * chore: use deletepacketcommitment instead of setting an empty one * typo * Update modules/core/04-channel/v2/keeper/msg_server_test.go Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> * chore: use deletepacketcommitment instead of setting an empty one * wip * chore: debugging timeout test * chore: removed unneeded proto field and added helper function for endpoint MsgTimeout --------- Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> Co-authored-by: chatton <cian@interchain.io> * channel/v2: Add Keeper Tests (#7456) * test progress * use export_test and fix send_packet * fix test build * in-progress fixing tests * remove test file * fix mockv2 acknowledgment * comment on export_test * appease linter * fix bug * fix nits and add test case * add writeAck tests * use existing endpoint test fns * fix: timeout tests after timeout as seconds. (#7480) * chore: add validation for MsgAcknowledgement. (#7473) * chore: remove packet-server. (#7481) * chore: remove packet-server. * chore: remove commented out test funcs. * chore: add ValidateBasic for MsgTimeout in ChannelKeeper V2 (#7482) * chore: add ValidateBasic for MsgTimeout in ChannelKeeper V2 * rename * chore: rename PacketData to Payload (#7483) * chore: rename PacketData to Payload * Update modules/core/04-channel/v2/types/msgs.go Co-authored-by: Cian Hatton <cian@interchain.io> * Update proto/ibc/core/channel/v2/tx.proto Co-authored-by: Cian Hatton <cian@interchain.io> * Update modules/core/04-channel/v2/keeper/packet.go Co-authored-by: Cian Hatton <cian@interchain.io> * Update modules/core/04-channel/v2/keeper/msg_server_test.go Co-authored-by: Cian Hatton <cian@interchain.io> * Update modules/core/04-channel/v2/keeper/export_test.go Co-authored-by: Cian Hatton <cian@interchain.io> * fixes after renaming - PR feedback --------- Co-authored-by: Cian Hatton <cian@interchain.io> * chore: remove copyloopvar check * chore: further renaming of packetdata to payload (#7485) * chore: generate distinct channel identifiers in testing library. (#7489) * chore: limit packet data to length of one. (#7484) * chore: remove fallback logic for GetChannel in timeout handler (#7490) * chore: remove fallback logic for GetChannel in timeout handler * Update modules/core/04-channel/v2/keeper/packet.go Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * chore: remove unecessary KeyChannelStorePrefix (#7496) * tests: fix ProvideCounterparty test. (#7501) * chore: clean up ctx unwrapping in channel/v2/keeper. (#7497) * chore: remove notion of protocol version, revert packet/v1 diffs. (#7498) * chore: Undo split to packet-server in 04-channel/v1. Move v2 testing functions to endpoint_v2. Fix comments in module.go for channel/v2. (#7495) * chore: revert v1 event changes. (#7499) * chore: add tests for Channel.Validate (#7504) * chore: add tests for Channel.Validate * Update modules/core/04-channel/v2/types/channel_test.go Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * Update modules/core/04-channel/v2/types/channel_test.go Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * refactor: check timeouts directly in channel/v2 (#7464) * refactor: check timeouts directly * chore: add seconds to nanos conversion * rm stupid if * chore: regen protos * Update modules/core/04-channel/v2/keeper/packet.go Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * Update modules/core/04-channel/v2/keeper/packet.go * chore: compare timeouts as was done in the olden days * chore: update comments and use secs in recvPacket Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> * chore: fix the compiler error breakage --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> * chore: rename apis to align with spec (#7511) * chore: rename apis to align with spec * nit: order interface assertions * chore: reorder the order of the order of functions * chore: add v2 packet commitment query (#7494) * feat: add v2 packet commitment query * chore: add cli for packet commitment query with abci proof * chore: correct channel query url path, correct errors numbering * chore: impl packet acknowledgement query (#7507) * feat: add v2 packet commitment query * chore: add cli for packet commitment query with abci proof * chore: impl packet acknowledgement query * fix: update identifier validation in grpcs * chore: remove creator field from channel query (#7523) * chore: impl packet receipt query (#7513) * feat: add v2 packet commitment query * chore: add cli for packet commitment query with abci proof * chore: impl packet acknowledgement query * fix: update identifier validation in grpcs * chore: impl packet receipt query * Add MaxTimeout condition (#7521) * enforce maxTimeout * fixes * fix error * run gofumpt * Apply review suggestions Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> * address review comments * errors * use time package --------- Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> * chore: remove usage of v1 errors from v2 (#7528) * chore: remove usage of v1 errors from v2 * linter * chore: reduce number of timeout errors, cleanup (#7529) * chore: add redundancy checks for V2 Msgs (#7509) * chore: add redundant checks for V2 Msgs * reintroduce tests * chore: create ResultType for ChannelV2 (#7534) * chore: lockin v0.50.10 (#7532) * chore: create ResultType for ChannelV2 * move redundancy chgecks to new result type * empty commit * Revert "chore: lockin v0.50.10 (#7532)" This reverts commit 5911185. * Fix timeout in ante tests for V2 --------- Co-authored-by: Damian Nolan <damiannolan@gmail.com> * feat: add protobuf files for channel/v2 genesis storage. (#7502) * wire channel query server v2 (#7537) * wire channel query server v2 * register grpc gateway routes * fix: channel must exist before channel creator check (#7538) * fix: channel must exist before channel creator check * Update modules/core/04-channel/v2/keeper/msg_server.go Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * fixed failing test --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * feat: add paginated packet commitments query to channel/v2 (#7533) * feat: add paginated packet commitments query to channel/v2 * chore: add cli handler * chore: rm commented code * chore: make lint-fix --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * chore: revert re-ordering for v1 channel msg. * chore: revert exporting of deletePacketCommitment. * Match commitment to specification (#7544) * fix hash * prepend hash with byte 0x02 * fix hash to spec * chore: update function documentation to align with implementation. --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * chore: drop usage of 'channeltypesv2'. * chore: fix post-merge test failure. * ICS24: Change Provable keys (#7517) * refactor packet keys * provable keys * chore: fix packet commitments prefix function. --------- Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * chore: amend event emitted for create channel. (#7557) * chore: add event for register counterparty (#7556) * chore: add next sequence send query. (#7550) * chore: make AliasV1Channel a private function. * nit: consistent import name for 24-host/v2 * Simplify Acknowledgement structure (#7555) * simplify ack to array of byte arrays * simplify test * lint * support client identifiers as channels in ics20 denom hops (#7551) * chore: add unreceived acks rpc (#7562) * chore: add unreceived acks rpc * nit: init path in setup function. * make packet commitments fixed length (#7564) * make packet commitments fixed length * updated docs for packet commits * feat: add custom querier to wasm image (#7559) * add custom querier to wasmd + build for arm64 * Use build-push-action for multi-platform build * fix build-args * fix bad bash * lint * add build-essential for building arm64 arch * add g++-aarch64-linux-gnu for arm64 * add some more info to custom query error msg * chore: add unreceived packets rpc (#7561) * add UnreceivedPackets query * lint * minor * use HasChannel and correct flag * add unit test * lint * fix expErr * Update modules/core/04-channel/v2/keeper/grpc_query.go Co-authored-by: Damian Nolan <damiannolan@gmail.com> * using HasPacketReceipt --------- Co-authored-by: Damian Nolan <damiannolan@gmail.com> * Ibcmodulev2 transfer application spike (#7524) * chore: adding ibc module v2 and on recv implementation with hard coded sequence * chore: adding ack callback * chore: adding send packet * chore: adding transfer v2 module to app wiring * chore: adding happy path and basic failure for send and recv for transfer module * chore: adding ack test for transfer * chore: fix some linter errors * chore: adding timeout test for transfer v2 * chore: adding test case which ensures tokens can be transfered over both v1 and v2 * chore: full transfer flow from A - B - C - B - A * chore: separated test out into subtests * chore: add sequence as argument to OnRecvPacket * chore: adding TODOs for next steps * chore: adding transferv2 module to wasm simapp * chore: refactor OnTimeout to accept sequence * chore: refactor OnAck to accept sequence * chore: switch argument order * wip: mid merge with feature branch, build will be broken * Fix timeoutTimestamp for tests * linter * chore: removing duplicate imports in wasm simapp * chore: adding channelkeeperv2 query server * register grpc gateway routes * fix ack structure for v2 transfer tests * lint * make signature consistent --------- Co-authored-by: chatton <cian@interchain.io> Co-authored-by: bznein <bznein@debian> Co-authored-by: Gjermund Garaba <gjermund@garaba.net> * chore: use encoding fields for packet data unmarshaling (#7574) * chore: use encoding fields for packet data unmarshaling * linter * clean up function * more comments * use MIME type and constants * use application/x-protobuf as MIME type for proto encoding * renaming and linter * feat: add type constructors/validation for genesis types. (#7554) * chore: add events for send packet (#7577) * chore: add events for recv packet. (#7582) * chore: add events for send packet * chore: add events for recv packet. * chore: lint-fixes * testing: add merkle path to endpoint struct. (#7576) * chore: add packet acknowledgements rpc (#7558) * chore: add packet acknowledgements rpc * Update modules/core/04-channel/v2/keeper/grpc_query_test.go Co-authored-by: Gjermund Garaba <gjermund@garaba.net> --------- Co-authored-by: Gjermund Garaba <gjermund@garaba.net> * imp: added simpler events (#7613) * feat: add solidity ABI support in ICS20Transfer ics20-1 (#7592) * add support for abi encoding in ICS20Transfer * fix abi encoding order * add tests for unmarshaling packet data with encoding * change from x-abi to x-solidity-abi * use solidity abigen for encoding of abi ics20 payloads * lint * fix arm64 test build * install compiler before first build step * bump ethereum-go * bump prysm for wasm simapp * tidy * add comment to abi encoding function * code review cleanups --------- Co-authored-by: srdtrk <srdtrk@hotmail.com> * chore: add channel client state rpc (#7616) * chore: add channel client state rpc * chore: drop func to provide proof * rename v2 event attribute key for encoded data (#7635) * bug: fix packet commitment path used for timeout (#7646) * fix: correct error message for payload validation in packet ValidateBasic (#7649) * chore: add validation for Ack and plug it in. (#7647) * fix typeos (#7654) * chore: document packet commitment keys + move prefixes to 24-host (#7633) * move timestamp checks in SendPacket earlier (#7637) * rename v2 router api to use portID (#7639) * chore: fix merge mess * chore: remove stale connection test cases brought in by merge * use unordered check (#7689) * chore: add telemetry reporting for packet methods (#7673) * chore: remove redundant calls to emit events in cached context. (#7648) * chore: add channel consensus state rpc (#7619) * test: add tests for v2 transfer vesting account (#7688) * test vesting accounts in v2 transfer module * add changelog + fix godoc * chore: use separate store paths for channels/creators (#7696) * proto swager gen (#7722) Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * lint * update abigen * chore: add permissions to wasm image job * fix: wasm docker file + wasm simapp gas limit (#7830) * fix: dockerfile layer name * update wasm simapp image with higher max gas * lint * updated max gas to same as cosmos hub * Move channel back to counterparty (#7842) * add back client registerCounterparty * change channel to id in packet * fix tests * split messaging key to prefix and clientId * change eureka packet handlers to no longer rely on channel * naming suggestions * fix test file * start to fix tests * fix v2/keeper tests * fix tests * DELETE channel from v2 * rm commented code * move nextSeqSend to a better place * remove resolveV2Identifiers for now * lint * lint * review suggestions * Update cli.go * Compare Timeout timestamps in seconds instead of nanoseconds (#7857) * compare seconds instead of nanoseconds * remove unnecessary helper func * improve naming * imp: simplified `BuildMerklePath` (#7863) * imp: simplified BuildMerklePath * imp: review item * test: improved test structure * refactor: make transfer module v2 use same core paths as v1 (#7754) * reuse transfer keeper in v2 * remove keeper from transfer module v2 * moved some comments around and disabled forwarding * code review fixes * Update modules/apps/transfer/keeper/relay_test.go --------- Co-authored-by: Aditya <14364734+AdityaSripal@users.noreply.github.com> * Simplify WriteAck API for async acks (#7869) * simplify writeack api * fix tests * fix: send entire balance not working as expected (#7871) * imp: updated events to remove channels (#7874) * imp: updated channel v2 events * fix: removed event * fix: build wasm image on native architecture (#7884) * distribute build on native OS for wasm builds * fix build-wasm-simd-image-from-tag.yml * add buildx * Add install go for macos runner * setup docker before login * use linux arm instead of macos * fix image name * reference issue in TODO * test: add initial eureka transfer tests (#7901) * fix: enable noop error in v2 timeout (#7903) * imp: harden ICS20 Eureka Module (#7908) * enforce strict portID check in eureka module * make base denom check * fix comments * lint * lint moar * one last time --------- Co-authored-by: Gjermund Garaba <gjermund@garaba.net> * imp: drop solidity-ibc-eureka dependency (#7909) * imp: abi decoding * imp: removed abigen --------- Co-authored-by: Gjermund Garaba <gjermund@garaba.net> * imp: use constant error acknowledgement * test: create tests for constant error acknowledgement (#7925) * fix msg server * add tests * harden transfer ack * chore: transfer telemetry and events in eureka (#7918) * chore: transfer telemetry and events in eureka * lint * chore: lint after merge * imp: allow 8 character client-ids (#7931) --------- Co-authored-by: sangier <45793271+sangier@users.noreply.github.com> Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com> Co-authored-by: Aditya Sripal <14364734+AdityaSripal@users.noreply.github.com> Co-authored-by: Stefano Angieri <stefano@interchain.io> Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com> Co-authored-by: Carlos Rodriguez <carlos@interchain.io> Co-authored-by: chandiniv1 <117723967+chandiniv1@users.noreply.github.com> Co-authored-by: Vishal Potpelliwar <71565171+vishal-kanna@users.noreply.github.com> Co-authored-by: Aditya <adityasripal@gmail.com> Co-authored-by: Cian Hatton <cian@interchain.io> Co-authored-by: Nikolas De Giorgis <nikolas.degiorgis@interchain.io> Co-authored-by: Damian Nolan <damiannolan@gmail.com> Co-authored-by: Gjermund Garaba <gjermund@garaba.net> Co-authored-by: lacsomot <153717732+lacsomot@users.noreply.github.com> Co-authored-by: bznein <bznein@debian> Co-authored-by: srdtrk <srdtrk@hotmail.com> Co-authored-by: Sruthi2357 <eswar143chandu@gmail.com> Co-authored-by: bmo <biemohat@gmail.com> Co-authored-by: Alyak <alyak9766@gmail.com> Co-authored-by: iIvaki <loli.zizaki@gmail.com>
Description
TODO:
closes: #6971 #6972
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
).godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.