-
Notifications
You must be signed in to change notification settings - Fork 657
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
feat(core, apps): 'PacketDataProvider' interface added and implemented #4199
Merged
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
041476c
refactor(core/exported): moved packet interfaces to packet.go
srdtrk fc46e89
feat(core/exported): 'PacketDataProvider' interface added
srdtrk b6fe7fa
feat(transfer): PacketDataProvider implemented
srdtrk 7b56d59
feat(ica): implemented PacketDataProvider
srdtrk 83f7817
style(transfer_test, ica_test): improved test name
srdtrk e23b769
Merge branch 'main' into serdar/packetdataprovider
srdtrk 5b01a89
merge: branch 'main' into serdar/packetdataprovider
srdtrk 7173bab
docs(core.adr8): updated godocs
srdtrk 950d77c
style(ica_test): changed a variable name
srdtrk 3f382b0
docs(core.adr8): added missing '.'
srdtrk 6fc5c26
imp(transfer): removed type assertion on jsonKey
srdtrk 116a2db
fix(transfer_test): removed unused test case parameter
srdtrk c86405c
docs(transfer): updated godocs
srdtrk aa3fe0f
imp(ica): removed type assertion from 'GetCustomPacketData'
srdtrk 11a859a
imp(transfer_test): improved tests without type assertion
srdtrk fbcf8b7
imp(ica_test): improved tests without type assertion
srdtrk fc5e953
style(transfer_test): changed test case parameter name
srdtrk 7b9bfa2
merge: branch 'main' into serdar/packetdataprovider
srdtrk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package exported | ||
|
||
// PacketI defines the standard interface for IBC packets | ||
type PacketI interface { | ||
GetSequence() uint64 | ||
GetTimeoutHeight() Height | ||
GetTimeoutTimestamp() uint64 | ||
GetSourcePort() string | ||
GetSourceChannel() string | ||
GetDestPort() string | ||
GetDestChannel() string | ||
GetData() []byte | ||
ValidateBasic() error | ||
} | ||
|
||
// Acknowledgement defines the interface used to return acknowledgements in the OnRecvPacket callback. | ||
// The Acknowledgement interface is used by core IBC to ensure partial state changes are not committed | ||
// when packet receives have not properly succeeded (typically resulting in an error acknowledgement being returned). | ||
// The interface also allows core IBC to obtain the acknowledgement bytes whose encoding is determined by each IBC application or middleware. | ||
// Each custom acknowledgement type must implement this interface. | ||
type Acknowledgement interface { | ||
// Success determines if the IBC application state should be persisted when handling `RecvPacket`. | ||
// During `OnRecvPacket` IBC application callback execution, all state changes are held in a cache store and committed if: | ||
// - the acknowledgement.Success() returns true | ||
// - a nil acknowledgement is returned (asynchronous acknowledgements) | ||
// | ||
// Note 1: IBC application callback events are always persisted so long as `RecvPacket` succeeds without error. | ||
// | ||
// Note 2: The return value should account for the success of the underlying IBC application or middleware. Thus the `acknowledgement.Success` is representative of the entire IBC stack's success when receiving a packet. The individual success of each acknowledgement associated with an IBC application or middleware must be determined by obtaining the actual acknowledgement type after decoding the acknowledgement bytes. | ||
// | ||
// See https://github.com/cosmos/ibc-go/blob/v7.0.0/docs/ibc/apps.md for further explanations. | ||
Success() bool | ||
Acknowledgement() []byte | ||
} | ||
|
||
// PacketDataProvider defines an optional interfaces for retrieving custom packet data stored on behalf of another application. | ||
// An existing problem in the IBC middleware design is the inability for a middleware to define its own packet data type and insert packet sender provided information. | ||
// A short term solution was introduced into several application's packet data to utilize a memo field to carry this information on behalf of another application. | ||
// This interfaces standardizes that behaviour. Upon realization of the ability for middleware's to define their own packet data types, this interface will be deprecated and removed with time. | ||
type PacketDataProvider interface { | ||
// GetCustomPacketData returns the packet data held on behalf of another application. | ||
// The name the information is stored under should be provided as the key. | ||
// If no custom packet data exists for the key, nil should be returned. | ||
GetCustomPacketData(key string) interface{} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
super super nit:
expAdditionalData
->expCustomData
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.
done