Skip to content

Commit

Permalink
docs(callbacks): added godocs for defensive send packet validation (#…
Browse files Browse the repository at this point in the history
…4358)

* docs(callbacks): added godocs for send packet validation

* docs(callbacks): improved godocs

* docs(callbacks): used colin and damian suggested doc string

* docs(callbacks): fixed typo

* docs(callbacks): improved a minor typo
  • Loading branch information
srdtrk authored Aug 23, 2023
1 parent b25c065 commit 85821bd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions modules/apps/callbacks/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ type ContractKeeper interface {
// gas limit, and handle any errors, or panics gracefully.
// If an error is returned, the transaction will be reverted by the callbacks middleware, and the
// packet will not be sent.
//
// Implementations are provided with the packetSenderAddress and MAY choose to use this to perform
// validation on the origin of a given packet. It is recommended to perform the same validation
// on all source chain callbacks (SendPacket, AcknowledgementPacket, TimeoutPacket). This
// defensively guards against exploits due to incorrectly wired SendPacket ordering in IBC stacks.
IBCSendPacketCallback(
ctx sdk.Context,
sourcePort string,
Expand All @@ -31,6 +36,11 @@ type ContractKeeper interface {
// the sender is unknown or undefined. The contract is expected to handle the callback within the
// user defined gas limit, and handle any errors, or panics gracefully.
// If an error is returned, state will be reverted by the callbacks middleware.
//
// Implementations are provided with the packetSenderAddress and MAY choose to use this to perform
// validation on the origin of a given packet. It is recommended to perform the same validation
// on all source chain callbacks (SendPacket, AcknowledgementPacket, TimeoutPacket). This
// defensively guards against exploits due to incorrectly wired SendPacket ordering in IBC stacks.
IBCOnAcknowledgementPacketCallback(
ctx sdk.Context,
packet channeltypes.Packet,
Expand All @@ -44,6 +54,11 @@ type ContractKeeper interface {
// empty if the sender is unknown or undefined. The contract is expected to handle the callback
// within the user defined gas limit, and handle any error, out of gas, or panics gracefully.
// If an error is returned, state will be reverted by the callbacks middleware.
//
// Implementations are provided with the packetSenderAddress and MAY choose to use this to perform
// validation on the origin of a given packet. It is recommended to perform the same validation
// on all source chain callbacks (SendPacket, AcknowledgementPacket, TimeoutPacket). This
// defensively guards against exploits due to incorrectly wired SendPacket ordering in IBC stacks.
IBCOnTimeoutPacketCallback(
ctx sdk.Context,
packet channeltypes.Packet,
Expand Down

0 comments on commit 85821bd

Please sign in to comment.