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(crosschain): add rate limiter flags singleton state variable #2046

Merged
merged 10 commits into from
Apr 18, 2024

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Apr 18, 2024

Description

This self contained object will contains all information for rate limiting

  • Add message UpdateRateLimiterFlags
  • Add query
  • Add variable to genesis
message RateLimiterFlags {
  bool enabled = 1;

  // window in blocks
  int64 window = 2;

  // rate in azeta per block
  string rate = 3 [
    (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint",
    (gogoproto.nullable) = false
  ];

  // conversion in azeta per token
  repeated Conversion conversions = 4 [(gogoproto.nullable) = false];
}

message Conversion {
  string zrc20 = 1;
  string rate = 2 [
    (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
    (gogoproto.nullable) = false
  ];
}

Closes: #2041

Copy link

!!!WARNING!!!
nosec detected in the following files: x/crosschain/types/keys.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Apr 18, 2024
Copy link

codecov bot commented Apr 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.25%. Comparing base (583bfaf) to head (ac8590d).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2046      +/-   ##
===========================================
+ Coverage    71.11%   71.25%   +0.14%     
===========================================
  Files          245      250       +5     
  Lines        13643    13712      +69     
===========================================
+ Hits          9702     9771      +69     
  Misses        3495     3495              
  Partials       446      446              
Files Coverage Δ
x/crosschain/genesis.go 100.00% <100.00%> (ø)
...crosschain/keeper/grpc_query_rate_limiter_flags.go 100.00% <100.00%> (ø)
...ain/keeper/msg_server_update_rate_limiter_flags.go 100.00% <100.00%> (ø)
x/crosschain/keeper/rate_limiter_flags.go 100.00% <100.00%> (ø)
x/crosschain/types/genesis.go 77.41% <100.00%> (ø)
...sschain/types/message_update_rate_limiter_flags.go 100.00% <100.00%> (ø)
x/crosschain/types/rate_limiter_flags.go 100.00% <100.00%> (ø)

Copy link
Contributor

@skosito skosito left a comment

Choose a reason for hiding this comment

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

lgtm, only minor comments

@lumtis lumtis merged commit e0ea646 into develop Apr 18, 2024
21 checks passed
@lumtis lumtis deleted the feat/rate-limiter-flags branch April 18, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Outbound rate limit: add rate limit flags to state and corresponding update message
3 participants