diff --git a/packages/store/gas-report.json b/packages/store/gas-report.json index de59342b6d..3cb96c0ad8 100644 --- a/packages/store/gas-report.json +++ b/packages/store/gas-report.json @@ -15,19 +15,19 @@ "file": "test/Bytes.t.sol", "test": "testSetBytes1", "name": "set bytes1 in bytes32", - "gasUsed": 1 + "gasUsed": 16 }, { "file": "test/Bytes.t.sol", "test": "testSetBytes2", "name": "set bytes2 in bytes32", - "gasUsed": 1 + "gasUsed": 16 }, { "file": "test/Bytes.t.sol", "test": "testSetBytes4", "name": "set bytes4 in bytes32", - "gasUsed": 1 + "gasUsed": 16 }, { "file": "test/Bytes.t.sol", @@ -207,13 +207,13 @@ "file": "test/Slice.t.sol", "test": "testFromBytes", "name": "get Slice length", - "gasUsed": 1 + "gasUsed": 10 }, { "file": "test/Slice.t.sol", "test": "testFromBytes", "name": "get Slice pointer", - "gasUsed": 27 + "gasUsed": 33 }, { "file": "test/Slice.t.sol", diff --git a/packages/store/test/Bytes.t.sol b/packages/store/test/Bytes.t.sol index c89fb3e12d..8ae2e11693 100644 --- a/packages/store/test/Bytes.t.sol +++ b/packages/store/test/Bytes.t.sol @@ -92,9 +92,10 @@ contract BytesTest is Test, GasReporter { bytes32 input = bytes32(0); startGasReport("set bytes1 in bytes32"); - Bytes.setBytes1(input, 8, 0xff); + bytes32 output = Bytes.setBytes1(input, 8, 0xff); endGasReport(); + assertEq(output, hex"0000000000000000ff"); assertEq(Bytes.setBytes1(input, 0, 0x01), bytes32(bytes1(0x01))); assertEq(Bytes.setBytes1(input, 31, 0x01), bytes32(uint256(0x01))); } @@ -103,9 +104,10 @@ contract BytesTest is Test, GasReporter { bytes32 input = bytes32(0); startGasReport("set bytes2 in bytes32"); - Bytes.setBytes2(input, 8, 0xffff); + bytes32 output = Bytes.setBytes2(input, 8, 0xffff); endGasReport(); + assertEq(output, hex"0000000000000000ffff"); assertEq(Bytes.setBytes2(input, 0, 0xffff), bytes32(bytes2(0xffff))); assertEq(Bytes.setBytes2(input, 30, 0xffff), bytes32(uint256(0xffff))); } @@ -114,9 +116,10 @@ contract BytesTest is Test, GasReporter { bytes32 input = bytes32(0); startGasReport("set bytes4 in bytes32"); - Bytes.setBytes4(input, 8, 0xffffffff); + bytes32 output = Bytes.setBytes4(input, 8, 0xffffffff); endGasReport(); + assertEq(output, hex"0000000000000000ffffffff"); assertEq(Bytes.setBytes4(input, 0, 0xffffffff), bytes32(bytes4(0xffffffff))); assertEq(Bytes.setBytes4(input, 30, 0xffffffff), bytes32(uint256(0xffff))); assertEq(Bytes.setBytes4(input, 28, 0xffffffff), bytes32(uint256(0xffffffff))); diff --git a/packages/store/test/Slice.t.sol b/packages/store/test/Slice.t.sol index 02856114f5..c49a3b97b6 100644 --- a/packages/store/test/Slice.t.sol +++ b/packages/store/test/Slice.t.sol @@ -15,15 +15,15 @@ contract SliceTest is Test, GasReporter { endGasReport(); startGasReport("get Slice length"); - slice.length(); + uint256 length = slice.length(); endGasReport(); startGasReport("get Slice pointer"); - slice.pointer(); + uint256 pointer = slice.pointer(); endGasReport(); - assertEq(slice.length(), 8); - assertEq(slice.pointer(), Memory.dataPointer(data)); + assertEq(length, 8); + assertEq(pointer, Memory.dataPointer(data)); assertEq(slice.toBytes(), data); } diff --git a/packages/store/ts/codegen/ephemeral.ts b/packages/store/ts/codegen/ephemeral.ts index c9a5b72eff..6b339c2f5d 100644 --- a/packages/store/ts/codegen/ephemeral.ts +++ b/packages/store/ts/codegen/ephemeral.ts @@ -35,12 +35,12 @@ export function renderEphemeralMethods(options: RenderTableOptions) { _typedKeyArgs, `${structName} memory _table`, ])}) internal { - emitEphemeral(${renderArguments([ - _untypedStore, - _tableId, - _keyArgs, - renderArguments(options.fields.map(({ name }) => `_table.${name}`)), - ])}); + emitEphemeral(${renderArguments([ + _untypedStore, + _tableId, + _keyArgs, + renderArguments(options.fields.map(({ name }) => `_table.${name}`)), + ])}); } ` );