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 transfer quota #1568

Merged
merged 84 commits into from
Jan 30, 2023
Merged

feat!: ibc transfer quota #1568

merged 84 commits into from
Jan 30, 2023

Conversation

gsk967
Copy link
Collaborator

@gsk967 gsk967 commented Nov 10, 2022

Description

closes: #


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 (see PR Targeting)
  • 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)

1. add cli queries for rate_limits and params
2. add updateProposal for rate_limits and ibcPause status
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

let's try to convert x/ibctransfer into a true sdk module. Hence I propose the following structure (which also is inline with the most recent recommendations):

x/ibctransfer
- "root" ->
  - generated types and codec will go here
  - ibc_module.go -> ibc module can go there, eg `IBCModule`
- /module -> cosmos-sdk module
- /quota -> keeper for ibc limits and IBC middleware implementation  (this doesn't implement anything related to gRPC service)
- /service -> sdk module keeper (it should import and encapsulate /quota) implementing gRPC service
- /client etc... - standard

- /ics20  -- move the existing ibctransfer/keeper package here

app/app.go Outdated Show resolved Hide resolved
proto/umee/ibc_rate_limit/v1beta1/genesis.proto Outdated Show resolved Hide resolved
x/ibc-rate-limit/abci.go Fixed Show fixed Hide fixed
x/ibc-rate-limit/abci.go Fixed Show fixed Hide fixed
x/ibc-rate-limit/abci.go Fixed Show fixed Hide fixed
x/ibc-rate-limit/abci.go Fixed Show fixed Hide fixed
x/ibc-rate-limit/abci.go Fixed Show fixed Hide fixed
x/ibc-rate-limit/abci.go Fixed Show fixed Hide fixed
x/ibc-rate-limit/abci.go Fixed Show fixed Hide fixed
x/ibc-rate-limit/abci.go Fixed Show fixed Hide fixed
x/ibc-rate-limit/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/abci.go Fixed Show fixed Hide fixed
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

Let's keep generated types directly in x/ibctransfer and the SDK module code in x/ibctransfer/module as in the authz module.

x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
@codecov-commenter
Copy link

codecov-commenter commented Nov 16, 2022

Codecov Report

Merging #1568 (87d72ae) into main (9af22b8) will decrease coverage by 1.71%.
The diff coverage is 8.93%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1568      +/-   ##
==========================================
- Coverage   57.50%   55.80%   -1.71%     
==========================================
  Files          77       83       +6     
  Lines        8034     8322     +288     
==========================================
+ Hits         4620     4644      +24     
- Misses       3063     3327     +264     
  Partials      351      351              
Impacted Files Coverage Δ
x/uibc/genesis.go 0.00% <0.00%> (ø)
x/uibc/ics20/keeper/keeper.go 0.00% <0.00%> (ø)
x/uibc/keys.go 0.00% <0.00%> (ø)
x/uibc/msg.go 0.00% <0.00%> (ø)
x/uibc/query.pb.gw.go 0.00% <0.00%> (ø)
x/uibc/params.go 41.46% <41.46%> (ø)
x/uibc/codec.go 46.66% <46.66%> (ø)
x/leverage/keeper/keeper.go 69.27% <100.00%> (ø)

x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
x/ibctransfer/module/abci.go Fixed Show fixed Hide fixed
@gsk967 gsk967 requested a review from robert-zaremba January 23, 2023 14:43
@gsk967 gsk967 changed the title feat!: rate limits for ibc transfer feat!: ibc transfer quota Jan 23, 2023
x/uibc/errors.go Outdated Show resolved Hide resolved
x/uibc/errors.go Outdated Show resolved Hide resolved
x/uibc/module/abci.go Show resolved Hide resolved
x/uibc/msg.go Outdated Show resolved Hide resolved
x/uibc/msg.go Outdated Show resolved Hide resolved
x/uibc/msg.go Outdated Show resolved Hide resolved
x/uibc/msg.go Outdated Show resolved Hide resolved
x/uibc/quota/ibc_module.go Show resolved Hide resolved
// reset quotas
if quotaExpires == nil || quotaExpires.Before(ctx.BlockTime()) {
if err := keeper.ResetQuota(ctx); err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt

// BeginBlock implements BeginBlock for the x/uibc module.
func BeginBlock(ctx sdk.Context, keeper keeper.Keeper) {
quotaExpires, err := keeper.GetExpire(ctx)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func BeginBlock(ctx sdk.Context, keeper keeper.Keeper) {
quotaExpires, err := keeper.GetExpire(ctx)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
}

// reset quotas
if quotaExpires == nil || quotaExpires.Before(ctx.BlockTime()) {

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
}

// reset quotas
if quotaExpires == nil || quotaExpires.Before(ctx.BlockTime()) {

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt

// reset quotas
if quotaExpires == nil || quotaExpires.Before(ctx.BlockTime()) {
if err := keeper.ResetQuota(ctx); err != nil {

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
x/uibc/errors.go Outdated Show resolved Hide resolved
x/uibc/msg.go Outdated Show resolved Hide resolved
x/uibc/params.go Outdated Show resolved Hide resolved
x/uibc/quota/ibc_module.go Show resolved Hide resolved
x/uibc/quota/ibc_module.go Show resolved Hide resolved
x/uibc/quota/keeper/keeper.go Outdated Show resolved Hide resolved
x/uibc/quota/keeper/keeper.go Outdated Show resolved Hide resolved
x/uibc/quota/keeper/quota.go Outdated Show resolved Hide resolved
x/uibc/quota/keeper/quota.go Outdated Show resolved Hide resolved
x/uibc/quota/keeper/quota.go Outdated Show resolved Hide resolved
Copy link
Member

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

pre-approving.

x/uibc/quota/keeper/quota.go Outdated Show resolved Hide resolved
x/uibc/quota/keeper/quota.go Outdated Show resolved Hide resolved
x/uibc/quota/keeper/quota.go Outdated Show resolved Hide resolved
@robert-zaremba robert-zaremba merged commit 5d1a0a3 into main Jan 30, 2023
@robert-zaremba robert-zaremba deleted the sai/ibc-rate-limit branch January 30, 2023 17:14
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