Skip to content

Commit 8b9b329

Browse files
committed
test(logic): add test for max variables
1 parent 3291dfa commit 8b9b329

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

x/logic/keeper/grpc_query_ask_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func TestGRPCAsk(t *testing.T) {
4040
maxSize int
4141
predicateBlacklist []string
4242
maxGas uint64
43+
maxVariables uint64
4344
predicateCosts map[string]uint64
4445
expectedAnswer *types.Answer
4546
expectedError string
@@ -153,6 +154,11 @@ func TestGRPCAsk(t *testing.T) {
153154
},
154155
expectedError: "out of gas: logic <block_height/1> (11167/3000): limit exceeded",
155156
},
157+
{
158+
query: "length(List, 100000).",
159+
maxVariables: 1000,
160+
expectedError: "maximum number of variables reached: limit exceeded",
161+
},
156162
{
157163
program: "father(bob, 'élodie').",
158164
query: "father(bob, X).",
@@ -351,6 +357,8 @@ foo(a4).
351357
params := types.DefaultParams()
352358
params.Limits.MaxResultCount = &maxResultCount
353359
params.Limits.MaxSize = &maxSize
360+
maxVariables := sdkmath.NewUint(tc.maxVariables)
361+
params.Limits.MaxVariables = &maxVariables
354362
if tc.predicateBlacklist != nil {
355363
params.Interpreter.PredicatesFilter.Blacklist = tc.predicateBlacklist
356364
}

0 commit comments

Comments
 (0)