Fix Checkpoints fuzz overflow (#4184)

Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
Ernesto García
2023-04-25 17:57:16 +02:00
committed by GitHub
parent 1a079d258b
commit 8f14d52b73
2 changed files with 29 additions and 19 deletions

View File

@ -86,10 +86,12 @@ function testPush(
if (keys.length > 0) {
${opts.keyTypeName} lastKey = keys[keys.length - 1];
pastKey = _bound${capitalize(opts.keyTypeName)}(pastKey, 0, lastKey - 1);
vm.expectRevert();
this.push(pastKey, values[keys.length % values.length]);
if (lastKey > 0) {
pastKey = _bound${capitalize(opts.keyTypeName)}(pastKey, 0, lastKey - 1);
vm.expectRevert();
this.push(pastKey, values[keys.length % values.length]);
}
}
}
@ -173,11 +175,13 @@ function testPush(
// Can't push any key in the past
if (keys.length > 0) {
${opts.keyTypeName} lastKey = keys[keys.length - 1];
pastKey = _bound${capitalize(opts.keyTypeName)}(pastKey, 0, lastKey - 1);
vm.roll(pastKey);
vm.expectRevert();
this.push(values[keys.length % values.length]);
if (lastKey > 0) {
pastKey = _bound${capitalize(opts.keyTypeName)}(pastKey, 0, lastKey - 1);
vm.roll(pastKey);
vm.expectRevert();
this.push(values[keys.length % values.length]);
}
}
}