Skip to content

Commit 853033c

Browse files
committed
rpc: update new supply commit calls to use the global universe server rate limiter
This ensures that these queries are also rate limited, as they'll be exposed to the outside world depending on config setting.
1 parent 592dea0 commit 853033c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

rpcserver.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4223,6 +4223,12 @@ func (r *rpcServer) FetchSupplyCommit(ctx context.Context,
42234223
req *unirpc.FetchSupplyCommitRequest) (
42244224
*unirpc.FetchSupplyCommitResponse, error) {
42254225

4226+
// Check the rate limiter to see if we need to wait at all. If not then
4227+
// this'll be a noop.
4228+
if err := r.proofQueryRateLimiter.Wait(ctx); err != nil {
4229+
return nil, err
4230+
}
4231+
42264232
groupPubKey, err := unmarshalGroupKey(
42274233
req.GetGroupKeyBytes(), req.GetGroupKeyStr(),
42284234
)
@@ -4794,6 +4800,12 @@ func (r *rpcServer) InsertSupplyCommit(ctx context.Context,
47944800
req *unirpc.InsertSupplyCommitRequest) (
47954801
*unirpc.InsertSupplyCommitResponse, error) {
47964802

4803+
// Check the rate limiter to see if we need to wait at all. If not then
4804+
// this'll be a noop.
4805+
if err := r.proofQueryRateLimiter.Wait(ctx); err != nil {
4806+
return nil, err
4807+
}
4808+
47974809
groupPubKey, err := unmarshalGroupKey(
47984810
req.GetGroupKeyBytes(), req.GetGroupKeyStr(),
47994811
)

0 commit comments

Comments
 (0)