From 018b7662d525ee11d00dda01945e9f73ffe1ccdb Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Fri, 15 Mar 2024 12:22:25 +1100 Subject: [PATCH] fix(events,gateway): check that filter.FromHeight isn't too far back for gateway calls --- gateway/proxy_fil.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gateway/proxy_fil.go b/gateway/proxy_fil.go index e7ad3bdb4..b3480752b 100644 --- a/gateway/proxy_fil.go +++ b/gateway/proxy_fil.go @@ -441,6 +441,11 @@ func (gw *Node) GetActorEvents(ctx context.Context, filter *types.ActorEventFilt if err := gw.limit(ctx, stateRateLimitTokens); err != nil { return nil, err } + if filter != nil && filter.FromHeight != nil { + if err := gw.checkTipSetHeight(ctx, *filter.FromHeight, types.EmptyTSK); err != nil { + return nil, err + } + } return gw.target.GetActorEvents(ctx, filter) } @@ -448,6 +453,11 @@ func (gw *Node) SubscribeActorEvents(ctx context.Context, filter *types.ActorEve if err := gw.limit(ctx, stateRateLimitTokens); err != nil { return nil, err } + if filter != nil && filter.FromHeight != nil { + if err := gw.checkTipSetHeight(ctx, *filter.FromHeight, types.EmptyTSK); err != nil { + return nil, err + } + } return gw.target.SubscribeActorEvents(ctx, filter) }