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

Rate limiter #94

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Rate limiter #94

wants to merge 14 commits into from

Conversation

janekolszak
Copy link
Contributor

  • 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"
Copy link
Contributor

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"
Copy link
Contributor

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")
Copy link
Contributor

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")
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

update comment

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.

2 participants