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

feat(core, apps): 'PacketData' interface added and implemented #4200

Merged
merged 19 commits into from
Aug 1, 2023

Conversation

srdtrk
Copy link
Member

@srdtrk srdtrk commented Jul 28, 2023

Description

This PR reduces the diff when reviewing the adr8 PR #3939.

PacketData defines an optional interface which PacketData's may implement.

closes: #XXXX

Commit Message / Changelog Entry

feat(core, apps): 'PacketData' interface added and implemented

see the guidelines for commit messages. (view raw markdown for examples)


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.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

modules/apps/transfer/types/packet.go Outdated Show resolved Hide resolved
modules/core/exported/packet.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jul 31, 2023

Codecov Report

Merging #4200 (b9480d1) into main (4e1e594) will increase coverage by 0.03%.
Report is 11 commits behind head on main.
The diff coverage is 75.65%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4200      +/-   ##
==========================================
+ Coverage   79.45%   79.48%   +0.03%     
==========================================
  Files         188      188              
  Lines       12990    13005      +15     
==========================================
+ Hits        10321    10337      +16     
+ Misses       2240     2239       -1     
  Partials      429      429              
Files Changed Coverage Δ
...interchain-accounts/controller/keeper/handshake.go 89.85% <ø> (ø)
...les/apps/27-interchain-accounts/host/ibc_module.go 91.11% <ø> (ø)
...ps/27-interchain-accounts/host/keeper/handshake.go 89.39% <ø> (ø)
...odules/core/02-client/migrations/v7/solomachine.go 18.30% <0.00%> (ø)
modules/core/02-client/types/proposal.go 87.01% <0.00%> (ø)
modules/core/03-connection/types/codec.go 100.00% <ø> (ø)
modules/core/03-connection/types/connection.go 76.81% <0.00%> (ø)
modules/core/23-commitment/types/merkle.go 68.04% <0.00%> (ø)
modules/core/24-host/parse.go 51.47% <30.00%> (-2.63%) ⬇️
...dules/light-clients/06-solomachine/client_state.go 88.28% <33.33%> (ø)
... and 37 more

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK pending change from GetPacketSender -> GetSender

modules/core/exported/packet.go Show resolved Hide resolved
modules/core/exported/packet.go Outdated Show resolved Hide resolved
modules/core/exported/packet.go Outdated Show resolved Hide resolved
Comment on lines 73 to 76
// NOTES:
// - The sender address is set at the source chain and not validated by
// a signature check in IBC.
// - sourcePortID is not used in this implementation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// NOTES:
// - The sender address is set at the source chain and not validated by
// a signature check in IBC.
// - sourcePortID is not used in this implementation.
// NOTE:
// - The sender address is set by the packet sender and may not have been validated a signature check if the packet sender isn't the transfer module.
// - The sender address must only be used by modules on the sending chain.
// - sourcePortID is not used in this implementation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits:

Is it necessary to say if the packet sender isn't the transfer module. Because in pfm, the packet sender is still technically the transfer module. Pfm just submits a MsgTransfer on behalf of a user I believe.

Should we use should instead of must in The sender address must only be used by modules on the sending chain.

For now, I'll paste your suggestion.

Copy link
Contributor

@colin-axner colin-axner Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good questions, what if we rather state:

  • The sender address is the sender embedded in the packet data. The sender authentication is handled by the module which requested the packet to be sent.

and for

Should we use should instead of must in The sender address must only be used by modules on the sending chain.

I'm not sure what the language semantics dictate here, but I'd like to communicate that it is fully unsafe to use the packet sender on the destination chain without additional logic, whichever you think conveys that

modules/apps/27-interchain-accounts/types/packet_test.go Outdated Show resolved Hide resolved
modules/apps/27-interchain-accounts/types/packet.go Outdated Show resolved Hide resolved
Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, replied to your comment, happy for my suggestions to be readjusted as your see fit

@srdtrk srdtrk merged commit ec68438 into main Aug 1, 2023
53 checks passed
@srdtrk srdtrk deleted the serdar/optional-packetdata branch August 1, 2023 16:49
mergify bot pushed a commit that referenced this pull request Aug 1, 2023
* refactor(core/exported): moved packet interfaces to packet.go

* feat(core/exported): created PacketData interface

* feat(transfer): implemented PacketData for transfer

* feat(ica): implemented PacketData

* docs(transfer.adr8): updated godocs of GetPacketSender

* style(adr8): renamed parameter srcPortID -> sourcePortID

* docs(core.adr8): updated godocs for PacketData interface

* docs(core.adr8): improved godocs for PacketData interface

* docs(core.adr8): updated godocs

* docs(transfer.adr8): updated godocs

* style(ica_test): removed unneeded comment

* docs(ica.adr8): updated godocs

* style(ica): fixed revive linter complaint

* docs(transfer.adr8): updated GetPacketSender's godocs

* style(transfer, ica): ran golangci-lin

(cherry picked from commit ec68438)

# Conflicts:
#	modules/apps/27-interchain-accounts/types/packet.go
#	modules/apps/27-interchain-accounts/types/packet_test.go
#	modules/apps/transfer/types/packet.go
#	modules/apps/transfer/types/packet_test.go
#	modules/core/exported/packet.go
srdtrk added a commit that referenced this pull request Aug 4, 2023
…ort #4200) (#4219)

* feat(core, apps): 'PacketData' interface added and implemented (#4200)

* refactor(core/exported): moved packet interfaces to packet.go

* feat(core/exported): created PacketData interface

* feat(transfer): implemented PacketData for transfer

* feat(ica): implemented PacketData

* docs(transfer.adr8): updated godocs of GetPacketSender

* style(adr8): renamed parameter srcPortID -> sourcePortID

* docs(core.adr8): updated godocs for PacketData interface

* docs(core.adr8): improved godocs for PacketData interface

* docs(core.adr8): updated godocs

* docs(transfer.adr8): updated godocs

* style(ica_test): removed unneeded comment

* docs(ica.adr8): updated godocs

* style(ica): fixed revive linter complaint

* docs(transfer.adr8): updated GetPacketSender's godocs

* style(transfer, ica): ran golangci-lin

(cherry picked from commit ec68438)

# Conflicts:
#	modules/apps/27-interchain-accounts/types/packet.go
#	modules/apps/27-interchain-accounts/types/packet_test.go
#	modules/apps/transfer/types/packet.go
#	modules/apps/transfer/types/packet_test.go
#	modules/core/exported/packet.go

* fix: fixed backporting conflicts

* fix: used TrimPrefix because CutPrefix was added in go1.20

* style(ica_test): typo fixed

---------

Co-authored-by: srdtrk <59252793+srdtrk@users.noreply.github.com>
Co-authored-by: srdtrk <srdtrk@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants