Skip to content

Commit 90d60a7

Browse files
committed
add failing test
1 parent 3067075 commit 90d60a7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/store/test/StoreCore.t.sol

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,23 @@ contract StoreCoreTest is Test, StoreMock {
10351035
uint40(data.thirdDataForUpdate.length),
10361036
data.thirdDataForUpdate
10371037
);
1038+
1039+
// startByteIndex + deleteCount must not overflow
1040+
vm.expectRevert(
1041+
abi.encodeWithSelector(
1042+
IStoreErrors.Store_IndexOutOfBounds.selector,
1043+
data.newThirdDataBytes.length - 8,
1044+
data.newThirdDataBytes.length
1045+
)
1046+
);
1047+
this.spliceDynamicData(
1048+
data.tableId,
1049+
data.keyTuple,
1050+
1,
1051+
uint40(data.newThirdDataBytes.length), // set start to end of the field
1052+
uint40(8), // delete 8 bytes (after the start index, so after the size of the field)
1053+
abi.encodePacked(uint64(1)) // append 8 bytes
1054+
);
10381055
}
10391056

10401057
function testAccessEmptyData() public {

0 commit comments

Comments
 (0)