-
Notifications
You must be signed in to change notification settings - Fork 0
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
Rate limiter #94
base: main
Are you sure you want to change the base?
Rate limiter #94
Conversation
janekolszak
commented
Jan 2, 2024
- Limiter: Generated module implementation
- Limiter: Fix linter errors
- Limiter: Pass limiter's keeper to sequencer's keeper
- Limiter: Simple cache implementation, no synchronization yet
- Limiter: Non-blocking cache implementation
- Limiter: Add controller to LimiterKeeper
- Limiter: Replace map with non-blocking cache
- Limiter: Increment counter when processing L2 interactions
- Limiter: Increment counter when processing L1 interactions
- Limiter: Check limiter's counters before accepting L2 data item
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
// "github.com/cosmos/cosmos-sdk/client/flags" |
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.
remove commented imports
) | ||
|
||
const ( | ||
// flagPacketTimeoutTimestamp = "packet-timeout-timestamp" |
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.
to remove?
|
||
// x/limiter module sentinel errors | ||
var ( | ||
// ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") |
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.
to remove
// Rate limiting | ||
if !h.ownerWhitelist.Contains(msg.DataItem.Owner.Base64()) && | ||
h.limiterKeeper.GetCount(sequencer.LIMITER_CONTRACT_ID, []byte(contractId)) > sequencer.LIMITER_CONTRACT_ID_MAX_REQUESTS { | ||
TooManyRequestsError(w, err, "parse contract id error") |
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.
change error description
@@ -22,6 +22,11 @@ func BadRequestError(w http.ResponseWriter, err error, errorType string) { | |||
ErrorWithStatus(w, err.Error(), errorType, http.StatusBadRequest) | |||
} | |||
|
|||
// Writes a bad request error in the form of JSON to the HTTP response |
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.
update comment