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: ibc validation logic #318

Merged
merged 5 commits into from
Nov 15, 2023
Merged

feat: ibc validation logic #318

merged 5 commits into from
Nov 15, 2023

Conversation

adamewozniak
Copy link
Member

@adamewozniak adamewozniak commented Nov 14, 2023

Description

This adds IBC validation logic to the IBC Transfer function. The flow now is:

  • GMP makes an IBC transfer request, which is then decoded and RelayPrice is called
  • RelayPrice builds a new NewMsgTransfer, which has the MsgRelayPrice object in the memo field
  • IBCKeeper.Transfer tries to see if there is a MsgRelayPrice in the memo field, and sends it to GmpKeeper.BuildGmpRequest
  • BuildGmpRequest queries the oracle for asset prices & median data, and sends it back to IBCKeeper.Transfer
  • IBCKeeper.Transfer sends it -> IBCKeeper.Transfer.transfer

The reason for this is we need to restrict someone from doing a normal IBC transfer to the GMP address with incorrect oracle data.

closes: #312

This also:

  • Fixes the CLI command (e.g. ojod tx gmp relay Ethereum 0x000 0x000 QUJDRA== QUJDRA== 100 ATOM 1uojo --from alice --yes
  • Fixes the cross-reference between app.TransferKeeper and app.GmpKeeper (both of them are now pointers to one another)
  • Fixes the ibc transfer module & ibc module. Previously they were not running initGenesis because we were not using the AppModule object properly. The only ugly thing about this is we have to instantiate an instance of the ibc transfer keeper within the app.TransferKeeper object (app.TransferKeeper.Keeper)
  • Adds a basic integration test for RelayPrice to make sure it doesn't panic

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • added appropriate labels to the PR
  • targeted the correct branch
  • provided a link to the relevant issue or specification
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@codecov-commenter
Copy link

codecov-commenter commented Nov 14, 2023

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (326eee2) 15.44% compared to head (a6ed79c) 15.82%.

Files Patch % Lines
x/gmp/keeper/keeper.go 76.66% 6 Missing and 1 partial ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #318      +/-   ##
==========================================
+ Coverage   15.44%   15.82%   +0.38%     
==========================================
  Files          78       78              
  Lines       18942    18961      +19     
==========================================
+ Hits         2925     3000      +75     
+ Misses      15868    15806      -62     
- Partials      149      155       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adamewozniak adamewozniak marked this pull request as ready for review November 15, 2023 17:42
@adamewozniak adamewozniak requested a review from a team as a code owner November 15, 2023 17:42
@adamewozniak adamewozniak merged commit dba3a2c into main Nov 15, 2023
@adamewozniak adamewozniak deleted the woz/ibc-valdiation-logic branch November 15, 2023 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GMP: IBC Validation logic
3 participants