-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(eth): apply limit in EthGetBlockReceiptsLimited #12883
base: master
Are you sure you want to change the base?
fix(eth): apply limit in EthGetBlockReceiptsLimited #12883
Conversation
PR title now matches the required format.
OK, that was a bit excessive from the PR title GH-actions workflow, I'll investigate how to make it less spammy and improve its behavior. |
@ameeetgaikwad : I don't know the codebase to be able to speak to the feasibility, but did you look at adding a unit test? |
@ameeetgaikwad check out the lint error from CI, your editor should be able to pick this one up too if you have it configured correctly. Line 272 in b1376cf
This is the error we're kind of aiming to replicate, but it's a slightly different since we're not doing this directly in the gateway. Also, let's use the epoch (
|
Regarding testing, you should be able to piggy-back an existing itest to run this. Try this: diff --git a/itests/fevm_test.go b/itests/fevm_test.go
index 7bbab0c64..babae9eb4 100644
--- a/itests/fevm_test.go
+++ b/itests/fevm_test.go
@@ -1185,6 +1185,17 @@ func TestEthGetBlockReceipts(t *testing.T) {
gethBlockReceipts, err := client.EthGetBlockReceipts(ctx, req)
require.NoError(t, err)
require.Len(t, gethBlockReceipts, 3)
+
+ t.Run("EthGetBlockReceiptsLimited", func(t *testing.T) {
+ // just to be sure we're far enough in the chain for the limit to work
+ client.WaitTillChain(ctx, kit.HeightAtLeast(10))
+ // request epoch 2
+ bn := ethtypes.EthUint64(5)
+ // limit to 5 epochs lookback
+ blockReceipts, err := client.EthGetBlockReceiptsLimited(ctx, ethtypes.EthBlockNumberOrHash{BlockNumber: &bn}, 5)
+ require.ErrorContains(t, err, "older than the allowed")
+ require.Nil(t, blockReceipts, "should not return any receipts")
+ })
}
func deployContractWithEth(ctx context.Context, t *testing.T, client *kit.TestFullNode, ethAddr ethtypes.EthAddress, Then you can run it with |
yes i tried adding tests for |
ok ser! will look into this |
PR title now matches the required format.
Related Issues
#12838
Proposed Changes
Additional Info
Checklist
Before you mark the PR ready for review, please make sure that: