From cea754dde0d8abf7392e93faa319b260956ae92b Mon Sep 17 00:00:00 2001 From: alvarius Date: Sat, 23 Sep 2023 22:52:55 +0100 Subject: [PATCH] feat(store,world): polish store methods (#1581) --- .changeset/wicked-squids-do.md | 128 +++ docs/pages/store/spec.mdx | 2 +- .../contracts/src/codegen/tables/Multi.sol | 24 +- .../contracts/src/codegen/tables/Number.sol | 16 +- .../src/codegen/tables/NumberList.sol | 96 +- .../contracts/src/codegen/tables/Vector.sol | 24 +- .../src/systems/NumberListSystem.sol | 2 +- e2e/packages/contracts/worlds.json | 2 +- .../sync-test/data/setContractData.ts | 1 - .../src/codegen/tables/CounterTable.sol | 16 +- .../src/codegen/tables/Inventory.sol | 16 +- .../src/codegen/tables/MessageTable.sol | 8 +- packages/block-logs-stream/README.md | 2 +- .../src/codegen/tables/Dynamics1.sol | 287 ++---- .../src/codegen/tables/Dynamics2.sol | 150 ++- .../contracts/src/codegen/tables/Offchain.sol | 14 +- .../src/codegen/tables/Singleton.sol | 152 ++- .../contracts/src/codegen/tables/Statics.sol | 48 +- packages/cli/contracts/test/Tablegen.t.sol | 2 + .../src/codegen/render-solidity/common.ts | 5 +- packages/dev-tools/src/events/LogsTable.tsx | 2 +- .../src/postgres/postgresStorage.test.ts | 8 +- .../src/postgres/postgresStorage.ts | 4 +- packages/store-sync/src/recs/recsStorage.ts | 4 +- .../src/sqlite/sqliteStorage.test.ts | 8 +- .../store-sync/src/sqlite/sqliteStorage.ts | 4 +- packages/store/gas-report.json | 208 ++-- packages/store/src/IStore.sol | 92 +- packages/store/src/IStoreErrors.sol | 4 +- packages/store/src/IStoreHook.sol | 2 - packages/store/src/Storage.sol | 12 + packages/store/src/StoreCore.sol | 351 +++---- packages/store/src/StoreHook.sol | 4 +- packages/store/src/StoreRead.sol | 38 +- packages/store/src/StoreSwitch.sol | 139 ++- .../store/src/codegen/tables/Callbacks.sol | 110 +- packages/store/src/codegen/tables/Hooks.sol | 110 +- .../store/src/codegen/tables/KeyEncoding.sol | 16 +- packages/store/src/codegen/tables/Mixed.sol | 116 +-- .../store/src/codegen/tables/ResourceIds.sol | 16 +- .../store/src/codegen/tables/StoreHooks.sol | 110 +- packages/store/src/codegen/tables/Tables.sol | 122 +-- packages/store/src/codegen/tables/Vector2.sol | 24 +- packages/store/test/EchoSubscriber.sol | 6 +- packages/store/test/MirrorSubscriber.sol | 20 +- packages/store/test/Mixed.t.sol | 71 +- packages/store/test/RevertSubscriber.sol | 4 +- packages/store/test/StoreCore.t.sol | 176 ++-- packages/store/test/StoreCoreDynamic.t.sol | 41 +- packages/store/test/StoreCoreGas.t.sol | 70 +- packages/store/test/StoreMock.sol | 63 +- packages/store/ts/codegen/field.ts | 79 +- packages/store/ts/codegen/record.ts | 83 +- packages/store/ts/storeEvents.ts | 2 +- packages/world/gas-report.json | 118 +-- packages/world/src/World.sol | 85 +- .../src/modules/core/tables/Balances.sol | 16 +- .../modules/core/tables/FunctionSelectors.sol | 20 +- .../core/tables/FunctionSignatures.sol | 8 +- .../src/modules/core/tables/SystemHooks.sol | 110 +- .../modules/core/tables/SystemRegistry.sol | 16 +- .../world/src/modules/core/tables/Systems.sol | 20 +- .../modules/keysintable/KeysInTableHook.sol | 1 - .../keysintable/tables/KeysInTable.sol | 277 ++--- .../keysintable/tables/UsedKeysIndex.sol | 20 +- .../keyswithvalue/KeysWithValueHook.sol | 2 - .../keyswithvalue/tables/KeysWithValue.sol | 110 +- .../tables/CallboundDelegations.sol | 16 +- .../tables/TimeboundDelegations.sol | 16 +- .../uniqueentity/tables/UniqueEntity.sol | 16 +- packages/world/src/tables/Delegations.sol | 16 +- .../world/src/tables/InstalledModules.sol | 16 +- packages/world/src/tables/NamespaceOwner.sol | 16 +- packages/world/src/tables/ResourceAccess.sol | 16 +- packages/world/test/KeysInTableModule.t.sol | 134 +-- packages/world/test/KeysWithValueModule.t.sol | 56 +- packages/world/test/World.t.sol | 98 +- packages/world/test/WorldDynamicUpdate.t.sol | 42 +- packages/world/test/query.t.sol | 112 +- packages/world/test/tables/AddressArray.sol | 110 +- packages/world/test/tables/Bool.sol | 16 +- packages/world/test/tables/TwoFields.sol | 24 +- .../contracts/src/codegen/tables/Counter.sol | 16 +- .../contracts/src/codegen/tables/Counter.sol | 16 +- .../contracts/src/codegen/tables/Position.sol | 30 +- .../contracts/src/codegen/tables/Counter.sol | 16 +- test-data/world-logs.json | 970 ++++++++++++------ 87 files changed, 2965 insertions(+), 2704 deletions(-) create mode 100644 .changeset/wicked-squids-do.md diff --git a/.changeset/wicked-squids-do.md b/.changeset/wicked-squids-do.md new file mode 100644 index 0000000000..039fb58cb8 --- /dev/null +++ b/.changeset/wicked-squids-do.md @@ -0,0 +1,128 @@ +--- +"@latticexyz/block-logs-stream": patch +"@latticexyz/cli": patch +"@latticexyz/common": minor +"@latticexyz/dev-tools": patch +"@latticexyz/store-sync": patch +"@latticexyz/store": major +"@latticexyz/world": major +"create-mud": patch +--- + +- The external `setRecord` and `deleteRecord` methods of `IStore` no longer accept a `FieldLayout` as input, but load it from storage instead. + This is to prevent invalid `FieldLayout` values being passed, which could cause the onchain state to diverge from the indexer state. + However, the internal `StoreCore` library still exposes a `setRecord` and `deleteRecord` method that allows a `FieldLayout` to be passed. + This is because `StoreCore` can only be used internally, so the `FieldLayout` value can be trusted and we can save the gas for accessing storage. + + ```diff + interface IStore { + function setRecord( + ResourceId tableId, + bytes32[] calldata keyTuple, + bytes calldata staticData, + PackedCounter encodedLengths, + bytes calldata dynamicData, + - FieldLayout fieldLayout + ) external; + + function deleteRecord( + ResourceId tableId, + bytes32[] memory keyTuple, + - FieldLayout fieldLayout + ) external; + } + ``` + +- The `spliceStaticData` method and `Store_SpliceStaticData` event of `IStore` and `StoreCore` no longer include `deleteCount` in their signature. + This is because when splicing static data, the data after `start` is always overwritten with `data` instead of being shifted, so `deleteCount` is always the length of the data to be written. + + ```diff + + event Store_SpliceStaticData( + ResourceId indexed tableId, + bytes32[] keyTuple, + uint48 start, + - uint40 deleteCount, + bytes data + ); + + interface IStore { + function spliceStaticData( + ResourceId tableId, + bytes32[] calldata keyTuple, + uint48 start, + - uint40 deleteCount, + bytes calldata data + ) external; + } + ``` + +- The `updateInField` method has been removed from `IStore`, as it's almost identical to the more general `spliceDynamicData`. + If you're manually calling `updateInField`, here is how to upgrade to `spliceDynamicData`: + + ```diff + - store.updateInField(tableId, keyTuple, fieldIndex, startByteIndex, dataToSet, fieldLayout); + + uint8 dynamicFieldIndex = fieldIndex - fieldLayout.numStaticFields(); + + store.spliceDynamicData(tableId, keyTuple, dynamicFieldIndex, uint40(startByteIndex), uint40(dataToSet.length), dataToSet); + ``` + +- All other methods that are only valid for dynamic fields (`pushToField`, `popFromField`, `getFieldSlice`) + have been renamed to make this more explicit (`pushToDynamicField`, `popFromDynamicField`, `getDynamicFieldSlice`). + + Their `fieldIndex` parameter has been replaced by a `dynamicFieldIndex` parameter, which is the index relative to the first dynamic field (i.e. `dynamicFieldIndex` = `fieldIndex` - `numStaticFields`). + The `FieldLayout` parameter has been removed, as it was only used to calculate the `dynamicFieldIndex` in the method. + + ```diff + interface IStore { + - function pushToField( + + function pushToDynamicField( + ResourceId tableId, + bytes32[] calldata keyTuple, + - uint8 fieldIndex, + + uint8 dynamicFieldIndex, + bytes calldata dataToPush, + - FieldLayout fieldLayout + ) external; + + - function popFromField( + + function popFromDynamicField( + ResourceId tableId, + bytes32[] calldata keyTuple, + - uint8 fieldIndex, + + uint8 dynamicFieldIndex, + uint256 byteLengthToPop, + - FieldLayout fieldLayout + ) external; + + - function getFieldSlice( + + function getDynamicFieldSlice( + ResourceId tableId, + bytes32[] memory keyTuple, + - uint8 fieldIndex, + + uint8 dynamicFieldIndex, + - FieldLayout fieldLayout, + uint256 start, + uint256 end + ) external view returns (bytes memory data); + } + ``` + +- `IStore` has a new `getDynamicFieldLength` length method, which returns the byte length of the given dynamic field and doesn't require the `FieldLayout`. + + ```diff + IStore { + + function getDynamicFieldLength( + + ResourceId tableId, + + bytes32[] memory keyTuple, + + uint8 dynamicFieldIndex + + ) external view returns (uint256); + } + + ``` + +- `IStore` now has additional overloads for `getRecord`, `getField`, `getFieldLength` and `setField` that don't require a `FieldLength` to be passed, but instead load it from storage. + +- `IStore` now exposes `setStaticField` and `setDynamicField` to save gas by avoiding the dynamic inference of whether the field is static or dynamic. + +- The `getDynamicFieldSlice` method no longer accepts reading outside the bounds of the dynamic field. + This is to avoid returning invalid data, as the data of a dynamic field is not deleted when the record is deleted, but only its length is set to zero. diff --git a/docs/pages/store/spec.mdx b/docs/pages/store/spec.mdx index 6c05722c38..e1b9123b8b 100644 --- a/docs/pages/store/spec.mdx +++ b/docs/pages/store/spec.mdx @@ -8,7 +8,7 @@ When a record or a single field is edited, or when a record is deleted, Store em ```solidity event Store_SetRecord(bytes32 indexed tableId, bytes32[] keyTuple, bytes staticData, bytes32 encodedLengths, bytes dynamicData), -event Store_SpliceStaticData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, uint40 deleteCount, bytes data), +event Store_SpliceStaticData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, bytes data), event Store_SpliceDynamicData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, uint40 deleteCount, bytes data, bytes32 encodedLengths), event Store_DeleteRecord(bytes32 indexed tableId, bytes32[] keyTuple), ``` diff --git a/e2e/packages/contracts/src/codegen/tables/Multi.sol b/e2e/packages/contracts/src/codegen/tables/Multi.sol index bc2f7c4e6e..d05ca9deea 100644 --- a/e2e/packages/contracts/src/codegen/tables/Multi.sol +++ b/e2e/packages/contracts/src/codegen/tables/Multi.sol @@ -135,7 +135,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((num)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((num)), _fieldLayout); } /** Set num */ @@ -146,7 +146,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((num)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((num)), _fieldLayout); } /** Set num (using the specified store) */ @@ -157,7 +157,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((num)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((num)), _fieldLayout); } /** Get value */ @@ -204,7 +204,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((value)), _fieldLayout); } /** Set value */ @@ -215,7 +215,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ @@ -226,7 +226,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((value)), _fieldLayout); } /** Get the full data */ @@ -290,7 +290,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -322,7 +322,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -338,7 +338,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -370,7 +370,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -403,7 +403,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -425,7 +425,7 @@ library Multi { _keyTuple[2] = bytes32(uint256(c)); _keyTuple[3] = bytes32(uint256(int256(d))); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/e2e/packages/contracts/src/codegen/tables/Number.sol b/e2e/packages/contracts/src/codegen/tables/Number.sol index 339abd0feb..7b59e9b2b0 100644 --- a/e2e/packages/contracts/src/codegen/tables/Number.sol +++ b/e2e/packages/contracts/src/codegen/tables/Number.sol @@ -137,7 +137,7 @@ library Number { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ @@ -145,7 +145,7 @@ library Number { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ @@ -153,7 +153,7 @@ library Number { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ @@ -161,7 +161,7 @@ library Number { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ @@ -169,7 +169,7 @@ library Number { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ @@ -177,7 +177,7 @@ library Number { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Delete all data for given keys */ @@ -185,7 +185,7 @@ library Number { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -201,7 +201,7 @@ library Number { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/e2e/packages/contracts/src/codegen/tables/NumberList.sol b/e2e/packages/contracts/src/codegen/tables/NumberList.sol index abfad96a35..7f70d3db64 100644 --- a/e2e/packages/contracts/src/codegen/tables/NumberList.sol +++ b/e2e/packages/contracts/src/codegen/tables/NumberList.sol @@ -128,49 +128,49 @@ library NumberList { function setValue(uint32[] memory value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ function _setValue(uint32[] memory value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ function setValue(IStore _store, uint32[] memory value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ function set(uint32[] memory value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ function _set(uint32[] memory value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ function set(IStore _store, uint32[] memory value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Get the length of value */ function lengthValue() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -180,7 +180,7 @@ library NumberList { function _lengthValue() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -190,7 +190,7 @@ library NumberList { function lengthValue(IStore _store) internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -200,7 +200,7 @@ library NumberList { function length() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -210,7 +210,7 @@ library NumberList { function _length() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -220,7 +220,7 @@ library NumberList { function length(IStore _store) internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -234,14 +234,7 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 4, - (_index + 1) * 4 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -254,7 +247,7 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -267,7 +260,7 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -280,14 +273,7 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 4, - (_index + 1) * 4 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -300,7 +286,7 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -313,7 +299,7 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -322,84 +308,84 @@ library NumberList { function pushValue(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ function _pushValue(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ function pushValue(IStore _store, uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ function push(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ function _push(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ function push(IStore _store, uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from value */ function popValue() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 4, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** Pop an element from value */ function _popValue() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.popFromField(_tableId, _keyTuple, 0, 4, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** Pop an element from value (using the specified store) */ function popValue(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.popFromField(_tableId, _keyTuple, 0, 4, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** Pop an element from value */ function pop() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 4, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** Pop an element from value */ function _pop() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.popFromField(_tableId, _keyTuple, 0, 4, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** Pop an element from value (using the specified store) */ function pop(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.popFromField(_tableId, _keyTuple, 0, 4, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** @@ -410,7 +396,8 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -422,7 +409,8 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -434,7 +422,8 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -446,7 +435,8 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -458,7 +448,8 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -470,7 +461,8 @@ library NumberList { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -478,7 +470,7 @@ library NumberList { function deleteRecord() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -492,7 +484,7 @@ library NumberList { function deleteRecord(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/e2e/packages/contracts/src/codegen/tables/Vector.sol b/e2e/packages/contracts/src/codegen/tables/Vector.sol index 30513851e3..7726df751c 100644 --- a/e2e/packages/contracts/src/codegen/tables/Vector.sol +++ b/e2e/packages/contracts/src/codegen/tables/Vector.sol @@ -117,7 +117,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); } /** Set x */ @@ -125,7 +125,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); } /** Set x (using the specified store) */ @@ -133,7 +133,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); } /** Get y */ @@ -168,7 +168,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); } /** Set y */ @@ -176,7 +176,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); } /** Set y (using the specified store) */ @@ -184,7 +184,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); } /** Get the full data */ @@ -236,7 +236,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -262,7 +262,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -275,7 +275,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -301,7 +301,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -331,7 +331,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -347,7 +347,7 @@ library Vector { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(key)); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/e2e/packages/contracts/src/systems/NumberListSystem.sol b/e2e/packages/contracts/src/systems/NumberListSystem.sol index 9309cf5a0e..0433e1efc5 100644 --- a/e2e/packages/contracts/src/systems/NumberListSystem.sol +++ b/e2e/packages/contracts/src/systems/NumberListSystem.sol @@ -22,7 +22,7 @@ contract NumberListSystem is System { } bytes32[] memory emptyKey; - StoreSwitch.pushToField(NumberListTableId, emptyKey, 0, EncodeArray.encode(list), NumberList.getFieldLayout()); + StoreSwitch.pushToDynamicField(NumberListTableId, emptyKey, 0, EncodeArray.encode(list)); } function pop() public { diff --git a/e2e/packages/contracts/worlds.json b/e2e/packages/contracts/worlds.json index e00b04bb2d..17fe3e5e71 100644 --- a/e2e/packages/contracts/worlds.json +++ b/e2e/packages/contracts/worlds.json @@ -1,5 +1,5 @@ { "31337": { - "address": "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584" + "address": "0x0355B7B8cb128fA5692729Ab3AAa199C1753f726" } } \ No newline at end of file diff --git a/e2e/packages/sync-test/data/setContractData.ts b/e2e/packages/sync-test/data/setContractData.ts index be886c0d07..3b8ebc80f4 100644 --- a/e2e/packages/sync-test/data/setContractData.ts +++ b/e2e/packages/sync-test/data/setContractData.ts @@ -19,7 +19,6 @@ export async function setContractData(page: Page, data: Data) { record.staticData, record.encodedLengths, record.dynamicData, - record.fieldLayout, ]); // Wait for transactions to be confirmed diff --git a/examples/minimal/packages/contracts/src/codegen/tables/CounterTable.sol b/examples/minimal/packages/contracts/src/codegen/tables/CounterTable.sol index 9aa6a37376..d7d9be524e 100644 --- a/examples/minimal/packages/contracts/src/codegen/tables/CounterTable.sol +++ b/examples/minimal/packages/contracts/src/codegen/tables/CounterTable.sol @@ -128,49 +128,49 @@ library CounterTable { function setValue(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _setValue(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function setValue(IStore _store, uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function set(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _set(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function set(IStore _store, uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Delete all data for given keys */ function deleteRecord() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -184,7 +184,7 @@ library CounterTable { function deleteRecord(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/examples/minimal/packages/contracts/src/codegen/tables/Inventory.sol b/examples/minimal/packages/contracts/src/codegen/tables/Inventory.sol index 49f685a0b1..f4ffed0d8c 100644 --- a/examples/minimal/packages/contracts/src/codegen/tables/Inventory.sol +++ b/examples/minimal/packages/contracts/src/codegen/tables/Inventory.sol @@ -160,7 +160,7 @@ library Inventory { _keyTuple[1] = bytes32(uint256(item)); _keyTuple[2] = bytes32(uint256(itemVariant)); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); } /** Set amount */ @@ -170,7 +170,7 @@ library Inventory { _keyTuple[1] = bytes32(uint256(item)); _keyTuple[2] = bytes32(uint256(itemVariant)); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); } /** Set amount (using the specified store) */ @@ -180,7 +180,7 @@ library Inventory { _keyTuple[1] = bytes32(uint256(item)); _keyTuple[2] = bytes32(uint256(itemVariant)); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); } /** Set amount */ @@ -190,7 +190,7 @@ library Inventory { _keyTuple[1] = bytes32(uint256(item)); _keyTuple[2] = bytes32(uint256(itemVariant)); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); } /** Set amount */ @@ -200,7 +200,7 @@ library Inventory { _keyTuple[1] = bytes32(uint256(item)); _keyTuple[2] = bytes32(uint256(itemVariant)); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); } /** Set amount (using the specified store) */ @@ -210,7 +210,7 @@ library Inventory { _keyTuple[1] = bytes32(uint256(item)); _keyTuple[2] = bytes32(uint256(itemVariant)); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((amount)), _fieldLayout); } /** Delete all data for given keys */ @@ -220,7 +220,7 @@ library Inventory { _keyTuple[1] = bytes32(uint256(item)); _keyTuple[2] = bytes32(uint256(itemVariant)); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -240,7 +240,7 @@ library Inventory { _keyTuple[1] = bytes32(uint256(item)); _keyTuple[2] = bytes32(uint256(itemVariant)); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/examples/minimal/packages/contracts/src/codegen/tables/MessageTable.sol b/examples/minimal/packages/contracts/src/codegen/tables/MessageTable.sol index ae3ce987db..db4763267d 100644 --- a/examples/minimal/packages/contracts/src/codegen/tables/MessageTable.sol +++ b/examples/minimal/packages/contracts/src/codegen/tables/MessageTable.sol @@ -84,7 +84,7 @@ library MessageTable { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -106,7 +106,7 @@ library MessageTable { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -141,7 +141,7 @@ library MessageTable { function deleteRecord() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -155,7 +155,7 @@ library MessageTable { function deleteRecord(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/block-logs-stream/README.md b/packages/block-logs-stream/README.md index 97a77e5a99..f56e552c13 100644 --- a/packages/block-logs-stream/README.md +++ b/packages/block-logs-stream/README.md @@ -27,7 +27,7 @@ latestBlockNumber$ address, events: parseAbi([ "event Store_SetRecord(bytes32 indexed tableId, bytes32[] keyTuple, bytes staticData, bytes32 encodedLengths, bytes dynamicData)", - "event Store_SpliceStaticData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, uint40 deleteCount, bytes data)", + "event Store_SpliceStaticData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, bytes data)", "event Store_SpliceDynamicData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, uint40 deleteCount, bytes data, bytes32 encodedLengths)", "event Store_DeleteRecord(bytes32 indexed tableId, bytes32[] keyTuple)", ]), diff --git a/packages/cli/contracts/src/codegen/tables/Dynamics1.sol b/packages/cli/contracts/src/codegen/tables/Dynamics1.sol index d71529b3dc..4957973342 100644 --- a/packages/cli/contracts/src/codegen/tables/Dynamics1.sol +++ b/packages/cli/contracts/src/codegen/tables/Dynamics1.sol @@ -126,13 +126,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField( - _tableId, - _keyTuple, - 0, - EncodeArray.encode(fromStaticArray_bytes32_1(staticB32)), - _fieldLayout - ); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode(fromStaticArray_bytes32_1(staticB32))); } /** Set staticB32 */ @@ -140,7 +134,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode(fromStaticArray_bytes32_1(staticB32)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode(fromStaticArray_bytes32_1(staticB32))); } /** Set staticB32 (using the specified store) */ @@ -148,7 +142,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode(fromStaticArray_bytes32_1(staticB32)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode(fromStaticArray_bytes32_1(staticB32))); } /** Get the length of staticB32 */ @@ -156,7 +150,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -167,7 +161,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -178,7 +172,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -193,14 +187,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -214,14 +201,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -235,7 +215,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 32, (_index + 1) * 32); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -245,7 +225,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to staticB32 */ @@ -253,7 +233,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to staticB32 (using the specified store) */ @@ -261,7 +241,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from staticB32 */ @@ -269,7 +249,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** Pop an element from staticB32 */ @@ -277,7 +257,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** Pop an element from staticB32 (using the specified store) */ @@ -285,7 +265,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** @@ -297,7 +277,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -310,7 +291,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -323,7 +305,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -359,7 +342,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_int32_2(staticI32)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_int32_2(staticI32))); } /** Set staticI32 */ @@ -367,7 +350,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_int32_2(staticI32)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_int32_2(staticI32))); } /** Set staticI32 (using the specified store) */ @@ -375,7 +358,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_int32_2(staticI32)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_int32_2(staticI32))); } /** Get the length of staticI32 */ @@ -383,7 +366,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 4; } @@ -394,7 +377,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 4; } @@ -405,7 +388,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 4; } @@ -420,14 +403,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 1, - _fieldLayout, - _index * 4, - (_index + 1) * 4 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 4, (_index + 1) * 4); return (int32(uint32(bytes4(_blob)))); } } @@ -441,7 +417,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 1, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 4, (_index + 1) * 4); return (int32(uint32(bytes4(_blob)))); } } @@ -455,7 +431,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 1, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 4, (_index + 1) * 4); return (int32(uint32(bytes4(_blob)))); } } @@ -465,7 +441,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 1, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); } /** Push an element to staticI32 */ @@ -473,7 +449,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 1, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); } /** Push an element to staticI32 (using the specified store) */ @@ -481,7 +457,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 1, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); } /** Pop an element from staticI32 */ @@ -489,7 +465,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 1, 4, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 1, 4); } /** Pop an element from staticI32 */ @@ -497,7 +473,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 1, 4, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, 4); } /** Pop an element from staticI32 (using the specified store) */ @@ -505,7 +481,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 1, 4, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 1, 4); } /** @@ -517,7 +493,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 1, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -530,7 +507,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 1, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -543,7 +521,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 1, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -579,13 +558,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField( - _tableId, - _keyTuple, - 2, - EncodeArray.encode(fromStaticArray_uint128_3(staticU128)), - _fieldLayout - ); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint128_3(staticU128))); } /** Set staticU128 */ @@ -593,7 +566,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint128_3(staticU128)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint128_3(staticU128))); } /** Set staticU128 (using the specified store) */ @@ -601,7 +574,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint128_3(staticU128)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint128_3(staticU128))); } /** Get the length of staticU128 */ @@ -609,7 +582,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 16; } @@ -620,7 +593,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 16; } @@ -631,7 +604,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 16; } @@ -646,14 +619,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 2, - _fieldLayout, - _index * 16, - (_index + 1) * 16 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 16, (_index + 1) * 16); return (uint128(bytes16(_blob))); } } @@ -667,14 +633,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 2, - _fieldLayout, - _index * 16, - (_index + 1) * 16 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 16, (_index + 1) * 16); return (uint128(bytes16(_blob))); } } @@ -688,7 +647,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 2, _fieldLayout, _index * 16, (_index + 1) * 16); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 16, (_index + 1) * 16); return (uint128(bytes16(_blob))); } } @@ -698,7 +657,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element))); } /** Push an element to staticU128 */ @@ -706,7 +665,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element))); } /** Push an element to staticU128 (using the specified store) */ @@ -714,7 +673,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element))); } /** Pop an element from staticU128 */ @@ -722,7 +681,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 2, 16, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 2, 16); } /** Pop an element from staticU128 */ @@ -730,7 +689,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 2, 16, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 2, 16); } /** Pop an element from staticU128 (using the specified store) */ @@ -738,7 +697,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 2, 16, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 2, 16); } /** @@ -750,7 +709,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 2, _index * 16, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 16), uint40(_encoded.length), _encoded); } } @@ -763,7 +723,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 2, _index * 16, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 16), uint40(_encoded.length), _encoded); } } @@ -776,7 +737,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 2, _index * 16, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 16), uint40(_encoded.length), _encoded); } } @@ -812,13 +774,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField( - _tableId, - _keyTuple, - 3, - EncodeArray.encode(fromStaticArray_address_4(staticAddrs)), - _fieldLayout - ); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode(fromStaticArray_address_4(staticAddrs))); } /** Set staticAddrs */ @@ -826,13 +782,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField( - _tableId, - _keyTuple, - 3, - EncodeArray.encode(fromStaticArray_address_4(staticAddrs)), - _fieldLayout - ); + StoreCore.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode(fromStaticArray_address_4(staticAddrs))); } /** Set staticAddrs (using the specified store) */ @@ -840,7 +790,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 3, EncodeArray.encode(fromStaticArray_address_4(staticAddrs)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode(fromStaticArray_address_4(staticAddrs))); } /** Get the length of staticAddrs */ @@ -848,7 +798,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 3); unchecked { return _byteLength / 20; } @@ -859,7 +809,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 3); unchecked { return _byteLength / 20; } @@ -870,7 +820,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 3); unchecked { return _byteLength / 20; } @@ -885,14 +835,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 3, - _fieldLayout, - _index * 20, - (_index + 1) * 20 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 3, _index * 20, (_index + 1) * 20); return (address(bytes20(_blob))); } } @@ -906,14 +849,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 3, - _fieldLayout, - _index * 20, - (_index + 1) * 20 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 3, _index * 20, (_index + 1) * 20); return (address(bytes20(_blob))); } } @@ -927,7 +863,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 3, _fieldLayout, _index * 20, (_index + 1) * 20); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 3, _index * 20, (_index + 1) * 20); return (address(bytes20(_blob))); } } @@ -937,7 +873,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 3, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element))); } /** Push an element to staticAddrs */ @@ -945,7 +881,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 3, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element))); } /** Push an element to staticAddrs (using the specified store) */ @@ -953,7 +889,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 3, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element))); } /** Pop an element from staticAddrs */ @@ -961,7 +897,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 3, 20, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 3, 20); } /** Pop an element from staticAddrs */ @@ -969,7 +905,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 3, 20, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 3, 20); } /** Pop an element from staticAddrs (using the specified store) */ @@ -977,7 +913,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 3, 20, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 3, 20); } /** @@ -989,7 +925,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 3, _index * 20, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 3, uint40(_index * 20), uint40(_encoded.length), _encoded); } } @@ -1002,7 +939,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 3, _index * 20, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 3, uint40(_index * 20), uint40(_encoded.length), _encoded); } } @@ -1015,7 +953,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 3, _index * 20, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 3, uint40(_index * 20), uint40(_encoded.length), _encoded); } } @@ -1051,7 +990,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 4, EncodeArray.encode(fromStaticArray_bool_5(staticBools)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode(fromStaticArray_bool_5(staticBools))); } /** Set staticBools */ @@ -1059,7 +998,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 4, EncodeArray.encode(fromStaticArray_bool_5(staticBools)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode(fromStaticArray_bool_5(staticBools))); } /** Set staticBools (using the specified store) */ @@ -1067,7 +1006,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 4, EncodeArray.encode(fromStaticArray_bool_5(staticBools)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode(fromStaticArray_bool_5(staticBools))); } /** Get the length of staticBools */ @@ -1075,7 +1014,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 4, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 4); unchecked { return _byteLength / 1; } @@ -1086,7 +1025,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 4, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 4); unchecked { return _byteLength / 1; } @@ -1097,7 +1036,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 4, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 4); unchecked { return _byteLength / 1; } @@ -1112,14 +1051,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 4, - _fieldLayout, - _index * 1, - (_index + 1) * 1 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 4, _index * 1, (_index + 1) * 1); return (_toBool(uint8(bytes1(_blob)))); } } @@ -1133,7 +1065,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 4, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 4, _index * 1, (_index + 1) * 1); return (_toBool(uint8(bytes1(_blob)))); } } @@ -1147,7 +1079,7 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 4, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 4, _index * 1, (_index + 1) * 1); return (_toBool(uint8(bytes1(_blob)))); } } @@ -1157,7 +1089,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 4, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element))); } /** Push an element to staticBools */ @@ -1165,7 +1097,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 4, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element))); } /** Push an element to staticBools (using the specified store) */ @@ -1173,7 +1105,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 4, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element))); } /** Pop an element from staticBools */ @@ -1181,7 +1113,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 4, 1, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 4, 1); } /** Pop an element from staticBools */ @@ -1189,7 +1121,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 4, 1, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 4, 1); } /** Pop an element from staticBools (using the specified store) */ @@ -1197,7 +1129,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 4, 1, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 4, 1); } /** @@ -1209,7 +1141,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 4, _index * 1, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 4, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -1222,7 +1155,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 4, _index * 1, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 4, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -1235,7 +1169,8 @@ library Dynamics1 { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 4, _index * 1, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 4, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -1294,7 +1229,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -1333,7 +1268,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -1357,7 +1292,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -1405,7 +1340,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -1478,7 +1413,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -1494,7 +1429,7 @@ library Dynamics1 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/cli/contracts/src/codegen/tables/Dynamics2.sol b/packages/cli/contracts/src/codegen/tables/Dynamics2.sol index 8347277c43..06603f02f2 100644 --- a/packages/cli/contracts/src/codegen/tables/Dynamics2.sol +++ b/packages/cli/contracts/src/codegen/tables/Dynamics2.sol @@ -120,7 +120,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((u64)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((u64))); } /** Set u64 */ @@ -128,7 +128,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((u64)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((u64))); } /** Set u64 (using the specified store) */ @@ -136,7 +136,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((u64)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((u64))); } /** Get the length of u64 */ @@ -144,7 +144,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 8; } @@ -155,7 +155,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 8; } @@ -166,7 +166,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 8; } @@ -181,14 +181,7 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 8, - (_index + 1) * 8 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 8, (_index + 1) * 8); return (uint64(bytes8(_blob))); } } @@ -202,7 +195,7 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 8, (_index + 1) * 8); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 8, (_index + 1) * 8); return (uint64(bytes8(_blob))); } } @@ -216,7 +209,7 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 8, (_index + 1) * 8); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 8, (_index + 1) * 8); return (uint64(bytes8(_blob))); } } @@ -226,7 +219,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to u64 */ @@ -234,7 +227,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to u64 (using the specified store) */ @@ -242,7 +235,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from u64 */ @@ -250,7 +243,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 8, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 8); } /** Pop an element from u64 */ @@ -258,7 +251,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 8, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 8); } /** Pop an element from u64 (using the specified store) */ @@ -266,7 +259,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 8, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 8); } /** @@ -278,7 +271,8 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 8, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 8), uint40(_encoded.length), _encoded); } } @@ -291,7 +285,8 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 8, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 8), uint40(_encoded.length), _encoded); } } @@ -304,7 +299,8 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 8, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 8), uint40(_encoded.length), _encoded); } } @@ -340,7 +336,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 1, bytes((str)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 1, bytes((str))); } /** Set str */ @@ -348,7 +344,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 1, bytes((str)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 1, bytes((str))); } /** Set str (using the specified store) */ @@ -356,7 +352,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 1, bytes((str)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 1, bytes((str))); } /** Get the length of str */ @@ -364,7 +360,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 1; } @@ -375,7 +371,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 1; } @@ -386,7 +382,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 1; } @@ -401,14 +397,7 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 1, - _fieldLayout, - _index * 1, - (_index + 1) * 1 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 1, (_index + 1) * 1); return (string(_blob)); } } @@ -422,7 +411,7 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 1, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 1, (_index + 1) * 1); return (string(_blob)); } } @@ -436,7 +425,7 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 1, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 1, (_index + 1) * 1); return (string(_blob)); } } @@ -446,7 +435,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 1, bytes((_slice)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 1, bytes((_slice))); } /** Push a slice to str */ @@ -454,7 +443,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 1, bytes((_slice)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, bytes((_slice))); } /** Push a slice to str (using the specified store) */ @@ -462,7 +451,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 1, bytes((_slice)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 1, bytes((_slice))); } /** Pop a slice from str */ @@ -470,7 +459,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 1, 1, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 1, 1); } /** Pop a slice from str */ @@ -478,7 +467,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 1, 1, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, 1); } /** Pop a slice from str (using the specified store) */ @@ -486,7 +475,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 1, 1, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 1, 1); } /** @@ -498,7 +487,8 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 1, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -511,7 +501,8 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 1, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -524,7 +515,8 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 1, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + _store.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -560,7 +552,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 2, bytes((b)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 2, bytes((b))); } /** Set b */ @@ -568,7 +560,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 2, bytes((b)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 2, bytes((b))); } /** Set b (using the specified store) */ @@ -576,7 +568,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 2, bytes((b)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 2, bytes((b))); } /** Get the length of b */ @@ -584,7 +576,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 1; } @@ -595,7 +587,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 1; } @@ -606,7 +598,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 1; } @@ -621,14 +613,7 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 2, - _fieldLayout, - _index * 1, - (_index + 1) * 1 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 1, (_index + 1) * 1); return (bytes(_blob)); } } @@ -642,7 +627,7 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 2, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 1, (_index + 1) * 1); return (bytes(_blob)); } } @@ -656,7 +641,7 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 2, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 1, (_index + 1) * 1); return (bytes(_blob)); } } @@ -666,7 +651,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 2, bytes((_slice)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 2, bytes((_slice))); } /** Push a slice to b */ @@ -674,7 +659,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 2, bytes((_slice)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 2, bytes((_slice))); } /** Push a slice to b (using the specified store) */ @@ -682,7 +667,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 2, bytes((_slice)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 2, bytes((_slice))); } /** Pop a slice from b */ @@ -690,7 +675,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 2, 1, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 2, 1); } /** Pop a slice from b */ @@ -698,7 +683,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 2, 1, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 2, 1); } /** Pop a slice from b (using the specified store) */ @@ -706,7 +691,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 2, 1, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 2, 1); } /** @@ -718,7 +703,8 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 2, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -731,7 +717,8 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 2, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -744,7 +731,8 @@ library Dynamics2 { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 2, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + _store.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -796,7 +784,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -820,7 +808,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -832,7 +820,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -856,7 +844,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -904,7 +892,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -920,7 +908,7 @@ library Dynamics2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/cli/contracts/src/codegen/tables/Offchain.sol b/packages/cli/contracts/src/codegen/tables/Offchain.sol index 9400c79ef6..bc428c7f0c 100644 --- a/packages/cli/contracts/src/codegen/tables/Offchain.sol +++ b/packages/cli/contracts/src/codegen/tables/Offchain.sol @@ -83,7 +83,7 @@ library Offchain { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ @@ -91,7 +91,7 @@ library Offchain { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ @@ -99,7 +99,7 @@ library Offchain { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set the full data using individual values */ @@ -112,7 +112,7 @@ library Offchain { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -138,7 +138,7 @@ library Offchain { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -162,7 +162,7 @@ library Offchain { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -178,7 +178,7 @@ library Offchain { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/cli/contracts/src/codegen/tables/Singleton.sol b/packages/cli/contracts/src/codegen/tables/Singleton.sol index 1e87e6d89c..ab91f15ecc 100644 --- a/packages/cli/contracts/src/codegen/tables/Singleton.sol +++ b/packages/cli/contracts/src/codegen/tables/Singleton.sol @@ -110,21 +110,21 @@ library Singleton { function setV1(int256 v1) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); } /** Set v1 */ function _setV1(int256 v1) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); } /** Set v1 (using the specified store) */ function setV1(IStore _store, int256 v1) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); } /** Get v2 */ @@ -155,28 +155,28 @@ library Singleton { function setV2(uint32[2] memory v2) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_uint32_2(v2)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode(fromStaticArray_uint32_2(v2))); } /** Set v2 */ function _setV2(uint32[2] memory v2) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_uint32_2(v2)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode(fromStaticArray_uint32_2(v2))); } /** Set v2 (using the specified store) */ function setV2(IStore _store, uint32[2] memory v2) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_uint32_2(v2)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode(fromStaticArray_uint32_2(v2))); } /** Get the length of v2 */ function lengthV2() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -186,7 +186,7 @@ library Singleton { function _lengthV2() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -196,7 +196,7 @@ library Singleton { function lengthV2(IStore _store) internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -210,14 +210,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 1, - _fieldLayout, - _index * 4, - (_index + 1) * 4 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -230,7 +223,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 1, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -243,7 +236,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 1, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -252,42 +245,42 @@ library Singleton { function pushV2(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.pushToField(_tableId, _keyTuple, 1, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to v2 */ function _pushV2(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.pushToField(_tableId, _keyTuple, 1, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to v2 (using the specified store) */ function pushV2(IStore _store, uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.pushToField(_tableId, _keyTuple, 1, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from v2 */ function popV2() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.popFromField(_tableId, _keyTuple, 1, 4, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** Pop an element from v2 */ function _popV2() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.popFromField(_tableId, _keyTuple, 1, 4, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** Pop an element from v2 (using the specified store) */ function popV2(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.popFromField(_tableId, _keyTuple, 1, 4, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** @@ -298,7 +291,8 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 1, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -310,7 +304,8 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 1, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -322,7 +317,8 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - _store.updateInField(_tableId, _keyTuple, 1, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -354,28 +350,28 @@ library Singleton { function setV3(uint32[2] memory v3) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint32_2(v3)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_uint32_2(v3))); } /** Set v3 */ function _setV3(uint32[2] memory v3) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint32_2(v3)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_uint32_2(v3))); } /** Set v3 (using the specified store) */ function setV3(IStore _store, uint32[2] memory v3) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint32_2(v3)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode(fromStaticArray_uint32_2(v3))); } /** Get the length of v3 */ function lengthV3() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 4; } @@ -385,7 +381,7 @@ library Singleton { function _lengthV3() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 4; } @@ -395,7 +391,7 @@ library Singleton { function lengthV3(IStore _store) internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 4; } @@ -409,14 +405,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 2, - _fieldLayout, - _index * 4, - (_index + 1) * 4 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -429,7 +418,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 2, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -442,7 +431,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 2, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -451,42 +440,42 @@ library Singleton { function pushV3(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); } /** Push an element to v3 */ function _pushV3(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); } /** Push an element to v3 (using the specified store) */ function pushV3(IStore _store, uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); } /** Pop an element from v3 */ function popV3() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.popFromField(_tableId, _keyTuple, 2, 4, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 1, 4); } /** Pop an element from v3 */ function _popV3() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.popFromField(_tableId, _keyTuple, 2, 4, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, 4); } /** Pop an element from v3 (using the specified store) */ function popV3(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.popFromField(_tableId, _keyTuple, 2, 4, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 1, 4); } /** @@ -497,7 +486,8 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 2, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -509,7 +499,8 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 2, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -521,7 +512,8 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - _store.updateInField(_tableId, _keyTuple, 2, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -553,28 +545,28 @@ library Singleton { function setV4(uint32[1] memory v4) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 3, EncodeArray.encode(fromStaticArray_uint32_1(v4)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint32_1(v4))); } /** Set v4 */ function _setV4(uint32[1] memory v4) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 3, EncodeArray.encode(fromStaticArray_uint32_1(v4)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint32_1(v4))); } /** Set v4 (using the specified store) */ function setV4(IStore _store, uint32[1] memory v4) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 3, EncodeArray.encode(fromStaticArray_uint32_1(v4)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode(fromStaticArray_uint32_1(v4))); } /** Get the length of v4 */ function lengthV4() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 4; } @@ -584,7 +576,7 @@ library Singleton { function _lengthV4() internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 4; } @@ -594,7 +586,7 @@ library Singleton { function lengthV4(IStore _store) internal view returns (uint256) { bytes32[] memory _keyTuple = new bytes32[](0); - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 4; } @@ -608,14 +600,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 3, - _fieldLayout, - _index * 4, - (_index + 1) * 4 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -628,7 +613,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 3, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -641,7 +626,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 3, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -650,42 +635,42 @@ library Singleton { function pushV4(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.pushToField(_tableId, _keyTuple, 3, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element))); } /** Push an element to v4 */ function _pushV4(uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.pushToField(_tableId, _keyTuple, 3, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element))); } /** Push an element to v4 (using the specified store) */ function pushV4(IStore _store, uint32 _element) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.pushToField(_tableId, _keyTuple, 3, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element))); } /** Pop an element from v4 */ function popV4() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.popFromField(_tableId, _keyTuple, 3, 4, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 2, 4); } /** Pop an element from v4 */ function _popV4() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.popFromField(_tableId, _keyTuple, 3, 4, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 2, 4); } /** Pop an element from v4 (using the specified store) */ function popV4(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.popFromField(_tableId, _keyTuple, 3, 4, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 2, 4); } /** @@ -696,7 +681,8 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 3, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -708,7 +694,8 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 3, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -720,7 +707,8 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); unchecked { - _store.updateInField(_tableId, _keyTuple, 3, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -771,7 +759,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -795,7 +783,7 @@ library Singleton { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -852,7 +840,7 @@ library Singleton { function deleteRecord() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -866,7 +854,7 @@ library Singleton { function deleteRecord(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/cli/contracts/src/codegen/tables/Statics.sol b/packages/cli/contracts/src/codegen/tables/Statics.sol index 0c6d986b4f..2177a5282a 100644 --- a/packages/cli/contracts/src/codegen/tables/Statics.sol +++ b/packages/cli/contracts/src/codegen/tables/Statics.sol @@ -170,7 +170,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); } /** Set v1 */ @@ -183,7 +183,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); } /** Set v1 (using the specified store) */ @@ -196,7 +196,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((v1)), _fieldLayout); } /** Get v2 */ @@ -259,7 +259,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((v2)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((v2)), _fieldLayout); } /** Set v2 */ @@ -272,7 +272,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((v2)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((v2)), _fieldLayout); } /** Set v2 (using the specified store) */ @@ -285,7 +285,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((v2)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((v2)), _fieldLayout); } /** Get v3 */ @@ -348,7 +348,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setField(_tableId, _keyTuple, 2, abi.encodePacked((v3)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 2, abi.encodePacked((v3)), _fieldLayout); } /** Set v3 */ @@ -361,7 +361,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreCore.setField(_tableId, _keyTuple, 2, abi.encodePacked((v3)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 2, abi.encodePacked((v3)), _fieldLayout); } /** Set v3 (using the specified store) */ @@ -374,7 +374,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setField(_tableId, _keyTuple, 2, abi.encodePacked((v3)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 2, abi.encodePacked((v3)), _fieldLayout); } /** Get v4 */ @@ -437,7 +437,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setField(_tableId, _keyTuple, 3, abi.encodePacked((v4)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 3, abi.encodePacked((v4)), _fieldLayout); } /** Set v4 */ @@ -450,7 +450,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreCore.setField(_tableId, _keyTuple, 3, abi.encodePacked((v4)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 3, abi.encodePacked((v4)), _fieldLayout); } /** Set v4 (using the specified store) */ @@ -463,7 +463,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setField(_tableId, _keyTuple, 3, abi.encodePacked((v4)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 3, abi.encodePacked((v4)), _fieldLayout); } /** Get v5 */ @@ -526,7 +526,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setField(_tableId, _keyTuple, 4, abi.encodePacked((v5)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 4, abi.encodePacked((v5)), _fieldLayout); } /** Set v5 */ @@ -539,7 +539,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreCore.setField(_tableId, _keyTuple, 4, abi.encodePacked((v5)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 4, abi.encodePacked((v5)), _fieldLayout); } /** Set v5 (using the specified store) */ @@ -552,7 +552,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setField(_tableId, _keyTuple, 4, abi.encodePacked((v5)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 4, abi.encodePacked((v5)), _fieldLayout); } /** Get v6 */ @@ -615,7 +615,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setField(_tableId, _keyTuple, 5, abi.encodePacked(uint8(v6)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 5, abi.encodePacked(uint8(v6)), _fieldLayout); } /** Set v6 */ @@ -628,7 +628,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreCore.setField(_tableId, _keyTuple, 5, abi.encodePacked(uint8(v6)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 5, abi.encodePacked(uint8(v6)), _fieldLayout); } /** Set v6 (using the specified store) */ @@ -641,7 +641,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setField(_tableId, _keyTuple, 5, abi.encodePacked(uint8(v6)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 5, abi.encodePacked(uint8(v6)), _fieldLayout); } /** Get the full data */ @@ -748,7 +748,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -811,7 +811,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -829,7 +829,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -874,7 +874,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -919,7 +919,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -945,7 +945,7 @@ library Statics { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/cli/contracts/test/Tablegen.t.sol b/packages/cli/contracts/test/Tablegen.t.sol index 204566a7a1..1d1e611ed2 100644 --- a/packages/cli/contracts/test/Tablegen.t.sol +++ b/packages/cli/contracts/test/Tablegen.t.sol @@ -3,6 +3,7 @@ pragma solidity >=0.8.21; import "forge-std/Test.sol"; import { StoreMock } from "@latticexyz/store/test/StoreMock.sol"; +import { IStoreErrors } from "@latticexyz/store/src/IStoreErrors.sol"; import { Statics, StaticsData, Dynamics1, Dynamics1Data, Dynamics2, Dynamics2Data, Singleton, Offchain } from "../src/codegen/index.sol"; @@ -140,6 +141,7 @@ contract TablegenTest is Test, StoreMock { assertEq(abi.encode(Singleton.getV4()), abi.encode([uint32(5)])); assertEq(Singleton.lengthV4(), 1); assertEq(Singleton.getItemV4(0), 5); + vm.expectRevert(abi.encodeWithSelector(IStoreErrors.Store_IndexOutOfBounds.selector, 4, 4)); assertEq(Singleton.getItemV4(1), 0); } diff --git a/packages/common/src/codegen/render-solidity/common.ts b/packages/common/src/codegen/render-solidity/common.ts index 14e668c3d2..9ce0ec120e 100644 --- a/packages/common/src/codegen/render-solidity/common.ts +++ b/packages/common/src/codegen/render-solidity/common.ts @@ -132,12 +132,13 @@ export function renderWithStore( _store: string, _commentSuffix: string, _untypedStore: string | undefined, - _methodPrefix: string + _methodPrefix: string, + _internal?: boolean ) => string ): string { let result = ""; result += callback(undefined, "StoreSwitch", "", undefined, ""); - result += callback(undefined, "StoreCore", "", undefined, "_"); + result += callback(undefined, "StoreCore", "", undefined, "_", true); if (storeArgument) { result += "\n" + callback("IStore _store", "_store", " (using the specified store)", "_store", ""); diff --git a/packages/dev-tools/src/events/LogsTable.tsx b/packages/dev-tools/src/events/LogsTable.tsx index aee82a615a..7e38dec1c4 100644 --- a/packages/dev-tools/src/events/LogsTable.tsx +++ b/packages/dev-tools/src/events/LogsTable.tsx @@ -52,7 +52,7 @@ export function LogsTable({ logs }: Props) { }) : null} {log.eventName === "Store_SpliceStaticData" - ? JSON.stringify({ start: log.args.start, deleteCount: log.args.deleteCount, data: log.args.data }) + ? JSON.stringify({ start: log.args.start, data: log.args.data }) : null} {log.eventName === "Store_SpliceDynamicData" ? JSON.stringify({ diff --git a/packages/store-sync/src/postgres/postgresStorage.test.ts b/packages/store-sync/src/postgres/postgresStorage.test.ts index 5708b84656..f717c07ea8 100644 --- a/packages/store-sync/src/postgres/postgresStorage.test.ts +++ b/packages/store-sync/src/postgres/postgresStorage.test.ts @@ -56,7 +56,7 @@ describe("postgresStorage", async () => { { "chainId": 31337, "lastError": null, - "lastUpdatedBlockNumber": 6n, + "lastUpdatedBlockNumber": 5n, "schemaVersion": 1, }, ] @@ -74,7 +74,7 @@ describe("postgresStorage", async () => { "key": "0x5FbDB2315678afecb367f032d93F642f64180aa3::NumberList", "keySchema": {}, "lastError": null, - "lastUpdatedBlockNumber": 6n, + "lastUpdatedBlockNumber": 5n, "name": "NumberList", "namespace": "", "schemaVersion": 1, @@ -94,7 +94,7 @@ describe("postgresStorage", async () => { "key": "0x5FbDB2315678afecb367f032d93F642f64180aa3::NumberList", "keySchema": {}, "lastError": null, - "lastUpdatedBlockNumber": 6n, + "lastUpdatedBlockNumber": 5n, "name": "NumberList", "namespace": "", "schemaVersion": 1, @@ -114,7 +114,7 @@ describe("postgresStorage", async () => { "__encodedLengths": "0x0000000000000000000000000000000000000000000000000800000000000008", "__isDeleted": false, "__key": "0x", - "__lastUpdatedBlockNumber": 6n, + "__lastUpdatedBlockNumber": 5n, "__staticData": null, "value": [ 420, diff --git a/packages/store-sync/src/postgres/postgresStorage.ts b/packages/store-sync/src/postgres/postgresStorage.ts index 961c0b726a..127889a855 100644 --- a/packages/store-sync/src/postgres/postgresStorage.ts +++ b/packages/store-sync/src/postgres/postgresStorage.ts @@ -1,4 +1,4 @@ -import { Hex, PublicClient, concatHex } from "viem"; +import { Hex, PublicClient, concatHex, size } from "viem"; import { PgDatabase, QueryResultHKT } from "drizzle-orm/pg-core"; import { eq, inArray } from "drizzle-orm"; import { buildTable } from "./buildTable"; @@ -132,7 +132,7 @@ export async function postgresStorage // TODO: verify that this returns what we expect (doesn't error/undefined on no record) const previousValue = (await tx.select().from(sqlTable).where(eq(sqlTable.__key, uniqueKey)).execute())[0]; const previousStaticData = (previousValue?.__staticData as Hex) ?? "0x"; - const newStaticData = spliceHex(previousStaticData, log.args.start, log.args.deleteCount, log.args.data); + const newStaticData = spliceHex(previousStaticData, log.args.start, size(log.args.data), log.args.data); const newValue = decodeValueArgs(table.valueSchema, { staticData: newStaticData, encodedLengths: (previousValue?.__encodedLengths as Hex) ?? "0x", diff --git a/packages/store-sync/src/recs/recsStorage.ts b/packages/store-sync/src/recs/recsStorage.ts index 27f2dccd89..f4c3672d2a 100644 --- a/packages/store-sync/src/recs/recsStorage.ts +++ b/packages/store-sync/src/recs/recsStorage.ts @@ -5,7 +5,7 @@ import { defineInternalComponents } from "./defineInternalComponents"; import { getTableEntity } from "./getTableEntity"; import { hexToResourceId, spliceHex } from "@latticexyz/common"; import { decodeValueArgs } from "@latticexyz/protocol-parser"; -import { Hex } from "viem"; +import { Hex, size } from "viem"; import { isTableRegistrationLog } from "../isTableRegistrationLog"; import { logToTable } from "../logToTable"; import { hexKeyTupleToEntity } from "./hexKeyTupleToEntity"; @@ -98,7 +98,7 @@ export function recsStorage({ // TODO: add tests that this works when no record had been set before const previousValue = getComponentValue(component, entity); const previousStaticData = (previousValue?.__staticData as Hex) ?? "0x"; - const newStaticData = spliceHex(previousStaticData, log.args.start, log.args.deleteCount, log.args.data); + const newStaticData = spliceHex(previousStaticData, log.args.start, size(log.args.data), log.args.data); const newValue = decodeValueArgs(table.valueSchema, { staticData: newStaticData, encodedLengths: (previousValue?.__encodedLengths as Hex) ?? "0x", diff --git a/packages/store-sync/src/sqlite/sqliteStorage.test.ts b/packages/store-sync/src/sqlite/sqliteStorage.test.ts index 4df6c97446..06b01ce31e 100644 --- a/packages/store-sync/src/sqlite/sqliteStorage.test.ts +++ b/packages/store-sync/src/sqlite/sqliteStorage.test.ts @@ -64,7 +64,7 @@ describe("sqliteStorage", async () => { { "chainId": 31337, "lastError": null, - "lastUpdatedBlockNumber": 6n, + "lastUpdatedBlockNumber": 5n, "schemaVersion": 1, }, ] @@ -77,7 +77,7 @@ describe("sqliteStorage", async () => { "id": "0x5FbDB2315678afecb367f032d93F642f64180aa3____NumberList", "keySchema": {}, "lastError": null, - "lastUpdatedBlockNumber": 6n, + "lastUpdatedBlockNumber": 5n, "name": "NumberList", "namespace": "", "schemaVersion": 1, @@ -97,7 +97,7 @@ describe("sqliteStorage", async () => { "id": "0x5FbDB2315678afecb367f032d93F642f64180aa3____NumberList", "keySchema": {}, "lastError": null, - "lastUpdatedBlockNumber": 6n, + "lastUpdatedBlockNumber": 5n, "name": "NumberList", "namespace": "", "schemaVersion": 1, @@ -117,7 +117,7 @@ describe("sqliteStorage", async () => { "__encodedLengths": "0x0000000000000000000000000000000000000000000000000800000000000008", "__isDeleted": false, "__key": "0x", - "__lastUpdatedBlockNumber": 6n, + "__lastUpdatedBlockNumber": 5n, "__staticData": null, "value": [ 420, diff --git a/packages/store-sync/src/sqlite/sqliteStorage.ts b/packages/store-sync/src/sqlite/sqliteStorage.ts index 7d4590c9f5..c010d8c8d7 100644 --- a/packages/store-sync/src/sqlite/sqliteStorage.ts +++ b/packages/store-sync/src/sqlite/sqliteStorage.ts @@ -1,4 +1,4 @@ -import { Hex, PublicClient, concatHex, getAddress } from "viem"; +import { Hex, PublicClient, concatHex, getAddress, size } from "viem"; import { BaseSQLiteDatabase } from "drizzle-orm/sqlite-core"; import { and, eq, sql } from "drizzle-orm"; import { sqliteTableToSql } from "./sqliteTableToSql"; @@ -131,7 +131,7 @@ export async function sqliteStorage({ // TODO: verify that this returns what we expect (doesn't error/undefined on no record) const previousValue = (await tx.select().from(sqlTable).where(eq(sqlTable.__key, uniqueKey)).execute())[0]; const previousStaticData = (previousValue?.__staticData as Hex) ?? "0x"; - const newStaticData = spliceHex(previousStaticData, log.args.start, log.args.deleteCount, log.args.data); + const newStaticData = spliceHex(previousStaticData, log.args.start, size(log.args.data), log.args.data); const newValue = decodeValueArgs(table.valueSchema, { staticData: newStaticData, encodedLengths: (previousValue?.__encodedLengths as Hex) ?? "0x", diff --git a/packages/store/gas-report.json b/packages/store/gas-report.json index 808cfb2080..8d0a243835 100644 --- a/packages/store/gas-report.json +++ b/packages/store/gas-report.json @@ -351,7 +351,7 @@ "file": "test/KeyEncoding.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "register KeyEncoding table", - "gasUsed": 720205 + "gasUsed": 719171 }, { "file": "test/Mixed.t.sol", @@ -361,21 +361,51 @@ }, { "file": "test/Mixed.t.sol", - "test": "testRegisterAndGetFieldLayout", - "name": "register Mixed table", - "gasUsed": 582081 + "test": "testDeleteExternalCold", + "name": "delete record from Mixed (external, cold)", + "gasUsed": 24434 }, { "file": "test/Mixed.t.sol", - "test": "testSetAndGet", - "name": "set record in Mixed", - "gasUsed": 103978 + "test": "testDeleteInternalCold", + "name": "delete record from Mixed (internal, cold)", + "gasUsed": 19230 }, { "file": "test/Mixed.t.sol", - "test": "testSetAndGet", - "name": "get record from Mixed", - "gasUsed": 7091 + "test": "testSetGetDeleteExternal", + "name": "set record in Mixed (external, cold)", + "gasUsed": 108604 + }, + { + "file": "test/Mixed.t.sol", + "test": "testSetGetDeleteExternal", + "name": "get record from Mixed (external, warm)", + "gasUsed": 7078 + }, + { + "file": "test/Mixed.t.sol", + "test": "testSetGetDeleteExternal", + "name": "delete record from Mixed (external, warm)", + "gasUsed": 8750 + }, + { + "file": "test/Mixed.t.sol", + "test": "testSetGetDeleteInternal", + "name": "set record in Mixed (internal, cold)", + "gasUsed": 103358 + }, + { + "file": "test/Mixed.t.sol", + "test": "testSetGetDeleteInternal", + "name": "get record from Mixed (internal, warm)", + "gasUsed": 6764 + }, + { + "file": "test/Mixed.t.sol", + "test": "testSetGetDeleteInternal", + "name": "delete record from Mixed (internal, warm)", + "gasUsed": 7543 }, { "file": "test/PackedCounter.t.sol", @@ -571,75 +601,75 @@ }, { "file": "test/StoreCoreDynamic.t.sol", - "test": "testGetFieldSlice", + "test": "testGetDynamicFieldSlice", "name": "get field slice (cold, 1 slot)", - "gasUsed": 8311 + "gasUsed": 10240 }, { "file": "test/StoreCoreDynamic.t.sol", - "test": "testGetFieldSlice", + "test": "testGetDynamicFieldSlice", "name": "get field slice (warm, 1 slot)", - "gasUsed": 2383 + "gasUsed": 2308 }, { "file": "test/StoreCoreDynamic.t.sol", - "test": "testGetFieldSlice", + "test": "testGetDynamicFieldSlice", "name": "get field slice (semi-cold, 1 slot)", - "gasUsed": 4386 + "gasUsed": 4313 }, { "file": "test/StoreCoreDynamic.t.sol", - "test": "testGetFieldSlice", + "test": "testGetDynamicFieldSlice", "name": "get field slice (warm, 2 slots)", - "gasUsed": 4608 + "gasUsed": 4539 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testGetSecondFieldLength", "name": "get field length (cold, 1 slot)", - "gasUsed": 7754 + "gasUsed": 7795 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testGetSecondFieldLength", "name": "get field length (warm, 1 slot)", - "gasUsed": 1749 + "gasUsed": 1790 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testGetThirdFieldLength", "name": "get field length (warm due to , 2 slots)", - "gasUsed": 7753 + "gasUsed": 7794 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testGetThirdFieldLength", "name": "get field length (warm, 2 slots)", - "gasUsed": 1749 + "gasUsed": 1790 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testPopFromSecondField", "name": "pop from field (cold, 1 slot, 1 uint32 item)", - "gasUsed": 19479 + "gasUsed": 18728 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testPopFromSecondField", "name": "pop from field (warm, 1 slot, 1 uint32 item)", - "gasUsed": 13487 + "gasUsed": 12736 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testPopFromThirdField", "name": "pop from field (cold, 2 slots, 10 uint32 items)", - "gasUsed": 17247 + "gasUsed": 16496 }, { "file": "test/StoreCoreDynamic.t.sol", "test": "testPopFromThirdField", "name": "pop from field (warm, 2 slots, 10 uint32 items)", - "gasUsed": 13255 + "gasUsed": 12504 }, { "file": "test/StoreCoreGas.t.sol", @@ -657,25 +687,31 @@ "file": "test/StoreCoreGas.t.sol", "test": "testAccessEmptyData", "name": "access dynamic field of non-existing record", - "gasUsed": 2059 + "gasUsed": 2063 }, { "file": "test/StoreCoreGas.t.sol", "test": "testAccessEmptyData", "name": "access length of dynamic field of non-existing record", - "gasUsed": 1118 + "gasUsed": 1159 }, { "file": "test/StoreCoreGas.t.sol", - "test": "testAccessEmptyData", - "name": "access slice of dynamic field of non-existing record", - "gasUsed": 1517 + "test": "testDeleteData", + "name": "delete record (complex data, 3 slots)", + "gasUsed": 8077 }, { "file": "test/StoreCoreGas.t.sol", - "test": "testDeleteData", - "name": "delete record (complex data, 3 slots)", - "gasUsed": 6778 + "test": "testGetStaticDataLocation", + "name": "get static data location (single key)", + "gasUsed": 217 + }, + { + "file": "test/StoreCoreGas.t.sol", + "test": "testGetStaticDataLocation", + "name": "get static data location (single key tuple)", + "gasUsed": 387 }, { "file": "test/StoreCoreGas.t.sol", @@ -693,73 +729,73 @@ "file": "test/StoreCoreGas.t.sol", "test": "testHooks", "name": "register subscriber", - "gasUsed": 58781 + "gasUsed": 58019 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooks", "name": "set record on table with subscriber", - "gasUsed": 71248 + "gasUsed": 72428 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooks", "name": "set static field on table with subscriber", - "gasUsed": 20732 + "gasUsed": 19915 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooks", "name": "delete record on table with subscriber", - "gasUsed": 16870 + "gasUsed": 18741 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooksDynamicData", "name": "register subscriber", - "gasUsed": 58781 + "gasUsed": 58019 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooksDynamicData", "name": "set (dynamic) record on table with subscriber", - "gasUsed": 164402 + "gasUsed": 165583 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooksDynamicData", "name": "set (dynamic) field on table with subscriber", - "gasUsed": 24526 + "gasUsed": 24599 }, { "file": "test/StoreCoreGas.t.sol", "test": "testHooksDynamicData", "name": "delete (dynamic) record on table with subscriber", - "gasUsed": 17855 + "gasUsed": 20407 }, { "file": "test/StoreCoreGas.t.sol", - "test": "testPushToField", + "test": "testPushToDynamicField", "name": "push to field (1 slot, 1 uint32 item)", - "gasUsed": 10275 + "gasUsed": 9524 }, { "file": "test/StoreCoreGas.t.sol", - "test": "testPushToField", + "test": "testPushToDynamicField", "name": "push to field (2 slots, 10 uint32 items)", - "gasUsed": 32945 + "gasUsed": 32194 }, { "file": "test/StoreCoreGas.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "StoreCore: register table", - "gasUsed": 642079 + "gasUsed": 641053 }, { "file": "test/StoreCoreGas.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "StoreCore: get field layout (warm)", - "gasUsed": 1287 + "gasUsed": 922 }, { "file": "test/StoreCoreGas.t.sol", @@ -777,13 +813,13 @@ "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetDynamicData", "name": "set complex record with dynamic data (4 slots)", - "gasUsed": 101934 + "gasUsed": 102589 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetDynamicData", "name": "get complex record with dynamic data (4 slots)", - "gasUsed": 4243 + "gasUsed": 4244 }, { "file": "test/StoreCoreGas.t.sol", @@ -819,7 +855,7 @@ "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "set static field (1 slot)", - "gasUsed": 31607 + "gasUsed": 31286 }, { "file": "test/StoreCoreGas.t.sol", @@ -831,7 +867,7 @@ "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "set static field (overlap 2 slot)", - "gasUsed": 30260 + "gasUsed": 29939 }, { "file": "test/StoreCoreGas.t.sol", @@ -843,67 +879,67 @@ "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "set dynamic field (1 slot, first dynamic field)", - "gasUsed": 53974 + "gasUsed": 54010 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "get dynamic field (1 slot, first dynamic field)", - "gasUsed": 2226 + "gasUsed": 2230 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "set dynamic field (1 slot, second dynamic field)", - "gasUsed": 32197 + "gasUsed": 32233 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetField", "name": "get dynamic field (1 slot, second dynamic field)", - "gasUsed": 2229 + "gasUsed": 2233 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetStaticData", "name": "set static record (1 slot)", - "gasUsed": 32179 + "gasUsed": 32833 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetStaticData", "name": "get static record (1 slot)", - "gasUsed": 1554 + "gasUsed": 1555 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetStaticDataSpanningWords", "name": "set static record (2 slots)", - "gasUsed": 54684 + "gasUsed": 55337 }, { "file": "test/StoreCoreGas.t.sol", "test": "testSetAndGetStaticDataSpanningWords", "name": "get static record (2 slots)", - "gasUsed": 1741 + "gasUsed": 1740 }, { "file": "test/StoreCoreGas.t.sol", - "test": "testUpdateInField", + "test": "testUpdateInDynamicField", "name": "update in field (1 slot, 1 uint32 item)", - "gasUsed": 9627 + "gasUsed": 8872 }, { "file": "test/StoreCoreGas.t.sol", - "test": "testUpdateInField", + "test": "testUpdateInDynamicField", "name": "push to field (2 slots, 6 uint64 items)", - "gasUsed": 10073 + "gasUsed": 9318 }, { "file": "test/StoreHook.t.sol", "test": "testCallHook", "name": "call an enabled hook", - "gasUsed": 15032 + "gasUsed": 15010 }, { "file": "test/StoreHook.t.sol", @@ -939,31 +975,31 @@ "file": "test/tables/Callbacks.t.sol", "test": "testSetAndGet", "name": "Callbacks: set field", - "gasUsed": 57069 + "gasUsed": 56321 }, { "file": "test/tables/Callbacks.t.sol", "test": "testSetAndGet", "name": "Callbacks: get field (warm)", - "gasUsed": 2915 + "gasUsed": 2919 }, { "file": "test/tables/Callbacks.t.sol", "test": "testSetAndGet", "name": "Callbacks: push 1 element", - "gasUsed": 33351 + "gasUsed": 32579 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testOneSlot", "name": "StoreHooks: set field with one elements (cold)", - "gasUsed": 59075 + "gasUsed": 58327 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: set field (cold)", - "gasUsed": 59075 + "gasUsed": 58327 }, { "file": "test/tables/StoreHooks.t.sol", @@ -975,55 +1011,55 @@ "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: push 1 element (cold)", - "gasUsed": 13449 + "gasUsed": 12677 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: pop 1 element (warm)", - "gasUsed": 10777 + "gasUsed": 10011 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: push 1 element (warm)", - "gasUsed": 11466 + "gasUsed": 10694 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: update 1 element (warm)", - "gasUsed": 30686 + "gasUsed": 29920 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: delete record (warm)", - "gasUsed": 7210 + "gasUsed": 10487 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTable", "name": "StoreHooks: set field (warm)", - "gasUsed": 31219 + "gasUsed": 30472 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testThreeSlots", "name": "StoreHooks: set field with three elements (cold)", - "gasUsed": 81763 + "gasUsed": 81015 }, { "file": "test/tables/StoreHooks.t.sol", "test": "testTwoSlots", "name": "StoreHooks: set field with two elements (cold)", - "gasUsed": 81675 + "gasUsed": 80927 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testDelete", "name": "StoreHooks: delete record (cold)", - "gasUsed": 16078 + "gasUsed": 19345 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", @@ -1035,25 +1071,25 @@ "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testGetItem", "name": "StoreHooks: get 1 element (cold)", - "gasUsed": 6575 + "gasUsed": 8486 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testLength", "name": "StoreHooks: get length (cold)", - "gasUsed": 5871 + "gasUsed": 5394 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testPop", "name": "StoreHooks: pop 1 element (cold)", - "gasUsed": 19212 + "gasUsed": 18446 }, { "file": "test/tables/StoreHooksColdLoad.t.sol", "test": "testUpdate", "name": "StoreHooks: update 1 element (cold)", - "gasUsed": 21141 + "gasUsed": 20375 }, { "file": "test/tightcoder/DecodeSlice.t.sol", @@ -1107,18 +1143,18 @@ "file": "test/Vector2.t.sol", "test": "testRegisterAndGetFieldLayout", "name": "register Vector2 field layout", - "gasUsed": 443558 + "gasUsed": 442557 }, { "file": "test/Vector2.t.sol", "test": "testSetAndGet", "name": "set Vector2 record", - "gasUsed": 33096 + "gasUsed": 33735 }, { "file": "test/Vector2.t.sol", "test": "testSetAndGet", "name": "get Vector2 record", - "gasUsed": 2540 + "gasUsed": 2539 } ] diff --git a/packages/store/src/IStore.sol b/packages/store/src/IStore.sol index 344b37ff88..192968fb27 100644 --- a/packages/store/src/IStore.sol +++ b/packages/store/src/IStore.sol @@ -20,7 +20,15 @@ interface IStoreRead { function getKeySchema(ResourceId tableId) external view returns (Schema keySchema); /** - * Get full record (all fields, static and dynamic data) for the given tableId and key tuple, with the given value field layout + * Get full record (all fields, static and dynamic data) for the given tableId and key tuple, loading the field layout from storage + */ + function getRecord( + ResourceId tableId, + bytes32[] calldata keyTuple + ) external view returns (bytes memory staticData, PackedCounter encodedLengths, bytes memory dynamicData); + + /** + * Get full record (all fields, static and dynamic data) for the given tableId and key tuple, with the given field layout */ function getRecord( ResourceId tableId, @@ -29,7 +37,16 @@ interface IStoreRead { ) external view returns (bytes memory staticData, PackedCounter encodedLengths, bytes memory dynamicData); /** - * Get a single field from the given tableId and key tuple, with the given value field layout + * Get a single field from the given tableId and key tuple, loading the field layout from storage + */ + function getField( + ResourceId tableId, + bytes32[] calldata keyTuple, + uint8 fieldIndex + ) external view returns (bytes memory data); + + /** + * Get a single field from the given tableId and key tuple, with the given field layout */ function getField( ResourceId tableId, @@ -60,6 +77,15 @@ interface IStoreRead { uint8 dynamicFieldIndex ) external view returns (bytes memory); + /** + * Get the byte length of a single field from the given tableId and key tuple, loading the field layout from storage + */ + function getFieldLength( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 fieldIndex + ) external view returns (uint256); + /** * Get the byte length of a single field from the given tableId and key tuple, with the given value field layout */ @@ -70,15 +96,23 @@ interface IStoreRead { FieldLayout fieldLayout ) external view returns (uint256); + /** + * Get the byte length of a single dynamic field from the given tableId and key tuple + */ + function getDynamicFieldLength( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 dynamicFieldIndex + ) external view returns (uint256); + /** * Get a byte slice (including start, excluding end) of a single dynamic field from the given tableId and key tuple, with the given value field layout. * The slice is unchecked and will return invalid data if `start`:`end` overflow. */ - function getFieldSlice( + function getDynamicFieldSlice( ResourceId tableId, bytes32[] memory keyTuple, - uint8 fieldIndex, - FieldLayout fieldLayout, + uint8 dynamicFieldIndex, uint256 start, uint256 end ) external view returns (bytes memory data); @@ -92,13 +126,7 @@ interface IStoreWrite { bytes32 encodedLengths, bytes dynamicData ); - event Store_SpliceStaticData( - ResourceId indexed tableId, - bytes32[] keyTuple, - uint48 start, - uint40 deleteCount, - bytes data - ); + event Store_SpliceStaticData(ResourceId indexed tableId, bytes32[] keyTuple, uint48 start, bytes data); event Store_SpliceDynamicData( ResourceId indexed tableId, bytes32[] keyTuple, @@ -115,8 +143,7 @@ interface IStoreWrite { bytes32[] calldata keyTuple, bytes calldata staticData, PackedCounter encodedLengths, - bytes calldata dynamicData, - FieldLayout fieldLayout + bytes calldata dynamicData ) external; // Splice data in the static part of the record @@ -124,7 +151,6 @@ interface IStoreWrite { ResourceId tableId, bytes32[] calldata keyTuple, uint48 start, - uint40 deleteCount, bytes calldata data ) external; @@ -138,6 +164,9 @@ interface IStoreWrite { bytes calldata data ) external; + // Set partial data at field index + function setField(ResourceId tableId, bytes32[] calldata keyTuple, uint8 fieldIndex, bytes calldata data) external; + // Set partial data at field index function setField( ResourceId tableId, @@ -147,36 +176,39 @@ interface IStoreWrite { FieldLayout fieldLayout ) external; - // Push encoded items to the dynamic field at field index - function pushToField( + function setStaticField( ResourceId tableId, bytes32[] calldata keyTuple, uint8 fieldIndex, - bytes calldata dataToPush, + bytes calldata data, FieldLayout fieldLayout ) external; - // Pop byte length from the dynamic field at field index - function popFromField( + function setDynamicField( ResourceId tableId, bytes32[] calldata keyTuple, - uint8 fieldIndex, - uint256 byteLengthToPop, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + bytes calldata data ) external; - // Change encoded items within the dynamic field at field index - function updateInField( + // Push encoded items to the dynamic field at field index + function pushToDynamicField( ResourceId tableId, bytes32[] calldata keyTuple, - uint8 fieldIndex, - uint256 startByteIndex, - bytes calldata dataToSet, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + bytes calldata dataToPush + ) external; + + // Pop byte length from the dynamic field at field index + function popFromDynamicField( + ResourceId tableId, + bytes32[] calldata keyTuple, + uint8 dynamicFieldIndex, + uint256 byteLengthToPop ) external; // Set full record (including full dynamic data) - function deleteRecord(ResourceId tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) external; + function deleteRecord(ResourceId tableId, bytes32[] memory keyTuple) external; } /** diff --git a/packages/store/src/IStoreErrors.sol b/packages/store/src/IStoreErrors.sol index e75591d41f..5a957a2f4e 100644 --- a/packages/store/src/IStoreErrors.sol +++ b/packages/store/src/IStoreErrors.sol @@ -9,12 +9,10 @@ interface IStoreErrors { error Store_TableNotFound(ResourceId tableId, string tableIdString); error Store_InvalidResourceType(bytes2 expected, ResourceId resourceId, string resourceIdString); - error Store_NotDynamicField(); - error Store_InvalidStaticDataLength(uint256 expected, uint256 received); error Store_InvalidDynamicDataLength(uint256 expected, uint256 received); + error Store_IndexOutOfBounds(uint256 length, uint256 accessedIndex); error Store_InvalidKeyNamesLength(uint256 expected, uint256 received); error Store_InvalidFieldNamesLength(uint256 expected, uint256 received); error Store_InvalidValueSchemaLength(uint256 expected, uint256 received); - error Store_DataIndexOverflow(uint256 length, uint256 received); error Store_InvalidSplice(uint40 startWithinField, uint40 deleteCount, uint40 fieldLength); } diff --git a/packages/store/src/IStoreHook.sol b/packages/store/src/IStoreHook.sol index b8a1b70947..2e4b6e1d28 100644 --- a/packages/store/src/IStoreHook.sol +++ b/packages/store/src/IStoreHook.sol @@ -42,7 +42,6 @@ interface IStoreHook is IERC165 { ResourceId tableId, bytes32[] memory keyTuple, uint48 start, - uint40 deleteCount, bytes memory data ) external; @@ -50,7 +49,6 @@ interface IStoreHook is IERC165 { ResourceId tableId, bytes32[] memory keyTuple, uint48 start, - uint40 deleteCount, bytes memory data ) external; diff --git a/packages/store/src/Storage.sol b/packages/store/src/Storage.sol index d8745b3636..e558d23093 100644 --- a/packages/store/src/Storage.sol +++ b/packages/store/src/Storage.sol @@ -99,6 +99,18 @@ library Storage { } } + function zero(uint256 storagePointer, uint256 length) internal { + // Ceil division to round up to the nearest word + uint256 limit = storagePointer + (length + 31) / 32; + while (storagePointer < limit) { + /// @solidity memory-safe-assembly + assembly { + sstore(storagePointer, 0) + storagePointer := add(storagePointer, 1) + } + } + } + function load(uint256 storagePointer) internal view returns (bytes32 word) { assembly { word := sload(storagePointer) diff --git a/packages/store/src/StoreCore.sol b/packages/store/src/StoreCore.sol index d2db8940e0..8679adb77d 100644 --- a/packages/store/src/StoreCore.sol +++ b/packages/store/src/StoreCore.sol @@ -9,7 +9,8 @@ import { FieldLayout, FieldLayoutLib } from "./FieldLayout.sol"; import { Schema, SchemaLib } from "./Schema.sol"; import { PackedCounter } from "./PackedCounter.sol"; import { Slice, SliceLib } from "./Slice.sol"; -import { StoreHooks, Tables, ResourceIds, StoreHooksTableId } from "./codegen/index.sol"; +import { StoreHooks, Tables, TablesTableId, ResourceIds, StoreHooksTableId } from "./codegen/index.sol"; +import { _fieldLayout as TablesTableFieldLayout } from "./codegen/tables/Tables.sol"; import { IStoreErrors } from "./IStoreErrors.sol"; import { IStoreHook } from "./IStoreHook.sol"; import { StoreSwitch } from "./StoreSwitch.sol"; @@ -34,13 +35,7 @@ library StoreCore { bytes32 encodedLengths, bytes dynamicData ); - event Store_SpliceStaticData( - ResourceId indexed tableId, - bytes32[] keyTuple, - uint48 start, - uint40 deleteCount, - bytes data - ); + event Store_SpliceStaticData(ResourceId indexed tableId, bytes32[] keyTuple, uint48 start, bytes data); event Store_SpliceDynamicData( ResourceId indexed tableId, bytes32[] keyTuple, @@ -83,13 +78,21 @@ library StoreCore { ************************************************************************/ /** - * Get the field layout for the given tableId + * Get the field layout for the given table ID. */ - function getFieldLayout(ResourceId tableId) internal view returns (FieldLayout fieldLayout) { - fieldLayout = FieldLayout.wrap(Tables._getFieldLayout(ResourceId.unwrap(tableId))); - if (fieldLayout.isEmpty()) { - revert IStoreErrors.Store_TableNotFound(tableId, string(abi.encodePacked(tableId))); + function getFieldLayout(ResourceId tableId) internal view returns (FieldLayout) { + // Explicit check for the tables table to solve the bootstraping issue + if (ResourceId.unwrap(tableId) == ResourceId.unwrap(TablesTableId)) { + return TablesTableFieldLayout; } + return + FieldLayout.wrap( + Storage.loadField({ + storagePointer: StoreCoreInternal._getStaticDataLocation(TablesTableId, ResourceId.unwrap(tableId)), + length: 32, + offset: 0 + }) + ); } /** @@ -202,7 +205,22 @@ library StoreCore { ************************************************************************/ /** - * Set full data record for the given table ID and key tuple and field layout + * Set full data record for the given table ID and key tuple and field layout. + * This overload loads the field layout from storage and is exposed externally on `IStore`. + */ + function setRecord( + ResourceId tableId, + bytes32[] memory keyTuple, + bytes memory staticData, + PackedCounter encodedLengths, + bytes memory dynamicData + ) internal { + setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData, getFieldLayout(tableId)); + } + + /** + * Set full data record for the given table ID and key tuple and field layout. + * This overload allows passing in a FieldLayout and is not exposed externally on `IStore`. */ function setRecord( ResourceId tableId, @@ -212,12 +230,6 @@ library StoreCore { bytes memory dynamicData, FieldLayout fieldLayout ) internal { - // verify the value has the correct length for the tableId (based on the tableId's field layout) - // to prevent invalid data from being stored - - // Verify static data length + dynamic data length matches the given data - StoreCoreInternal._validateDataLength(fieldLayout, staticData, encodedLengths, dynamicData); - // Emit event to notify indexers emit Store_SetRecord(tableId, keyTuple, staticData, encodedLengths.unwrap(), dynamicData); @@ -296,23 +308,11 @@ library StoreCore { } } - function spliceStaticData( - ResourceId tableId, - bytes32[] memory keyTuple, - uint48 start, - uint40 deleteCount, - bytes memory data - ) internal { + function spliceStaticData(ResourceId tableId, bytes32[] memory keyTuple, uint48 start, bytes memory data) internal { uint256 location = StoreCoreInternal._getStaticDataLocation(tableId, keyTuple); // Emit event to notify offchain indexers - emit StoreCore.Store_SpliceStaticData({ - tableId: tableId, - keyTuple: keyTuple, - start: start, - deleteCount: deleteCount, - data: data - }); + emit StoreCore.Store_SpliceStaticData({ tableId: tableId, keyTuple: keyTuple, start: start, data: data }); // Early return if the table is an offchain table if (tableId.getType() != RESOURCE_TABLE) { @@ -328,7 +328,6 @@ library StoreCore { tableId: tableId, keyTuple: keyTuple, start: start, - deleteCount: deleteCount, data: data }); } @@ -345,7 +344,6 @@ library StoreCore { tableId: tableId, keyTuple: keyTuple, start: start, - deleteCount: deleteCount, data: data }); } @@ -355,7 +353,7 @@ library StoreCore { function spliceDynamicData( ResourceId tableId, bytes32[] memory keyTuple, - uint8 dynamicFieldIndex, // need this to compute the dynamic data location + uint8 dynamicFieldIndex, uint40 startWithinField, uint40 deleteCount, bytes memory data @@ -372,7 +370,14 @@ library StoreCore { } /** - * Set data for a field in a table with the given tableId, key tuple and value field layout + * Set data for a field at the given index in a table with the given tableId, key tuple, loading the field layout from storage + */ + function setField(ResourceId tableId, bytes32[] memory keyTuple, uint8 fieldIndex, bytes memory data) internal { + setField(tableId, keyTuple, fieldIndex, data, getFieldLayout(tableId)); + } + + /** + * Set data for a field at the given index in a table with the given tableId, key tuple and value field layout */ function setField( ResourceId tableId, @@ -382,7 +387,7 @@ library StoreCore { FieldLayout fieldLayout ) internal { if (fieldIndex < fieldLayout.numStaticFields()) { - setStaticField(tableId, keyTuple, fieldLayout, fieldIndex, data); + setStaticField(tableId, keyTuple, fieldIndex, data, fieldLayout); } else { setDynamicField(tableId, keyTuple, fieldIndex - uint8(fieldLayout.numStaticFields()), data); } @@ -391,15 +396,14 @@ library StoreCore { function setStaticField( ResourceId tableId, bytes32[] memory keyTuple, - FieldLayout fieldLayout, uint8 fieldIndex, - bytes memory data + bytes memory data, + FieldLayout fieldLayout ) internal { spliceStaticData({ tableId: tableId, keyTuple: keyTuple, start: uint48(StoreCoreInternal._getStaticDataOffset(fieldLayout, fieldIndex)), - deleteCount: uint40(fieldLayout.atIndex(fieldIndex)), data: data }); } @@ -426,7 +430,16 @@ library StoreCore { } /** - * Delete a record for the given tableId, key tuple and value field layout + * Delete a record for the given tableId, key tuple and value field layout. + * This overload loads the field layout from storage and is exposed externally on `IStore`. + */ + function deleteRecord(ResourceId tableId, bytes32[] memory keyTuple) internal { + deleteRecord(tableId, keyTuple, getFieldLayout(tableId)); + } + + /** + * Delete a record for the given tableId, key tuple and value field layout. + * This overload allows passing in a FieldLayout and is not exposed externally on `IStore`. */ function deleteRecord(ResourceId tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) internal { // Emit event to notify indexers @@ -450,10 +463,11 @@ library StoreCore { uint256 staticDataLocation = StoreCoreInternal._getStaticDataLocation(tableId, keyTuple); Storage.store({ storagePointer: staticDataLocation, offset: 0, data: new bytes(fieldLayout.staticDataLength()) }); - // If there are dynamic fields, delete the dynamic data length + // If there are dynamic fields, set the dynamic data length to 0. + // We don't need to delete the dynamic data because it will be overwritten when a new record is set. if (fieldLayout.numDynamicFields() > 0) { uint256 dynamicDataLengthLocation = StoreCoreInternal._getDynamicDataLengthLocation(tableId, keyTuple); - Storage.store({ storagePointer: dynamicDataLengthLocation, data: bytes32(0) }); + Storage.zero({ storagePointer: dynamicDataLengthLocation, length: 32 }); } // Call onAfterDeleteRecord hooks @@ -466,61 +480,53 @@ library StoreCore { } /** - * Push data to a field in a table with the given tableId, keyTuple tuple and value field layout - */ - function pushToField( - ResourceId tableId, - bytes32[] memory keyTuple, - uint8 fieldIndex, - bytes memory dataToPush, - FieldLayout fieldLayout - ) internal { - if (fieldIndex < fieldLayout.numStaticFields()) { - revert IStoreErrors.Store_NotDynamicField(); - } - - StoreCoreInternal._pushToDynamicField(tableId, keyTuple, fieldLayout, fieldIndex, dataToPush); - } - - /** - * Pop data from a field in a table with the given tableId, key tuple and value field layout + * Push data to a field at the dynamic field index in a table with the given table ID and keyTuple tuple */ - function popFromField( + function pushToDynamicField( ResourceId tableId, bytes32[] memory keyTuple, - uint8 fieldIndex, - uint256 byteLengthToPop, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + bytes memory dataToPush ) internal { - if (fieldIndex < fieldLayout.numStaticFields()) { - revert IStoreErrors.Store_NotDynamicField(); - } + // Load the previous length of the field to set from storage to compute where to start to push + PackedCounter previousEncodedLengths = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple); + uint40 previousFieldLength = uint40(previousEncodedLengths.atIndex(dynamicFieldIndex)); - StoreCoreInternal._popFromDynamicField(tableId, keyTuple, fieldLayout, fieldIndex, byteLengthToPop); + // Splice the dynamic data + StoreCoreInternal._spliceDynamicData({ + tableId: tableId, + keyTuple: keyTuple, + dynamicFieldIndex: dynamicFieldIndex, + startWithinField: uint40(previousFieldLength), + deleteCount: 0, + data: dataToPush, + previousEncodedLengths: previousEncodedLengths + }); } /** - * Update data in a field in a table with the given tableId, key tuple and value field layout + * Pop data from a field at the dynamic field index in a table with the given table ID and key tuple */ - function updateInField( + function popFromDynamicField( ResourceId tableId, bytes32[] memory keyTuple, - uint8 fieldIndex, - uint256 startByteIndex, - bytes memory dataToSet, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + uint256 byteLengthToPop ) internal { - if (fieldIndex < fieldLayout.numStaticFields()) { - revert IStoreErrors.Store_NotDynamicField(); - } - - // index must be checked because it could be arbitrarily large - // (but dataToSet.length can be unchecked - it won't overflow into another slot due to gas costs and hashed slots) - if (startByteIndex > type(uint40).max) { - revert IStoreErrors.Store_DataIndexOverflow(type(uint40).max, startByteIndex); - } + // Load the previous length of the field to set from storage to compute where to start to push + PackedCounter previousEncodedLengths = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple); + uint40 previousFieldLength = uint40(previousEncodedLengths.atIndex(dynamicFieldIndex)); - StoreCoreInternal._setDynamicFieldItem(tableId, keyTuple, fieldLayout, fieldIndex, startByteIndex, dataToSet); + // Splice the dynamic data + StoreCoreInternal._spliceDynamicData({ + tableId: tableId, + keyTuple: keyTuple, + dynamicFieldIndex: dynamicFieldIndex, + startWithinField: uint40(previousFieldLength - byteLengthToPop), + deleteCount: uint40(byteLengthToPop), + data: new bytes(0), + previousEncodedLengths: previousEncodedLengths + }); } /************************************************************************ @@ -530,7 +536,17 @@ library StoreCore { ************************************************************************/ /** - * Get full record (all fields, static and dynamic data) for the given table ID and key tuple, with the given value field layout + * Get full record (all fields, static and dynamic data) for the given table ID and key tuple, loading the field layout from storage + */ + function getRecord( + ResourceId tableId, + bytes32[] memory keyTuple + ) internal view returns (bytes memory staticData, PackedCounter encodedLengths, bytes memory dynamicData) { + return getRecord(tableId, keyTuple, getFieldLayout(tableId)); + } + + /** + * Get full record (all fields, static and dynamic data) for the given table ID and key tuple, with the given field layout */ function getRecord( ResourceId tableId, @@ -563,6 +579,17 @@ library StoreCore { } } + /** + * Get a single field from the given table ID and key tuple, loading the field layout from storage + */ + function getField( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 fieldIndex + ) internal view returns (bytes memory) { + return getField(tableId, keyTuple, fieldIndex, getFieldLayout(tableId)); + } + /** * Get a single field from the given table ID and key tuple, with the given value field layout */ @@ -618,6 +645,17 @@ library StoreCore { }); } + /** + * Get the byte length of a single field from the given table ID and key tuple + */ + function getFieldLength( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 fieldIndex + ) internal view returns (uint256) { + return getFieldLength(tableId, keyTuple, fieldIndex, getFieldLayout(tableId)); + } + /** * Get the byte length of a single field from the given table ID and key tuple, with the given value field layout */ @@ -631,31 +669,41 @@ library StoreCore { if (fieldIndex < numStaticFields) { return fieldLayout.atIndex(fieldIndex); } else { - // Get the length and storage location of the dynamic field - uint8 dynamicFieldLayoutIndex = fieldIndex - numStaticFields; - return StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple).atIndex(dynamicFieldLayoutIndex); + return getDynamicFieldLength(tableId, keyTuple, fieldIndex - numStaticFields); } } + /** + * Get the byte length of a single dynamic field from the given table ID and key tuple + */ + function getDynamicFieldLength( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 dynamicFieldIndex + ) internal view returns (uint256) { + return StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple).atIndex(dynamicFieldIndex); + } + /** * Get a byte slice (including start, excluding end) of a single dynamic field from the given table ID and key tuple, with the given value field layout. - * The slice is unchecked and will return invalid data if `start`:`end` overflow. */ - function getFieldSlice( + function getDynamicFieldSlice( ResourceId tableId, bytes32[] memory keyTuple, - uint8 fieldIndex, - FieldLayout fieldLayout, + uint8 dynamicFieldIndex, uint256 start, uint256 end ) internal view returns (bytes memory) { - uint8 numStaticFields = uint8(fieldLayout.numStaticFields()); - if (fieldIndex < fieldLayout.numStaticFields()) { - revert IStoreErrors.Store_NotDynamicField(); + // Verify the accessed data is within the bounds of the dynamic field. + // This is necessary because we don't delete the dynamic data when a record is deleted, + // but only decrease its length. + PackedCounter encodedLengths = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple); + uint256 fieldLength = encodedLengths.atIndex(dynamicFieldIndex); + if (start >= fieldLength || end > fieldLength) { + revert IStoreErrors.Store_IndexOutOfBounds(fieldLength, start >= fieldLength ? start : end - 1); } // Get the length and storage location of the dynamic field - uint8 dynamicFieldIndex = fieldIndex - numStaticFields; uint256 location = StoreCoreInternal._getDynamicDataLocation(tableId, keyTuple, dynamicFieldIndex); return Storage.load({ storagePointer: location, length: end - start, offset: start }); @@ -699,6 +747,11 @@ library StoreCoreInternal { revert IStoreErrors.Store_InvalidSplice(startWithinField, deleteCount, uint40(previousFieldLength)); } + // The start index can't be larger than the previous length of the field + if (startWithinField > previousFieldLength) { + revert IStoreErrors.Store_IndexOutOfBounds(previousFieldLength, startWithinField); + } + // Compute start index for the splice uint256 start = startWithinField; unchecked { @@ -767,75 +820,6 @@ library StoreCoreInternal { } } - function _pushToDynamicField( - ResourceId tableId, - bytes32[] memory keyTuple, - FieldLayout fieldLayout, - uint8 fieldIndex, - bytes memory dataToPush - ) internal { - uint8 dynamicFieldIndex = fieldIndex - uint8(fieldLayout.numStaticFields()); - - // Load the previous length of the field to set from storage to compute where to start to push - PackedCounter previousEncodedLengths = _loadEncodedDynamicDataLength(tableId, keyTuple); - uint40 previousFieldLength = uint40(previousEncodedLengths.atIndex(dynamicFieldIndex)); - - // Splice the dynamic data - _spliceDynamicData({ - tableId: tableId, - keyTuple: keyTuple, - dynamicFieldIndex: dynamicFieldIndex, - startWithinField: uint40(previousFieldLength), - deleteCount: 0, - data: dataToPush, - previousEncodedLengths: previousEncodedLengths - }); - } - - function _popFromDynamicField( - ResourceId tableId, - bytes32[] memory keyTuple, - FieldLayout fieldLayout, - uint8 fieldIndex, - uint256 byteLengthToPop - ) internal { - uint8 dynamicFieldIndex = fieldIndex - uint8(fieldLayout.numStaticFields()); - - // Load the previous length of the field to set from storage to compute where to start to push - PackedCounter previousEncodedLengths = _loadEncodedDynamicDataLength(tableId, keyTuple); - uint40 previousFieldLength = uint40(previousEncodedLengths.atIndex(dynamicFieldIndex)); - - // Splice the dynamic data - _spliceDynamicData({ - tableId: tableId, - keyTuple: keyTuple, - dynamicFieldIndex: dynamicFieldIndex, - startWithinField: uint40(previousFieldLength - byteLengthToPop), - deleteCount: uint40(byteLengthToPop), - data: new bytes(0), - previousEncodedLengths: previousEncodedLengths - }); - } - - function _setDynamicFieldItem( - ResourceId tableId, - bytes32[] memory keyTuple, - FieldLayout fieldLayout, - uint8 fieldIndex, - uint256 startByteIndex, - bytes memory dataToSet - ) internal { - _spliceDynamicData({ - tableId: tableId, - keyTuple: keyTuple, - dynamicFieldIndex: fieldIndex - uint8(fieldLayout.numStaticFields()), - startWithinField: uint40(startByteIndex), - deleteCount: uint40(dataToSet.length), - data: dataToSet, - previousEncodedLengths: _loadEncodedDynamicDataLength(tableId, keyTuple) - }); - } - /************************************************************************ * * GET DATA @@ -883,35 +867,24 @@ library StoreCoreInternal { * ************************************************************************/ - /** - * Verify static data length + dynamic data length matches the given data - * Returns the static and dynamic lengths - */ - function _validateDataLength( - FieldLayout fieldLayout, - bytes memory staticData, - PackedCounter encodedLengths, - bytes memory dynamicData - ) internal pure { - if (fieldLayout.staticDataLength() != staticData.length) { - revert IStoreErrors.Store_InvalidStaticDataLength(fieldLayout.staticDataLength(), staticData.length); - } - if (encodedLengths.total() != dynamicData.length) { - revert IStoreErrors.Store_InvalidDynamicDataLength(encodedLengths.total(), dynamicData.length); - } - } - ///////////////////////////////////////////////////////////////////////// // STATIC DATA ///////////////////////////////////////////////////////////////////////// /** - * Compute the storage location based on tableId id and index tuple + * Compute the storage location based on tableId id and key tuple */ function _getStaticDataLocation(ResourceId tableId, bytes32[] memory keyTuple) internal pure returns (uint256) { return uint256(SLOT ^ keccak256(abi.encodePacked(tableId, keyTuple))); } + /** + * Compute the storage location based on tableId id and key (equivalent to keyTuple = [key]) + */ + function _getStaticDataLocation(ResourceId tableId, bytes32 key) internal pure returns (uint256) { + return uint256(SLOT ^ keccak256(abi.encodePacked(tableId, key))); + } + /** * Get storage offset for the given value field layout and (static length) index */ @@ -933,9 +906,9 @@ library StoreCoreInternal { function _getDynamicDataLocation( ResourceId tableId, bytes32[] memory keyTuple, - uint8 fieldIndex + uint8 dynamicFieldIndex ) internal pure returns (uint256) { - return uint256(DYNMAIC_DATA_SLOT ^ bytes1(fieldIndex) ^ keccak256(abi.encodePacked(tableId, keyTuple))); + return uint256(DYNMAIC_DATA_SLOT ^ bytes1(dynamicFieldIndex) ^ keccak256(abi.encodePacked(tableId, keyTuple))); } /** diff --git a/packages/store/src/StoreHook.sol b/packages/store/src/StoreHook.sol index fae57d9cec..6b5faabb10 100644 --- a/packages/store/src/StoreHook.sol +++ b/packages/store/src/StoreHook.sol @@ -35,11 +35,11 @@ abstract contract StoreHook is IStoreHook { revert StoreHook_NotImplemented(); } - function onBeforeSpliceStaticData(ResourceId, bytes32[] memory, uint48, uint40, bytes memory) public virtual { + function onBeforeSpliceStaticData(ResourceId, bytes32[] memory, uint48, bytes memory) public virtual { revert StoreHook_NotImplemented(); } - function onAfterSpliceStaticData(ResourceId, bytes32[] memory, uint48, uint40, bytes memory) public virtual { + function onAfterSpliceStaticData(ResourceId, bytes32[] memory, uint48, bytes memory) public virtual { revert StoreHook_NotImplemented(); } diff --git a/packages/store/src/StoreRead.sol b/packages/store/src/StoreRead.sol index 386e3c7f29..a9720b6907 100644 --- a/packages/store/src/StoreRead.sol +++ b/packages/store/src/StoreRead.sol @@ -26,6 +26,13 @@ contract StoreRead is IStoreRead { keySchema = StoreCore.getKeySchema(tableId); } + function getRecord( + ResourceId tableId, + bytes32[] calldata keyTuple + ) public view virtual returns (bytes memory staticData, PackedCounter encodedLengths, bytes memory dynamicData) { + return StoreCore.getRecord(tableId, keyTuple); + } + function getRecord( ResourceId tableId, bytes32[] calldata keyTuple, @@ -34,6 +41,14 @@ contract StoreRead is IStoreRead { return StoreCore.getRecord(tableId, keyTuple, fieldLayout); } + function getField( + ResourceId tableId, + bytes32[] calldata keyTuple, + uint8 fieldIndex + ) public view virtual returns (bytes memory data) { + data = StoreCore.getField(tableId, keyTuple, fieldIndex); + } + function getField( ResourceId tableId, bytes32[] calldata keyTuple, @@ -60,6 +75,14 @@ contract StoreRead is IStoreRead { data = StoreCore.getDynamicField(tableId, keyTuple, dynamicFieldIndex); } + function getFieldLength( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 fieldIndex + ) public view virtual returns (uint256) { + return StoreCore.getFieldLength(tableId, keyTuple, fieldIndex); + } + function getFieldLength( ResourceId tableId, bytes32[] memory keyTuple, @@ -69,14 +92,21 @@ contract StoreRead is IStoreRead { return StoreCore.getFieldLength(tableId, keyTuple, fieldIndex, fieldLayout); } - function getFieldSlice( + function getDynamicFieldLength( ResourceId tableId, bytes32[] memory keyTuple, - uint8 fieldIndex, - FieldLayout fieldLayout, + uint8 dynamicFieldIndex + ) public view virtual returns (uint256) { + return StoreCore.getFieldLength(tableId, keyTuple, dynamicFieldIndex); + } + + function getDynamicFieldSlice( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 dynamicFieldIndex, uint256 start, uint256 end ) public view virtual returns (bytes memory) { - return StoreCore.getFieldSlice(tableId, keyTuple, fieldIndex, fieldLayout, start, end); + return StoreCore.getDynamicFieldSlice(tableId, keyTuple, dynamicFieldIndex, start, end); } } diff --git a/packages/store/src/StoreSwitch.sol b/packages/store/src/StoreSwitch.sol index 2c540fec70..08af0e37b5 100644 --- a/packages/store/src/StoreSwitch.sol +++ b/packages/store/src/StoreSwitch.sol @@ -115,29 +115,22 @@ library StoreSwitch { bytes32[] memory keyTuple, bytes memory staticData, PackedCounter encodedLengths, - bytes memory dynamicData, - FieldLayout fieldLayout + bytes memory dynamicData ) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData); } else { - IStore(_storeAddress).setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData, fieldLayout); + IStore(_storeAddress).setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData); } } - function spliceStaticData( - ResourceId tableId, - bytes32[] memory keyTuple, - uint48 start, - uint40 deleteCount, - bytes memory data - ) internal { + function spliceStaticData(ResourceId tableId, bytes32[] memory keyTuple, uint48 start, bytes memory data) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.spliceStaticData(tableId, keyTuple, start, deleteCount, data); + StoreCore.spliceStaticData(tableId, keyTuple, start, data); } else { - IStore(_storeAddress).spliceStaticData(tableId, keyTuple, start, deleteCount, data); + IStore(_storeAddress).spliceStaticData(tableId, keyTuple, start, data); } } @@ -164,6 +157,15 @@ library StoreSwitch { } } + function setField(ResourceId tableId, bytes32[] memory keyTuple, uint8 fieldIndex, bytes memory data) internal { + address _storeAddress = getStoreAddress(); + if (_storeAddress == address(this)) { + StoreCore.setField(tableId, keyTuple, fieldIndex, data); + } else { + IStore(_storeAddress).setField(tableId, keyTuple, fieldIndex, data); + } + } + function setField( ResourceId tableId, bytes32[] memory keyTuple, @@ -179,58 +181,81 @@ library StoreSwitch { } } - function pushToField( + function setStaticField( ResourceId tableId, bytes32[] memory keyTuple, uint8 fieldIndex, - bytes memory dataToPush, + bytes memory data, FieldLayout fieldLayout ) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.pushToField(tableId, keyTuple, fieldIndex, dataToPush, fieldLayout); + StoreCore.setStaticField(tableId, keyTuple, fieldIndex, data, fieldLayout); } else { - IStore(_storeAddress).pushToField(tableId, keyTuple, fieldIndex, dataToPush, fieldLayout); + IStore(_storeAddress).setStaticField(tableId, keyTuple, fieldIndex, data, fieldLayout); } } - function popFromField( + function setDynamicField( ResourceId tableId, bytes32[] memory keyTuple, - uint8 fieldIndex, - uint256 byteLengthToPop, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + bytes memory data ) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.popFromField(tableId, keyTuple, fieldIndex, byteLengthToPop, fieldLayout); + StoreCore.setDynamicField(tableId, keyTuple, dynamicFieldIndex, data); } else { - IStore(_storeAddress).popFromField(tableId, keyTuple, fieldIndex, byteLengthToPop, fieldLayout); + IStore(_storeAddress).setDynamicField(tableId, keyTuple, dynamicFieldIndex, data); } } - function updateInField( + function pushToDynamicField( ResourceId tableId, bytes32[] memory keyTuple, - uint8 fieldIndex, - uint256 startByteIndex, - bytes memory dataToSet, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + bytes memory dataToPush + ) internal { + address _storeAddress = getStoreAddress(); + if (_storeAddress == address(this)) { + StoreCore.pushToDynamicField(tableId, keyTuple, dynamicFieldIndex, dataToPush); + } else { + IStore(_storeAddress).pushToDynamicField(tableId, keyTuple, dynamicFieldIndex, dataToPush); + } + } + + function popFromDynamicField( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 dynamicFieldIndex, + uint256 byteLengthToPop ) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.updateInField(tableId, keyTuple, fieldIndex, startByteIndex, dataToSet, fieldLayout); + StoreCore.popFromDynamicField(tableId, keyTuple, dynamicFieldIndex, byteLengthToPop); + } else { + IStore(_storeAddress).popFromDynamicField(tableId, keyTuple, dynamicFieldIndex, byteLengthToPop); + } + } + + function deleteRecord(ResourceId tableId, bytes32[] memory keyTuple) internal { + address _storeAddress = getStoreAddress(); + if (_storeAddress == address(this)) { + StoreCore.deleteRecord(tableId, keyTuple); } else { - IStore(_storeAddress).updateInField(tableId, keyTuple, fieldIndex, startByteIndex, dataToSet, fieldLayout); + IStore(_storeAddress).deleteRecord(tableId, keyTuple); } } - function deleteRecord(ResourceId tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) internal { + function getRecord( + ResourceId tableId, + bytes32[] memory keyTuple + ) internal view returns (bytes memory, PackedCounter, bytes memory) { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); + return StoreCore.getRecord(tableId, keyTuple); } else { - IStore(_storeAddress).deleteRecord(tableId, keyTuple, fieldLayout); + return IStore(_storeAddress).getRecord(tableId, keyTuple); } } @@ -247,6 +272,19 @@ library StoreSwitch { } } + function getField( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 fieldIndex + ) internal view returns (bytes memory) { + address _storeAddress = getStoreAddress(); + if (_storeAddress == address(this)) { + return StoreCore.getField(tableId, keyTuple, fieldIndex); + } else { + return IStore(_storeAddress).getField(tableId, keyTuple, fieldIndex); + } + } + function getField( ResourceId tableId, bytes32[] memory keyTuple, @@ -288,6 +326,19 @@ library StoreSwitch { } } + function getFieldLength( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 fieldIndex + ) internal view returns (uint256) { + address _storeAddress = getStoreAddress(); + if (_storeAddress == address(this)) { + return StoreCore.getFieldLength(tableId, keyTuple, fieldIndex); + } else { + return IStore(_storeAddress).getFieldLength(tableId, keyTuple, fieldIndex); + } + } + function getFieldLength( ResourceId tableId, bytes32[] memory keyTuple, @@ -302,19 +353,31 @@ library StoreSwitch { } } - function getFieldSlice( + function getDynamicFieldLength( ResourceId tableId, bytes32[] memory keyTuple, - uint8 fieldIndex, - FieldLayout fieldLayout, + uint8 dynamicFieldIndex + ) internal view returns (uint256) { + address _storeAddress = getStoreAddress(); + if (_storeAddress == address(this)) { + return StoreCore.getDynamicFieldLength(tableId, keyTuple, dynamicFieldIndex); + } else { + return IStore(_storeAddress).getDynamicFieldLength(tableId, keyTuple, dynamicFieldIndex); + } + } + + function getDynamicFieldSlice( + ResourceId tableId, + bytes32[] memory keyTuple, + uint8 dynamicFieldIndex, uint256 start, uint256 end ) internal view returns (bytes memory) { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - return StoreCore.getFieldSlice(tableId, keyTuple, fieldIndex, fieldLayout, start, end); + return StoreCore.getDynamicFieldSlice(tableId, keyTuple, dynamicFieldIndex, start, end); } else { - return IStore(_storeAddress).getFieldSlice(tableId, keyTuple, fieldIndex, fieldLayout, start, end); + return IStore(_storeAddress).getDynamicFieldSlice(tableId, keyTuple, dynamicFieldIndex, start, end); } } } diff --git a/packages/store/src/codegen/tables/Callbacks.sol b/packages/store/src/codegen/tables/Callbacks.sol index 23315c30a9..78cf4c6bf3 100644 --- a/packages/store/src/codegen/tables/Callbacks.sol +++ b/packages/store/src/codegen/tables/Callbacks.sol @@ -137,7 +137,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -145,7 +145,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -153,7 +153,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -161,7 +161,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -169,7 +169,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -177,7 +177,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Get the length of value */ @@ -185,7 +185,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 24; } @@ -196,7 +196,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 24; } @@ -207,7 +207,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 24; } @@ -218,7 +218,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 24; } @@ -229,7 +229,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 24; } @@ -240,7 +240,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 24; } @@ -255,14 +255,7 @@ library Callbacks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 24, - (_index + 1) * 24 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 24, (_index + 1) * 24); return (bytes24(_blob)); } } @@ -276,14 +269,7 @@ library Callbacks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 24, - (_index + 1) * 24 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 24, (_index + 1) * 24); return (bytes24(_blob)); } } @@ -297,7 +283,7 @@ library Callbacks { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 24, (_index + 1) * 24); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 24, (_index + 1) * 24); return (bytes24(_blob)); } } @@ -311,14 +297,7 @@ library Callbacks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 24, - (_index + 1) * 24 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 24, (_index + 1) * 24); return (bytes24(_blob)); } } @@ -332,14 +311,7 @@ library Callbacks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 24, - (_index + 1) * 24 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 24, (_index + 1) * 24); return (bytes24(_blob)); } } @@ -353,7 +325,7 @@ library Callbacks { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 24, (_index + 1) * 24); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 24, (_index + 1) * 24); return (bytes24(_blob)); } } @@ -363,7 +335,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -371,7 +343,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -379,7 +351,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -387,7 +359,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -395,7 +367,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -403,7 +375,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from value */ @@ -411,7 +383,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 24, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 24); } /** Pop an element from value */ @@ -419,7 +391,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 24, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 24); } /** Pop an element from value (using the specified store) */ @@ -427,7 +399,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 24, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 24); } /** Pop an element from value */ @@ -435,7 +407,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 24, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 24); } /** Pop an element from value */ @@ -443,7 +415,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 24, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 24); } /** Pop an element from value (using the specified store) */ @@ -451,7 +423,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 24, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 24); } /** @@ -463,7 +435,8 @@ library Callbacks { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 24, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 24), uint40(_encoded.length), _encoded); } } @@ -476,7 +449,8 @@ library Callbacks { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 24, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 24), uint40(_encoded.length), _encoded); } } @@ -489,7 +463,8 @@ library Callbacks { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 24, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 24), uint40(_encoded.length), _encoded); } } @@ -502,7 +477,8 @@ library Callbacks { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 24, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 24), uint40(_encoded.length), _encoded); } } @@ -515,7 +491,8 @@ library Callbacks { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 24, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 24), uint40(_encoded.length), _encoded); } } @@ -528,7 +505,8 @@ library Callbacks { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 24, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 24), uint40(_encoded.length), _encoded); } } @@ -537,7 +515,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -553,7 +531,7 @@ library Callbacks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/store/src/codegen/tables/Hooks.sol b/packages/store/src/codegen/tables/Hooks.sol index e836bd9352..3210316a6b 100644 --- a/packages/store/src/codegen/tables/Hooks.sol +++ b/packages/store/src/codegen/tables/Hooks.sol @@ -132,7 +132,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -140,7 +140,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -148,7 +148,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -156,7 +156,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -164,7 +164,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -172,7 +172,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Get the length of value */ @@ -180,7 +180,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -191,7 +191,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -202,7 +202,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -213,7 +213,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -224,7 +224,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -235,7 +235,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -250,14 +250,7 @@ library Hooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -271,14 +264,7 @@ library Hooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -297,7 +283,7 @@ library Hooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 21, (_index + 1) * 21); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -311,14 +297,7 @@ library Hooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -332,14 +311,7 @@ library Hooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -353,7 +325,7 @@ library Hooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 21, (_index + 1) * 21); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -363,7 +335,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -371,7 +343,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -379,7 +351,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -387,7 +359,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -395,7 +367,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -403,7 +375,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from value */ @@ -411,7 +383,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value */ @@ -419,7 +391,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value (using the specified store) */ @@ -427,7 +399,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value */ @@ -435,7 +407,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value */ @@ -443,7 +415,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value (using the specified store) */ @@ -451,7 +423,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** @@ -463,7 +435,8 @@ library Hooks { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -476,7 +449,8 @@ library Hooks { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -489,7 +463,8 @@ library Hooks { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -502,7 +477,8 @@ library Hooks { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -515,7 +491,8 @@ library Hooks { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -528,7 +505,8 @@ library Hooks { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -537,7 +515,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -553,7 +531,7 @@ library Hooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/store/src/codegen/tables/KeyEncoding.sol b/packages/store/src/codegen/tables/KeyEncoding.sol index 2351d5ee75..4beef6264b 100644 --- a/packages/store/src/codegen/tables/KeyEncoding.sol +++ b/packages/store/src/codegen/tables/KeyEncoding.sol @@ -229,7 +229,7 @@ library KeyEncoding { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ @@ -242,7 +242,7 @@ library KeyEncoding { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ @@ -264,7 +264,7 @@ library KeyEncoding { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ @@ -277,7 +277,7 @@ library KeyEncoding { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ @@ -290,7 +290,7 @@ library KeyEncoding { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ @@ -312,7 +312,7 @@ library KeyEncoding { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Delete all data for given keys */ @@ -325,7 +325,7 @@ library KeyEncoding { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -351,7 +351,7 @@ library KeyEncoding { _keyTuple[4] = _boolToBytes32(k5); _keyTuple[5] = bytes32(uint256(uint8(k6))); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/store/src/codegen/tables/Mixed.sol b/packages/store/src/codegen/tables/Mixed.sol index 2aca3ce5d4..603baed3bd 100644 --- a/packages/store/src/codegen/tables/Mixed.sol +++ b/packages/store/src/codegen/tables/Mixed.sol @@ -123,7 +123,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((u32)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((u32)), _fieldLayout); } /** Set u32 */ @@ -131,7 +131,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((u32)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((u32)), _fieldLayout); } /** Set u32 (using the specified store) */ @@ -139,7 +139,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((u32)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((u32)), _fieldLayout); } /** Get u128 */ @@ -174,7 +174,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((u128)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((u128)), _fieldLayout); } /** Set u128 */ @@ -182,7 +182,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((u128)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((u128)), _fieldLayout); } /** Set u128 (using the specified store) */ @@ -190,7 +190,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((u128)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((u128)), _fieldLayout); } /** Get a32 */ @@ -225,7 +225,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 2, EncodeArray.encode((a32)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((a32))); } /** Set a32 */ @@ -233,7 +233,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 2, EncodeArray.encode((a32)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((a32))); } /** Set a32 (using the specified store) */ @@ -241,7 +241,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 2, EncodeArray.encode((a32)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((a32))); } /** Get the length of a32 */ @@ -249,7 +249,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -260,7 +260,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -271,7 +271,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 4; } @@ -286,14 +286,7 @@ library Mixed { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 2, - _fieldLayout, - _index * 4, - (_index + 1) * 4 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -307,7 +300,7 @@ library Mixed { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 2, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -321,7 +314,7 @@ library Mixed { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 2, _fieldLayout, _index * 4, (_index + 1) * 4); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 4, (_index + 1) * 4); return (uint32(bytes4(_blob))); } } @@ -331,7 +324,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to a32 */ @@ -339,7 +332,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to a32 (using the specified store) */ @@ -347,7 +340,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from a32 */ @@ -355,7 +348,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 2, 4, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** Pop an element from a32 */ @@ -363,7 +356,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 2, 4, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** Pop an element from a32 (using the specified store) */ @@ -371,7 +364,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 2, 4, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 4); } /** @@ -383,7 +376,8 @@ library Mixed { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 2, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -396,7 +390,8 @@ library Mixed { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 2, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -409,7 +404,8 @@ library Mixed { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 2, _index * 4, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 4), uint40(_encoded.length), _encoded); } } @@ -445,7 +441,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 3, bytes((s)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 1, bytes((s))); } /** Set s */ @@ -453,7 +449,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 3, bytes((s)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 1, bytes((s))); } /** Set s (using the specified store) */ @@ -461,7 +457,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 3, bytes((s)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 1, bytes((s))); } /** Get the length of s */ @@ -469,7 +465,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 1; } @@ -480,7 +476,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 1; } @@ -491,7 +487,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 1; } @@ -506,14 +502,7 @@ library Mixed { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 3, - _fieldLayout, - _index * 1, - (_index + 1) * 1 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 1, (_index + 1) * 1); return (string(_blob)); } } @@ -527,7 +516,7 @@ library Mixed { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 3, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 1, (_index + 1) * 1); return (string(_blob)); } } @@ -541,7 +530,7 @@ library Mixed { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 3, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 1, (_index + 1) * 1); return (string(_blob)); } } @@ -551,7 +540,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 3, bytes((_slice)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 1, bytes((_slice))); } /** Push a slice to s */ @@ -559,7 +548,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 3, bytes((_slice)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, bytes((_slice))); } /** Push a slice to s (using the specified store) */ @@ -567,7 +556,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 3, bytes((_slice)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 1, bytes((_slice))); } /** Pop a slice from s */ @@ -575,7 +564,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 3, 1, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 1, 1); } /** Pop a slice from s */ @@ -583,7 +572,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 3, 1, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, 1); } /** Pop a slice from s (using the specified store) */ @@ -591,7 +580,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 3, 1, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 1, 1); } /** @@ -603,7 +592,8 @@ library Mixed { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 3, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -616,7 +606,8 @@ library Mixed { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 3, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -629,7 +620,8 @@ library Mixed { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 3, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + _store.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -682,7 +674,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -708,7 +700,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -721,7 +713,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -747,7 +739,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -801,7 +793,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -817,7 +809,7 @@ library Mixed { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/store/src/codegen/tables/ResourceIds.sol b/packages/store/src/codegen/tables/ResourceIds.sol index 9414ce5464..742af60ce9 100644 --- a/packages/store/src/codegen/tables/ResourceIds.sol +++ b/packages/store/src/codegen/tables/ResourceIds.sol @@ -137,7 +137,7 @@ library ResourceIds { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = resourceId; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); } /** Set exists */ @@ -145,7 +145,7 @@ library ResourceIds { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = resourceId; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); } /** Set exists (using the specified store) */ @@ -153,7 +153,7 @@ library ResourceIds { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = resourceId; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); } /** Set exists */ @@ -161,7 +161,7 @@ library ResourceIds { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = resourceId; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); } /** Set exists */ @@ -169,7 +169,7 @@ library ResourceIds { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = resourceId; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); } /** Set exists (using the specified store) */ @@ -177,7 +177,7 @@ library ResourceIds { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = resourceId; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((exists)), _fieldLayout); } /** Delete all data for given keys */ @@ -185,7 +185,7 @@ library ResourceIds { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = resourceId; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -201,7 +201,7 @@ library ResourceIds { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = resourceId; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/store/src/codegen/tables/StoreHooks.sol b/packages/store/src/codegen/tables/StoreHooks.sol index 63f987692c..964bf84104 100644 --- a/packages/store/src/codegen/tables/StoreHooks.sol +++ b/packages/store/src/codegen/tables/StoreHooks.sol @@ -137,7 +137,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -145,7 +145,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -153,7 +153,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -161,7 +161,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -169,7 +169,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -177,7 +177,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Get the length of value */ @@ -185,7 +185,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -196,7 +196,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -207,7 +207,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -218,7 +218,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -229,7 +229,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -240,7 +240,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -255,14 +255,7 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -276,14 +269,7 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -297,7 +283,7 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 21, (_index + 1) * 21); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -311,14 +297,7 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -332,14 +311,7 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -353,7 +325,7 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 21, (_index + 1) * 21); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -363,7 +335,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -371,7 +343,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -379,7 +351,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -387,7 +359,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -395,7 +367,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -403,7 +375,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from value */ @@ -411,7 +383,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value */ @@ -419,7 +391,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value (using the specified store) */ @@ -427,7 +399,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value */ @@ -435,7 +407,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value */ @@ -443,7 +415,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value (using the specified store) */ @@ -451,7 +423,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** @@ -463,7 +435,8 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -476,7 +449,8 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -489,7 +463,8 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -502,7 +477,8 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -515,7 +491,8 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -528,7 +505,8 @@ library StoreHooks { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -537,7 +515,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -553,7 +531,7 @@ library StoreHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/store/src/codegen/tables/Tables.sol b/packages/store/src/codegen/tables/Tables.sol index ffdd1b208a..36a03a5a66 100644 --- a/packages/store/src/codegen/tables/Tables.sol +++ b/packages/store/src/codegen/tables/Tables.sol @@ -126,7 +126,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((fieldLayout)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((fieldLayout)), _fieldLayout); } /** Set fieldLayout */ @@ -134,7 +134,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((fieldLayout)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((fieldLayout)), _fieldLayout); } /** Set fieldLayout (using the specified store) */ @@ -142,7 +142,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((fieldLayout)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((fieldLayout)), _fieldLayout); } /** Get keySchema */ @@ -177,7 +177,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((keySchema)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((keySchema)), _fieldLayout); } /** Set keySchema */ @@ -185,7 +185,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((keySchema)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((keySchema)), _fieldLayout); } /** Set keySchema (using the specified store) */ @@ -193,7 +193,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((keySchema)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((keySchema)), _fieldLayout); } /** Get valueSchema */ @@ -228,7 +228,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.setField(_tableId, _keyTuple, 2, abi.encodePacked((valueSchema)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 2, abi.encodePacked((valueSchema)), _fieldLayout); } /** Set valueSchema */ @@ -236,7 +236,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreCore.setField(_tableId, _keyTuple, 2, abi.encodePacked((valueSchema)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 2, abi.encodePacked((valueSchema)), _fieldLayout); } /** Set valueSchema (using the specified store) */ @@ -244,7 +244,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.setField(_tableId, _keyTuple, 2, abi.encodePacked((valueSchema)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 2, abi.encodePacked((valueSchema)), _fieldLayout); } /** Get abiEncodedKeyNames */ @@ -282,7 +282,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.setField(_tableId, _keyTuple, 3, bytes((abiEncodedKeyNames)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, bytes((abiEncodedKeyNames))); } /** Set abiEncodedKeyNames */ @@ -290,7 +290,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreCore.setField(_tableId, _keyTuple, 3, bytes((abiEncodedKeyNames)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, bytes((abiEncodedKeyNames))); } /** Set abiEncodedKeyNames (using the specified store) */ @@ -298,7 +298,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.setField(_tableId, _keyTuple, 3, bytes((abiEncodedKeyNames)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, bytes((abiEncodedKeyNames))); } /** Get the length of abiEncodedKeyNames */ @@ -306,7 +306,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 1; } @@ -317,7 +317,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 1; } @@ -328,7 +328,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 1; } @@ -343,14 +343,7 @@ library Tables { _keyTuple[0] = tableId; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 3, - _fieldLayout, - _index * 1, - (_index + 1) * 1 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); return (bytes(_blob)); } } @@ -364,7 +357,7 @@ library Tables { _keyTuple[0] = tableId; unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 3, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); return (bytes(_blob)); } } @@ -382,7 +375,7 @@ library Tables { _keyTuple[0] = tableId; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 3, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 1, (_index + 1) * 1); return (bytes(_blob)); } } @@ -392,7 +385,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.pushToField(_tableId, _keyTuple, 3, bytes((_slice)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); } /** Push a slice to abiEncodedKeyNames */ @@ -400,7 +393,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreCore.pushToField(_tableId, _keyTuple, 3, bytes((_slice)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); } /** Push a slice to abiEncodedKeyNames (using the specified store) */ @@ -408,7 +401,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.pushToField(_tableId, _keyTuple, 3, bytes((_slice)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, bytes((_slice))); } /** Pop a slice from abiEncodedKeyNames */ @@ -416,7 +409,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.popFromField(_tableId, _keyTuple, 3, 1, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 1); } /** Pop a slice from abiEncodedKeyNames */ @@ -424,7 +417,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreCore.popFromField(_tableId, _keyTuple, 3, 1, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 1); } /** Pop a slice from abiEncodedKeyNames (using the specified store) */ @@ -432,7 +425,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.popFromField(_tableId, _keyTuple, 3, 1, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 1); } /** @@ -444,7 +437,8 @@ library Tables { _keyTuple[0] = tableId; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 3, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -457,7 +451,8 @@ library Tables { _keyTuple[0] = tableId; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 3, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -470,7 +465,8 @@ library Tables { _keyTuple[0] = tableId; unchecked { - _store.updateInField(_tableId, _keyTuple, 3, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -509,7 +505,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.setField(_tableId, _keyTuple, 4, bytes((abiEncodedFieldNames)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 1, bytes((abiEncodedFieldNames))); } /** Set abiEncodedFieldNames */ @@ -517,7 +513,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreCore.setField(_tableId, _keyTuple, 4, bytes((abiEncodedFieldNames)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 1, bytes((abiEncodedFieldNames))); } /** Set abiEncodedFieldNames (using the specified store) */ @@ -525,7 +521,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.setField(_tableId, _keyTuple, 4, bytes((abiEncodedFieldNames)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 1, bytes((abiEncodedFieldNames))); } /** Get the length of abiEncodedFieldNames */ @@ -533,7 +529,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 4, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 1; } @@ -544,7 +540,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 4, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 1; } @@ -555,7 +551,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 4, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 1; } @@ -570,14 +566,7 @@ library Tables { _keyTuple[0] = tableId; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 4, - _fieldLayout, - _index * 1, - (_index + 1) * 1 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 1, (_index + 1) * 1); return (bytes(_blob)); } } @@ -591,7 +580,7 @@ library Tables { _keyTuple[0] = tableId; unchecked { - bytes memory _blob = StoreCore.getFieldSlice(_tableId, _keyTuple, 4, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 1, (_index + 1) * 1); return (bytes(_blob)); } } @@ -609,7 +598,7 @@ library Tables { _keyTuple[0] = tableId; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 4, _fieldLayout, _index * 1, (_index + 1) * 1); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 1, (_index + 1) * 1); return (bytes(_blob)); } } @@ -619,7 +608,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.pushToField(_tableId, _keyTuple, 4, bytes((_slice)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 1, bytes((_slice))); } /** Push a slice to abiEncodedFieldNames */ @@ -627,7 +616,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreCore.pushToField(_tableId, _keyTuple, 4, bytes((_slice)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, bytes((_slice))); } /** Push a slice to abiEncodedFieldNames (using the specified store) */ @@ -635,7 +624,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.pushToField(_tableId, _keyTuple, 4, bytes((_slice)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 1, bytes((_slice))); } /** Pop a slice from abiEncodedFieldNames */ @@ -643,7 +632,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.popFromField(_tableId, _keyTuple, 4, 1, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 1, 1); } /** Pop a slice from abiEncodedFieldNames */ @@ -651,7 +640,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreCore.popFromField(_tableId, _keyTuple, 4, 1, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, 1); } /** Pop a slice from abiEncodedFieldNames (using the specified store) */ @@ -659,7 +648,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.popFromField(_tableId, _keyTuple, 4, 1, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 1, 1); } /** @@ -671,7 +660,8 @@ library Tables { _keyTuple[0] = tableId; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 4, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -684,7 +674,8 @@ library Tables { _keyTuple[0] = tableId; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 4, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -697,7 +688,8 @@ library Tables { _keyTuple[0] = tableId; unchecked { - _store.updateInField(_tableId, _keyTuple, 4, _index * 1, bytes((_slice)), _fieldLayout); + bytes memory _encoded = bytes((_slice)); + _store.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 1), uint40(_encoded.length), _encoded); } } @@ -757,7 +749,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -798,7 +790,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -811,7 +803,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -837,7 +829,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -895,7 +887,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -911,7 +903,7 @@ library Tables { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = tableId; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/store/src/codegen/tables/Vector2.sol b/packages/store/src/codegen/tables/Vector2.sol index 69a48138d5..2a394dce5d 100644 --- a/packages/store/src/codegen/tables/Vector2.sol +++ b/packages/store/src/codegen/tables/Vector2.sol @@ -117,7 +117,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); } /** Set x */ @@ -125,7 +125,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); } /** Set x (using the specified store) */ @@ -133,7 +133,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); } /** Get y */ @@ -168,7 +168,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); } /** Set y */ @@ -176,7 +176,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); } /** Set y (using the specified store) */ @@ -184,7 +184,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); } /** Get the full data */ @@ -236,7 +236,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -262,7 +262,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -275,7 +275,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -301,7 +301,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -331,7 +331,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -347,7 +347,7 @@ library Vector2 { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/store/test/EchoSubscriber.sol b/packages/store/test/EchoSubscriber.sol index 6612677719..a0aced4a9d 100644 --- a/packages/store/test/EchoSubscriber.sol +++ b/packages/store/test/EchoSubscriber.sol @@ -39,20 +39,18 @@ contract EchoSubscriber is StoreHook { ResourceId tableId, bytes32[] memory keyTuple, uint48 start, - uint40 deleteCount, bytes memory data ) public override { - emit HookCalled(abi.encodeCall(this.onBeforeSpliceStaticData, (tableId, keyTuple, start, deleteCount, data))); + emit HookCalled(abi.encodeCall(this.onBeforeSpliceStaticData, (tableId, keyTuple, start, data))); } function onAfterSpliceStaticData( ResourceId tableId, bytes32[] memory keyTuple, uint48 start, - uint40 deleteCount, bytes memory data ) public override { - emit HookCalled(abi.encodeCall(this.onAfterSpliceStaticData, (tableId, keyTuple, start, deleteCount, data))); + emit HookCalled(abi.encodeCall(this.onAfterSpliceStaticData, (tableId, keyTuple, start, data))); } function onBeforeSpliceDynamicData( diff --git a/packages/store/test/MirrorSubscriber.sol b/packages/store/test/MirrorSubscriber.sol index 2a355201df..137fb36a45 100644 --- a/packages/store/test/MirrorSubscriber.sol +++ b/packages/store/test/MirrorSubscriber.sol @@ -38,18 +38,17 @@ contract MirrorSubscriber is StoreHook { FieldLayout fieldLayout ) public override { if (ResourceId.unwrap(tableId) != _tableId) revert("invalid table"); - StoreSwitch.setRecord(indexerTableId, keyTuple, staticData, encodedLengths, dynamicData, fieldLayout); + StoreSwitch.setRecord(indexerTableId, keyTuple, staticData, encodedLengths, dynamicData); } function onBeforeSpliceStaticData( ResourceId tableId, bytes32[] memory keyTuple, uint48 start, - uint40 deleteCount, bytes memory data ) public override { if (ResourceId.unwrap(tableId) != _tableId) revert("invalid tableId"); - StoreSwitch.spliceStaticData(indexerTableId, keyTuple, start, deleteCount, data); + StoreSwitch.spliceStaticData(indexerTableId, keyTuple, start, data); } function onBeforeSpliceDynamicData( @@ -65,25 +64,12 @@ contract MirrorSubscriber is StoreHook { StoreSwitch.spliceDynamicData(indexerTableId, keyTuple, dynamicFieldIndex, startWithinField, deleteCount, data); } - function onAfterSpliceDynamicData( - ResourceId tableId, - bytes32[] memory keyTuple, - uint8 dynamicFieldIndex, - uint40 startWithinField, - uint40 deleteCount, - bytes memory data, - PackedCounter - ) public override { - if (ResourceId.unwrap(tableId) != _tableId) revert("invalid tableId"); - StoreSwitch.spliceDynamicData(indexerTableId, keyTuple, dynamicFieldIndex, startWithinField, deleteCount, data); - } - function onBeforeDeleteRecord( ResourceId tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout ) public override { if (ResourceId.unwrap(tableId) != _tableId) revert("invalid tableId"); - StoreSwitch.deleteRecord(indexerTableId, keyTuple, fieldLayout); + StoreSwitch.deleteRecord(indexerTableId, keyTuple); } } diff --git a/packages/store/test/Mixed.t.sol b/packages/store/test/Mixed.t.sol index 00d8217ee6..c9a0ba7249 100644 --- a/packages/store/test/Mixed.t.sol +++ b/packages/store/test/Mixed.t.sol @@ -13,11 +13,18 @@ import { PackedCounter } from "../src/PackedCounter.sol"; contract MixedTest is Test, GasReporter, StoreMock { MixedData private testMixed; - function testRegisterAndGetFieldLayout() public { - startGasReport("register Mixed table"); - Mixed.register(); - endGasReport(); + function setUp() public { + Mixed._register(); + + bytes32 key = keccak256("defaultkey"); + uint32[] memory a32 = new uint32[](2); + a32[0] = 3; + a32[1] = 4; + string memory s = "Lorem ipsum dolor sit amet"; + Mixed.set({ key: key, u32: 1, u128: 2, a32: a32, s: s }); + } + function testRegisterAndGetFieldLayout() public { FieldLayout registeredFieldLayout = StoreCore.getFieldLayout(MixedTableId); FieldLayout declaredFieldLayout = Mixed.getFieldLayout(); @@ -25,16 +32,13 @@ contract MixedTest is Test, GasReporter, StoreMock { } function testRegisterAndGetSchema() public { - Mixed.register(); - Schema registeredSchema = StoreCore.getValueSchema(MixedTableId); Schema declaredSchema = Mixed.getValueSchema(); assertEq(keccak256(abi.encode(registeredSchema)), keccak256(abi.encode(declaredSchema))); } - function testSetAndGet() public { - Mixed.register(); + function testSetGetDeleteExternal() public { bytes32 key = keccak256("somekey"); uint32[] memory a32 = new uint32[](2); @@ -42,11 +46,11 @@ contract MixedTest is Test, GasReporter, StoreMock { a32[1] = 4; string memory s = "some string"; - startGasReport("set record in Mixed"); + startGasReport("set record in Mixed (external, cold)"); Mixed.set({ key: key, u32: 1, u128: 2, a32: a32, s: s }); endGasReport(); - startGasReport("get record from Mixed"); + startGasReport("get record from Mixed (external, warm)"); MixedData memory mixed = Mixed.get(key); endGasReport(); @@ -55,6 +59,53 @@ contract MixedTest is Test, GasReporter, StoreMock { assertEq(mixed.a32[0], 3); assertEq(mixed.a32[1], 4); assertEq(mixed.s, s); + + startGasReport("delete record from Mixed (external, warm)"); + Mixed.deleteRecord(key); + endGasReport(); + } + + function testSetGetDeleteInternal() public { + bytes32 key = keccak256("somekey"); + + uint32[] memory a32 = new uint32[](2); + a32[0] = 3; + a32[1] = 4; + string memory s = "some string"; + + startGasReport("set record in Mixed (internal, cold)"); + Mixed._set({ key: key, u32: 1, u128: 2, a32: a32, s: s }); + endGasReport(); + + startGasReport("get record from Mixed (internal, warm)"); + MixedData memory mixed = Mixed._get(key); + endGasReport(); + + assertEq(mixed.u32, 1); + assertEq(mixed.u128, 2); + assertEq(mixed.a32[0], 3); + assertEq(mixed.a32[1], 4); + assertEq(mixed.s, s); + + startGasReport("delete record from Mixed (internal, warm)"); + Mixed._deleteRecord(key); + endGasReport(); + } + + function testDeleteExternalCold() public { + bytes32 key = keccak256("defaultkey"); + + startGasReport("delete record from Mixed (external, cold)"); + Mixed.deleteRecord(key); + endGasReport(); + } + + function testDeleteInternalCold() public { + bytes32 key = keccak256("defaultkey"); + + startGasReport("delete record from Mixed (internal, cold)"); + Mixed._deleteRecord(key); + endGasReport(); } function testCompareSolidity() public { diff --git a/packages/store/test/RevertSubscriber.sol b/packages/store/test/RevertSubscriber.sol index f1a7a7d4a1..05f1c6fe55 100644 --- a/packages/store/test/RevertSubscriber.sol +++ b/packages/store/test/RevertSubscriber.sol @@ -29,11 +29,11 @@ contract RevertSubscriber is StoreHook { revert("onAfterSetRecord"); } - function onBeforeSpliceStaticData(ResourceId, bytes32[] memory, uint48, uint40, bytes memory) public pure override { + function onBeforeSpliceStaticData(ResourceId, bytes32[] memory, uint48, bytes memory) public pure override { revert("onBeforeSpliceStaticData"); } - function onAfterSpliceStaticData(ResourceId, bytes32[] memory, uint48, uint40, bytes memory) public pure override { + function onAfterSpliceStaticData(ResourceId, bytes32[] memory, uint48, bytes memory) public pure override { revert("onAfterSpliceStaticData"); } diff --git a/packages/store/test/StoreCore.t.sol b/packages/store/test/StoreCore.t.sol index 02f3ce9ac2..61dc2cddcd 100644 --- a/packages/store/test/StoreCore.t.sol +++ b/packages/store/test/StoreCore.t.sol @@ -45,6 +45,19 @@ contract StoreCoreTest is Test, StoreMock { ResourceId _tableId = ResourceIdLib.encode({ typeId: RESOURCE_TABLE, name: "some table" }); ResourceId _tableId2 = ResourceIdLib.encode({ typeId: RESOURCE_TABLE, name: "some other table" }); + function testGetStaticDataLocation() public { + ResourceId tableId = _tableId; + bytes32 key = "some key"; + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = key; + + // Expect the two methods to return the same value + assertEq( + StoreCoreInternal._getStaticDataLocation(tableId, keyTuple), + StoreCoreInternal._getStaticDataLocation(tableId, key) + ); + } + function testRegisterTable() public { ResourceId tableId = _tableId; @@ -176,18 +189,11 @@ contract StoreCoreTest is Test, StoreMock { assertTrue(ResourceIds._getExists(ResourceId.unwrap(tableId))); assertFalse(ResourceIds._getExists(ResourceId.unwrap(tableId2))); - IStore(this).getFieldLayout(tableId); - IStore(this).getValueSchema(tableId); - IStore(this).getKeySchema(tableId); + assertEq(FieldLayout.unwrap(IStore(this).getFieldLayout(tableId)), FieldLayout.unwrap(fieldLayout)); + assertEq(Schema.unwrap(IStore(this).getValueSchema(tableId)), Schema.unwrap(valueSchema)); + assertEq(Schema.unwrap(IStore(this).getKeySchema(tableId)), Schema.unwrap(defaultKeySchema)); - vm.expectRevert( - abi.encodeWithSelector( - IStoreErrors.Store_TableNotFound.selector, - tableId2, - string(abi.encodePacked(ResourceId.unwrap(tableId2))) - ) - ); - IStore(this).getFieldLayout(tableId2); + assertTrue(IStore(this).getFieldLayout(tableId2).isEmpty()); vm.expectRevert( abi.encodeWithSelector(IStoreErrors.Store_TableNotFound.selector, tableId2, string(abi.encodePacked(tableId2))) @@ -291,7 +297,7 @@ contract StoreCoreTest is Test, StoreMock { vm.expectEmit(true, true, true, true); emit Store_SetRecord(tableId, keyTuple, staticData, bytes32(0), new bytes(0)); - IStore(this).setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0), fieldLayout); + IStore(this).setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get data (bytes memory loadedStaticData, PackedCounter _encodedLengths, bytes memory _dynamicData) = IStore(this).getRecord( @@ -305,30 +311,6 @@ contract StoreCoreTest is Test, StoreMock { assertEq(_dynamicData, ""); } - function testRevertSetAndGetStaticData() public { - ResourceId tableId = _tableId; - - // Register table - FieldLayout fieldLayout = FieldLayoutEncodeHelper.encode(1, 2, 1, 2, 0); - Schema valueSchema = SchemaEncodeHelper.encode( - SchemaType.UINT8, - SchemaType.UINT16, - SchemaType.UINT8, - SchemaType.UINT16 - ); - IStore(this).registerTable(tableId, fieldLayout, defaultKeySchema, valueSchema, new string[](1), new string[](4)); - - // Set data - bytes memory staticData = abi.encodePacked(bytes1(0x01), bytes2(0x0203), bytes1(0x04)); - - bytes32[] memory keyTuple = new bytes32[](1); - keyTuple[0] = "some key"; - - // This should fail because the data is not 6 bytes long - vm.expectRevert(abi.encodeWithSelector(IStoreErrors.Store_InvalidStaticDataLength.selector, 6, 4)); - IStore(this).setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0), fieldLayout); - } - function testSetAndGetStaticDataSpanningWords() public { ResourceId tableId = _tableId; @@ -352,7 +334,7 @@ contract StoreCoreTest is Test, StoreMock { vm.expectEmit(true, true, true, true); emit Store_SetRecord(tableId, keyTuple, staticData, bytes32(0), new bytes(0)); - IStore(this).setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0), fieldLayout); + IStore(this).setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get data (bytes memory loadedStaticData, PackedCounter _encodedLengths, bytes memory _dynamicData) = IStore(this).getRecord( @@ -417,7 +399,7 @@ contract StoreCoreTest is Test, StoreMock { emit Store_SetRecord(tableId, keyTuple, staticData, encodedDynamicLength.unwrap(), dynamicData); // Set data - IStore(this).setRecord(tableId, keyTuple, staticData, encodedDynamicLength, dynamicData, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, staticData, encodedDynamicLength, dynamicData); // Get data (bytes memory loadedStaticData, PackedCounter loadedEncodedLengths, bytes memory loadedDynamicData) = IStore(this) @@ -491,13 +473,7 @@ contract StoreCoreTest is Test, StoreMock { // Expect a Store_SpliceStaticData event to be emitted vm.expectEmit(true, true, true, true); - emit Store_SpliceStaticData( - _data.tableId, - keyTuple, - 0, - uint40(_data.firstDataPacked.length), - _data.firstDataPacked - ); + emit Store_SpliceStaticData(_data.tableId, keyTuple, 0, _data.firstDataPacked); // Set first field IStore(this).setField(_data.tableId, keyTuple, 0, _data.firstDataPacked, _data.fieldLayout); @@ -519,13 +495,7 @@ contract StoreCoreTest is Test, StoreMock { // Expect a StoreSpliceRecord event to be emitted vm.expectEmit(true, true, true, true); - emit Store_SpliceStaticData( - _data.tableId, - keyTuple, - uint48(_data.firstDataPacked.length), - uint40(_data.secondDataPacked.length), - _data.secondDataPacked - ); + emit Store_SpliceStaticData(_data.tableId, keyTuple, uint48(_data.firstDataPacked.length), _data.secondDataPacked); IStore(this).setField(_data.tableId, keyTuple, 1, _data.secondDataPacked, _data.fieldLayout); @@ -728,7 +698,7 @@ contract StoreCoreTest is Test, StoreMock { keyTuple[0] = bytes32("some key"); // Set data - IStore(this).setRecord(tableId, keyTuple, staticData, encodedDynamicLength, dynamicData, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, staticData, encodedDynamicLength, dynamicData); // Get data (bytes memory loadedStaticData, PackedCounter loadedEncodedLengths, bytes memory loadedDynamicData) = IStore(this) @@ -741,7 +711,7 @@ contract StoreCoreTest is Test, StoreMock { emit Store_DeleteRecord(tableId, keyTuple); // Delete data - IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple); // Verify data is deleted (loadedStaticData, loadedEncodedLengths, loadedDynamicData) = IStore(this).getRecord( @@ -754,7 +724,7 @@ contract StoreCoreTest is Test, StoreMock { assertEq(loadedDynamicData, ""); } - struct TestPushToFieldData { + struct TestPushToDynamicFieldData { ResourceId tableId; bytes32[] keyTuple; bytes32 firstDataBytes; @@ -767,10 +737,21 @@ contract StoreCoreTest is Test, StoreMock { bytes newThirdDataBytes; } - function testPushToField() public { + function testPushToDynamicField() public { ResourceId tableId = _tableId; - TestPushToFieldData memory data = TestPushToFieldData(tableId, new bytes32[](0), 0, "", "", "", "", "", "", ""); + TestPushToDynamicFieldData memory data = TestPushToDynamicFieldData( + tableId, + new bytes32[](0), + 0, + "", + "", + "", + "", + "", + "", + "" + ); // Register table FieldLayout fieldLayout = FieldLayoutEncodeHelper.encode(32, 2); @@ -813,7 +794,7 @@ contract StoreCoreTest is Test, StoreMock { IStore(this).setField(data.tableId, data.keyTuple, 0, abi.encodePacked(data.firstDataBytes), fieldLayout); IStore(this).setField(data.tableId, data.keyTuple, 1, data.secondDataBytes, fieldLayout); // Initialize a field with push - IStore(this).pushToField(data.tableId, data.keyTuple, 2, data.thirdDataBytes, fieldLayout); + IStore(this).pushToDynamicField(data.tableId, data.keyTuple, 1, data.thirdDataBytes); // Create data to push { @@ -835,7 +816,7 @@ contract StoreCoreTest is Test, StoreMock { ); // Push to second field - IStore(this).pushToField(data.tableId, data.keyTuple, 1, data.secondDataToPush, fieldLayout); + IStore(this).pushToDynamicField(data.tableId, data.keyTuple, 0, data.secondDataToPush); // Get second field data.loadedData = IStore(this).getField(data.tableId, data.keyTuple, 1, fieldLayout); @@ -878,7 +859,7 @@ contract StoreCoreTest is Test, StoreMock { ); // Push to third field - IStore(this).pushToField(data.tableId, data.keyTuple, 2, data.thirdDataToPush, fieldLayout); + IStore(this).pushToDynamicField(data.tableId, data.keyTuple, 1, data.thirdDataToPush); // Get third field data.loadedData = IStore(this).getField(data.tableId, data.keyTuple, 2, fieldLayout); @@ -893,7 +874,7 @@ contract StoreCoreTest is Test, StoreMock { assertEq(IStore(this).getField(data.tableId, data.keyTuple, 1, fieldLayout), data.newSecondDataBytes, "10"); } - struct TestUpdateInFieldData { + struct TestSpliceDynamicDataData { ResourceId tableId; bytes32[] keyTuple; bytes32 firstDataBytes; @@ -908,10 +889,10 @@ contract StoreCoreTest is Test, StoreMock { bytes loadedData; } - function testUpdateInField() public { + function testSpliceDynamicData() public { ResourceId tableId = _tableId; - TestUpdateInFieldData memory data = TestUpdateInFieldData( + TestSpliceDynamicDataData memory data = TestSpliceDynamicDataData( tableId, new bytes32[](0), 0, @@ -988,7 +969,14 @@ contract StoreCoreTest is Test, StoreMock { ); // Update index 1 in second field (4 = byte length of uint32) - IStore(this).updateInField(data.tableId, data.keyTuple, 1, 4 * 1, data.secondDataForUpdate, fieldLayout); + IStore(this).spliceDynamicData( + data.tableId, + data.keyTuple, + 0, + uint40(4 * 1), + uint40(data.secondDataForUpdate.length), + data.secondDataForUpdate + ); // Get second field data.loadedData = IStore(this).getField(data.tableId, data.keyTuple, 1, fieldLayout); @@ -1033,7 +1021,14 @@ contract StoreCoreTest is Test, StoreMock { ); // Update indexes 1,2,3,4 in third field (8 = byte length of uint64) - IStore(this).updateInField(data.tableId, data.keyTuple, 2, 8 * 1, data.thirdDataForUpdate, fieldLayout); + IStore(this).spliceDynamicData( + data.tableId, + data.keyTuple, + 1, + uint40(8 * 1), + uint40(data.thirdDataForUpdate.length), + data.thirdDataForUpdate + ); // Get third field data.loadedData = IStore(this).getField(data.tableId, data.keyTuple, 2, fieldLayout); @@ -1049,9 +1044,20 @@ contract StoreCoreTest is Test, StoreMock { // startByteIndex must not overflow vm.expectRevert( - abi.encodeWithSelector(IStoreErrors.Store_DataIndexOverflow.selector, type(uint40).max, type(uint56).max) + abi.encodeWithSelector( + IStoreErrors.Store_IndexOutOfBounds.selector, + data.newThirdDataBytes.length, + uint40(type(uint56).max) + ) + ); + IStore(this).spliceDynamicData( + data.tableId, + data.keyTuple, + 1, + uint40(type(uint56).max), + uint40(data.thirdDataForUpdate.length), + data.thirdDataForUpdate ); - IStore(this).updateInField(data.tableId, data.keyTuple, 2, type(uint56).max, data.thirdDataForUpdate, fieldLayout); } function testAccessEmptyData() public { @@ -1078,7 +1084,8 @@ contract StoreCoreTest is Test, StoreMock { uint256 data3Length = IStore(this).getFieldLength(tableId, keyTuple, 1, fieldLayout); assertEq(data3Length, 0); - bytes memory data3Slice = IStore(this).getFieldSlice(tableId, keyTuple, 1, fieldLayout, 0, 0); + vm.expectRevert(abi.encodeWithSelector(IStoreErrors.Store_IndexOutOfBounds.selector, 0, 0)); + bytes memory data3Slice = IStore(this).getDynamicFieldSlice(tableId, keyTuple, 0, 0, 0); assertEq(data3Slice.length, 0); } @@ -1107,7 +1114,7 @@ contract StoreCoreTest is Test, StoreMock { bytes memory staticData = abi.encodePacked(bytes16(0x0102030405060708090a0b0c0d0e0f10)); - IStore(this).setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0), fieldLayout); + IStore(this).setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get data from indexed table - the indexer should have mirrored the data there (bytes memory indexedData, , ) = IStore(this).getRecord(indexerTableId, keyTuple, fieldLayout); @@ -1121,7 +1128,7 @@ contract StoreCoreTest is Test, StoreMock { (indexedData, , ) = IStore(this).getRecord(indexerTableId, keyTuple, fieldLayout); assertEq(keccak256(staticData), keccak256(indexedData)); - IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple); // Get data from indexed table - the indexer should have mirrored the data there (indexedData, , ) = IStore(this).getRecord(indexerTableId, keyTuple, fieldLayout); @@ -1154,7 +1161,7 @@ contract StoreCoreTest is Test, StoreMock { // Expect a revert when the RevertSubscriber's onBeforeSetRecord hook is called vm.expectRevert(bytes("onBeforeSetRecord")); - IStore(this).setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData); // Expect a revert when the RevertSubscriber's onBeforeSpliceStaticData hook is called vm.expectRevert(bytes("onBeforeSpliceStaticData")); @@ -1166,7 +1173,7 @@ contract StoreCoreTest is Test, StoreMock { // Expect a revert when the RevertSubscriber's onBeforeDeleteRecord hook is called vm.expectRevert(bytes("onBeforeDeleteRecord")); - IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple); // Unregister the RevertSubscriber IStore(this).unregisterStoreHook(tableId, revertSubscriber); @@ -1189,19 +1196,15 @@ contract StoreCoreTest is Test, StoreMock { ) ); - IStore(this).setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData); // Expect a HookCalled event to be emitted when the EchoSubscriber's onBeforeSpliceStaticData hook is called vm.expectEmit(true, true, true, true); - emit HookCalled( - abi.encodeCall(IStoreHook.onBeforeSpliceStaticData, (tableId, keyTuple, 0, uint40(staticData.length), staticData)) - ); + emit HookCalled(abi.encodeCall(IStoreHook.onBeforeSpliceStaticData, (tableId, keyTuple, 0, staticData))); // Expect a HookCalled event to be emitted when the EchoSubscriber's onAfterSpliceStaticData hook is called vm.expectEmit(true, true, true, true); - emit HookCalled( - abi.encodeCall(IStoreHook.onAfterSpliceStaticData, (tableId, keyTuple, 0, uint40(staticData.length), staticData)) - ); + emit HookCalled(abi.encodeCall(IStoreHook.onAfterSpliceStaticData, (tableId, keyTuple, 0, staticData))); IStore(this).setField(tableId, keyTuple, 0, staticData, fieldLayout); @@ -1214,7 +1217,7 @@ contract StoreCoreTest is Test, StoreMock { ) ); - // Expect a HookCalled event to be emitted when the EchoSubscriber's onAfterSpliceStaticData hook is called + // Expect a HookCalled event to be emitted when the EchoSubscriber's onAfterSpliceDynamicData hook is called vm.expectEmit(true, true, true, true); emit HookCalled( abi.encodeCall( @@ -1235,7 +1238,7 @@ contract StoreCoreTest is Test, StoreMock { vm.expectEmit(true, true, true, true); emit HookCalled(abi.encodeCall(IStoreHook.onAfterDeleteRecord, (tableId, keyTuple, fieldLayout))); - IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple); } struct RecordData { @@ -1276,14 +1279,7 @@ contract StoreCoreTest is Test, StoreMock { dynamicData: arrayDataBytes }); - IStore(this).setRecord( - tableId, - keyTuple, - recordData.staticData, - recordData.encodedLengths, - recordData.dynamicData, - fieldLayout - ); + IStore(this).setRecord(tableId, keyTuple, recordData.staticData, recordData.encodedLengths, recordData.dynamicData); // Get data from indexed table - the indexer should have mirrored the data there RecordData memory loadedData; @@ -1313,7 +1309,7 @@ contract StoreCoreTest is Test, StoreMock { assertEq(loadedData.encodedLengths.unwrap(), recordData.encodedLengths.unwrap()); assertEq(loadedData.dynamicData, recordData.dynamicData); - IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple); // Get data from indexed table - the indexer should have mirrored the data there (loadedData.staticData, loadedData.encodedLengths, loadedData.dynamicData) = IStore(this).getRecord( diff --git a/packages/store/test/StoreCoreDynamic.t.sol b/packages/store/test/StoreCoreDynamic.t.sol index f596f71419..e91eaf498c 100644 --- a/packages/store/test/StoreCoreDynamic.t.sol +++ b/packages/store/test/StoreCoreDynamic.t.sol @@ -12,6 +12,7 @@ import { FieldLayout } from "../src/FieldLayout.sol"; import { Schema } from "../src/Schema.sol"; import { ResourceId, ResourceIdLib } from "../src/ResourceId.sol"; import { RESOURCE_TABLE } from "../src/storeResourceTypes.sol"; +import { IStoreErrors } from "../src/IStoreErrors.sol"; import { StoreMock } from "../test/StoreMock.sol"; import { FieldLayoutEncodeHelper } from "./FieldLayoutEncodeHelper.sol"; import { SchemaEncodeHelper } from "./SchemaEncodeHelper.sol"; @@ -28,15 +29,14 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { uint32[] internal thirdData; bytes internal thirdDataBytes; - // Expose an external popFromField function for testing purposes of indexers (see testHooks) - function popFromField( + // Expose an external popFromDynamicField function for testing purposes of indexers (see testHooks) + function popFromDynamicField( ResourceId tableId, bytes32[] calldata keyTuple, - uint8 fieldIndex, - uint256 byteLengthToPop, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + uint256 byteLengthToPop ) public override { - StoreCore.popFromField(tableId, keyTuple, fieldIndex, byteLengthToPop, fieldLayout); + StoreCore.popFromDynamicField(tableId, keyTuple, dynamicFieldIndex, byteLengthToPop); } function setUp() public { @@ -79,7 +79,7 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked(firstDataBytes), fieldLayout); StoreCore.setField(_tableId, _keyTuple, 1, secondDataBytes, fieldLayout); // Initialize a field with push - StoreCore.pushToField(_tableId, _keyTuple, 2, thirdDataBytes, fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, thirdDataBytes); } function testPopFromSecondField() public { @@ -106,7 +106,7 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { // Pop from second field startGasReport("pop from field (cold, 1 slot, 1 uint32 item)"); - StoreCore.popFromField(_tableId, _keyTuple, 1, byteLengthToPop, fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, byteLengthToPop); endGasReport(); // Get second field bytes memory loadedData = StoreCore.getField(_tableId, _keyTuple, 1, fieldLayout); @@ -116,7 +116,7 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { // Reset the second field and pop again (but warm this time) StoreCore.setField(_tableId, _keyTuple, 1, dataBytes, fieldLayout); startGasReport("pop from field (warm, 1 slot, 1 uint32 item)"); - StoreCore.popFromField(_tableId, _keyTuple, 1, byteLengthToPop, fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, byteLengthToPop); endGasReport(); // Get second field loadedData = StoreCore.getField(_tableId, _keyTuple, 1, fieldLayout); @@ -152,7 +152,7 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { // Pop from the field startGasReport("pop from field (cold, 2 slots, 10 uint32 items)"); - StoreCore.popFromField(_tableId, _keyTuple, 2, byteLengthToPop, fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, byteLengthToPop); endGasReport(); // Load and verify the field bytes memory loadedData = StoreCore.getField(_tableId, _keyTuple, 2, fieldLayout); @@ -161,7 +161,7 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { // Reset the field and pop again (but warm this time) StoreCore.setField(_tableId, _keyTuple, 2, dataBytes, fieldLayout); startGasReport("pop from field (warm, 2 slots, 10 uint32 items)"); - StoreCore.popFromField(_tableId, _keyTuple, 2, byteLengthToPop, fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, byteLengthToPop); endGasReport(); // Load and verify the field loadedData = StoreCore.getField(_tableId, _keyTuple, 2, fieldLayout); @@ -198,25 +198,34 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { assertEq(length, thirdDataBytes.length); } - function testGetFieldSlice() public { + function testGetDynamicFieldSlice() public { FieldLayout fieldLayout = StoreCore.getFieldLayout(_tableId); startGasReport("get field slice (cold, 1 slot)"); - bytes memory secondFieldSlice = StoreCore.getFieldSlice(_tableId, _keyTuple, 1, fieldLayout, 0, 4); + bytes memory secondFieldSlice = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, 0, 4); endGasReport(); assertEq(secondFieldSlice, SliceLib.getSubslice(secondDataBytes, 0, 4).toBytes()); startGasReport("get field slice (warm, 1 slot)"); - secondFieldSlice = StoreCore.getFieldSlice(_tableId, _keyTuple, 1, fieldLayout, 4, 8); + secondFieldSlice = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, 4, 8); endGasReport(); assertEq(secondFieldSlice, SliceLib.getSubslice(secondDataBytes, 4, 8).toBytes()); startGasReport("get field slice (semi-cold, 1 slot)"); - bytes memory thirdFieldSlice = StoreCore.getFieldSlice(_tableId, _keyTuple, 2, fieldLayout, 4, 32); + bytes memory thirdFieldSlice = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, 4, 32); endGasReport(); assertEq(thirdFieldSlice, SliceLib.getSubslice(thirdDataBytes, 4, 32).toBytes()); startGasReport("get field slice (warm, 2 slots)"); - thirdFieldSlice = StoreCore.getFieldSlice(_tableId, _keyTuple, 2, fieldLayout, 8, 40); + thirdFieldSlice = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, 8, 40); endGasReport(); assertEq(thirdFieldSlice, SliceLib.getSubslice(thirdDataBytes, 8, 40).toBytes()); + + // Expect a revert if the end index is out of bounds + uint256 length = secondDataBytes.length; + vm.expectRevert(abi.encodeWithSelector(IStoreErrors.Store_IndexOutOfBounds.selector, length, length)); + StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, 0, length + 1); + + // Expect a revert if the start index is out of bounds + vm.expectRevert(abi.encodeWithSelector(IStoreErrors.Store_IndexOutOfBounds.selector, length, length)); + StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, length, length); } } diff --git a/packages/store/test/StoreCoreGas.t.sol b/packages/store/test/StoreCoreGas.t.sol index 50990bad79..dfe4f86597 100644 --- a/packages/store/test/StoreCoreGas.t.sol +++ b/packages/store/test/StoreCoreGas.t.sol @@ -38,6 +38,21 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { ResourceId _tableId = ResourceIdLib.encode({ typeId: RESOURCE_TABLE, name: "some table" }); ResourceId _tableId2 = ResourceIdLib.encode({ typeId: RESOURCE_TABLE, name: "some other table" }); + function testGetStaticDataLocation() public { + ResourceId tableId = _tableId; + bytes32 key = "some key"; + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = key; + + startGasReport("get static data location (single key)"); + StoreCoreInternal._getStaticDataLocation(tableId, key); + endGasReport(); + + startGasReport("get static data location (single key tuple)"); + StoreCoreInternal._getStaticDataLocation(tableId, keyTuple); + endGasReport(); + } + function testRegisterAndGetFieldLayout() public { ResourceId tableId = _tableId; @@ -154,7 +169,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { keyTuple[0] = keccak256("some.key"); startGasReport("set static record (1 slot)"); - StoreCore.setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), dynamicData, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), dynamicData); endGasReport(); // Get data @@ -182,7 +197,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { keyTuple[0] = "some key"; startGasReport("set static record (2 slots)"); - StoreCore.setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), dynamicData, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), dynamicData); endGasReport(); // Get data @@ -237,7 +252,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Set data startGasReport("set complex record with dynamic data (4 slots)"); - StoreCore.setRecord(tableId, keyTuple, staticData, encodedDynamicLength, dynamicData, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, staticData, encodedDynamicLength, dynamicData); endGasReport(); // Get data @@ -398,15 +413,15 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { keyTuple[0] = "some key"; // Set data - StoreCore.setRecord(tableId, keyTuple, staticData, encodedDynamicLength, dynamicData, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, staticData, encodedDynamicLength, dynamicData); // Delete data startGasReport("delete record (complex data, 3 slots)"); - StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); + StoreCore.deleteRecord(tableId, keyTuple); endGasReport(); } - function testPushToField() public { + function testPushToDynamicField() public { ResourceId tableId = _tableId; // Register table @@ -444,7 +459,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { StoreCore.setField(tableId, keyTuple, 0, abi.encodePacked(firstDataBytes), fieldLayout); StoreCore.setField(tableId, keyTuple, 1, secondDataBytes, fieldLayout); // Initialize a field with push - StoreCore.pushToField(tableId, keyTuple, 2, thirdDataBytes, fieldLayout); + StoreCore.pushToDynamicField(tableId, keyTuple, 1, thirdDataBytes); // Create data to push bytes memory secondDataToPush; @@ -456,7 +471,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Push to second field startGasReport("push to field (1 slot, 1 uint32 item)"); - StoreCore.pushToField(tableId, keyTuple, 1, secondDataToPush, fieldLayout); + StoreCore.pushToDynamicField(tableId, keyTuple, 0, secondDataToPush); endGasReport(); // Create data to push @@ -478,11 +493,11 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Push to third field startGasReport("push to field (2 slots, 10 uint32 items)"); - StoreCore.pushToField(tableId, keyTuple, 2, thirdDataToPush, fieldLayout); + StoreCore.pushToDynamicField(tableId, keyTuple, 1, thirdDataToPush); endGasReport(); } - struct TestUpdateInFieldData { + struct TestUpdateInDynamicFieldData { bytes32 firstDataBytes; bytes secondDataBytes; bytes secondDataForUpdate; @@ -492,10 +507,10 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { bytes newThirdDataBytes; } - function testUpdateInField() public { + function testUpdateInDynamicField() public { ResourceId tableId = _tableId; - TestUpdateInFieldData memory data = TestUpdateInFieldData("", "", "", "", "", "", ""); + TestUpdateInDynamicFieldData memory data = TestUpdateInDynamicFieldData("", "", "", "", "", "", ""); // Register table FieldLayout fieldLayout = FieldLayoutEncodeHelper.encode(32, 2); Schema valueSchema = SchemaEncodeHelper.encode( @@ -541,7 +556,14 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Update index 1 in second field (4 = byte length of uint32) startGasReport("update in field (1 slot, 1 uint32 item)"); - StoreCore.updateInField(tableId, keyTuple, 1, 4 * 1, data.secondDataForUpdate, fieldLayout); + StoreCore.spliceDynamicData( + tableId, + keyTuple, + 0, + uint40(4 * 1), + uint40(data.secondDataForUpdate.length), + data.secondDataForUpdate + ); endGasReport(); // Create data for update @@ -565,7 +587,14 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Update indexes 1,2,3,4 in third field (8 = byte length of uint64) startGasReport("push to field (2 slots, 6 uint64 items)"); - StoreCore.updateInField(tableId, keyTuple, 2, 8 * 1, data.thirdDataForUpdate, fieldLayout); + StoreCore.spliceDynamicData( + tableId, + keyTuple, + 1, + uint40(8 * 1), + uint40(data.thirdDataForUpdate.length), + data.thirdDataForUpdate + ); endGasReport(); } @@ -597,9 +626,8 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { StoreCore.getFieldLength(tableId, keyTuple, 1, fieldLayout); endGasReport(); - startGasReport("access slice of dynamic field of non-existing record"); - StoreCore.getFieldSlice(tableId, keyTuple, 1, fieldLayout, 0, 0); - endGasReport(); + vm.expectRevert(abi.encodeWithSelector(IStoreErrors.Store_IndexOutOfBounds.selector, 0, 0)); + StoreCore.getDynamicFieldSlice(tableId, keyTuple, 0, 0, 0); } function testHooks() public { @@ -631,7 +659,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { bytes memory dynamicData = new bytes(0); startGasReport("set record on table with subscriber"); - StoreCore.setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), dynamicData, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, staticData, PackedCounter.wrap(bytes32(0)), dynamicData); endGasReport(); staticData = abi.encodePacked(bytes16(0x1112131415161718191a1b1c1d1e1f20)); @@ -641,7 +669,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { endGasReport(); startGasReport("delete record on table with subscriber"); - StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); + StoreCore.deleteRecord(tableId, keyTuple); endGasReport(); } @@ -679,7 +707,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { bytes memory data = abi.encodePacked(staticData, encodedArrayDataLength, dynamicData); startGasReport("set (dynamic) record on table with subscriber"); - StoreCore.setRecord(tableId, keyTuple, staticData, encodedArrayDataLength, dynamicData, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, staticData, encodedArrayDataLength, dynamicData); endGasReport(); // Update dynamic data @@ -693,7 +721,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { endGasReport(); startGasReport("delete (dynamic) record on table with subscriber"); - StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); + StoreCore.deleteRecord(tableId, keyTuple); endGasReport(); } } diff --git a/packages/store/test/StoreMock.sol b/packages/store/test/StoreMock.sol index 7028b83418..590a53f033 100644 --- a/packages/store/test/StoreMock.sol +++ b/packages/store/test/StoreMock.sol @@ -24,10 +24,9 @@ contract StoreMock is IStore, StoreRead { bytes32[] calldata keyTuple, bytes calldata staticData, PackedCounter encodedLengths, - bytes calldata dynamicData, - FieldLayout fieldLayout + bytes calldata dynamicData ) public { - StoreCore.setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData); } // Splice data in the static part of the record @@ -35,10 +34,9 @@ contract StoreMock is IStore, StoreRead { ResourceId tableId, bytes32[] calldata keyTuple, uint48 start, - uint40 deleteCount, bytes calldata data ) public virtual { - StoreCore.spliceStaticData(tableId, keyTuple, start, deleteCount, data); + StoreCore.spliceStaticData(tableId, keyTuple, start, data); } // Splice data in the dynamic part of the record @@ -53,6 +51,16 @@ contract StoreMock is IStore, StoreRead { StoreCore.spliceDynamicData(tableId, keyTuple, dynamicFieldIndex, startWithinField, deleteCount, data); } + // Set partial data at field index + function setField( + ResourceId tableId, + bytes32[] calldata keyTuple, + uint8 fieldIndex, + bytes calldata data + ) public virtual { + StoreCore.setField(tableId, keyTuple, fieldIndex, data); + } + // Set partial data at field index function setField( ResourceId tableId, @@ -64,43 +72,50 @@ contract StoreMock is IStore, StoreRead { StoreCore.setField(tableId, keyTuple, fieldIndex, data, fieldLayout); } - // Push encoded items to the dynamic field at field index - function pushToField( + // Set partial data at field index + function setStaticField( ResourceId tableId, bytes32[] calldata keyTuple, uint8 fieldIndex, - bytes calldata dataToPush, + bytes calldata data, FieldLayout fieldLayout ) public virtual { - StoreCore.pushToField(tableId, keyTuple, fieldIndex, dataToPush, fieldLayout); + StoreCore.setStaticField(tableId, keyTuple, fieldIndex, data, fieldLayout); } - // Pop byte length from the dynamic field at field index - function popFromField( + // Set partial data at dynamic field index + function setDynamicField( ResourceId tableId, bytes32[] calldata keyTuple, - uint8 fieldIndex, - uint256 byteLengthToPop, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + bytes calldata data ) public virtual { - StoreCore.popFromField(tableId, keyTuple, fieldIndex, byteLengthToPop, fieldLayout); + StoreCore.setDynamicField(tableId, keyTuple, dynamicFieldIndex, data); } - // Change encoded items within the dynamic field at field index - function updateInField( + // Push encoded items to the dynamic field at field index + function pushToDynamicField( ResourceId tableId, bytes32[] calldata keyTuple, - uint8 fieldIndex, - uint256 startByteIndex, - bytes calldata dataToSet, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + bytes calldata dataToPush + ) public virtual { + StoreCore.pushToDynamicField(tableId, keyTuple, dynamicFieldIndex, dataToPush); + } + + // Pop byte length from the dynamic field at field index + function popFromDynamicField( + ResourceId tableId, + bytes32[] calldata keyTuple, + uint8 dynamicFieldIndex, + uint256 byteLengthToPop ) public virtual { - StoreCore.updateInField(tableId, keyTuple, fieldIndex, startByteIndex, dataToSet, fieldLayout); + StoreCore.popFromDynamicField(tableId, keyTuple, dynamicFieldIndex, byteLengthToPop); } // Set full record (including full dynamic data) - function deleteRecord(ResourceId tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) public virtual { - StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); + function deleteRecord(ResourceId tableId, bytes32[] memory keyTuple) public virtual { + StoreCore.deleteRecord(tableId, keyTuple); } function registerTable( diff --git a/packages/store/ts/codegen/field.ts b/packages/store/ts/codegen/field.ts index 6fad585ca1..30b0beeebe 100644 --- a/packages/store/ts/codegen/field.ts +++ b/packages/store/ts/codegen/field.ts @@ -55,25 +55,27 @@ export function renderFieldMethods(options: RenderTableOptions) { } result += renderWithFieldSuffix(options.withSuffixlessFieldMethods, field.name, (_methodNameSuffix) => - renderWithStore( - storeArgument, - (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix) => ` + renderWithStore(storeArgument, (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix) => { + const externalArguments = renderArguments([_typedStore, _typedTableId, _typedKeyArgs, _typedFieldName]); + const setFieldMethod = field.isDynamic ? "setDynamicField" : "setStaticField"; + const encodeFieldSingle = renderEncodeFieldSingle(field); + const internalArguments = field.isDynamic + ? `_tableId, _keyTuple, ${schemaIndex - options.staticFields.length}, ${encodeFieldSingle}` + : `_tableId, _keyTuple, ${schemaIndex}, ${encodeFieldSingle}, _fieldLayout`; + + return ` /** Set ${field.name}${_commentSuffix} */ - function ${_methodNamePrefix}set${_methodNameSuffix}(${renderArguments([ - _typedStore, - _typedTableId, - _typedKeyArgs, - _typedFieldName, - ])}) internal { + function ${_methodNamePrefix}set${_methodNameSuffix}(${externalArguments}) internal { ${_keyTupleDefinition} - ${_store}.setField(_tableId, _keyTuple, ${schemaIndex}, ${renderEncodeFieldSingle(field)}, _fieldLayout); + ${_store}.${setFieldMethod}(${internalArguments}); } - ` - ) + `; + }) ); if (field.isDynamic) { const portionData = fieldPortionData(field); + const dynamicSchemaIndex = schemaIndex - options.staticFields.length; if (options.withGetters) { result += renderWithFieldSuffix(options.withSuffixlessFieldMethods, field.name, (_methodNameSuffix) => @@ -87,7 +89,7 @@ export function renderFieldMethods(options: RenderTableOptions) { _typedKeyArgs, ])}) internal view returns (uint256) { ${_keyTupleDefinition} - uint256 _byteLength = ${_store}.getFieldLength(_tableId, _keyTuple, ${schemaIndex}, _fieldLayout); + uint256 _byteLength = ${_store}.getDynamicFieldLength(_tableId, _keyTuple, ${dynamicSchemaIndex}); unchecked { return _byteLength / ${portionData.elementLength}; } @@ -112,11 +114,10 @@ export function renderFieldMethods(options: RenderTableOptions) { ])}) internal view returns (${portionData.typeWithLocation}) { ${_keyTupleDefinition} unchecked { - bytes memory _blob = ${_store}.getFieldSlice( + bytes memory _blob = ${_store}.getDynamicFieldSlice( _tableId, _keyTuple, - ${schemaIndex}, - _fieldLayout, + ${dynamicSchemaIndex}, _index * ${portionData.elementLength}, (_index + 1) * ${portionData.elementLength} ); @@ -140,7 +141,7 @@ export function renderFieldMethods(options: RenderTableOptions) { `${portionData.typeWithLocation} ${portionData.name}`, ])}) internal { ${_keyTupleDefinition} - ${_store}.pushToField(_tableId, _keyTuple, ${schemaIndex}, ${portionData.encoded}, _fieldLayout); + ${_store}.pushToDynamicField(_tableId, _keyTuple, ${dynamicSchemaIndex}, ${portionData.encoded}); } ` ) @@ -157,41 +158,45 @@ export function renderFieldMethods(options: RenderTableOptions) { _typedKeyArgs, ])}) internal { ${_keyTupleDefinition} - ${_store}.popFromField(_tableId, _keyTuple, ${schemaIndex}, ${portionData.elementLength}, _fieldLayout); + ${_store}.popFromDynamicField(_tableId, _keyTuple, ${dynamicSchemaIndex}, ${portionData.elementLength}); } ` ) ); result += renderWithFieldSuffix(options.withSuffixlessFieldMethods, field.name, (_methodNameSuffix) => - renderWithStore( - storeArgument, - (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix) => ` - /** - * Update ${portionData.title} of ${field.name}${_commentSuffix} at \`_index\` - * (checked only to prevent modifying other tables; can corrupt own data if index overflows) - */ - function ${_methodNamePrefix}update${_methodNameSuffix}(${renderArguments([ + renderWithStore(storeArgument, (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix) => { + const externalArguments = renderArguments([ _typedStore, _typedTableId, _typedKeyArgs, "uint256 _index", `${portionData.typeWithLocation} ${portionData.name}`, - ])}) internal { + ]); + + const internalArguments = ` + _tableId, + _keyTuple, + ${dynamicSchemaIndex}, + uint40(_index * ${portionData.elementLength}), + uint40(_encoded.length), + _encoded + `; + + return ` + /** + * Update ${portionData.title} of ${field.name}${_commentSuffix} at \`_index\` + * (checked only to prevent modifying other tables; can corrupt own data if index overflows) + */ + function ${_methodNamePrefix}update${_methodNameSuffix}(${externalArguments}) internal { ${_keyTupleDefinition} unchecked { - ${_store}.updateInField( - _tableId, - _keyTuple, - ${schemaIndex}, - _index * ${portionData.elementLength}, - ${portionData.encoded}, - _fieldLayout - ); + bytes memory _encoded = ${portionData.encoded}; + ${_store}.spliceDynamicData(${internalArguments}); } } - ` - ) + `; + }) ); } } diff --git a/packages/store/ts/codegen/record.ts b/packages/store/ts/codegen/record.ts index 8824a08e63..fa90d96992 100644 --- a/packages/store/ts/codegen/record.ts +++ b/packages/store/ts/codegen/record.ts @@ -39,41 +39,55 @@ export function renderRecordMethods(options: RenderTableOptions) { result += renderWithStore( storeArgument, - (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix) => ` - /** Set the full data using individual values${_commentSuffix} */ - function ${_methodNamePrefix}set(${renderArguments([ - _typedStore, - _typedTableId, - _typedKeyArgs, - renderArguments(options.fields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`)), - ])}) internal { - ${renderRecordData(options)} + (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix, _internal) => { + const externalArguments = renderArguments([ + _typedStore, + _typedTableId, + _typedKeyArgs, + renderArguments(options.fields.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`)), + ]); - ${_keyTupleDefinition} + const internalArguments = + "_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData" + (_internal ? ", _fieldLayout" : ""); - ${_store}.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); - } - ` + return ` + /** Set the full data using individual values${_commentSuffix} */ + function ${_methodNamePrefix}set(${externalArguments}) internal { + ${renderRecordData(options)} + + ${_keyTupleDefinition} + + ${_store}.setRecord(${internalArguments}); + } + `; + } ); if (structName !== undefined) { result += renderWithStore( storeArgument, - (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix) => ` - /** Set the full data using the data struct${_commentSuffix} */ - function ${_methodNamePrefix}set(${renderArguments([ - _typedStore, - _typedTableId, - _typedKeyArgs, - `${structName} memory _table`, - ])}) internal { - ${renderRecordData(options, "_table.")} + (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix, _internal) => { + const externalArguments = renderArguments([ + _typedStore, + _typedTableId, + _typedKeyArgs, + `${structName} memory _table`, + ]); - ${_keyTupleDefinition} + const internalArguments = + "_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData" + (_internal ? ", _fieldLayout" : ""); - ${_store}.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); - } - ` + return ` + /** Set the full data using the data struct${_commentSuffix} */ + function ${_methodNamePrefix}set(${externalArguments}) internal { + ${renderRecordData(options, "_table.")} + + ${_keyTupleDefinition} + + ${_store}.setRecord(${internalArguments}); + } + `; + } ); } @@ -119,17 +133,18 @@ export function renderDeleteRecordMethods(options: RenderTableOptions) { return renderWithStore( storeArgument, - (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix) => ` + (_typedStore, _store, _commentSuffix, _untypedStore, _methodNamePrefix, _internal) => { + const externalArguments = renderArguments([_typedStore, _typedTableId, _typedKeyArgs]); + const internalArguments = "_tableId, _keyTuple" + (_internal ? ", _fieldLayout" : ""); + + return ` /** Delete all data for given keys${_commentSuffix} */ - function ${_methodNamePrefix}deleteRecord(${renderArguments([ - _typedStore, - _typedTableId, - _typedKeyArgs, - ])}) internal { + function ${_methodNamePrefix}deleteRecord(${externalArguments}) internal { ${_keyTupleDefinition} - ${_store}.deleteRecord(_tableId, _keyTuple, _fieldLayout); + ${_store}.deleteRecord(${internalArguments}); } - ` + `; + } ); } diff --git a/packages/store/ts/storeEvents.ts b/packages/store/ts/storeEvents.ts index 4feeb89db3..84e9f0d8d9 100644 --- a/packages/store/ts/storeEvents.ts +++ b/packages/store/ts/storeEvents.ts @@ -1,6 +1,6 @@ export const storeEvents = [ "event Store_SetRecord(bytes32 indexed tableId, bytes32[] keyTuple, bytes staticData, bytes32 encodedLengths, bytes dynamicData)", - "event Store_SpliceStaticData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, uint40 deleteCount, bytes data)", + "event Store_SpliceStaticData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, bytes data)", "event Store_SpliceDynamicData(bytes32 indexed tableId, bytes32[] keyTuple, uint48 start, uint40 deleteCount, bytes data, bytes32 encodedLengths)", "event Store_DeleteRecord(bytes32 indexed tableId, bytes32[] keyTuple)", ] as const; diff --git a/packages/world/gas-report.json b/packages/world/gas-report.json index 8318a79df6..ca76f2c34a 100644 --- a/packages/world/gas-report.json +++ b/packages/world/gas-report.json @@ -39,73 +39,73 @@ "file": "test/KeysInTableModule.t.sol", "test": "testInstallComposite", "name": "install keys in table module", - "gasUsed": 1413281 + "gasUsed": 1408343 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallGas", "name": "install keys in table module", - "gasUsed": 1413281 + "gasUsed": 1408343 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallGas", "name": "set a record on a table with keysInTableModule installed", - "gasUsed": 157774 + "gasUsed": 159011 }, { "file": "test/KeysInTableModule.t.sol", "test": "testInstallSingleton", "name": "install keys in table module", - "gasUsed": 1413281 + "gasUsed": 1408343 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "install keys in table module", - "gasUsed": 1413281 + "gasUsed": 1408343 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "change a composite record on a table with keysInTableModule installed", - "gasUsed": 22092 + "gasUsed": 22549 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookCompositeGas", "name": "delete a composite record on a table with keysInTableModule installed", - "gasUsed": 159243 + "gasUsed": 156389 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "install keys in table module", - "gasUsed": 1413281 + "gasUsed": 1408343 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "change a record on a table with keysInTableModule installed", - "gasUsed": 20814 + "gasUsed": 21271 }, { "file": "test/KeysInTableModule.t.sol", "test": "testSetAndDeleteRecordHookGas", "name": "delete a record on a table with keysInTableModule installed", - "gasUsed": 84959 + "gasUsed": 85335 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testGetKeysWithValueGas", "name": "install keys with value module", - "gasUsed": 654858 + "gasUsed": 649500 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testGetKeysWithValueGas", "name": "Get list of keys with a given value", - "gasUsed": 5709 + "gasUsed": 5712 }, { "file": "test/KeysWithValueModule.t.sol", @@ -117,79 +117,79 @@ "file": "test/KeysWithValueModule.t.sol", "test": "testInstall", "name": "install keys with value module", - "gasUsed": 654858 + "gasUsed": 649500 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testInstall", "name": "set a record on a table with KeysWithValueModule installed", - "gasUsed": 134702 + "gasUsed": 135679 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "install keys with value module", - "gasUsed": 654858 + "gasUsed": 649500 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "change a record on a table with KeysWithValueModule installed", - "gasUsed": 105043 + "gasUsed": 104066 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetAndDeleteRecordHook", "name": "delete a record on a table with KeysWithValueModule installed", - "gasUsed": 34626 + "gasUsed": 36693 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "install keys with value module", - "gasUsed": 654858 + "gasUsed": 649500 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "set a field on a table with KeysWithValueModule installed", - "gasUsed": 146968 + "gasUsed": 146910 }, { "file": "test/KeysWithValueModule.t.sol", "test": "testSetField", "name": "change a field on a table with KeysWithValueModule installed", - "gasUsed": 111727 + "gasUsed": 111669 }, { "file": "test/query.t.sol", "test": "testCombinedHasHasValueNotQuery", "name": "CombinedHasHasValueNotQuery", - "gasUsed": 103211 + "gasUsed": 105109 }, { "file": "test/query.t.sol", "test": "testCombinedHasHasValueQuery", "name": "CombinedHasHasValueQuery", - "gasUsed": 52945 + "gasUsed": 53579 }, { "file": "test/query.t.sol", "test": "testCombinedHasNotQuery", "name": "CombinedHasNotQuery", - "gasUsed": 128343 + "gasUsed": 131374 }, { "file": "test/query.t.sol", "test": "testCombinedHasQuery", "name": "CombinedHasQuery", - "gasUsed": 81556 + "gasUsed": 84497 }, { "file": "test/query.t.sol", "test": "testCombinedHasValueNotQuery", "name": "CombinedHasValueNotQuery", - "gasUsed": 83218 + "gasUsed": 85116 }, { "file": "test/query.t.sol", @@ -201,19 +201,19 @@ "file": "test/query.t.sol", "test": "testHasQuery", "name": "HasQuery", - "gasUsed": 18116 + "gasUsed": 18882 }, { "file": "test/query.t.sol", "test": "testHasQuery1000Keys", "name": "HasQuery with 1000 keys", - "gasUsed": 5938615 + "gasUsed": 5804585 }, { "file": "test/query.t.sol", "test": "testHasQuery100Keys", "name": "HasQuery with 100 keys", - "gasUsed": 554009 + "gasUsed": 541538 }, { "file": "test/query.t.sol", @@ -225,55 +225,55 @@ "file": "test/query.t.sol", "test": "testNotValueQuery", "name": "NotValueQuery", - "gasUsed": 46541 + "gasUsed": 47175 }, { "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromCallboundDelegation", "name": "register a callbound delegation", - "gasUsed": 114534 + "gasUsed": 113124 }, { "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromCallboundDelegation", "name": "call a system via a callbound delegation", - "gasUsed": 33774 + "gasUsed": 36737 }, { "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromTimeboundDelegation", "name": "register a timebound delegation", - "gasUsed": 109029 + "gasUsed": 107619 }, { "file": "test/StandardDelegationsModule.t.sol", "test": "testCallFromTimeboundDelegation", "name": "call a system via a timebound delegation", - "gasUsed": 26779 + "gasUsed": 26822 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "install unique entity module", - "gasUsed": 682963 + "gasUsed": 676007 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstall", "name": "get a unique entity nonce (non-root module)", - "gasUsed": 51919 + "gasUsed": 51180 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "installRoot unique entity module", - "gasUsed": 650259 + "gasUsed": 643281 }, { "file": "test/UniqueEntityModule.t.sol", "test": "testInstallRoot", "name": "get a unique entity nonce (root module)", - "gasUsed": 51919 + "gasUsed": 51180 }, { "file": "test/World.t.sol", @@ -285,91 +285,91 @@ "file": "test/World.t.sol", "test": "testCallFromUnlimitedDelegation", "name": "register an unlimited delegation", - "gasUsed": 50539 + "gasUsed": 49845 }, { "file": "test/World.t.sol", "test": "testCallFromUnlimitedDelegation", "name": "call a system via an unlimited delegation", - "gasUsed": 12796 + "gasUsed": 12839 }, { "file": "test/World.t.sol", "test": "testDeleteRecord", "name": "Delete record", - "gasUsed": 9024 + "gasUsed": 9911 }, { "file": "test/World.t.sol", - "test": "testPushToField", + "test": "testPushToDynamicField", "name": "Push data to the table", - "gasUsed": 86698 + "gasUsed": 85888 }, { "file": "test/World.t.sol", "test": "testRegisterFunctionSelector", "name": "Register a function selector", - "gasUsed": 83885 + "gasUsed": 83271 }, { "file": "test/World.t.sol", "test": "testRegisterNamespace", "name": "Register a new namespace", - "gasUsed": 123163 + "gasUsed": 121037 }, { "file": "test/World.t.sol", "test": "testRegisterRootFunctionSelector", "name": "Register a root function selector", - "gasUsed": 81147 + "gasUsed": 80532 }, { "file": "test/World.t.sol", "test": "testRegisterSystem", "name": "register a system", - "gasUsed": 165280 + "gasUsed": 162836 }, { "file": "test/World.t.sol", "test": "testRegisterTable", "name": "Register a new table in the namespace", - "gasUsed": 640821 + "gasUsed": 637671 }, { "file": "test/World.t.sol", "test": "testSetField", "name": "Write data to a table field", - "gasUsed": 37214 + "gasUsed": 36955 }, { "file": "test/World.t.sol", "test": "testSetRecord", "name": "Write data to the table", - "gasUsed": 36340 + "gasUsed": 36970 }, { "file": "test/WorldDynamicUpdate.t.sol", - "test": "testPopFromField", + "test": "testPopFromDynamicField", "name": "pop 1 address (cold)", - "gasUsed": 24499 + "gasUsed": 23679 }, { "file": "test/WorldDynamicUpdate.t.sol", - "test": "testPopFromField", + "test": "testPopFromDynamicField", "name": "pop 1 address (warm)", - "gasUsed": 13645 + "gasUsed": 12825 }, { "file": "test/WorldDynamicUpdate.t.sol", - "test": "testUpdateInField", - "name": "updateInField 1 item (cold)", - "gasUsed": 25063 + "test": "testSpliceDynamicData", + "name": "update in field 1 item (cold)", + "gasUsed": 24030 }, { "file": "test/WorldDynamicUpdate.t.sol", - "test": "testUpdateInField", - "name": "updateInField 1 item (warm)", - "gasUsed": 14268 + "test": "testSpliceDynamicData", + "name": "update in field 1 item (warm)", + "gasUsed": 13231 }, { "file": "test/WorldResourceId.t.sol", diff --git a/packages/world/src/World.sol b/packages/world/src/World.sol index 91e35b256b..5cead664e8 100644 --- a/packages/world/src/World.sol +++ b/packages/world/src/World.sol @@ -117,28 +117,26 @@ contract World is StoreRead, IStoreData, IWorldKernel { bytes32[] calldata keyTuple, bytes calldata staticData, PackedCounter encodedLengths, - bytes calldata dynamicData, - FieldLayout fieldLayout + bytes calldata dynamicData ) public virtual requireNoCallback { // Require access to the namespace or name AccessControl.requireAccess(tableId, msg.sender); // Set the record - StoreCore.setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, staticData, encodedLengths, dynamicData); } function spliceStaticData( ResourceId tableId, bytes32[] calldata keyTuple, uint48 start, - uint40 deleteCount, bytes calldata data ) public virtual requireNoCallback { // Require access to the namespace or name AccessControl.requireAccess(tableId, msg.sender); // Splice the static data - StoreCore.spliceStaticData(tableId, keyTuple, start, deleteCount, data); + StoreCore.spliceStaticData(tableId, keyTuple, start, data); } function spliceDynamicData( @@ -156,6 +154,23 @@ contract World is StoreRead, IStoreData, IWorldKernel { StoreCore.spliceDynamicData(tableId, keyTuple, dynamicFieldIndex, startWithinField, deleteCount, data); } + /** + * Write a field in the table at the given tableId. + * Requires the caller to have access to the table's namespace or name (encoded in the tableId). + */ + function setField( + ResourceId tableId, + bytes32[] calldata keyTuple, + uint8 fieldIndex, + bytes calldata data + ) public virtual requireNoCallback { + // Require access to namespace or name + AccessControl.requireAccess(tableId, msg.sender); + + // Set the field + StoreCore.setField(tableId, keyTuple, fieldIndex, data); + } + /** * Write a field in the table at the given tableId. * Requires the caller to have access to the table's namespace or name (encoded in the tableId). @@ -175,74 +190,84 @@ contract World is StoreRead, IStoreData, IWorldKernel { } /** - * Push data to the end of a field in the table at the given tableId. + * Write a static field in the table at the given tableId. * Requires the caller to have access to the table's namespace or name (encoded in the tableId). */ - function pushToField( + function setStaticField( ResourceId tableId, bytes32[] calldata keyTuple, uint8 fieldIndex, - bytes calldata dataToPush, + bytes calldata data, FieldLayout fieldLayout ) public virtual requireNoCallback { // Require access to namespace or name AccessControl.requireAccess(tableId, msg.sender); - // Push to the field - StoreCore.pushToField(tableId, keyTuple, fieldIndex, dataToPush, fieldLayout); + // Set the field + StoreCore.setStaticField(tableId, keyTuple, fieldIndex, data, fieldLayout); } /** - * Pop data from the end of a field in the table at the given tableId. + * Write a dynamic field in the table at the given tableId. * Requires the caller to have access to the table's namespace or name (encoded in the tableId). */ - function popFromField( + function setDynamicField( ResourceId tableId, bytes32[] calldata keyTuple, - uint8 fieldIndex, - uint256 byteLengthToPop, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + bytes calldata data ) public virtual requireNoCallback { // Require access to namespace or name AccessControl.requireAccess(tableId, msg.sender); - // Push to the field - StoreCore.popFromField(tableId, keyTuple, fieldIndex, byteLengthToPop, fieldLayout); + // Set the field + StoreCore.setDynamicField(tableId, keyTuple, dynamicFieldIndex, data); } /** - * Update data at `startByteIndex` of a field in the table at the given tableId. + * Push data to the end of a field in the table at the given tableId. * Requires the caller to have access to the table's namespace or name (encoded in the tableId). */ - function updateInField( + function pushToDynamicField( ResourceId tableId, bytes32[] calldata keyTuple, - uint8 fieldIndex, - uint256 startByteIndex, - bytes calldata dataToSet, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + bytes calldata dataToPush ) public virtual requireNoCallback { // Require access to namespace or name AccessControl.requireAccess(tableId, msg.sender); - // Update data in the field - StoreCore.updateInField(tableId, keyTuple, fieldIndex, startByteIndex, dataToSet, fieldLayout); + // Push to the field + StoreCore.pushToDynamicField(tableId, keyTuple, dynamicFieldIndex, dataToPush); } /** - * Delete a record in the table at the given tableId. - * Requires the caller to have access to the namespace or name. + * Pop data from the end of a field in the table at the given tableId. + * Requires the caller to have access to the table's namespace or name (encoded in the tableId). */ - function deleteRecord( + function popFromDynamicField( ResourceId tableId, bytes32[] calldata keyTuple, - FieldLayout fieldLayout + uint8 dynamicFieldIndex, + uint256 byteLengthToPop ) public virtual requireNoCallback { // Require access to namespace or name AccessControl.requireAccess(tableId, msg.sender); + // Push to the field + StoreCore.popFromDynamicField(tableId, keyTuple, dynamicFieldIndex, byteLengthToPop); + } + + /** + * Delete a record in the table at the given tableId. + * Requires the caller to have access to the namespace or name. + */ + function deleteRecord(ResourceId tableId, bytes32[] calldata keyTuple) public virtual requireNoCallback { + // Require access to namespace or name + AccessControl.requireAccess(tableId, msg.sender); + // Delete the record - StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); + StoreCore.deleteRecord(tableId, keyTuple); } /************************************************************************ diff --git a/packages/world/src/modules/core/tables/Balances.sol b/packages/world/src/modules/core/tables/Balances.sol index a5c091c2fc..eef3ceabe6 100644 --- a/packages/world/src/modules/core/tables/Balances.sol +++ b/packages/world/src/modules/core/tables/Balances.sol @@ -137,7 +137,7 @@ library Balances { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); } /** Set balance */ @@ -145,7 +145,7 @@ library Balances { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); } /** Set balance (using the specified store) */ @@ -153,7 +153,7 @@ library Balances { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); } /** Set balance */ @@ -161,7 +161,7 @@ library Balances { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); } /** Set balance */ @@ -169,7 +169,7 @@ library Balances { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); } /** Set balance (using the specified store) */ @@ -177,7 +177,7 @@ library Balances { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((balance)), _fieldLayout); } /** Delete all data for given keys */ @@ -185,7 +185,7 @@ library Balances { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -201,7 +201,7 @@ library Balances { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/modules/core/tables/FunctionSelectors.sol b/packages/world/src/modules/core/tables/FunctionSelectors.sol index 5bea8fed05..9e8cdb6c2f 100644 --- a/packages/world/src/modules/core/tables/FunctionSelectors.sol +++ b/packages/world/src/modules/core/tables/FunctionSelectors.sol @@ -112,7 +112,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); } /** Set systemId */ @@ -120,7 +120,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); } /** Set systemId (using the specified store) */ @@ -128,7 +128,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); } /** Get systemFunctionSelector */ @@ -166,7 +166,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((systemFunctionSelector)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((systemFunctionSelector)), _fieldLayout); } /** Set systemFunctionSelector */ @@ -174,7 +174,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((systemFunctionSelector)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((systemFunctionSelector)), _fieldLayout); } /** Set systemFunctionSelector (using the specified store) */ @@ -182,7 +182,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((systemFunctionSelector)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((systemFunctionSelector)), _fieldLayout); } /** Get the full data */ @@ -237,7 +237,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -263,7 +263,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -293,7 +293,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -309,7 +309,7 @@ library FunctionSelectors { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/modules/core/tables/FunctionSignatures.sol b/packages/world/src/modules/core/tables/FunctionSignatures.sol index 263809abaa..72bfcef307 100644 --- a/packages/world/src/modules/core/tables/FunctionSignatures.sol +++ b/packages/world/src/modules/core/tables/FunctionSignatures.sol @@ -87,7 +87,7 @@ library FunctionSignatures { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -111,7 +111,7 @@ library FunctionSignatures { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -147,7 +147,7 @@ library FunctionSignatures { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -163,7 +163,7 @@ library FunctionSignatures { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(functionSelector); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/world/src/modules/core/tables/SystemHooks.sol b/packages/world/src/modules/core/tables/SystemHooks.sol index 2f04ecde7d..28ca84f61c 100644 --- a/packages/world/src/modules/core/tables/SystemHooks.sol +++ b/packages/world/src/modules/core/tables/SystemHooks.sol @@ -137,7 +137,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -145,7 +145,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -153,7 +153,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -161,7 +161,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -169,7 +169,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -177,7 +177,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Get the length of value */ @@ -185,7 +185,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -196,7 +196,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -207,7 +207,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -218,7 +218,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -229,7 +229,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -240,7 +240,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 21; } @@ -255,14 +255,7 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -276,14 +269,7 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -297,7 +283,7 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 21, (_index + 1) * 21); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -311,14 +297,7 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -332,14 +311,7 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 21, - (_index + 1) * 21 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -353,7 +325,7 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 21, (_index + 1) * 21); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 21, (_index + 1) * 21); return (bytes21(_blob)); } } @@ -363,7 +335,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -371,7 +343,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -379,7 +351,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -387,7 +359,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -395,7 +367,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -403,7 +375,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from value */ @@ -411,7 +383,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value */ @@ -419,7 +391,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreCore.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value (using the specified store) */ @@ -427,7 +399,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value */ @@ -435,7 +407,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value */ @@ -443,7 +415,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreCore.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** Pop an element from value (using the specified store) */ @@ -451,7 +423,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.popFromField(_tableId, _keyTuple, 0, 21, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 21); } /** @@ -463,7 +435,8 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -476,7 +449,8 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -489,7 +463,8 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -502,7 +477,8 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -515,7 +491,8 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -528,7 +505,8 @@ library SystemHooks { _keyTuple[0] = systemId; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 21, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 21), uint40(_encoded.length), _encoded); } } @@ -537,7 +515,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -553,7 +531,7 @@ library SystemHooks { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/world/src/modules/core/tables/SystemRegistry.sol b/packages/world/src/modules/core/tables/SystemRegistry.sol index 4160e95bce..b68751af45 100644 --- a/packages/world/src/modules/core/tables/SystemRegistry.sol +++ b/packages/world/src/modules/core/tables/SystemRegistry.sol @@ -137,7 +137,7 @@ library SystemRegistry { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(uint160(system))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); } /** Set systemId */ @@ -145,7 +145,7 @@ library SystemRegistry { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(uint160(system))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); } /** Set systemId (using the specified store) */ @@ -153,7 +153,7 @@ library SystemRegistry { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(uint160(system))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); } /** Set systemId */ @@ -161,7 +161,7 @@ library SystemRegistry { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(uint160(system))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); } /** Set systemId */ @@ -169,7 +169,7 @@ library SystemRegistry { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(uint160(system))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); } /** Set systemId (using the specified store) */ @@ -177,7 +177,7 @@ library SystemRegistry { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(uint160(system))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((systemId)), _fieldLayout); } /** Delete all data for given keys */ @@ -185,7 +185,7 @@ library SystemRegistry { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(uint160(system))); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -201,7 +201,7 @@ library SystemRegistry { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = bytes32(uint256(uint160(system))); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/modules/core/tables/Systems.sol b/packages/world/src/modules/core/tables/Systems.sol index 934122ca26..0f3f44acc3 100644 --- a/packages/world/src/modules/core/tables/Systems.sol +++ b/packages/world/src/modules/core/tables/Systems.sol @@ -112,7 +112,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((system)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((system)), _fieldLayout); } /** Set system */ @@ -120,7 +120,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((system)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((system)), _fieldLayout); } /** Set system (using the specified store) */ @@ -128,7 +128,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((system)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((system)), _fieldLayout); } /** Get publicAccess */ @@ -163,7 +163,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((publicAccess)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((publicAccess)), _fieldLayout); } /** Set publicAccess */ @@ -171,7 +171,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((publicAccess)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((publicAccess)), _fieldLayout); } /** Set publicAccess (using the specified store) */ @@ -179,7 +179,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((publicAccess)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((publicAccess)), _fieldLayout); } /** Get the full data */ @@ -231,7 +231,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -257,7 +257,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -287,7 +287,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -303,7 +303,7 @@ library Systems { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = systemId; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/modules/keysintable/KeysInTableHook.sol b/packages/world/src/modules/keysintable/KeysInTableHook.sol index 3cf09d4638..f3bada4a12 100644 --- a/packages/world/src/modules/keysintable/KeysInTableHook.sol +++ b/packages/world/src/modules/keysintable/KeysInTableHook.sol @@ -57,7 +57,6 @@ contract KeysInTableHook is StoreHook { ResourceId tableId, bytes32[] memory keyTuple, uint48, - uint40, bytes memory ) public override { handleSet(tableId, keyTuple); diff --git a/packages/world/src/modules/keysintable/tables/KeysInTable.sol b/packages/world/src/modules/keysintable/tables/KeysInTable.sol index 1939a1ffdb..5c049370a7 100644 --- a/packages/world/src/modules/keysintable/tables/KeysInTable.sol +++ b/packages/world/src/modules/keysintable/tables/KeysInTable.sol @@ -126,7 +126,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0))); } /** Set keys0 */ @@ -134,7 +134,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0))); } /** Set keys0 (using the specified store) */ @@ -142,7 +142,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keys0))); } /** Get the length of keys0 */ @@ -150,7 +150,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -161,7 +161,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -172,7 +172,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -187,14 +187,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -208,14 +201,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -229,7 +215,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 32, (_index + 1) * 32); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -239,7 +225,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to keys0 */ @@ -247,7 +233,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to keys0 (using the specified store) */ @@ -255,7 +241,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from keys0 */ @@ -263,7 +249,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** Pop an element from keys0 */ @@ -271,7 +257,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** Pop an element from keys0 (using the specified store) */ @@ -279,7 +265,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** @@ -291,7 +277,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -304,7 +291,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -317,7 +305,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -353,7 +342,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.setField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1))); } /** Set keys1 */ @@ -361,7 +350,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.setField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1))); } /** Set keys1 (using the specified store) */ @@ -369,7 +358,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.setField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 1, EncodeArray.encode((keys1))); } /** Get the length of keys1 */ @@ -377,7 +366,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 32; } @@ -388,7 +377,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 32; } @@ -399,7 +388,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 1, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 1); unchecked { return _byteLength / 32; } @@ -414,14 +403,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 1, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -435,14 +417,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 1, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -456,7 +431,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 1, _fieldLayout, _index * 32, (_index + 1) * 32); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 1, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -466,7 +441,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.pushToField(_tableId, _keyTuple, 1, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); } /** Push an element to keys1 */ @@ -474,7 +449,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.pushToField(_tableId, _keyTuple, 1, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); } /** Push an element to keys1 (using the specified store) */ @@ -482,7 +457,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.pushToField(_tableId, _keyTuple, 1, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 1, abi.encodePacked((_element))); } /** Pop an element from keys1 */ @@ -490,7 +465,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.popFromField(_tableId, _keyTuple, 1, 32, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 1, 32); } /** Pop an element from keys1 */ @@ -498,7 +473,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.popFromField(_tableId, _keyTuple, 1, 32, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 1, 32); } /** Pop an element from keys1 (using the specified store) */ @@ -506,7 +481,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.popFromField(_tableId, _keyTuple, 1, 32, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 1, 32); } /** @@ -518,7 +493,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 1, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -531,7 +507,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 1, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -544,7 +521,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - _store.updateInField(_tableId, _keyTuple, 1, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 1, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -580,7 +558,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.setField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2))); } /** Set keys2 */ @@ -588,7 +566,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.setField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2))); } /** Set keys2 (using the specified store) */ @@ -596,7 +574,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.setField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 2, EncodeArray.encode((keys2))); } /** Get the length of keys2 */ @@ -604,7 +582,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 32; } @@ -615,7 +593,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 32; } @@ -626,7 +604,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 2, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 2); unchecked { return _byteLength / 32; } @@ -641,14 +619,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 2, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -662,14 +633,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 2, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -683,7 +647,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 2, _fieldLayout, _index * 32, (_index + 1) * 32); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 2, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -693,7 +657,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element))); } /** Push an element to keys2 */ @@ -701,7 +665,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element))); } /** Push an element to keys2 (using the specified store) */ @@ -709,7 +673,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.pushToField(_tableId, _keyTuple, 2, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 2, abi.encodePacked((_element))); } /** Pop an element from keys2 */ @@ -717,7 +681,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.popFromField(_tableId, _keyTuple, 2, 32, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 2, 32); } /** Pop an element from keys2 */ @@ -725,7 +689,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.popFromField(_tableId, _keyTuple, 2, 32, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 2, 32); } /** Pop an element from keys2 (using the specified store) */ @@ -733,7 +697,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.popFromField(_tableId, _keyTuple, 2, 32, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 2, 32); } /** @@ -745,7 +709,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 2, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -758,7 +723,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 2, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -771,7 +737,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - _store.updateInField(_tableId, _keyTuple, 2, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 2, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -807,7 +774,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.setField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3))); } /** Set keys3 */ @@ -815,7 +782,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.setField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3))); } /** Set keys3 (using the specified store) */ @@ -823,7 +790,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.setField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 3, EncodeArray.encode((keys3))); } /** Get the length of keys3 */ @@ -831,7 +798,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 3); unchecked { return _byteLength / 32; } @@ -842,7 +809,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 3); unchecked { return _byteLength / 32; } @@ -853,7 +820,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 3, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 3); unchecked { return _byteLength / 32; } @@ -868,14 +835,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 3, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 3, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -889,14 +849,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 3, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 3, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -910,7 +863,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 3, _fieldLayout, _index * 32, (_index + 1) * 32); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 3, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -920,7 +873,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.pushToField(_tableId, _keyTuple, 3, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element))); } /** Push an element to keys3 */ @@ -928,7 +881,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.pushToField(_tableId, _keyTuple, 3, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element))); } /** Push an element to keys3 (using the specified store) */ @@ -936,7 +889,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.pushToField(_tableId, _keyTuple, 3, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 3, abi.encodePacked((_element))); } /** Pop an element from keys3 */ @@ -944,7 +897,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.popFromField(_tableId, _keyTuple, 3, 32, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 3, 32); } /** Pop an element from keys3 */ @@ -952,7 +905,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.popFromField(_tableId, _keyTuple, 3, 32, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 3, 32); } /** Pop an element from keys3 (using the specified store) */ @@ -960,7 +913,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.popFromField(_tableId, _keyTuple, 3, 32, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 3, 32); } /** @@ -972,7 +925,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 3, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 3, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -985,7 +939,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 3, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 3, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -998,7 +953,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - _store.updateInField(_tableId, _keyTuple, 3, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 3, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -1034,7 +990,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.setField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4))); } /** Set keys4 */ @@ -1042,7 +998,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.setField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4))); } /** Set keys4 (using the specified store) */ @@ -1050,7 +1006,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.setField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 4, EncodeArray.encode((keys4))); } /** Get the length of keys4 */ @@ -1058,7 +1014,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 4, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 4); unchecked { return _byteLength / 32; } @@ -1069,7 +1025,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 4, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 4); unchecked { return _byteLength / 32; } @@ -1080,7 +1036,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 4, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 4); unchecked { return _byteLength / 32; } @@ -1095,14 +1051,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 4, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 4, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -1116,14 +1065,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 4, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 4, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -1137,7 +1079,7 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 4, _fieldLayout, _index * 32, (_index + 1) * 32); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 4, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -1147,7 +1089,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.pushToField(_tableId, _keyTuple, 4, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element))); } /** Push an element to keys4 */ @@ -1155,7 +1097,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.pushToField(_tableId, _keyTuple, 4, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element))); } /** Push an element to keys4 (using the specified store) */ @@ -1163,7 +1105,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.pushToField(_tableId, _keyTuple, 4, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 4, abi.encodePacked((_element))); } /** Pop an element from keys4 */ @@ -1171,7 +1113,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.popFromField(_tableId, _keyTuple, 4, 32, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 4, 32); } /** Pop an element from keys4 */ @@ -1179,7 +1121,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreCore.popFromField(_tableId, _keyTuple, 4, 32, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 4, 32); } /** Pop an element from keys4 (using the specified store) */ @@ -1187,7 +1129,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.popFromField(_tableId, _keyTuple, 4, 32, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 4, 32); } /** @@ -1199,7 +1141,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 4, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 4, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -1212,7 +1155,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 4, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 4, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -1225,7 +1169,8 @@ library KeysInTable { _keyTuple[0] = sourceTable; unchecked { - _store.updateInField(_tableId, _keyTuple, 4, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 4, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -1284,7 +1229,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -1323,7 +1268,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -1335,7 +1280,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -1359,7 +1304,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -1432,7 +1377,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -1448,7 +1393,7 @@ library KeysInTable { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = sourceTable; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/world/src/modules/keysintable/tables/UsedKeysIndex.sol b/packages/world/src/modules/keysintable/tables/UsedKeysIndex.sol index 9cd905b612..5aa4220250 100644 --- a/packages/world/src/modules/keysintable/tables/UsedKeysIndex.sol +++ b/packages/world/src/modules/keysintable/tables/UsedKeysIndex.sol @@ -118,7 +118,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((has)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((has)), _fieldLayout); } /** Set has */ @@ -127,7 +127,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((has)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((has)), _fieldLayout); } /** Set has (using the specified store) */ @@ -136,7 +136,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((has)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((has)), _fieldLayout); } /** Get index */ @@ -175,7 +175,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((index)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((index)), _fieldLayout); } /** Set index */ @@ -184,7 +184,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((index)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((index)), _fieldLayout); } /** Set index (using the specified store) */ @@ -193,7 +193,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((index)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((index)), _fieldLayout); } /** Get the full data */ @@ -249,7 +249,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -277,7 +277,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -308,7 +308,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -326,7 +326,7 @@ library UsedKeysIndex { _keyTuple[0] = sourceTable; _keyTuple[1] = keysHash; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/modules/keyswithvalue/KeysWithValueHook.sol b/packages/world/src/modules/keyswithvalue/KeysWithValueHook.sol index 22e25b9d5b..aef1be86c6 100644 --- a/packages/world/src/modules/keyswithvalue/KeysWithValueHook.sol +++ b/packages/world/src/modules/keyswithvalue/KeysWithValueHook.sol @@ -61,7 +61,6 @@ contract KeysWithValueHook is StoreHook { ResourceId sourceTableId, bytes32[] memory keyTuple, uint48, - uint40, bytes memory ) public override { // Remove the key from the list of keys with the previous value @@ -75,7 +74,6 @@ contract KeysWithValueHook is StoreHook { ResourceId sourceTableId, bytes32[] memory keyTuple, uint48, - uint40, bytes memory ) public override { // Add the key to the list of keys with the new value diff --git a/packages/world/src/modules/keyswithvalue/tables/KeysWithValue.sol b/packages/world/src/modules/keyswithvalue/tables/KeysWithValue.sol index 7621b94d5f..eb6625f4dd 100644 --- a/packages/world/src/modules/keyswithvalue/tables/KeysWithValue.sol +++ b/packages/world/src/modules/keyswithvalue/tables/KeysWithValue.sol @@ -146,7 +146,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue))); } /** Set keysWithValue */ @@ -154,7 +154,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue))); } /** Set keysWithValue (using the specified store) */ @@ -167,7 +167,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue))); } /** Set keysWithValue */ @@ -175,7 +175,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue))); } /** Set keysWithValue */ @@ -183,7 +183,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue))); } /** Set keysWithValue (using the specified store) */ @@ -191,7 +191,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((keysWithValue))); } /** Get the length of keysWithValue */ @@ -199,7 +199,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -210,7 +210,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -221,7 +221,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -232,7 +232,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -243,7 +243,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -254,7 +254,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 32; } @@ -273,14 +273,7 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -298,14 +291,7 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -324,7 +310,7 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 32, (_index + 1) * 32); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -338,14 +324,7 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -359,14 +338,7 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 32, - (_index + 1) * 32 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -385,7 +357,7 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 32, (_index + 1) * 32); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 32, (_index + 1) * 32); return (bytes32(_blob)); } } @@ -395,7 +367,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to keysWithValue */ @@ -403,7 +375,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to keysWithValue (using the specified store) */ @@ -411,7 +383,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to keysWithValue */ @@ -419,7 +391,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to keysWithValue */ @@ -427,7 +399,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to keysWithValue (using the specified store) */ @@ -435,7 +407,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from keysWithValue */ @@ -443,7 +415,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** Pop an element from keysWithValue */ @@ -451,7 +423,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreCore.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** Pop an element from keysWithValue (using the specified store) */ @@ -459,7 +431,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - _store.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** Pop an element from keysWithValue */ @@ -467,7 +439,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** Pop an element from keysWithValue */ @@ -475,7 +447,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreCore.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** Pop an element from keysWithValue (using the specified store) */ @@ -483,7 +455,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - _store.popFromField(_tableId, _keyTuple, 0, 32, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 32); } /** @@ -495,7 +467,8 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -508,7 +481,8 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -527,7 +501,8 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -540,7 +515,8 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -553,7 +529,8 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -566,7 +543,8 @@ library KeysWithValue { _keyTuple[0] = valueHash; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 32, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 32), uint40(_encoded.length), _encoded); } } @@ -575,7 +553,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -591,7 +569,7 @@ library KeysWithValue { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = valueHash; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/world/src/modules/std-delegations/tables/CallboundDelegations.sol b/packages/world/src/modules/std-delegations/tables/CallboundDelegations.sol index 1cbdff95f9..cdf4002f24 100644 --- a/packages/world/src/modules/std-delegations/tables/CallboundDelegations.sol +++ b/packages/world/src/modules/std-delegations/tables/CallboundDelegations.sol @@ -202,7 +202,7 @@ library CallboundDelegations { _keyTuple[2] = systemId; _keyTuple[3] = callDataHash; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); } /** Set availableCalls */ @@ -219,7 +219,7 @@ library CallboundDelegations { _keyTuple[2] = systemId; _keyTuple[3] = callDataHash; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); } /** Set availableCalls (using the specified store) */ @@ -237,7 +237,7 @@ library CallboundDelegations { _keyTuple[2] = systemId; _keyTuple[3] = callDataHash; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); } /** Set availableCalls */ @@ -254,7 +254,7 @@ library CallboundDelegations { _keyTuple[2] = systemId; _keyTuple[3] = callDataHash; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); } /** Set availableCalls */ @@ -271,7 +271,7 @@ library CallboundDelegations { _keyTuple[2] = systemId; _keyTuple[3] = callDataHash; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); } /** Set availableCalls (using the specified store) */ @@ -289,7 +289,7 @@ library CallboundDelegations { _keyTuple[2] = systemId; _keyTuple[3] = callDataHash; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((availableCalls)), _fieldLayout); } /** Delete all data for given keys */ @@ -300,7 +300,7 @@ library CallboundDelegations { _keyTuple[2] = systemId; _keyTuple[3] = callDataHash; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -328,7 +328,7 @@ library CallboundDelegations { _keyTuple[2] = systemId; _keyTuple[3] = callDataHash; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/modules/std-delegations/tables/TimeboundDelegations.sol b/packages/world/src/modules/std-delegations/tables/TimeboundDelegations.sol index a8393b5e2f..977442857c 100644 --- a/packages/world/src/modules/std-delegations/tables/TimeboundDelegations.sol +++ b/packages/world/src/modules/std-delegations/tables/TimeboundDelegations.sol @@ -150,7 +150,7 @@ library TimeboundDelegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); } /** Set maxTimestamp */ @@ -159,7 +159,7 @@ library TimeboundDelegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); } /** Set maxTimestamp (using the specified store) */ @@ -168,7 +168,7 @@ library TimeboundDelegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); } /** Set maxTimestamp */ @@ -177,7 +177,7 @@ library TimeboundDelegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); } /** Set maxTimestamp */ @@ -186,7 +186,7 @@ library TimeboundDelegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); } /** Set maxTimestamp (using the specified store) */ @@ -195,7 +195,7 @@ library TimeboundDelegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((maxTimestamp)), _fieldLayout); } /** Delete all data for given keys */ @@ -204,7 +204,7 @@ library TimeboundDelegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -222,7 +222,7 @@ library TimeboundDelegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/modules/uniqueentity/tables/UniqueEntity.sol b/packages/world/src/modules/uniqueentity/tables/UniqueEntity.sol index 0d1b5db6d8..a62887d571 100644 --- a/packages/world/src/modules/uniqueentity/tables/UniqueEntity.sol +++ b/packages/world/src/modules/uniqueentity/tables/UniqueEntity.sol @@ -123,49 +123,49 @@ library UniqueEntity { function setValue(ResourceId _tableId, uint256 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _setValue(ResourceId _tableId, uint256 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function setValue(IStore _store, ResourceId _tableId, uint256 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function set(ResourceId _tableId, uint256 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _set(ResourceId _tableId, uint256 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function set(IStore _store, ResourceId _tableId, uint256 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Delete all data for given keys */ function deleteRecord(ResourceId _tableId) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -179,7 +179,7 @@ library UniqueEntity { function deleteRecord(IStore _store, ResourceId _tableId) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/tables/Delegations.sol b/packages/world/src/tables/Delegations.sol index 1b241f93e0..5e02211c4e 100644 --- a/packages/world/src/tables/Delegations.sol +++ b/packages/world/src/tables/Delegations.sol @@ -160,7 +160,7 @@ library Delegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); } /** Set delegationControlId */ @@ -169,7 +169,7 @@ library Delegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); } /** Set delegationControlId (using the specified store) */ @@ -183,7 +183,7 @@ library Delegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); } /** Set delegationControlId */ @@ -192,7 +192,7 @@ library Delegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); } /** Set delegationControlId */ @@ -201,7 +201,7 @@ library Delegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); } /** Set delegationControlId (using the specified store) */ @@ -210,7 +210,7 @@ library Delegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((delegationControlId)), _fieldLayout); } /** Delete all data for given keys */ @@ -219,7 +219,7 @@ library Delegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -237,7 +237,7 @@ library Delegations { _keyTuple[0] = bytes32(uint256(uint160(delegator))); _keyTuple[1] = bytes32(uint256(uint160(delegatee))); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/tables/InstalledModules.sol b/packages/world/src/tables/InstalledModules.sol index 5b80739eff..e030d1fec9 100644 --- a/packages/world/src/tables/InstalledModules.sol +++ b/packages/world/src/tables/InstalledModules.sol @@ -150,7 +150,7 @@ library InstalledModules { _keyTuple[0] = bytes32(moduleName); _keyTuple[1] = argumentsHash; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); } /** Set moduleAddress */ @@ -159,7 +159,7 @@ library InstalledModules { _keyTuple[0] = bytes32(moduleName); _keyTuple[1] = argumentsHash; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); } /** Set moduleAddress (using the specified store) */ @@ -168,7 +168,7 @@ library InstalledModules { _keyTuple[0] = bytes32(moduleName); _keyTuple[1] = argumentsHash; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); } /** Set moduleAddress */ @@ -177,7 +177,7 @@ library InstalledModules { _keyTuple[0] = bytes32(moduleName); _keyTuple[1] = argumentsHash; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); } /** Set moduleAddress */ @@ -186,7 +186,7 @@ library InstalledModules { _keyTuple[0] = bytes32(moduleName); _keyTuple[1] = argumentsHash; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); } /** Set moduleAddress (using the specified store) */ @@ -195,7 +195,7 @@ library InstalledModules { _keyTuple[0] = bytes32(moduleName); _keyTuple[1] = argumentsHash; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((moduleAddress)), _fieldLayout); } /** Delete all data for given keys */ @@ -204,7 +204,7 @@ library InstalledModules { _keyTuple[0] = bytes32(moduleName); _keyTuple[1] = argumentsHash; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -222,7 +222,7 @@ library InstalledModules { _keyTuple[0] = bytes32(moduleName); _keyTuple[1] = argumentsHash; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/tables/NamespaceOwner.sol b/packages/world/src/tables/NamespaceOwner.sol index 62832ecd4b..b47c56e645 100644 --- a/packages/world/src/tables/NamespaceOwner.sol +++ b/packages/world/src/tables/NamespaceOwner.sol @@ -137,7 +137,7 @@ library NamespaceOwner { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); } /** Set owner */ @@ -145,7 +145,7 @@ library NamespaceOwner { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); } /** Set owner (using the specified store) */ @@ -153,7 +153,7 @@ library NamespaceOwner { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); } /** Set owner */ @@ -161,7 +161,7 @@ library NamespaceOwner { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); } /** Set owner */ @@ -169,7 +169,7 @@ library NamespaceOwner { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); } /** Set owner (using the specified store) */ @@ -177,7 +177,7 @@ library NamespaceOwner { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout); } /** Delete all data for given keys */ @@ -185,7 +185,7 @@ library NamespaceOwner { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -201,7 +201,7 @@ library NamespaceOwner { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = namespaceId; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/src/tables/ResourceAccess.sol b/packages/world/src/tables/ResourceAccess.sol index 57ee1ea25e..37c4d3266b 100644 --- a/packages/world/src/tables/ResourceAccess.sol +++ b/packages/world/src/tables/ResourceAccess.sol @@ -146,7 +146,7 @@ library ResourceAccess { _keyTuple[0] = resourceId; _keyTuple[1] = bytes32(uint256(uint160(caller))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); } /** Set access */ @@ -155,7 +155,7 @@ library ResourceAccess { _keyTuple[0] = resourceId; _keyTuple[1] = bytes32(uint256(uint160(caller))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); } /** Set access (using the specified store) */ @@ -164,7 +164,7 @@ library ResourceAccess { _keyTuple[0] = resourceId; _keyTuple[1] = bytes32(uint256(uint160(caller))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); } /** Set access */ @@ -173,7 +173,7 @@ library ResourceAccess { _keyTuple[0] = resourceId; _keyTuple[1] = bytes32(uint256(uint160(caller))); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); } /** Set access */ @@ -182,7 +182,7 @@ library ResourceAccess { _keyTuple[0] = resourceId; _keyTuple[1] = bytes32(uint256(uint160(caller))); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); } /** Set access (using the specified store) */ @@ -191,7 +191,7 @@ library ResourceAccess { _keyTuple[0] = resourceId; _keyTuple[1] = bytes32(uint256(uint160(caller))); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((access)), _fieldLayout); } /** Delete all data for given keys */ @@ -200,7 +200,7 @@ library ResourceAccess { _keyTuple[0] = resourceId; _keyTuple[1] = bytes32(uint256(uint160(caller))); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -218,7 +218,7 @@ library ResourceAccess { _keyTuple[0] = resourceId; _keyTuple[1] = bytes32(uint256(uint160(caller))); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/test/KeysInTableModule.t.sol b/packages/world/test/KeysInTableModule.t.sol index 00072be318..80cbd901b7 100644 --- a/packages/world/test/KeysInTableModule.t.sol +++ b/packages/world/test/KeysInTableModule.t.sol @@ -108,14 +108,7 @@ contract KeysInTableModuleTest is Test, GasReporter { bytes32[] memory keyTuple = new bytes32[](0); - world.setRecord( - singletonTableId, - keyTuple, - abi.encodePacked(val1), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(singletonTableId, keyTuple, abi.encodePacked(val1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get the list of keys in this target table bytes32[][] memory keysInTable = getKeysInTable(world, singletonTableId); @@ -132,14 +125,7 @@ contract KeysInTableModuleTest is Test, GasReporter { keyTuple[1] = "two"; keyTuple[2] = "three"; - world.setRecord( - compositeTableId, - keyTuple, - abi.encodePacked(val1), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(compositeTableId, keyTuple, abi.encodePacked(val1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get the list of keys in this target table bytes32[][] memory keysInTable = getKeysInTable(world, compositeTableId); @@ -164,14 +150,7 @@ contract KeysInTableModuleTest is Test, GasReporter { _installKeysInTableModule(); // Set a value in the source table startGasReport("set a record on a table with keysInTableModule installed"); - world.setRecord( - tableId, - keyTuple1, - abi.encodePacked(value), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value), PackedCounter.wrap(bytes32(0)), new bytes(0)); endGasReport(); // Get the list of keys in this target table @@ -190,14 +169,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Set a value in the source table startGasReport("set a record on a table with keysInTableModule installed (first)"); - world.setRecord( - tableId, - keyTuple, - abi.encodePacked(value1), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(tableId, keyTuple, abi.encodePacked(value1), PackedCounter.wrap(bytes32(0)), new bytes(0)); endGasReport(); // Get the list of keys in the first target table @@ -229,14 +201,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Set a value in the source table startGasReport("set a record on a table with keysInTableModule installed (second)"); - world.setRecord( - sourceTableId2, - keyTuple, - abi.encodePacked(value2), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(sourceTableId2, keyTuple, abi.encodePacked(value2), PackedCounter.wrap(bytes32(0)), new bytes(0)); endGasReport(); // Get the list of keys in the second target table @@ -256,14 +221,7 @@ contract KeysInTableModuleTest is Test, GasReporter { _installKeysInTableModule(); // Set a value in the source table - world.setRecord( - tableId, - keyTuple1, - abi.encodePacked(value1), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get the list of keys in the target table bytes32[][] memory keysInTable = getKeysInTable(world, tableId); @@ -273,14 +231,7 @@ contract KeysInTableModuleTest is Test, GasReporter { assertEq(keysInTable[0][0], key1, "2"); // Set another key with the same value - world.setRecord( - tableId, - keyTuple2, - abi.encodePacked(value1), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(tableId, keyTuple2, abi.encodePacked(value1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get the list of keys in the target table keysInTable = getKeysInTable(world, tableId); @@ -292,14 +243,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Change the value of the first key startGasReport("change a record on a table with keysInTableModule installed"); - world.setRecord( - tableId, - keyTuple1, - abi.encodePacked(value2), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value2), PackedCounter.wrap(bytes32(0)), new bytes(0)); endGasReport(); // Get the list of keys in the target table @@ -312,7 +256,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Delete the first key startGasReport("delete a record on a table with keysInTableModule installed"); - world.deleteRecord(tableId, keyTuple1, tableFieldLayout); + world.deleteRecord(tableId, keyTuple1); endGasReport(); // Get the list of keys in the target table @@ -347,8 +291,7 @@ contract KeysInTableModuleTest is Test, GasReporter { keyTupleA, abi.encodePacked(value1), PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout + new bytes(0) ); // Get the list of keys in the target table @@ -366,8 +309,7 @@ contract KeysInTableModuleTest is Test, GasReporter { keyTupleB, abi.encodePacked(value1), PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout + new bytes(0) ); // Get the list of keys in the target table @@ -389,8 +331,7 @@ contract KeysInTableModuleTest is Test, GasReporter { keyTupleA, abi.encodePacked(value2), PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout + new bytes(0) ); endGasReport(); @@ -408,7 +349,7 @@ contract KeysInTableModuleTest is Test, GasReporter { // Delete the first key startGasReport("delete a composite record on a table with keysInTableModule installed"); - world.deleteRecord(compositeTableId, keyTupleA, tableFieldLayout); + world.deleteRecord(compositeTableId, keyTupleA); endGasReport(); // Get the list of keys in the target table @@ -453,14 +394,7 @@ contract KeysInTableModuleTest is Test, GasReporter { _installKeysInTableModule(); // Set a value in the source table - world.setRecord( - tableId, - keyTuple1, - abi.encodePacked(value1), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value1), PackedCounter.wrap(bytes32(0)), new bytes(0)); startGasReport("Get list of keys in a given table"); bytes32[][] memory keysInTable = getKeysInTable(world, tableId); @@ -471,14 +405,7 @@ contract KeysInTableModuleTest is Test, GasReporter { assertEq(keysInTable[0][0], key1); // Set another key with a different value - world.setRecord( - tableId, - keyTuple2, - abi.encodePacked(value2), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(tableId, keyTuple2, abi.encodePacked(value2), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get the list of keys in the target table keysInTable = getKeysInTable(world, tableId); @@ -493,35 +420,14 @@ contract KeysInTableModuleTest is Test, GasReporter { _installKeysInTableModule(); // Add 3 values - world.setRecord( - tableId, - keyTuple1, - abi.encodePacked(value), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); - world.setRecord( - tableId, - keyTuple2, - abi.encodePacked(value), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); - world.setRecord( - tableId, - keyTuple3, - abi.encodePacked(value), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - tableFieldLayout - ); + world.setRecord(tableId, keyTuple1, abi.encodePacked(value), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(tableId, keyTuple2, abi.encodePacked(value), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(tableId, keyTuple3, abi.encodePacked(value), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Remove 2, starting from the middle // This tests that KeysInTable correctly tracks swaps indexes - world.deleteRecord(tableId, keyTuple2, tableFieldLayout); - world.deleteRecord(tableId, keyTuple3, tableFieldLayout); + world.deleteRecord(tableId, keyTuple2); + world.deleteRecord(tableId, keyTuple3); // Get the list of keys in the target table bytes32[][] memory keysInTable = getKeysInTable(world, tableId); diff --git a/packages/world/test/KeysWithValueModule.t.sol b/packages/world/test/KeysWithValueModule.t.sol index ab05c20aaa..8be0d88fe4 100644 --- a/packages/world/test/KeysWithValueModule.t.sol +++ b/packages/world/test/KeysWithValueModule.t.sol @@ -89,14 +89,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { uint256 value = 1; startGasReport("set a record on a table with KeysWithValueModule installed"); - world.setRecord( - sourceTableId, - keyTuple1, - abi.encodePacked(value), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - sourceTableFieldLayout - ); + world.setRecord(sourceTableId, keyTuple1, abi.encodePacked(value), PackedCounter.wrap(bytes32(0)), new bytes(0)); endGasReport(); // Get the list of entities with this value from the target table @@ -113,14 +106,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { // Set a value in the source table uint256 value1 = 1; - world.setRecord( - sourceTableId, - keyTuple1, - abi.encodePacked(value1), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - sourceTableFieldLayout - ); + world.setRecord(sourceTableId, keyTuple1, abi.encodePacked(value1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get the list of entities with value1 from the target table bytes32[] memory keysWithValue = KeysWithValue.get(world, targetTableId, keccak256(abi.encodePacked(value1))); @@ -130,14 +116,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { assertEq(keysWithValue[0], key1, "2"); // Set a another key with the same value - world.setRecord( - sourceTableId, - keyTuple2, - abi.encodePacked(value1), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - sourceTableFieldLayout - ); + world.setRecord(sourceTableId, keyTuple2, abi.encodePacked(value1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get the list of entities with value2 from the target table keysWithValue = KeysWithValue.get(world, targetTableId, keccak256(abi.encodePacked(value1))); @@ -151,14 +130,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { uint256 value2 = 2; startGasReport("change a record on a table with KeysWithValueModule installed"); - world.setRecord( - sourceTableId, - keyTuple1, - abi.encodePacked(value2), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - sourceTableFieldLayout - ); + world.setRecord(sourceTableId, keyTuple1, abi.encodePacked(value2), PackedCounter.wrap(bytes32(0)), new bytes(0)); endGasReport(); // Get the list of entities with value1 from the target table @@ -177,7 +149,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { // Delete the first key startGasReport("delete a record on a table with KeysWithValueModule installed"); - world.deleteRecord(sourceTableId, keyTuple1, sourceTableFieldLayout); + world.deleteRecord(sourceTableId, keyTuple1); endGasReport(); // Get the list of entities with value2 from the target table @@ -260,14 +232,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { _installKeysWithValueModule(); // Set a value in the source table - world.setRecord( - sourceTableId, - keyTuple1, - abi.encodePacked(value), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - sourceTableFieldLayout - ); + world.setRecord(sourceTableId, keyTuple1, abi.encodePacked(value), PackedCounter.wrap(bytes32(0)), new bytes(0)); startGasReport("Get list of keys with a given value"); bytes32[] memory keysWithValue = getKeysWithValue( @@ -284,14 +249,7 @@ contract KeysWithValueModuleTest is Test, GasReporter { assertEq(keysWithValue[0], key1); // Set a another key with the same value - world.setRecord( - sourceTableId, - keyTuple2, - abi.encodePacked(value), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - sourceTableFieldLayout - ); + world.setRecord(sourceTableId, keyTuple2, abi.encodePacked(value), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Get the list of keys with value from the target table keysWithValue = getKeysWithValue( diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index 50abcff526..62f9cd4796 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -98,22 +98,14 @@ contract WorldTestSystem is System { FieldLayout fieldLayout = StoreSwitch.getFieldLayout(tableId); if (StoreSwitch.getStoreAddress() == address(this)) { - StoreCore.setRecord( - tableId, - keyTuple, - abi.encodePacked(data), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - fieldLayout - ); + StoreCore.setRecord(tableId, keyTuple, abi.encodePacked(data), PackedCounter.wrap(bytes32(0)), new bytes(0)); } else { IBaseWorld(msg.sender).setRecord( tableId, keyTuple, abi.encodePacked(data), PackedCounter.wrap(bytes32(0)), - new bytes(0), - fieldLayout + new bytes(0) ); } } @@ -795,11 +787,13 @@ contract WorldTest is Test, GasReporter { // Expect the World to not have access vm.prank(address(world)); - vm.expectRevert(abi.encodeWithSelector(IWorldErrors.World_CallbackNotAllowed.selector, world.setField.selector)); - world.setField(tableId, singletonKey, 0, abi.encodePacked(true), fieldLayout); + vm.expectRevert( + abi.encodeWithSelector(IWorldErrors.World_CallbackNotAllowed.selector, world.setStaticField.selector) + ); + world.setStaticField(tableId, singletonKey, 0, abi.encodePacked(true), fieldLayout); } - function testPushToField() public { + function testPushToDynamicField() public { bytes14 namespace = "testPushField"; bytes16 name = "testTable"; ResourceId tableId = WorldResourceIdLib.encode({ typeId: RESOURCE_TABLE, namespace: namespace, name: name }); @@ -817,29 +811,31 @@ contract WorldTest is Test, GasReporter { bytes memory encodedData = EncodeArray.encode(dataToPush); startGasReport("Push data to the table"); - world.pushToField(tableId, keyTuple, 0, encodedData, fieldLayout); + world.pushToDynamicField(tableId, keyTuple, 0, encodedData); endGasReport(); // Expect the data to be written assertEq(AddressArray.get(world, tableId, key), dataToPush); // Delete the data - world.deleteRecord(tableId, keyTuple, fieldLayout); + world.deleteRecord(tableId, keyTuple); // Push data to the table via direct access - world.pushToField(tableId, keyTuple, 0, encodedData, fieldLayout); + world.pushToDynamicField(tableId, keyTuple, 0, encodedData); // Expect the data to be written assertEq(AddressArray.get(world, tableId, key), dataToPush); // Expect an error when trying to write from an address that doesn't have access _expectAccessDenied(address(0x01), namespace, name, RESOURCE_TABLE); - world.pushToField(tableId, keyTuple, 0, encodedData, fieldLayout); + world.pushToDynamicField(tableId, keyTuple, 0, encodedData); // Expect the World to not have access vm.prank(address(world)); - vm.expectRevert(abi.encodeWithSelector(IWorldErrors.World_CallbackNotAllowed.selector, world.pushToField.selector)); - world.pushToField(tableId, keyTuple, 0, encodedData, fieldLayout); + vm.expectRevert( + abi.encodeWithSelector(IWorldErrors.World_CallbackNotAllowed.selector, world.pushToDynamicField.selector) + ); + world.pushToDynamicField(tableId, keyTuple, 0, encodedData); } function testDeleteRecord() public { @@ -853,45 +849,31 @@ contract WorldTest is Test, GasReporter { world.registerTable(tableId, fieldLayout, defaultKeySchema, valueSchema, new string[](1), new string[](1)); // Write data to the table and expect it to be written - world.setRecord( - tableId, - singletonKey, - abi.encodePacked(true), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - fieldLayout - ); + world.setRecord(tableId, singletonKey, abi.encodePacked(true), PackedCounter.wrap(bytes32(0)), new bytes(0)); assertTrue(Bool.get(world, tableId)); startGasReport("Delete record"); - world.deleteRecord(tableId, singletonKey, fieldLayout); + world.deleteRecord(tableId, singletonKey); endGasReport(); // expect it to be deleted assertFalse(Bool.get(world, tableId)); // Write data to the table and expect it to be written - world.setRecord( - tableId, - singletonKey, - abi.encodePacked(true), - PackedCounter.wrap(bytes32(0)), - new bytes(0), - fieldLayout - ); + world.setRecord(tableId, singletonKey, abi.encodePacked(true), PackedCounter.wrap(bytes32(0)), new bytes(0)); assertTrue(Bool.get(world, tableId)); assertTrue(Bool.get(world, tableId)); // Expect an error when trying to delete from an address that doesn't have access _expectAccessDenied(address(0x02), namespace, name, RESOURCE_TABLE); - world.deleteRecord(tableId, singletonKey, fieldLayout); + world.deleteRecord(tableId, singletonKey); // Expect the World to not have access vm.prank(address(world)); vm.expectRevert( abi.encodeWithSelector(IWorldErrors.World_CallbackNotAllowed.selector, world.deleteRecord.selector) ); - world.deleteRecord(tableId, singletonKey, fieldLayout); + world.deleteRecord(tableId, singletonKey); } function testCall() public { @@ -1093,24 +1075,14 @@ contract WorldTest is Test, GasReporter { ) ); - world.setRecord(tableId, singletonKey, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0), fieldLayout); + world.setRecord(tableId, singletonKey, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0)); // Expect the hook to be notified when a static field is written (once before and once after the field is written) vm.expectEmit(true, true, true, true); - emit HookCalled( - abi.encodeCall( - IStoreHook.onBeforeSpliceStaticData, - (tableId, singletonKey, 0, uint40(staticData.length), staticData) - ) - ); + emit HookCalled(abi.encodeCall(IStoreHook.onBeforeSpliceStaticData, (tableId, singletonKey, 0, staticData))); vm.expectEmit(true, true, true, true); - emit HookCalled( - abi.encodeCall( - IStoreHook.onAfterSpliceStaticData, - (tableId, singletonKey, 0, uint40(staticData.length), staticData) - ) - ); + emit HookCalled(abi.encodeCall(IStoreHook.onAfterSpliceStaticData, (tableId, singletonKey, 0, staticData))); world.setField(tableId, singletonKey, 0, staticData, fieldLayout); @@ -1121,7 +1093,7 @@ contract WorldTest is Test, GasReporter { vm.expectEmit(true, true, true, true); emit HookCalled(abi.encodeCall(IStoreHook.onAfterDeleteRecord, (tableId, singletonKey, fieldLayout))); - world.deleteRecord(tableId, singletonKey, fieldLayout); + world.deleteRecord(tableId, singletonKey); // Expect an error when trying to register an address that doesn't implement the IStoreHook interface vm.expectRevert( @@ -1154,7 +1126,7 @@ contract WorldTest is Test, GasReporter { // Expect a revert when the RevertSubscriber's onBeforeSetRecord hook is called vm.expectRevert(bytes("onBeforeSetRecord")); - world.setRecord(tableId, singletonKey, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0), fieldLayout); + world.setRecord(tableId, singletonKey, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0)); // Expect a revert when the RevertSubscriber's onBeforeSpliceStaticData hook is called vm.expectRevert(bytes("onBeforeSpliceStaticData")); @@ -1162,7 +1134,7 @@ contract WorldTest is Test, GasReporter { // Expect a revert when the RevertSubscriber's onBeforeDeleteRecord hook is called vm.expectRevert(bytes("onBeforeDeleteRecord")); - world.deleteRecord(tableId, singletonKey, fieldLayout); + world.deleteRecord(tableId, singletonKey); // Unregister the RevertSubscriber world.unregisterStoreHook(tableId, revertSubscriber); @@ -1184,24 +1156,14 @@ contract WorldTest is Test, GasReporter { ) ); - world.setRecord(tableId, singletonKey, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0), fieldLayout); + world.setRecord(tableId, singletonKey, staticData, PackedCounter.wrap(bytes32(0)), new bytes(0)); // Expect the hook to be notified when a static field is written (once before and once after the field is written) vm.expectEmit(true, true, true, true); - emit HookCalled( - abi.encodeCall( - IStoreHook.onBeforeSpliceStaticData, - (tableId, singletonKey, 0, uint40(staticData.length), staticData) - ) - ); + emit HookCalled(abi.encodeCall(IStoreHook.onBeforeSpliceStaticData, (tableId, singletonKey, 0, staticData))); vm.expectEmit(true, true, true, true); - emit HookCalled( - abi.encodeCall( - IStoreHook.onAfterSpliceStaticData, - (tableId, singletonKey, 0, uint40(staticData.length), staticData) - ) - ); + emit HookCalled(abi.encodeCall(IStoreHook.onAfterSpliceStaticData, (tableId, singletonKey, 0, staticData))); world.setField(tableId, singletonKey, 0, staticData, fieldLayout); @@ -1212,7 +1174,7 @@ contract WorldTest is Test, GasReporter { vm.expectEmit(true, true, true, true); emit HookCalled(abi.encodeCall(IStoreHook.onAfterDeleteRecord, (tableId, singletonKey, fieldLayout))); - world.deleteRecord(tableId, singletonKey, fieldLayout); + world.deleteRecord(tableId, singletonKey); } function testRegisterSystemHook() public { diff --git a/packages/world/test/WorldDynamicUpdate.t.sol b/packages/world/test/WorldDynamicUpdate.t.sol index 3d054da1e7..493e120065 100644 --- a/packages/world/test/WorldDynamicUpdate.t.sol +++ b/packages/world/test/WorldDynamicUpdate.t.sol @@ -26,7 +26,7 @@ import { CoreModule } from "../src/modules/core/CoreModule.sol"; import { IBaseWorld } from "../src/interfaces/IBaseWorld.sol"; import { IWorldErrors } from "../src/interfaces/IWorldErrors.sol"; -contract UpdateInFieldTest is Test, GasReporter { +contract UpdateInDynamicFieldTest is Test, GasReporter { using WorldResourceIdInstance for ResourceId; event HookCalled(bytes data); @@ -81,7 +81,7 @@ contract UpdateInFieldTest is Test, GasReporter { vm.expectRevert(abi.encodeWithSelector(IWorldErrors.World_AccessDenied.selector, _tableId.toString(), _caller)); } - function testPopFromField() public { + function testPopFromDynamicField() public { FieldLayout fieldLayout = AddressArray.getFieldLayout(); // Expect the data to be written @@ -91,7 +91,7 @@ contract UpdateInFieldTest is Test, GasReporter { uint256 byteLengthToPop = 20; startGasReport("pop 1 address (cold)"); - world.popFromField(tableId, keyTuple, 0, byteLengthToPop, fieldLayout); + world.popFromDynamicField(tableId, keyTuple, 0, byteLengthToPop); endGasReport(); // Expect the data to be updated @@ -105,7 +105,7 @@ contract UpdateInFieldTest is Test, GasReporter { byteLengthToPop = 20; startGasReport("pop 1 address (warm)"); - world.popFromField(tableId, keyTuple, 0, byteLengthToPop, fieldLayout); + world.popFromDynamicField(tableId, keyTuple, 0, byteLengthToPop); endGasReport(); // Expect the data to be updated @@ -119,7 +119,7 @@ contract UpdateInFieldTest is Test, GasReporter { world.setField(tableId, keyTuple, 0, encodedData, fieldLayout); // Pop 2 items via direct access byteLengthToPop = 20 * 2; - world.popFromField(tableId, keyTuple, 0, byteLengthToPop, fieldLayout); + world.popFromDynamicField(tableId, keyTuple, 0, byteLengthToPop); // Expect the data to be updated loadedData = AddressArray.get(world, tableId, key); assertEq(loadedData.length, initData.length - 2); @@ -129,17 +129,17 @@ contract UpdateInFieldTest is Test, GasReporter { // Expect an error when trying to write from an address that doesn't have access _expectAccessDenied(address(0x01), tableId); - world.popFromField(tableId, keyTuple, 0, 20, fieldLayout); + world.popFromDynamicField(tableId, keyTuple, 0, 20); // Expect the World to not have access vm.prank(address(world)); vm.expectRevert( - abi.encodeWithSelector(IWorldErrors.World_CallbackNotAllowed.selector, world.popFromField.selector) + abi.encodeWithSelector(IWorldErrors.World_CallbackNotAllowed.selector, world.popFromDynamicField.selector) ); - world.popFromField(tableId, keyTuple, 0, 20, fieldLayout); + world.popFromDynamicField(tableId, keyTuple, 0, 20); } - function testUpdateInField() public { + function testSpliceDynamicData() public { FieldLayout fieldLayout = AddressArray.getFieldLayout(); // Expect the data to be written @@ -148,13 +148,14 @@ contract UpdateInFieldTest is Test, GasReporter { // Update index 0 address[] memory dataForUpdate = new address[](1); dataForUpdate[0] = address(bytes20(keccak256("address for update"))); + bytes memory encodedDataForUpdate = EncodeArray.encode(dataForUpdate); - startGasReport("updateInField 1 item (cold)"); - world.updateInField(tableId, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), fieldLayout); + startGasReport("update in field 1 item (cold)"); + world.spliceDynamicData(tableId, keyTuple, 0, uint40(0), uint40(encodedDataForUpdate.length), encodedDataForUpdate); endGasReport(); - startGasReport("updateInField 1 item (warm)"); - world.updateInField(tableId, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), fieldLayout); + startGasReport("update in field 1 item (warm)"); + world.spliceDynamicData(tableId, keyTuple, 0, uint40(0), uint40(encodedDataForUpdate.length), encodedDataForUpdate); endGasReport(); // Expect the data to be updated @@ -162,7 +163,14 @@ contract UpdateInFieldTest is Test, GasReporter { assertEq(AddressArray.get(world, tableId, key), initData); // Update index 1 via direct access - world.updateInField(tableId, keyTuple, 0, 20 * 1, EncodeArray.encode(dataForUpdate), fieldLayout); + world.spliceDynamicData( + tableId, + keyTuple, + 0, + uint40(20 * 1), + uint40(encodedDataForUpdate.length), + encodedDataForUpdate + ); // Expect the data to be updated initData[1] = dataForUpdate[0]; @@ -170,13 +178,13 @@ contract UpdateInFieldTest is Test, GasReporter { // Expect an error when trying to write from an address that doesn't have access _expectAccessDenied(address(0x01), tableId); - world.updateInField(tableId, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), fieldLayout); + world.spliceDynamicData(tableId, keyTuple, 0, uint40(0), uint40(encodedDataForUpdate.length), encodedDataForUpdate); // Expect the World to not have access vm.prank(address(world)); vm.expectRevert( - abi.encodeWithSelector(IWorldErrors.World_CallbackNotAllowed.selector, world.updateInField.selector) + abi.encodeWithSelector(IWorldErrors.World_CallbackNotAllowed.selector, world.spliceDynamicData.selector) ); - world.updateInField(tableId, keyTuple, 0, 0, EncodeArray.encode(dataForUpdate), fieldLayout); + world.spliceDynamicData(tableId, keyTuple, 0, uint40(0), uint40(encodedDataForUpdate.length), encodedDataForUpdate); } } diff --git a/packages/world/test/query.t.sol b/packages/world/test/query.t.sol index 3b0cb7155e..87d3d0e64b 100644 --- a/packages/world/test/query.t.sol +++ b/packages/world/test/query.t.sol @@ -92,9 +92,9 @@ contract QueryTest is Test, GasReporter { function testHasQuery() public { _installKeysInTableModule(); - world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key1, abi.encode(0), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key1, abi.encode(0), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all keys in table1 QueryFragment[] memory fragments = new QueryFragment[](1); @@ -113,9 +113,9 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(table1, key1, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, key1, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all keys in table1 with value 1 QueryFragment[] memory fragments = new QueryFragment[](1); fragments[0] = QueryFragment(QueryType.HasValue, table1, abi.encode(1)); @@ -131,12 +131,12 @@ contract QueryTest is Test, GasReporter { function testCombinedHasQuery() public { _installKeysInTableModule(); - world.setRecord(table1, key1, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table3, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, key1, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table3, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -155,12 +155,12 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(table1, key1, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table3, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, key1, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table3, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -178,13 +178,13 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key3, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key4, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key3, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key4, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -202,13 +202,13 @@ contract QueryTest is Test, GasReporter { function testCombinedHasNotQuery() public { _installKeysInTableModule(); - world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key3, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key4, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key3, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key4, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -226,13 +226,13 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key4, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key4, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all entities that have table1 and table2 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -250,16 +250,16 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table2, key4, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table3, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table3, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table3, key4, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key1, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key2, abi.encode(2), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table2, key4, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table3, key2, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table3, key3, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table3, key4, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all entities that have table2 and not table1 QueryFragment[] memory fragments = new QueryFragment[](3); @@ -278,9 +278,9 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); _installKeysWithValueModule(); - world.setRecord(table1, key1, abi.encode(4), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key2, abi.encode(5), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); - world.setRecord(table1, key3, abi.encode(6), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, key1, abi.encode(4), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key2, abi.encode(5), PackedCounter.wrap(bytes32(0)), new bytes(0)); + world.setRecord(table1, key3, abi.encode(6), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all entities with table1 except value 6 QueryFragment[] memory fragments = new QueryFragment[](2); @@ -301,9 +301,9 @@ contract QueryTest is Test, GasReporter { for (uint256 i; i < 100; i++) { bytes32[] memory keyTuple = new bytes32[](1); keyTuple[0] = bytes32(i); - world.setRecord(table1, keyTuple, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, keyTuple, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); } - world.setRecord(table2, key1, abi.encode(0), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table2, key1, abi.encode(0), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all keys in table1 QueryFragment[] memory fragments = new QueryFragment[](1); @@ -322,9 +322,9 @@ contract QueryTest is Test, GasReporter { for (uint256 i; i < 1000; i++) { bytes32[] memory keyTuple = new bytes32[](1); keyTuple[0] = bytes32(i); - world.setRecord(table1, keyTuple, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table1, keyTuple, abi.encode(1), PackedCounter.wrap(bytes32(0)), new bytes(0)); } - world.setRecord(table2, key1, abi.encode(0), PackedCounter.wrap(bytes32(0)), new bytes(0), tableFieldLayout); + world.setRecord(table2, key1, abi.encode(0), PackedCounter.wrap(bytes32(0)), new bytes(0)); // Query should return all keys in table1 QueryFragment[] memory fragments = new QueryFragment[](1); diff --git a/packages/world/test/tables/AddressArray.sol b/packages/world/test/tables/AddressArray.sol index 26a7d7775b..b9e4230eef 100644 --- a/packages/world/test/tables/AddressArray.sol +++ b/packages/world/test/tables/AddressArray.sol @@ -132,7 +132,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -140,7 +140,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -148,7 +148,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -156,7 +156,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreSwitch.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value */ @@ -164,7 +164,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + StoreCore.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Set value (using the specified store) */ @@ -172,7 +172,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, EncodeArray.encode((value)), _fieldLayout); + _store.setDynamicField(_tableId, _keyTuple, 0, EncodeArray.encode((value))); } /** Get the length of value */ @@ -180,7 +180,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 20; } @@ -191,7 +191,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 20; } @@ -202,7 +202,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 20; } @@ -213,7 +213,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreSwitch.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreSwitch.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 20; } @@ -224,7 +224,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = StoreCore.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = StoreCore.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 20; } @@ -235,7 +235,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - uint256 _byteLength = _store.getFieldLength(_tableId, _keyTuple, 0, _fieldLayout); + uint256 _byteLength = _store.getDynamicFieldLength(_tableId, _keyTuple, 0); unchecked { return _byteLength / 20; } @@ -250,14 +250,7 @@ library AddressArray { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 20, - (_index + 1) * 20 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 20, (_index + 1) * 20); return (address(bytes20(_blob))); } } @@ -271,14 +264,7 @@ library AddressArray { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 20, - (_index + 1) * 20 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 20, (_index + 1) * 20); return (address(bytes20(_blob))); } } @@ -297,7 +283,7 @@ library AddressArray { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 20, (_index + 1) * 20); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 20, (_index + 1) * 20); return (address(bytes20(_blob))); } } @@ -311,14 +297,7 @@ library AddressArray { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreSwitch.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 20, - (_index + 1) * 20 - ); + bytes memory _blob = StoreSwitch.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 20, (_index + 1) * 20); return (address(bytes20(_blob))); } } @@ -332,14 +311,7 @@ library AddressArray { _keyTuple[0] = key; unchecked { - bytes memory _blob = StoreCore.getFieldSlice( - _tableId, - _keyTuple, - 0, - _fieldLayout, - _index * 20, - (_index + 1) * 20 - ); + bytes memory _blob = StoreCore.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 20, (_index + 1) * 20); return (address(bytes20(_blob))); } } @@ -353,7 +325,7 @@ library AddressArray { _keyTuple[0] = key; unchecked { - bytes memory _blob = _store.getFieldSlice(_tableId, _keyTuple, 0, _fieldLayout, _index * 20, (_index + 1) * 20); + bytes memory _blob = _store.getDynamicFieldSlice(_tableId, _keyTuple, 0, _index * 20, (_index + 1) * 20); return (address(bytes20(_blob))); } } @@ -363,7 +335,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -371,7 +343,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -379,7 +351,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -387,7 +359,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreSwitch.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value */ @@ -395,7 +367,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + StoreCore.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Push an element to value (using the specified store) */ @@ -403,7 +375,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.pushToField(_tableId, _keyTuple, 0, abi.encodePacked((_element)), _fieldLayout); + _store.pushToDynamicField(_tableId, _keyTuple, 0, abi.encodePacked((_element))); } /** Pop an element from value */ @@ -411,7 +383,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 20, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 20); } /** Pop an element from value */ @@ -419,7 +391,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 20, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 20); } /** Pop an element from value (using the specified store) */ @@ -427,7 +399,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 20, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 20); } /** Pop an element from value */ @@ -435,7 +407,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.popFromField(_tableId, _keyTuple, 0, 20, _fieldLayout); + StoreSwitch.popFromDynamicField(_tableId, _keyTuple, 0, 20); } /** Pop an element from value */ @@ -443,7 +415,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.popFromField(_tableId, _keyTuple, 0, 20, _fieldLayout); + StoreCore.popFromDynamicField(_tableId, _keyTuple, 0, 20); } /** Pop an element from value (using the specified store) */ @@ -451,7 +423,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.popFromField(_tableId, _keyTuple, 0, 20, _fieldLayout); + _store.popFromDynamicField(_tableId, _keyTuple, 0, 20); } /** @@ -463,7 +435,8 @@ library AddressArray { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 20, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 20), uint40(_encoded.length), _encoded); } } @@ -476,7 +449,8 @@ library AddressArray { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 20, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 20), uint40(_encoded.length), _encoded); } } @@ -489,7 +463,8 @@ library AddressArray { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 20, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 20), uint40(_encoded.length), _encoded); } } @@ -502,7 +477,8 @@ library AddressArray { _keyTuple[0] = key; unchecked { - StoreSwitch.updateInField(_tableId, _keyTuple, 0, _index * 20, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreSwitch.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 20), uint40(_encoded.length), _encoded); } } @@ -515,7 +491,8 @@ library AddressArray { _keyTuple[0] = key; unchecked { - StoreCore.updateInField(_tableId, _keyTuple, 0, _index * 20, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + StoreCore.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 20), uint40(_encoded.length), _encoded); } } @@ -528,7 +505,8 @@ library AddressArray { _keyTuple[0] = key; unchecked { - _store.updateInField(_tableId, _keyTuple, 0, _index * 20, abi.encodePacked((_element)), _fieldLayout); + bytes memory _encoded = abi.encodePacked((_element)); + _store.spliceDynamicData(_tableId, _keyTuple, 0, uint40(_index * 20), uint40(_encoded.length), _encoded); } } @@ -537,7 +515,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -553,7 +531,7 @@ library AddressArray { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack dynamic data using this table's schema */ diff --git a/packages/world/test/tables/Bool.sol b/packages/world/test/tables/Bool.sol index 425534d339..e110386002 100644 --- a/packages/world/test/tables/Bool.sol +++ b/packages/world/test/tables/Bool.sol @@ -123,49 +123,49 @@ library Bool { function setValue(ResourceId _tableId, bool value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _setValue(ResourceId _tableId, bool value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function setValue(IStore _store, ResourceId _tableId, bool value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function set(ResourceId _tableId, bool value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _set(ResourceId _tableId, bool value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function set(IStore _store, ResourceId _tableId, bool value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Delete all data for given keys */ function deleteRecord(ResourceId _tableId) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -179,7 +179,7 @@ library Bool { function deleteRecord(IStore _store, ResourceId _tableId) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/packages/world/test/tables/TwoFields.sol b/packages/world/test/tables/TwoFields.sol index a85c9eed17..8685868093 100644 --- a/packages/world/test/tables/TwoFields.sol +++ b/packages/world/test/tables/TwoFields.sol @@ -106,21 +106,21 @@ library TwoFields { function setValue1(ResourceId _tableId, bool value1) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value1)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value1)), _fieldLayout); } /** Set value1 */ function _setValue1(ResourceId _tableId, bool value1) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value1)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value1)), _fieldLayout); } /** Set value1 (using the specified store) */ function setValue1(IStore _store, ResourceId _tableId, bool value1) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value1)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value1)), _fieldLayout); } /** Get value2 */ @@ -151,21 +151,21 @@ library TwoFields { function setValue2(ResourceId _tableId, bool value2) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((value2)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((value2)), _fieldLayout); } /** Set value2 */ function _setValue2(ResourceId _tableId, bool value2) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((value2)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((value2)), _fieldLayout); } /** Set value2 (using the specified store) */ function setValue2(IStore _store, ResourceId _tableId, bool value2) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((value2)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((value2)), _fieldLayout); } /** Get the full data */ @@ -213,7 +213,7 @@ library TwoFields { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -237,7 +237,7 @@ library TwoFields { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -249,7 +249,7 @@ library TwoFields { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -273,7 +273,7 @@ library TwoFields { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -302,7 +302,7 @@ library TwoFields { function deleteRecord(ResourceId _tableId) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -316,7 +316,7 @@ library TwoFields { function deleteRecord(IStore _store, ResourceId _tableId) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/templates/phaser/packages/contracts/src/codegen/tables/Counter.sol b/templates/phaser/packages/contracts/src/codegen/tables/Counter.sol index 26d56e1b79..f9e4523d88 100644 --- a/templates/phaser/packages/contracts/src/codegen/tables/Counter.sol +++ b/templates/phaser/packages/contracts/src/codegen/tables/Counter.sol @@ -128,49 +128,49 @@ library Counter { function setValue(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _setValue(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function setValue(IStore _store, uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function set(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _set(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function set(IStore _store, uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Delete all data for given keys */ function deleteRecord() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -184,7 +184,7 @@ library Counter { function deleteRecord(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/templates/react/packages/contracts/src/codegen/tables/Counter.sol b/templates/react/packages/contracts/src/codegen/tables/Counter.sol index 26d56e1b79..f9e4523d88 100644 --- a/templates/react/packages/contracts/src/codegen/tables/Counter.sol +++ b/templates/react/packages/contracts/src/codegen/tables/Counter.sol @@ -128,49 +128,49 @@ library Counter { function setValue(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _setValue(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function setValue(IStore _store, uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function set(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _set(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function set(IStore _store, uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Delete all data for given keys */ function deleteRecord() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -184,7 +184,7 @@ library Counter { function deleteRecord(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/templates/threejs/packages/contracts/src/codegen/tables/Position.sol b/templates/threejs/packages/contracts/src/codegen/tables/Position.sol index bb7632f63a..7fe7bc7733 100644 --- a/templates/threejs/packages/contracts/src/codegen/tables/Position.sol +++ b/templates/threejs/packages/contracts/src/codegen/tables/Position.sol @@ -120,7 +120,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); } /** Set x */ @@ -128,7 +128,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); } /** Set x (using the specified store) */ @@ -136,7 +136,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((x)), _fieldLayout); } /** Get y */ @@ -171,7 +171,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); } /** Set y */ @@ -179,7 +179,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); } /** Set y (using the specified store) */ @@ -187,7 +187,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 1, abi.encodePacked((y)), _fieldLayout); } /** Get z */ @@ -222,7 +222,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setField(_tableId, _keyTuple, 2, abi.encodePacked((z)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 2, abi.encodePacked((z)), _fieldLayout); } /** Set z */ @@ -230,7 +230,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreCore.setField(_tableId, _keyTuple, 2, abi.encodePacked((z)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 2, abi.encodePacked((z)), _fieldLayout); } /** Set z (using the specified store) */ @@ -238,7 +238,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setField(_tableId, _keyTuple, 2, abi.encodePacked((z)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 2, abi.encodePacked((z)), _fieldLayout); } /** Get the full data */ @@ -290,7 +290,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using individual values */ @@ -316,7 +316,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -329,7 +329,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + StoreSwitch.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** Set the full data using the data struct */ @@ -355,7 +355,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData, _fieldLayout); + _store.setRecord(_tableId, _keyTuple, _staticData, _encodedLengths, _dynamicData); } /** @@ -387,7 +387,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -403,7 +403,7 @@ library Position { bytes32[] memory _keyTuple = new bytes32[](1); _keyTuple[0] = key; - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol b/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol index 26d56e1b79..f9e4523d88 100644 --- a/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol +++ b/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol @@ -128,49 +128,49 @@ library Counter { function setValue(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _setValue(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function setValue(IStore _store, uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function set(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value */ function _set(uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Set value (using the specified store) */ function set(IStore _store, uint32 value) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.setField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); + _store.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((value)), _fieldLayout); } /** Delete all data for given keys */ function deleteRecord() internal { bytes32[] memory _keyTuple = new bytes32[](0); - StoreSwitch.deleteRecord(_tableId, _keyTuple, _fieldLayout); + StoreSwitch.deleteRecord(_tableId, _keyTuple); } /** Delete all data for given keys */ @@ -184,7 +184,7 @@ library Counter { function deleteRecord(IStore _store) internal { bytes32[] memory _keyTuple = new bytes32[](0); - _store.deleteRecord(_tableId, _keyTuple, _fieldLayout); + _store.deleteRecord(_tableId, _keyTuple); } /** Tightly pack static data using this table's schema */ diff --git a/test-data/world-logs.json b/test-data/world-logs.json index 326f3e06e7..27eeab7fc6 100644 --- a/test-data/world-logs.json +++ b/test-data/world-logs.json @@ -6,9 +6,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000022000000000a0000000000002c00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000174626d756473746f72650000000000005461626c65730000000000000000000000000000000000000000000000000000000000000000000000000000000000600060030220202000000000000000000000000000000000000000000000000000002001005f000000000000000000000000000000000000000000000000000000006003025f5f5fc4c4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000077461626c654964000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000000b6669656c644c61796f757400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096b6579536368656d610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b76616c7565536368656d610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012616269456e636f6465644b65794e616d657300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014616269456e636f6465644669656c644e616d6573000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x0", "transactionLogIndex": "0x0", @@ -17,13 +17,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000174626d756473746f72650000000000005461626c65730000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000174626d756473746f72650000000000005461626c65730000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x1", "transactionLogIndex": "0x1", @@ -36,9 +36,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a000000000a0000000000001400000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000174626d756473746f726500000000000053746f7265486f6f6b7300000000000000000000000000000000000000000000000000000000000000000000000000600000000100000000000000000000000000000000000000000000000000000000002001005f00000000000000000000000000000000000000000000000000000000000001b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x2", "transactionLogIndex": "0x2", @@ -47,13 +47,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000174626d756473746f726500000000000053746f7265486f6f6b7300000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000174626d756473746f726500000000000053746f7265486f6f6b7300000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x3", "transactionLogIndex": "0x3", @@ -66,9 +66,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a000000000a0000000000001400000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000174626d756473746f72650000000000005265736f75726365496473000000000000000000000000000000000000000000000000000000000000000000000000600001010001000000000000000000000000000000000000000000000000000000002001005f00000000000000000000000000000000000000000000000000000000010100600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000a7265736f7572636549640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000066578697374730000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x4", "transactionLogIndex": "0x4", @@ -77,13 +77,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000174626d756473746f72650000000000005265736f75726365496473000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000174626d756473746f72650000000000005265736f75726365496473000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x5", "transactionLogIndex": "0x5", @@ -96,9 +96,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a000000000a00000000000014000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004e616d6573706163654f776e6572000000000000000000000000000000000000000000000000000000000000000000600014010014000000000000000000000000000000000000000000000000000000002001005f00000000000000000000000000000000000000000000000000000000140100610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000b6e616d657370616365496400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000056f776e6572000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x6", "transactionLogIndex": "0x6", @@ -107,13 +107,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004e616d6573706163654f776e6572000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004e616d6573706163654f776e6572000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x7", "transactionLogIndex": "0x7", @@ -126,9 +126,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a000000000a000000000000140000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000042616c616e636573000000000000000000000000000000000000000000000000000000000000000000000000000000600020010020000000000000000000000000000000000000000000000000000000002001005f000000000000000000000000000000000000000000000000000000002001001f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000b6e616d6573706163654964000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000762616c616e636500000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x8", "transactionLogIndex": "0x8", @@ -137,13 +137,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000042616c616e636573000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000042616c616e636573000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x9", "transactionLogIndex": "0x9", @@ -156,9 +156,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a00000000100000000000001a00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000174620000000000000000000000000000496e7374616c6c65644d6f64756c657300000000000000000000000000000000000000000000000000000000000000600014010014000000000000000000000000000000000000000000000000000000003002004f5f0000000000000000000000000000000000000000000000000000001401006100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000a6d6f64756c654e616d6500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d617267756d656e74734861736800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d6d6f64756c654164647265737300000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0xa", "transactionLogIndex": "0xa", @@ -167,13 +167,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000174620000000000000000000000000000496e7374616c6c65644d6f64756c657300000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000174620000000000000000000000000000496e7374616c6c65644d6f64756c657300000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0xb", "transactionLogIndex": "0xb", @@ -186,9 +186,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a00000000100000000000001a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000044656c65676174696f6e730000000000000000000000000000000000000000000000000000000000000000000000006000200100200000000000000000000000000000000000000000000000000000000028020061610000000000000000000000000000000000000000000000000000002001005f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000964656c656761746f720000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000964656c6567617465650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001364656c65676174696f6e436f6e74726f6c496400000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0xc", "transactionLogIndex": "0xc", @@ -197,13 +197,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000044656c65676174696f6e73000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000044656c65676174696f6e73000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0xd", "transactionLogIndex": "0xd", @@ -216,9 +216,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a00000000100000000000001a000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000005265736f75726365416363657373000000000000000000000000000000000000000000000000000000000000000000600001010001000000000000000000000000000000000000000000000000000000003402005f610000000000000000000000000000000000000000000000000000000101006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000a7265736f75726365496400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000663616c6c6572000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000066163636573730000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0xe", "transactionLogIndex": "0xe", @@ -227,13 +227,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000005265736f75726365416363657373000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000005265736f75726365416363657373000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0xf", "transactionLogIndex": "0xf", @@ -246,9 +246,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000010000000000a0000000000001a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000053797374656d7300000000000000000000000000000000000000000000000000000000000000000000000000000000600015020014010000000000000000000000000000000000000000000000000000002001005f000000000000000000000000000000000000000000000000000000001502006160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000873797374656d49640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000673797374656d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c7075626c69634163636573730000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x10", "transactionLogIndex": "0x10", @@ -257,13 +257,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000053797374656d7300000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000053797374656d7300000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x11", "transactionLogIndex": "0x11", @@ -276,9 +276,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000010000000000a0000000000001a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000240200200400000000000000000000000000000000000000000000000000000004010043000000000000000000000000000000000000000000000000000000002402005f43000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001066756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000873797374656d4964000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001673797374656d46756e6374696f6e53656c6563746f7200000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x12", "transactionLogIndex": "0x12", @@ -287,13 +287,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000046756e6374696f6e53656c6563746f7200000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000046756e6374696f6e53656c6563746f7200000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x13", "transactionLogIndex": "0x13", @@ -306,9 +306,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a000000000a000000000000140000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000053797374656d486f6f6b73000000000000000000000000000000000000000000000000000000000000000000000000600000000100000000000000000000000000000000000000000000000000000000002001005f00000000000000000000000000000000000000000000000000000000000001b60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000873797374656d4964000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x14", "transactionLogIndex": "0x14", @@ -317,13 +317,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000053797374656d486f6f6b73000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000053797374656d486f6f6b73000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x15", "transactionLogIndex": "0x15", @@ -336,9 +336,9 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a000000000a000000000000140000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000053797374656d52656769737472790000000000000000000000000000000000000000000000000000000000000000006000200100200000000000000000000000000000000000000000000000000000000014010061000000000000000000000000000000000000000000000000000000002001005f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000673797374656d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000873797374656d4964000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x16", "transactionLogIndex": "0x16", @@ -347,13 +347,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000053797374656d5265676973747279000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000017462000000000000000000000000000053797374656d5265676973747279000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x17", "transactionLogIndex": "0x17", @@ -362,13 +362,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000016e7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000016e7300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x18", "transactionLogIndex": "0x18", @@ -377,13 +377,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x746200000000000000000000000000004e616d6573706163654f776e65720000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000016e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000016e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x19", "transactionLogIndex": "0x19", @@ -392,13 +392,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x746200000000000000000000000000005265736f757263654163636573730000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000026e73000000000000000000000000000000000000000000000000000000000000000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb9226600000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000026e73000000000000000000000000000000000000000000000000000000000000000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb9226600000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x1a", "transactionLogIndex": "0x1a", @@ -407,13 +407,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000173790000000000000000000000000000636f726500000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000173790000000000000000000000000000636f726500000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x1b", "transactionLogIndex": "0x1b", @@ -426,9 +426,9 @@ "0x7462000000000000000000000000000053797374656d73000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000173790000000000000000000000000000636f72650000000000000000000000000000000000000000000000000000000000000000000000000000000000000015cafac3dd18ac6c6e92c921884f9e4176737c052c0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x1c", "transactionLogIndex": "0x1c", @@ -437,13 +437,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x7462000000000000000000000000000053797374656d52656769737472790000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000cafac3dd18ac6c6e92c921884f9e4176737c052c000000000000000000000000000000000000000000000000000000000000002073790000000000000000000000000000636f7265000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000cafac3dd18ac6c6e92c921884f9e4176737c052c000000000000000000000000000000000000000000000000000000000000002073790000000000000000000000000000636f7265000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x1d", "transactionLogIndex": "0x1d", @@ -452,13 +452,13 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x746200000000000000000000000000005265736f757263654163636573730000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000026e73000000000000000000000000000000000000000000000000000000000000000000000000000000000000cafac3dd18ac6c6e92c921884f9e4176737c052c00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000026e73000000000000000000000000000000000000000000000000000000000000000000000000000000000000cafac3dd18ac6c6e92c921884f9e4176737c052c00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x1e", "transactionLogIndex": "0x1e", @@ -471,9 +471,9 @@ "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000140554c3a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f726500000000000000000000000040554c3a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x1f", "transactionLogIndex": "0x1f", @@ -483,12 +483,12 @@ "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", - "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000018d53b20800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000008d53b208000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000001c0000000000001c00000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000140554c3a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c6772616e7441636365737328627974657333322c616464726573732900000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x20", "transactionLogIndex": "0x20", @@ -500,10 +500,10 @@ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001ef5d6bbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000ef5d6bbb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000018d53b20800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000008d53b208000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x21", "transactionLogIndex": "0x21", @@ -513,12 +513,12 @@ "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", - "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001c9c85a6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000c9c85a60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000001d0000000000001d00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000018d53b208000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001d7265766f6b6541636365737328627974657333322c6164647265737329000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x22", "transactionLogIndex": "0x22", @@ -530,10 +530,10 @@ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000145afd19900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f726500000000000000000000000045afd199000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001ef5d6bbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000ef5d6bbb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x23", "transactionLogIndex": "0x23", @@ -543,12 +543,12 @@ "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", - "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000010ca8997800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000000ca89978000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000220000000000002200000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001ef5d6bbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000227472616e736665724f776e65727368697028627974657333322c6164647265737329000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x24", "transactionLogIndex": "0x24", @@ -560,10 +560,10 @@ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000018da798da00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000008da798da000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001c9c85a6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000c9c85a60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x25", "transactionLogIndex": "0x25", @@ -573,12 +573,12 @@ "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", - "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000010ba51f4900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000000ba51f49000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000330000000000003300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001c9c85a6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000337472616e7366657242616c616e6365546f4e616d65737061636528627974657333322c627974657333322c75696e743235362900000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x26", "transactionLogIndex": "0x26", @@ -590,10 +590,10 @@ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001530f4b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000530f4b60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000145afd19900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f726500000000000000000000000045afd199000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x27", "transactionLogIndex": "0x27", @@ -603,12 +603,12 @@ "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", - "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000010560912900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f726500000000000000000000000005609129000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000310000000000003100000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000145afd19900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000317472616e7366657242616c616e6365546f4164647265737328627974657333322c616464726573732c75696e7432353629000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x28", "transactionLogIndex": "0x28", @@ -620,10 +620,10 @@ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001b29e408900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000b29e4089000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000010ca8997800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000000ca89978000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x29", "transactionLogIndex": "0x29", @@ -633,12 +633,12 @@ "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", - "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001d5f8337f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000d5f8337f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000001c0000000000001c00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010ca89978000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c63616c6c42617463682828627974657333322c6279746573295b5d2900000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x2a", "transactionLogIndex": "0x2a", @@ -650,10 +650,10 @@ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001a92813ad00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000a92813ad000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000018da798da00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000008da798da000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x2b", "transactionLogIndex": "0x2b", @@ -663,12 +663,12 @@ "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", - "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000013350b6a900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000003350b6a9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000001c0000000000001c00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000018da798da000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c696e7374616c6c4d6f64756c6528616464726573732c62797465732900000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x2c", "transactionLogIndex": "0x2c", @@ -680,10 +680,10 @@ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000013c03a51c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000003c03a51c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000010ba51f4900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000000ba51f49000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x2d", "transactionLogIndex": "0x2d", @@ -693,12 +693,12 @@ "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", - "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001b7a3c75600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000b7a3c756000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000400000000000004000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000010ba51f49000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004072656769737465725461626c6528627974657333322c627974657333322c627974657333322c627974657333322c737472696e675b5d2c737472696e675b5d29", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x2e", "transactionLogIndex": "0x2e", @@ -710,10 +710,10 @@ "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], - "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000011d2257ba00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000001d2257ba000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001530f4b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000530f4b60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x2f", "transactionLogIndex": "0x2f", @@ -722,18 +722,273 @@ { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", - "0x74620000000000000000000000000000496e7374616c6c65644d6f64756c6573" + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000002636f726500000000000000000000000000000000000000000000000000000000c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4700000000000000000000000000000000000000000000000000000000000000014e7f1725e7734ce288f8367e1bb143e90bb3f0512000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x0d4155dcc6f97b40f4fe8f4af55fe089b29c5eef9522dc83c66d5b96009210f0", + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000280000000000002800000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001530f4b600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028726567697374657253746f7265486f6f6b28627974657333322c616464726573732c75696e743829000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", "transactionIndex": "0x0", "logIndex": "0x30", "transactionLogIndex": "0x30", "removed": false }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000010560912900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f726500000000000000000000000005609129000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x31", + "transactionLogIndex": "0x31", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000240000000000002400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001056091290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024756e726567697374657253746f7265486f6f6b28627974657333322c616464726573732900000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x32", + "transactionLogIndex": "0x32", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001b29e408900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000b29e4089000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x33", + "transactionLogIndex": "0x33", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000001a0000000000001a00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001b29e4089000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a72656769737465724e616d657370616365286279746573333229000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x34", + "transactionLogIndex": "0x34", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001d5f8337f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000d5f8337f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x35", + "transactionLogIndex": "0x35", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000290000000000002900000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001d5f8337f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029726567697374657253797374656d486f6f6b28627974657333322c616464726573732c75696e7438290000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x36", + "transactionLogIndex": "0x36", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001a92813ad00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000a92813ad000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x37", + "transactionLogIndex": "0x37", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000250000000000002500000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001a92813ad0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000025756e726567697374657253797374656d486f6f6b28627974657333322c6164647265737329000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x38", + "transactionLogIndex": "0x38", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000013350b6a900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000003350b6a9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x39", + "transactionLogIndex": "0x39", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000240000000000002400000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000013350b6a90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024726567697374657253797374656d28627974657333322c616464726573732c626f6f6c2900000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x3a", + "transactionLogIndex": "0x3a", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000000126d9810200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f726500000000000000000000000026d98102000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x3b", + "transactionLogIndex": "0x3b", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000280000000000002800000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000126d981020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028726567697374657246756e6374696f6e53656c6563746f7228627974657333322c737472696e6729000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x3c", + "transactionLogIndex": "0x3c", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001742d611800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f7265000000000000000000000000742d6118000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x3d", + "transactionLogIndex": "0x3d", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000330000000000003300000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001742d611800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000337265676973746572526f6f7446756e6374696f6e53656c6563746f7228627974657333322c737472696e672c6279746573342900000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x3e", + "transactionLogIndex": "0x3e", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000011d2257ba00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000636f72650000000000000000000000001d2257ba000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x3f", + "transactionLogIndex": "0x3f", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000290000000000002900000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000011d2257ba0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000029726567697374657244656c65676174696f6e28616464726573732c627974657333322c6279746573290000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x40", + "transactionLogIndex": "0x40", + "removed": false + }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", + "0x74620000000000000000000000000000496e7374616c6c65644d6f64756c6573" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002636f726500000000000000000000000000000000000000000000000000000000c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4700000000000000000000000000000000000000000000000000000000000000014e7f1725e7734ce288f8367e1bb143e90bb3f0512000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5ee42010450b6a9f7d2fca03511de209f9fc8ed04782bd284595a9a76e13d30b", + "transactionIndex": "0x0", + "logIndex": "0x41", + "transactionLogIndex": "0x41", + "removed": false + }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ @@ -741,26 +996,26 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a000000000a00000000000014000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004e756d626572000000000000000000000000000000000000000000000000000000000000000000000000000000000060000401000400000000000000000000000000000000000000000000000000000000040100030000000000000000000000000000000000000000000000000000000004010003000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0xf5a82d96f1cc4bb9088cefeb8017b84c43b250bffcb1b32871299f1bd121e7ce", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x94df79dac95a1919e42cba4f58e67b9e024e0e6f21fbbc1aa3f62c0c125ec20d", "transactionIndex": "0x1", - "logIndex": "0x31", + "logIndex": "0x42", "transactionLogIndex": "0x0", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004e756d6265720000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0xf5a82d96f1cc4bb9088cefeb8017b84c43b250bffcb1b32871299f1bd121e7ce", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004e756d6265720000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x94df79dac95a1919e42cba4f58e67b9e024e0e6f21fbbc1aa3f62c0c125ec20d", "transactionIndex": "0x1", - "logIndex": "0x32", + "logIndex": "0x43", "transactionLogIndex": "0x1", "removed": false }, @@ -771,26 +1026,26 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000010000000000a0000000000001a00000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000000174620000000000000000000000000000566563746f7200000000000000000000000000000000000000000000000000000000000000000000000000000000006000080200040400000000000000000000000000000000000000000000000000000004010003000000000000000000000000000000000000000000000000000000000802002323000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000036b6579000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017900000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x3e121030b94cd43e44bfd7d304b22b1300d9495d9bddfa941442d4b99afa3aef", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0xbb5784f997595f2b2eeabe279c852bfe44d265243fa5a92221acb481620b1bce", "transactionIndex": "0x2", - "logIndex": "0x33", + "logIndex": "0x44", "transactionLogIndex": "0x0", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000174620000000000000000000000000000566563746f720000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x3e121030b94cd43e44bfd7d304b22b1300d9495d9bddfa941442d4b99afa3aef", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000174620000000000000000000000000000566563746f720000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0xbb5784f997595f2b2eeabe279c852bfe44d265243fa5a92221acb481620b1bce", "transactionIndex": "0x2", - "logIndex": "0x34", + "logIndex": "0x45", "transactionLogIndex": "0x1", "removed": false }, @@ -801,26 +1056,26 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000a00000000040000000000000e000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004e756d6265724c697374000000000000000000000000000000000000000000000000000000000000000000000000006000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x2ee1e32f041555f04407696ce0bf25ca5b23c187259dc638a001a87a1b24df19", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0xda6dd25e11f1ae999036ef7239af3a0a1765ce0f8a774aa45adfb34efdfd84f1", "transactionIndex": "0x3", - "logIndex": "0x35", + "logIndex": "0x46", "transactionLogIndex": "0x0", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004e756d6265724c69737400000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x2ee1e32f041555f04407696ce0bf25ca5b23c187259dc638a001a87a1b24df19", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004e756d6265724c69737400000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0xda6dd25e11f1ae999036ef7239af3a0a1765ce0f8a774aa45adfb34efdfd84f1", "transactionIndex": "0x3", - "logIndex": "0x36", + "logIndex": "0x47", "transactionLogIndex": "0x1", "removed": false }, @@ -831,41 +1086,41 @@ "0x74626d756473746f72650000000000005461626c657300000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000010000000001c0000000000002c000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004d756c74690000000000000000000000000000000000000000000000000000000000000000000000000000000000006000210200200100000000000000000000000000000000000000000000000000000034040003601f2e000000000000000000000000000000000000000000000000002102003f60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000162000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001630000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036e756d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x49135abf8dcc1a3c5232cb964bff59b619d259d5265d84a5034233f37adf5f0d", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x4a758aa6196b84927d3135706bc6914712dd6af007981926b2d771463c7a4f5b", "transactionIndex": "0x4", - "logIndex": "0x37", + "logIndex": "0x48", "transactionLogIndex": "0x0", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004d756c7469000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x49135abf8dcc1a3c5232cb964bff59b619d259d5265d84a5034233f37adf5f0d", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001746200000000000000000000000000004d756c7469000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x4a758aa6196b84927d3135706bc6914712dd6af007981926b2d771463c7a4f5b", "transactionIndex": "0x4", - "logIndex": "0x38", + "logIndex": "0x49", "transactionLogIndex": "0x1", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000173790000000000000000000000000000437573746f6d4572726f72735379737400000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x99e0c1847e48adcee18f0d44815cfc2a043c8ef5f3948f251615c45a8c611437", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000173790000000000000000000000000000437573746f6d4572726f72735379737400000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x6251a49bb9104637ca2884f86be1ae61bdf17552e71b5df926eb770eb4fe9b95", "transactionIndex": "0x5", - "logIndex": "0x39", + "logIndex": "0x4a", "transactionLogIndex": "0x0", "removed": false }, @@ -876,56 +1131,56 @@ "0x7462000000000000000000000000000053797374656d73000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000173790000000000000000000000000000437573746f6d4572726f72735379737400000000000000000000000000000000000000000000000000000000000000155fc8d32690cc91d4c39d9d3abcbd16989f8757070100000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x99e0c1847e48adcee18f0d44815cfc2a043c8ef5f3948f251615c45a8c611437", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x6251a49bb9104637ca2884f86be1ae61bdf17552e71b5df926eb770eb4fe9b95", "transactionIndex": "0x5", - "logIndex": "0x3a", + "logIndex": "0x4b", "transactionLogIndex": "0x1", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x7462000000000000000000000000000053797374656d52656769737472790000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005fc8d32690cc91d4c39d9d3abcbd16989f875707000000000000000000000000000000000000000000000000000000000000002073790000000000000000000000000000437573746f6d4572726f727353797374", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x99e0c1847e48adcee18f0d44815cfc2a043c8ef5f3948f251615c45a8c611437", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005fc8d32690cc91d4c39d9d3abcbd16989f875707000000000000000000000000000000000000000000000000000000000000002073790000000000000000000000000000437573746f6d4572726f727353797374", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x6251a49bb9104637ca2884f86be1ae61bdf17552e71b5df926eb770eb4fe9b95", "transactionIndex": "0x5", - "logIndex": "0x3b", + "logIndex": "0x4c", "transactionLogIndex": "0x2", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x746200000000000000000000000000005265736f757263654163636573730000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000026e730000000000000000000000000000000000000000000000000000000000000000000000000000000000005fc8d32690cc91d4c39d9d3abcbd16989f87570700000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x99e0c1847e48adcee18f0d44815cfc2a043c8ef5f3948f251615c45a8c611437", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000026e730000000000000000000000000000000000000000000000000000000000000000000000000000000000005fc8d32690cc91d4c39d9d3abcbd16989f87570700000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x6251a49bb9104637ca2884f86be1ae61bdf17552e71b5df926eb770eb4fe9b95", "transactionIndex": "0x5", - "logIndex": "0x3c", + "logIndex": "0x4d", "transactionLogIndex": "0x3", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x74626d756473746f72650000000000005265736f757263654964730000000000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001737900000000000000000000000000004e756d6265724c69737453797374656d00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x38e51a427ad28d8c2c2cc92b65668e0a9056624c610e7849234f3db49f50799e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001737900000000000000000000000000004e756d6265724c69737453797374656d00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x921cfb89e243f8f8bcd521023f05f131d42ddaedb5998fc7d13aa4ef12debaf6", "transactionIndex": "0x6", - "logIndex": "0x3d", + "logIndex": "0x4e", "transactionLogIndex": "0x0", "removed": false }, @@ -936,41 +1191,41 @@ "0x7462000000000000000000000000000053797374656d73000000000000000000" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001737900000000000000000000000000004e756d6265724c69737453797374656d00000000000000000000000000000000000000000000000000000000000000150165878a594ca255338adfa4d48449f69242eb8f0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x38e51a427ad28d8c2c2cc92b65668e0a9056624c610e7849234f3db49f50799e", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x921cfb89e243f8f8bcd521023f05f131d42ddaedb5998fc7d13aa4ef12debaf6", "transactionIndex": "0x6", - "logIndex": "0x3e", + "logIndex": "0x4f", "transactionLogIndex": "0x1", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x7462000000000000000000000000000053797374656d52656769737472790000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f0000000000000000000000000000000000000000000000000000000000000020737900000000000000000000000000004e756d6265724c69737453797374656d", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x38e51a427ad28d8c2c2cc92b65668e0a9056624c610e7849234f3db49f50799e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f0000000000000000000000000000000000000000000000000000000000000020737900000000000000000000000000004e756d6265724c69737453797374656d", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x921cfb89e243f8f8bcd521023f05f131d42ddaedb5998fc7d13aa4ef12debaf6", "transactionIndex": "0x6", - "logIndex": "0x3f", + "logIndex": "0x50", "transactionLogIndex": "0x2", "removed": false }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ - "0xac9f2b70ab41044b24c3864d8dce7f6ad1fef853dfd4404d42d93445baeb9e3b", + "0x8c0b5119d4cec7b284c6b1b39252a03d1e2f2d7451a5895562524c113bb952be", "0x746200000000000000000000000000005265736f757263654163636573730000" ], - "data": "0x00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000026e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x38e51a427ad28d8c2c2cc92b65668e0a9056624c610e7849234f3db49f50799e", + "data": "0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000026e730000000000000000000000000000000000000000000000000000000000000000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x921cfb89e243f8f8bcd521023f05f131d42ddaedb5998fc7d13aa4ef12debaf6", "transactionIndex": "0x6", - "logIndex": "0x40", + "logIndex": "0x51", "transactionLogIndex": "0x3", "removed": false }, @@ -981,14 +1236,29 @@ "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000015f644e3c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002473790000000000000000000000000000437573746f6d4572726f7273537973745f644e3c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x7598f1b801a683f2b453285df8011f829e5e9127355f76bd7dd46b3f4c2842d6", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0xb286f0ac33f44e432f794406490c5e613b71edaa4d7b0a775e2c955249752fa9", "transactionIndex": "0x7", - "logIndex": "0x41", + "logIndex": "0x52", "transactionLogIndex": "0x0", "removed": false }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000d0000000000000d00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000015f644e3c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d737475622875696e743235362900000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0xb286f0ac33f44e432f794406490c5e613b71edaa4d7b0a775e2c955249752fa9", + "transactionIndex": "0x7", + "logIndex": "0x53", + "transactionLogIndex": "0x1", + "removed": false + }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ @@ -996,14 +1266,29 @@ "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001a4ece52c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024737900000000000000000000000000004e756d6265724c69737453797374656da4ece52c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0xa2e4b041f401f2d1511ef4e6b524e3605d345249a6574f9ffd39a6e788f1d18b", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5adf0e6893341c02a55c76850baf664ea1591135560bfd49e91568c677cdd21a", "transactionIndex": "0x8", - "logIndex": "0x42", + "logIndex": "0x54", "transactionLogIndex": "0x0", "removed": false }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000050000000000000500000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001a4ece52c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005706f702829000000000000000000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x5adf0e6893341c02a55c76850baf664ea1591135560bfd49e91568c677cdd21a", + "transactionIndex": "0x8", + "logIndex": "0x55", + "transactionLogIndex": "0x1", + "removed": false + }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ @@ -1011,14 +1296,29 @@ "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001f7f0e440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024737900000000000000000000000000004e756d6265724c69737453797374656df7f0e440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x2bd78b932289533ba9d103c573e4e4067a29ee4746e31d8793b055a5fa047264", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x56b5b83be5d90b586081bb35a83f6a3b2e3bf74a776f8ac126aad4cf37b45077", "transactionIndex": "0x9", - "logIndex": "0x43", + "logIndex": "0x56", "transactionLogIndex": "0x0", "removed": false }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000c0000000000000c00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001f7f0e440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c707573682875696e743332290000000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x56b5b83be5d90b586081bb35a83f6a3b2e3bf74a776f8ac126aad4cf37b45077", + "transactionIndex": "0x9", + "logIndex": "0x57", + "transactionLogIndex": "0x1", + "removed": false + }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ @@ -1026,14 +1326,29 @@ "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001306d61a5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024737900000000000000000000000000004e756d6265724c69737453797374656d306d61a5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x7e432718eed0f9bac0392dff4c56a4806408c6be029d9cc7ae26ea4d38ad6d16", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x217733e1fa8b0d98657f37e45fcaeb3b39f53bf5cb60b4b0f54e25f24f574995", "transactionIndex": "0xa", - "logIndex": "0x44", + "logIndex": "0x58", "transactionLogIndex": "0x0", "removed": false }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000180000000000001800000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001306d61a500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000187075736852616e67652875696e7433322c75696e743332290000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x217733e1fa8b0d98657f37e45fcaeb3b39f53bf5cb60b4b0f54e25f24f574995", + "transactionIndex": "0xa", + "logIndex": "0x59", + "transactionLogIndex": "0x1", + "removed": false + }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ @@ -1041,14 +1356,29 @@ "0x7462000000000000000000000000000046756e6374696f6e53656c6563746f72" ], "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001b8a44c7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024737900000000000000000000000000004e756d6265724c69737453797374656db8a44c7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x5f2408cb39487c49f722df0cb4f4e2ebc9010e3ad7da802390014ff4fb347aae", - "blockNumber": "0x5", - "transactionHash": "0x8cff8e78888467f20094368dafceae31a8edc24c25db94bfef2e3c45f12012b8", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x35f04bc3c24ada572913090478644ca8a0245269cffdaef1d56b0ecb237090db", "transactionIndex": "0xb", - "logIndex": "0x45", + "logIndex": "0x5a", "transactionLogIndex": "0x0", "removed": false }, + { + "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", + "topics": [ + "0x8dbb3a9672eebfd3773e72dd9c102393436816d832c7ba9e1e1ac8fcadcac7a9", + "0x6f74000000000000000000000000000046756e6374696f6e5369676e61747572" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000d0000000000000d00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000001b8a44c7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d7365742875696e7433325b5d2900000000000000000000000000000000000000", + "blockHash": "0xeaf8ccb09cd16e6da4d06645533c73bd7ee9db947c3e919fa25a47dcafddbe9c", + "blockNumber": "0x4", + "transactionHash": "0x35f04bc3c24ada572913090478644ca8a0245269cffdaef1d56b0ecb237090db", + "transactionIndex": "0xb", + "logIndex": "0x5b", + "transactionLogIndex": "0x1", + "removed": false + }, { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "topics": [ @@ -1056,9 +1386,9 @@ "0x746200000000000000000000000000004e756d6265724c697374000000000000" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000040000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000001a400000000000000000000000000000000000000000000000000000000", - "blockHash": "0x4dae55000be05dbd6c7b3674e060d16b83187b5c0f960ce6c22cfe0ab48acf9d", - "blockNumber": "0x6", - "transactionHash": "0x4410e51b0804e73bbba41fc7012eef28c79f12ee16b608e4c9592ce019a2a962", + "blockHash": "0x25c9b45dfe75ab077cfa6285fda364fdbc33f6a97e418b19ff1925048e066338", + "blockNumber": "0x5", + "transactionHash": "0x07b9968aee56aa4bb2744fecff2adf3f5f62b7a48843413e76482cb0283d4bac", "transactionIndex": "0x0", "logIndex": "0x0", "transactionLogIndex": "0x0", @@ -1071,9 +1401,9 @@ "0x746200000000000000000000000000004e756d6265724c697374000000000000" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000800000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000004500000000000000000000000000000000000000000000000000000000", - "blockHash": "0x4dae55000be05dbd6c7b3674e060d16b83187b5c0f960ce6c22cfe0ab48acf9d", - "blockNumber": "0x6", - "transactionHash": "0x43dcd8e4dff98e4fcbf533f5acafd42cc91361b4eb7fbbc8c9d302520439219d", + "blockHash": "0x25c9b45dfe75ab077cfa6285fda364fdbc33f6a97e418b19ff1925048e066338", + "blockNumber": "0x5", + "transactionHash": "0x6e54305e15426eb9da2e8b4af55e43c45ee8706dbf9e2163f381ef454a87ac28", "transactionIndex": "0x1", "logIndex": "0x1", "transactionLogIndex": "0x0",