From 6e66c5b745a036c5bc5422819de9c518a6f6cc96 Mon Sep 17 00:00:00 2001 From: alvarius Date: Fri, 15 Sep 2023 13:07:35 +0100 Subject: [PATCH] feat: rename key to keyTuple (#1492) Co-authored-by: Kevin Ingersoll --- .changeset/nice-glasses-begin.md | 39 ++ docs/pages/store/advanced-features.mdx | 12 +- docs/pages/store/reading-and-writing.mdx | 58 +-- docs/pages/store/spec.mdx | 6 +- docs/pages/world/modules.mdx | 6 +- packages/block-logs-stream/README.md | 8 +- .../store-sync/src/blockLogsToStorage.test.ts | 8 +- packages/store-sync/src/blockLogsToStorage.ts | 4 +- .../src/postgres/postgresStorage.test.ts | 7 +- .../src/sqlite/sqliteStorage.test.ts | 7 +- packages/store/src/IStore.sol | 35 +- packages/store/src/IStoreHook.sol | 17 +- packages/store/src/StoreCore.sol | 182 +++---- packages/store/src/StoreRead.sol | 16 +- packages/store/src/StoreSwitch.sol | 66 +-- packages/store/test/EchoSubscriber.sol | 34 +- packages/store/test/MirrorSubscriber.sol | 26 +- packages/store/test/StoreCore.t.sol | 272 +++++----- packages/store/test/StoreCoreDynamic.t.sol | 66 +-- packages/store/test/StoreCoreGas.t.sol | 136 ++--- packages/store/test/StoreMock.sol | 28 +- packages/store/ts/storeEvents.ts | 8 +- packages/world/src/World.sol | 24 +- .../implementations/EphemeralRecordSystem.sol | 4 +- .../modules/keysintable/KeysInTableHook.sol | 69 +-- .../world/src/modules/keysintable/hasKey.sol | 12 +- .../keyswithvalue/KeysWithValueHook.sol | 32 +- packages/world/test/World.t.sol | 6 +- packages/world/test/query.t.sol | 12 +- test-data/world-logs.json | 488 +++++++++--------- 30 files changed, 884 insertions(+), 804 deletions(-) create mode 100644 .changeset/nice-glasses-begin.md diff --git a/.changeset/nice-glasses-begin.md b/.changeset/nice-glasses-begin.md new file mode 100644 index 0000000000..3ea9e5290d --- /dev/null +++ b/.changeset/nice-glasses-begin.md @@ -0,0 +1,39 @@ +--- +"@latticexyz/block-logs-stream": patch +"@latticexyz/store-sync": patch +"@latticexyz/store": patch +"@latticexyz/world": patch +--- + +Renamed all occurrences of `key` where it is used as "key tuple" to `keyTuple`. +This is only a breaking change for consumers who manually decode `Store` events, but not for consumers who use the MUD libraries. + +```diff +event StoreSetRecord( + bytes32 tableId, +- bytes32[] key, ++ bytes32[] keyTuple, + bytes data +); + +event StoreSetField( + bytes32 tableId, +- bytes32[] key, ++ bytes32[] keyTuple, + uint8 fieldIndex, + bytes data +); + +event StoreDeleteRecord( + bytes32 tableId, +- bytes32[] key, ++ bytes32[] keyTuple, +); + +event StoreEphemeralRecord( + bytes32 tableId, +- bytes32[] key, ++ bytes32[] keyTuple, + bytes data +); +``` diff --git a/docs/pages/store/advanced-features.mdx b/docs/pages/store/advanced-features.mdx index 6784d64b7b..c04efbdaa7 100644 --- a/docs/pages/store/advanced-features.mdx +++ b/docs/pages/store/advanced-features.mdx @@ -89,19 +89,19 @@ contract MirrorSubscriber is IStoreHook { _tableId = tableId; } - function onSetRecord(bytes32 tableId, bytes32[] memory key, bytes memory data) public { + function onSetRecord(bytes32 tableId, bytes32[] memory keyTuple, bytes memory data) public { if (_tableId != tableId) revert("invalid tableId"); - StoreSwitch.setRecord(indexerTableId, key, data); + StoreSwitch.setRecord(indexerTableId, keyTuple, data); } - function onSetField(bytes32 tableId, bytes32[] memory key, uint8 schemaIndex, bytes memory data) public { + function onSetField(bytes32 tableId, bytes32[] memory keyTuple, uint8 schemaIndex, bytes memory data) public { if (_tableId != tableId) revert("invalid tableId"); - StoreSwitch.setField(indexerTableId, key, schemaIndex, data); + StoreSwitch.setField(indexerTableId, keyTuple, schemaIndex, data); } - function onDeleteRecord(bytes32 tableId, bytes32[] memory key) public { + function onDeleteRecord(bytes32 tableId, bytes32[] memory keyTuple) public { if (_tableId != tableId) revert("invalid tableId"); - StoreSwitch.deleteRecord(indexerTableId, key); + StoreSwitch.deleteRecord(indexerTableId, keyTuple); } } ``` diff --git a/docs/pages/store/reading-and-writing.mdx b/docs/pages/store/reading-and-writing.mdx index a2471147c2..df4b54d962 100644 --- a/docs/pages/store/reading-and-writing.mdx +++ b/docs/pages/store/reading-and-writing.mdx @@ -41,55 +41,55 @@ barArray[0] = 69; barArray[1] = 85; fooArray[0] = 42; // args: key, foo, bar, fooArray, staticArray -MyTable.set(keccak256("some.key"), 45, false, fooArray, barArray); +MyTable.set("some.key", 45, false, fooArray, barArray); ``` **Setting a field** ```solidity // Setting foo -MyTable.setFoo(keccak256("some.key"), 33); +MyTable.setFoo("some.key", 33); // Setting bar -MyTable.setBar(keccak256("some.key"), false); +MyTable.setBar("some.key", false); // Setting fooArray uint256[] memory fooArray = new uint256[](3); fooArray[0] = 42; fooArray[1] = 15; fooArray[2] = 3; -MyTable.setFooArray(keccak256("some.key"), fooArray); +MyTable.setFooArray("some.key", fooArray); ``` **Operations on dynamic arrays** ```solidity -MyTable.pushFooArray(keccak256("some.key"), 4242); // adds 4242 at end of fooArray -MyTable.popFooArray(keccak256("some.key")); // pop fooArray -MyTable.setItemFooArray(keccak256("some.key"), 0, 123); // set fooArray[0] to 123 +MyTable.pushFooArray("some.key", 4242); // adds 4242 at end of fooArray +MyTable.popFooArray("some.key"); // pop fooArray +MyTable.setItemFooArray("some.key", 0, 123); // set fooArray[0] to 123 ``` **Retrieving a record** ```solidity // Retrieving a record -MyTable.get(keccak256("some.key")); +MyTable.get("some.key"); ``` **Retrieving a field** ```solidity // Retrieve foo -MyTable.getFoo(keccak256("some.key")); +MyTable.getFoo("some.key"); // Retrieve bar -MyTable.getBar(keccak256("some.key")); +MyTable.getBar("some.key"); // Retrieve an element of fooArray -MyTable.getItemFooArray(keccak256("some.key"), 0); // get fooArray[0] +MyTable.getItemFooArray("some.key", 0); // get fooArray[0] ``` **Deleting a record** ```solidity // Deleting a record -MyTable.deleteRecord(keccak256("some.key")); +MyTable.deleteRecord("some.key"); ``` ### Access to Store via low-level API @@ -120,10 +120,10 @@ tables: { uint256 tableId = uint256(keccak256("MyTable")); uint256 foo = 10; uint256 bar = 24; -bytes32[] memory key = new bytes32[](1); -key[0] = keccak256("some.key"); +bytes32[] memory keyTuple = new bytes32[](1); +keyTuple[0] = "some.key"; // Setting a record -StoreSwitch.setRecord(tableId, key, abi.encodePacked((foo, bar))); +StoreSwitch.setRecord(tableId, keyTuple, abi.encodePacked((foo, bar))); ``` **Setting a field** @@ -132,23 +132,23 @@ StoreSwitch.setRecord(tableId, key, abi.encodePacked((foo, bar))); uint256 tableId = uint256(keccak256("MyTable")); uint256 foo = 45; uint256 foo = 67; -bytes32[] memory key = new bytes32[](1); -key[0] = keccak256("some.key"); +bytes32[] memory keyTuple = new bytes32[](1); +keyTuple[0] = "some.key"; // Setting foo -StoreSwitch.setField(tableId, key, 0, abi.encodePacked((foo))); +StoreSwitch.setField(tableId, keyTuple, 0, abi.encodePacked((foo))); // Setting bar -StoreSwitch.setField(tableId, key, 1, abi.encodePacked((bar))); +StoreSwitch.setField(tableId, keyTuple, 1, abi.encodePacked((bar))); ``` **Retrieving a record** ```solidity uint256 tableId = uint256(keccak256("MyTable")); -bytes32[] memory key = new bytes32[](1); -key[0] = keccak256("some.key"); +bytes32[] memory keyTuple = new bytes32[](1); +keyTuple[0] = "some.key"; // Retrieve a record Schema valueSchema = SchemaLib.encode(SchemaType.UINT256, SchemaType.UINT256); -bytes memory loadedData = StoreCore.getRecord(tableId, key, valueSchema); +bytes memory loadedData = StoreCore.getRecord(tableId, keyTuple, valueSchema); uint256 foo = (uint256(Bytes.slice4(loadedData, 0))); uint256 bar = (uint256(Bytes.slice4(loadedData, 32))); ``` @@ -157,13 +157,13 @@ uint256 bar = (uint256(Bytes.slice4(loadedData, 32))); ```solidity uint256 tableId = uint256(keccak256("MyTable")); -bytes32[] memory key = new bytes32[](1); -key[0] = keccak256("some.key"); +bytes32[] memory keyTuple = new bytes32[](1); +keyTuple[0] = "some.key"; // Retrieve foo -bytes memory loadedDatafoo = StoreCore.getField(tableId, key, 0); +bytes memory loadedDatafoo = StoreCore.getField(tableId, keyTuple, 0); int32 foo = (uint32(Bytes.slice4(loadedDatafoo, 0))); // Retrieve bar -bytes memory loadedDatabar = StoreCore.getField(tableId, key, 1); +bytes memory loadedDatabar = StoreCore.getField(tableId, keyTuple, 1); int32 bar = (uint32(Bytes.slice4(loadedData, 0))); ``` @@ -171,8 +171,8 @@ int32 bar = (uint32(Bytes.slice4(loadedData, 0))); ```solidity uint256 tableId = uint256(keccak256("MyTable")); -bytes32[] memory key = new bytes32[](1); -key[0] = keccak256("some.key"); +bytes32[] memory keyTuple = new bytes32[](1); +keyTuple[0] = "some.key"; // Deleting a record -StoreCore.deleteRecord(tableId, key); +StoreCore.deleteRecord(tableId, keyTuple); ``` diff --git a/docs/pages/store/spec.mdx b/docs/pages/store/spec.mdx index cda5631000..41456d460a 100644 --- a/docs/pages/store/spec.mdx +++ b/docs/pages/store/spec.mdx @@ -7,9 +7,9 @@ import { Aside } from "../../components/Aside"; When a record or a single field is edited, or when a record is deleted, Store emits a standard event with enough information for off-chain actors to reconstruct the new version of the Store with event-sourcing. ```solidity -event StoreSetRecord(uint256 tableId, bytes32[] key, bytes data); -event StoreSetField(uint256 tableId, bytes32[] key, uint8 schemaIndex, bytes data); -event StoreDeleteRecord(uint256 tableId, bytes32[] key); +event StoreSetRecord(uint256 tableId, bytes32[] keyTuple, bytes data); +event StoreSetField(uint256 tableId, bytes32[] keyTuple, uint8 schemaIndex, bytes data); +event StoreDeleteRecord(uint256 tableId, bytes32[] keyTuple); ``` Each event includes the table ID and each key encoded as `bytes32`. diff --git a/docs/pages/world/modules.mdx b/docs/pages/world/modules.mdx index 5ae80689bb..f47a0a128f 100644 --- a/docs/pages/world/modules.mdx +++ b/docs/pages/world/modules.mdx @@ -48,7 +48,7 @@ For example, it can be used to fetch all keys in the "Position" table (if the ta It offers two methods: - `getKeysInTable(bytes32 tableId)` returns all keys in a table -- `hasKey(bytes32 tableId, bytes32[] memory key)` returns whether a given key is in a table (with O(1) gas) +- `hasKey(bytes32 tableId, bytes32[] memory keyTuple)` returns whether a given keyTuple is in a table (with O(1) gas) Using `getKeysInTable` to retrieve all keys in the Player table: @@ -62,7 +62,7 @@ import { Player, PlayerTableId } from "../codegen/tables/Player.sol"; bytes32[][] memory players = getKeysInTable(world, PlayerTableId); ``` -Using `hasKey` to check if a key is in the Player table: +Using `hasKey` to check if a keyTuple is in the Player table: ```solidity // assumes a boolean flag indicates a player: @@ -79,7 +79,7 @@ bool memory isPlayer = hasKey(world, PlayerTableId, keyTuple); Internally, it works by installing a [hook](https://v2.mud.dev/store/advanced-features#storage-hooks) that maintains: - an array of all keys in the table -- an index or "**reverse mapping**" of whether a given key is in the table +- an index or "**reverse mapping**" of whether a given keyTuple is in the table #### **`KeysWithValueModule`** diff --git a/packages/block-logs-stream/README.md b/packages/block-logs-stream/README.md index 692c02423f..14691644a6 100644 --- a/packages/block-logs-stream/README.md +++ b/packages/block-logs-stream/README.md @@ -26,10 +26,10 @@ latestBlockNumber$ publicClient, address, events: parseAbi([ - "event StoreDeleteRecord(bytes32 tableId, bytes32[] key)", - "event StoreSetField(bytes32 tableId, bytes32[] key, uint8 schemaIndex, bytes data)", - "event StoreSetRecord(bytes32 tableId, bytes32[] key, bytes data)", - "event StoreEphemeralRecord(bytes32 tableId, bytes32[] key, bytes data)", + "event StoreDeleteRecord(bytes32 tableId, bytes32[] keyTuple)", + "event StoreSetField(bytes32 tableId, bytes32[] keyTuple, uint8 schemaIndex, bytes data)", + "event StoreSetRecord(bytes32 tableId, bytes32[] keyTuple, bytes data)", + "event StoreEphemeralRecord(bytes32 tableId, bytes32[] keyTuple, bytes data)", ]), }), mergeMap(({ logs }) => from(groupLogsByBlockNumber(logs))) diff --git a/packages/store-sync/src/blockLogsToStorage.test.ts b/packages/store-sync/src/blockLogsToStorage.test.ts index d1adbaa602..e3f134db48 100644 --- a/packages/store-sync/src/blockLogsToStorage.test.ts +++ b/packages/store-sync/src/blockLogsToStorage.test.ts @@ -60,7 +60,7 @@ describe("blockLogsToStorage", () => { removed: false, args: { tableId: "0x6d756473746f726500000000000000005461626c657300000000000000000000", - key: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], + keyTuple: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], data: "0x0004010004000000000000000000000000000000000000000000000000000000001c030061030300000000000000000000000000000000000000000000000000000401000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000001600000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000056f776e657200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000046974656d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6974656d56617269616e740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006616d6f756e740000000000000000000000000000000000000000000000000000", }, eventName: "StoreSetRecord", @@ -77,7 +77,7 @@ describe("blockLogsToStorage", () => { removed: false, args: { tableId: "0x00000000000000000000000000000000496e76656e746f727900000000000000", - key: [ + keyTuple: [ "0x000000000000000000000000796eb990a3f9c431c69149c7a168b91596d87f60", "0x0000000000000000000000000000000000000000000000000000000000000001", "0x0000000000000000000000000000000000000000000000000000000000000001", @@ -110,7 +110,7 @@ describe("blockLogsToStorage", () => { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "args": { "data": "0x00000008", - "key": [ + "keyTuple": [ "0x000000000000000000000000796eb990a3f9c431c69149c7a168b91596d87f60", "0x0000000000000000000000000000000000000000000000000000000000000001", "0x0000000000000000000000000000000000000000000000000000000000000001", @@ -164,7 +164,7 @@ describe("blockLogsToStorage", () => { "address": "0x5fbdb2315678afecb367f032d93f642f64180aa3", "args": { "data": "0x00000008", - "key": [ + "keyTuple": [ "0x000000000000000000000000796eb990a3f9c431c69149c7a168b91596d87f60", "0x0000000000000000000000000000000000000000000000000000000000000001", "0x0000000000000000000000000000000000000000000000000000000000000001", diff --git a/packages/store-sync/src/blockLogsToStorage.ts b/packages/store-sync/src/blockLogsToStorage.ts index 645db04c3f..e2d025f3e3 100644 --- a/packages/store-sync/src/blockLogsToStorage.ts +++ b/packages/store-sync/src/blockLogsToStorage.ts @@ -41,7 +41,7 @@ export function blockLogsToStorage({ // TODO: refactor encode/decode to use Record schemas // TODO: refactor to decode key with protocol-parser utils - const [tableId, ...otherKeys] = log.args.key; + const [tableId, ...otherKeys] = log.args.keyTuple; if (otherKeys.length) { console.warn("registerSchema event is expected to have only one key in key tuple, but got multiple", log); } @@ -115,7 +115,7 @@ export function blockLogsToStorage({ const keyNames = Object.keys(table.keySchema); const keyValues = decodeKeyTuple( { staticFields: Object.values(table.keySchema), dynamicFields: [] }, - log.args.key + log.args.keyTuple ); const key = Object.fromEntries(keyValues.map((value, i) => [keyNames[i], value])) as Key< TConfig, diff --git a/packages/store-sync/src/postgres/postgresStorage.test.ts b/packages/store-sync/src/postgres/postgresStorage.test.ts index 710ba387fc..47c29b5ee9 100644 --- a/packages/store-sync/src/postgres/postgresStorage.test.ts +++ b/packages/store-sync/src/postgres/postgresStorage.test.ts @@ -9,6 +9,7 @@ import * as transformSchemaNameExports from "./transformSchemaName"; import { getTables } from "./getTables"; import { PostgresStorageAdapter, postgresStorage } from "./postgresStorage"; import { buildTable } from "./buildTable"; +import { StoreEventsLog } from "../common"; vi.spyOn(transformSchemaNameExports, "transformSchemaName").mockImplementation( (schemaName) => `${process.pid}_${process.env.VITEST_POOL_ID}__${schemaName}` @@ -47,7 +48,7 @@ describe("postgresStorage", async () => { removed: false, args: { tableId: "0x000000000000000000000000000000005265736f757263655479706500000000", - key: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], + keyTuple: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], schemaIndex: 0, data: "0x02", }, @@ -65,12 +66,12 @@ describe("postgresStorage", async () => { removed: false, args: { tableId: "0x6d756473746f726500000000000000005461626c657300000000000000000000", - key: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], + keyTuple: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], data: "0x0004010004000000000000000000000000000000000000000000000000000000001c030061030300000000000000000000000000000000000000000000000000000401000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000001600000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000056f776e657200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000046974656d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6974656d56617269616e740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006616d6f756e740000000000000000000000000000000000000000000000000000", }, eventName: "StoreSetRecord", }, - ], + ] satisfies StoreEventsLog[], }); expect(await db.select().from(storageAdapter.internalTables.chain)).toMatchInlineSnapshot(` diff --git a/packages/store-sync/src/sqlite/sqliteStorage.test.ts b/packages/store-sync/src/sqlite/sqliteStorage.test.ts index 1047ff4262..414c104b25 100644 --- a/packages/store-sync/src/sqlite/sqliteStorage.test.ts +++ b/packages/store-sync/src/sqlite/sqliteStorage.test.ts @@ -9,6 +9,7 @@ import { drizzle } from "drizzle-orm/sql-js"; import { createPublicClient, http } from "viem"; import { foundry } from "viem/chains"; import { blockLogsToStorage } from "../blockLogsToStorage"; +import { StoreEventsLog } from "../common"; describe("sqliteStorage", async () => { const SqlJs = await initSqlJs(); @@ -53,7 +54,7 @@ describe("sqliteStorage", async () => { removed: false, args: { tableId: "0x000000000000000000000000000000005265736f757263655479706500000000", - key: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], + keyTuple: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], schemaIndex: 0, data: "0x02", }, @@ -71,12 +72,12 @@ describe("sqliteStorage", async () => { removed: false, args: { tableId: "0x6d756473746f726500000000000000005461626c657300000000000000000000", - key: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], + keyTuple: ["0x00000000000000000000000000000000496e76656e746f727900000000000000"], data: "0x0004010004000000000000000000000000000000000000000000000000000000001c030061030300000000000000000000000000000000000000000000000000000401000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000001600000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000056f776e657200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000046974656d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b6974656d56617269616e740000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000006616d6f756e740000000000000000000000000000000000000000000000000000", }, eventName: "StoreSetRecord", }, - ], + ] satisfies StoreEventsLog[], }); expect(db.select().from(chainState).all()).toMatchInlineSnapshot(` diff --git a/packages/store/src/IStore.sol b/packages/store/src/IStore.sol index 86031f0c32..68df303f9e 100644 --- a/packages/store/src/IStore.sol +++ b/packages/store/src/IStore.sol @@ -16,14 +16,14 @@ interface IStoreRead { // Get full record (including full array) function getRecord( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, FieldLayout fieldLayout ) external view returns (bytes memory data); // Get partial data at schema index function getField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, FieldLayout fieldLayout ) external view returns (bytes memory data); @@ -31,7 +31,7 @@ interface IStoreRead { // Get field length at schema index function getFieldLength( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, FieldLayout fieldLayout ) external view returns (uint256); @@ -39,7 +39,7 @@ interface IStoreRead { // Get start:end slice of the field at schema index function getFieldSlice( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, FieldLayout fieldLayout, uint256 start, @@ -48,17 +48,22 @@ interface IStoreRead { } interface IStoreWrite { - event StoreSetRecord(bytes32 tableId, bytes32[] key, bytes data); - event StoreSetField(bytes32 tableId, bytes32[] key, uint8 schemaIndex, bytes data); - event StoreDeleteRecord(bytes32 tableId, bytes32[] key); + event StoreSetRecord(bytes32 tableId, bytes32[] keyTuple, bytes data); + event StoreSetField(bytes32 tableId, bytes32[] keyTuple, uint8 schemaIndex, bytes data); + event StoreDeleteRecord(bytes32 tableId, bytes32[] keyTuple); // Set full record (including full dynamic data) - function setRecord(bytes32 tableId, bytes32[] calldata key, bytes calldata data, FieldLayout fieldLayout) external; + function setRecord( + bytes32 tableId, + bytes32[] calldata keyTuple, + bytes calldata data, + FieldLayout fieldLayout + ) external; // Set partial data at schema index function setField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, bytes calldata data, FieldLayout fieldLayout @@ -67,7 +72,7 @@ interface IStoreWrite { // Push encoded items to the dynamic field at schema index function pushToField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, bytes calldata dataToPush, FieldLayout fieldLayout @@ -76,7 +81,7 @@ interface IStoreWrite { // Pop byte length from the dynamic field at schema index function popFromField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, uint256 byteLengthToPop, FieldLayout fieldLayout @@ -85,7 +90,7 @@ interface IStoreWrite { // Change encoded items within the dynamic field at schema index function updateInField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, uint256 startByteIndex, bytes calldata dataToSet, @@ -93,16 +98,16 @@ interface IStoreWrite { ) external; // Set full record (including full dynamic data) - function deleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) external; + function deleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) external; } interface IStoreEphemeral { - event StoreEphemeralRecord(bytes32 tableId, bytes32[] key, bytes data); + event StoreEphemeralRecord(bytes32 tableId, bytes32[] keyTuple, bytes data); // Emit the ephemeral event without modifying storage function emitEphemeralRecord( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, bytes calldata data, FieldLayout fieldLayout ) external; diff --git a/packages/store/src/IStoreHook.sol b/packages/store/src/IStoreHook.sol index dd75547967..fa65ff4cff 100644 --- a/packages/store/src/IStoreHook.sol +++ b/packages/store/src/IStoreHook.sol @@ -16,16 +16,21 @@ bytes4 constant STORE_HOOK_INTERFACE_ID = IStoreHook.onBeforeSetRecord.selector interface IStoreHook is IERC165 { function onBeforeSetRecord( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, bytes memory data, FieldLayout fieldLayout ) external; - function onAfterSetRecord(bytes32 tableId, bytes32[] memory key, bytes memory data, FieldLayout fieldLayout) external; + function onAfterSetRecord( + bytes32 tableId, + bytes32[] memory keyTuple, + bytes memory data, + FieldLayout fieldLayout + ) external; function onBeforeSetField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, bytes memory data, FieldLayout fieldLayout @@ -33,13 +38,13 @@ interface IStoreHook is IERC165 { function onAfterSetField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, bytes memory data, FieldLayout fieldLayout ) external; - function onBeforeDeleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) external; + function onBeforeDeleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) external; - function onAfterDeleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) external; + function onAfterDeleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) external; } diff --git a/packages/store/src/StoreCore.sol b/packages/store/src/StoreCore.sol index 46f010e9e8..c2b81a57a8 100644 --- a/packages/store/src/StoreCore.sol +++ b/packages/store/src/StoreCore.sol @@ -17,10 +17,10 @@ import { StoreHookLib, StoreHookType } from "./StoreHook.sol"; library StoreCore { // note: the preimage of the tuple of keys used to index is part of the event, so it can be used by indexers - event StoreSetRecord(bytes32 tableId, bytes32[] key, bytes data); - event StoreSetField(bytes32 tableId, bytes32[] key, uint8 fieldIndex, bytes data); - event StoreDeleteRecord(bytes32 tableId, bytes32[] key); - event StoreEphemeralRecord(bytes32 tableId, bytes32[] key, bytes data); + event StoreSetRecord(bytes32 tableId, bytes32[] keyTuple, bytes data); + event StoreSetField(bytes32 tableId, bytes32[] keyTuple, uint8 fieldIndex, bytes data); + event StoreDeleteRecord(bytes32 tableId, bytes32[] keyTuple); + event StoreEphemeralRecord(bytes32 tableId, bytes32[] keyTuple, bytes data); /** * Intialize the store address to use in StoreSwitch. @@ -89,7 +89,7 @@ library StoreCore { } /** - * Register a new table with key field layout, value field layout, key names, and value names + * Register a new table the given config */ function registerTable( bytes32 tableId, @@ -164,7 +164,7 @@ library StoreCore { /** * Set full data record for the given tableId and key tuple and field layout */ - function setRecord(bytes32 tableId, bytes32[] memory key, bytes memory data, FieldLayout fieldLayout) internal { + function setRecord(bytes32 tableId, bytes32[] memory keyTuple, bytes memory data, FieldLayout fieldLayout) internal { // verify the value has the correct length for the table (based on the table's field layout) // to prevent invalid data from being stored @@ -172,19 +172,19 @@ library StoreCore { (uint256 staticLength, PackedCounter dynamicLength) = StoreCoreInternal._validateDataLength(fieldLayout, data); // Emit event to notify indexers - emit StoreSetRecord(tableId, key, data); + emit StoreSetRecord(tableId, keyTuple, data); // Call onBeforeSetRecord hooks (before actually modifying the state, so observers have access to the previous state if needed) bytes21[] memory hooks = StoreHooks.get(tableId); for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.BEFORE_SET_RECORD))) { - IStoreHook(hook.getAddress()).onBeforeSetRecord(tableId, key, data, fieldLayout); + IStoreHook(hook.getAddress()).onBeforeSetRecord(tableId, keyTuple, data, fieldLayout); } } // Store the static data at the static data location - uint256 staticDataLocation = StoreCoreInternal._getStaticDataLocation(tableId, key); + uint256 staticDataLocation = StoreCoreInternal._getStaticDataLocation(tableId, keyTuple); uint256 memoryPointer = Memory.dataPointer(data); Storage.store({ storagePointer: staticDataLocation, @@ -197,14 +197,14 @@ library StoreCore { // Set the dynamic data if there are dynamic fields if (fieldLayout.numDynamicFields() > 0) { // Store the dynamic data length at the dynamic data length location - uint256 dynamicDataLengthLocation = StoreCoreInternal._getDynamicDataLengthLocation(tableId, key); + uint256 dynamicDataLengthLocation = StoreCoreInternal._getDynamicDataLengthLocation(tableId, keyTuple); Storage.store({ storagePointer: dynamicDataLengthLocation, data: dynamicLength.unwrap() }); // For every dynamic element, slice off the dynamic data and store it at the dynamic location uint256 dynamicDataLocation; uint256 dynamicDataLength; for (uint8 i; i < fieldLayout.numDynamicFields(); ) { - dynamicDataLocation = StoreCoreInternal._getDynamicDataLocation(tableId, key, i); + dynamicDataLocation = StoreCoreInternal._getDynamicDataLocation(tableId, keyTuple, i); dynamicDataLength = dynamicLength.atIndex(i); Storage.store({ storagePointer: dynamicDataLocation, @@ -223,7 +223,7 @@ library StoreCore { for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.AFTER_SET_RECORD))) { - IStoreHook(hook.getAddress()).onAfterSetRecord(tableId, key, data, fieldLayout); + IStoreHook(hook.getAddress()).onAfterSetRecord(tableId, keyTuple, data, fieldLayout); } } } @@ -233,34 +233,34 @@ library StoreCore { */ function setField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, bytes memory data, FieldLayout fieldLayout ) internal { // Emit event to notify indexers - emit StoreSetField(tableId, key, schemaIndex, data); + emit StoreSetField(tableId, keyTuple, schemaIndex, data); // Call onBeforeSetField hooks (before modifying the state) bytes21[] memory hooks = StoreHooks.get(tableId); for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.BEFORE_SET_FIELD))) { - IStoreHook(hook.getAddress()).onBeforeSetField(tableId, key, schemaIndex, data, fieldLayout); + IStoreHook(hook.getAddress()).onBeforeSetField(tableId, keyTuple, schemaIndex, data, fieldLayout); } } if (schemaIndex < fieldLayout.numStaticFields()) { - StoreCoreInternal._setStaticField(tableId, key, fieldLayout, schemaIndex, data); + StoreCoreInternal._setStaticField(tableId, keyTuple, fieldLayout, schemaIndex, data); } else { - StoreCoreInternal._setDynamicField(tableId, key, fieldLayout, schemaIndex, data); + StoreCoreInternal._setDynamicField(tableId, keyTuple, fieldLayout, schemaIndex, data); } // Call onAfterSetField hooks (after modifying the state) for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.AFTER_SET_FIELD))) { - IStoreHook(hook.getAddress()).onAfterSetField(tableId, key, schemaIndex, data, fieldLayout); + IStoreHook(hook.getAddress()).onAfterSetField(tableId, keyTuple, schemaIndex, data, fieldLayout); } } } @@ -268,26 +268,26 @@ library StoreCore { /** * Delete a record for the given tableId, key tuple and value field layout */ - function deleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) internal { + function deleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) internal { // Emit event to notify indexers - emit StoreDeleteRecord(tableId, key); + emit StoreDeleteRecord(tableId, keyTuple); // Call onBeforeDeleteRecord hooks (before actually modifying the state, so observers have access to the previous state if needed) bytes21[] memory hooks = StoreHooks.get(tableId); for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.BEFORE_DELETE_RECORD))) { - IStoreHook(hook.getAddress()).onBeforeDeleteRecord(tableId, key, fieldLayout); + IStoreHook(hook.getAddress()).onBeforeDeleteRecord(tableId, keyTuple, fieldLayout); } } // Delete static data - uint256 staticDataLocation = StoreCoreInternal._getStaticDataLocation(tableId, key); + 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 (fieldLayout.numDynamicFields() > 0) { - uint256 dynamicDataLengthLocation = StoreCoreInternal._getDynamicDataLengthLocation(tableId, key); + uint256 dynamicDataLengthLocation = StoreCoreInternal._getDynamicDataLengthLocation(tableId, keyTuple); Storage.store({ storagePointer: dynamicDataLengthLocation, data: bytes32(0) }); } @@ -295,17 +295,17 @@ library StoreCore { for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.AFTER_DELETE_RECORD))) { - IStoreHook(hook.getAddress()).onAfterDeleteRecord(tableId, key, fieldLayout); + IStoreHook(hook.getAddress()).onAfterDeleteRecord(tableId, keyTuple, fieldLayout); } } } /** - * Push data to a field in a table with the given tableId, key tuple and value field layout + * Push data to a field in a table with the given tableId, keyTuple tuple and value field layout */ function pushToField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, bytes memory dataToPush, FieldLayout fieldLayout @@ -316,29 +316,29 @@ library StoreCore { // TODO add push-specific event and hook to avoid the storage read? (https://github.com/latticexyz/mud/issues/444) bytes memory fullData = abi.encodePacked( - StoreCoreInternal._getDynamicField(tableId, key, schemaIndex, fieldLayout), + StoreCoreInternal._getDynamicField(tableId, keyTuple, schemaIndex, fieldLayout), dataToPush ); // Emit event to notify indexers - emit StoreSetField(tableId, key, schemaIndex, fullData); + emit StoreSetField(tableId, keyTuple, schemaIndex, fullData); // Call onBeforeSetField hooks (before modifying the state) bytes21[] memory hooks = StoreHooks.get(tableId); for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.BEFORE_SET_FIELD))) { - IStoreHook(hook.getAddress()).onBeforeSetField(tableId, key, schemaIndex, fullData, fieldLayout); + IStoreHook(hook.getAddress()).onBeforeSetField(tableId, keyTuple, schemaIndex, fullData, fieldLayout); } } - StoreCoreInternal._pushToDynamicField(tableId, key, fieldLayout, schemaIndex, dataToPush); + StoreCoreInternal._pushToDynamicField(tableId, keyTuple, fieldLayout, schemaIndex, dataToPush); // Call onAfterSetField hooks (after modifying the state) for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.AFTER_SET_FIELD))) { - IStoreHook(hook.getAddress()).onAfterSetField(tableId, key, schemaIndex, fullData, fieldLayout); + IStoreHook(hook.getAddress()).onAfterSetField(tableId, keyTuple, schemaIndex, fullData, fieldLayout); } } } @@ -348,7 +348,7 @@ library StoreCore { */ function popFromField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, uint256 byteLengthToPop, FieldLayout fieldLayout @@ -360,29 +360,29 @@ library StoreCore { // TODO add pop-specific event and hook to avoid the storage read? (https://github.com/latticexyz/mud/issues/444) bytes memory fullData; { - bytes memory oldData = StoreCoreInternal._getDynamicField(tableId, key, schemaIndex, fieldLayout); + bytes memory oldData = StoreCoreInternal._getDynamicField(tableId, keyTuple, schemaIndex, fieldLayout); fullData = SliceLib.getSubslice(oldData, 0, oldData.length - byteLengthToPop).toBytes(); } // Emit event to notify indexers - emit StoreSetField(tableId, key, schemaIndex, fullData); + emit StoreSetField(tableId, keyTuple, schemaIndex, fullData); // Call onBeforeSetField hooks (before modifying the state) bytes21[] memory hooks = StoreHooks.get(tableId); for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.BEFORE_SET_FIELD))) { - IStoreHook(hook.getAddress()).onBeforeSetField(tableId, key, schemaIndex, fullData, fieldLayout); + IStoreHook(hook.getAddress()).onBeforeSetField(tableId, keyTuple, schemaIndex, fullData, fieldLayout); } } - StoreCoreInternal._popFromDynamicField(tableId, key, fieldLayout, schemaIndex, byteLengthToPop); + StoreCoreInternal._popFromDynamicField(tableId, keyTuple, fieldLayout, schemaIndex, byteLengthToPop); // Call onAfterSetField hooks (after modifying the state) for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.AFTER_SET_FIELD))) { - IStoreHook(hook.getAddress()).onAfterSetField(tableId, key, schemaIndex, fullData, fieldLayout); + IStoreHook(hook.getAddress()).onAfterSetField(tableId, keyTuple, schemaIndex, fullData, fieldLayout); } } } @@ -392,7 +392,7 @@ library StoreCore { */ function updateInField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, uint256 startByteIndex, bytes memory dataToSet, @@ -410,7 +410,7 @@ library StoreCore { // TODO add setItem-specific event and hook to avoid the storage read? (https://github.com/latticexyz/mud/issues/444) bytes memory fullData; { - bytes memory oldData = StoreCoreInternal._getDynamicField(tableId, key, schemaIndex, fieldLayout); + bytes memory oldData = StoreCoreInternal._getDynamicField(tableId, keyTuple, schemaIndex, fieldLayout); fullData = abi.encodePacked( SliceLib.getSubslice(oldData, 0, startByteIndex).toBytes(), dataToSet, @@ -419,24 +419,24 @@ library StoreCore { } // Emit event to notify indexers - emit StoreSetField(tableId, key, schemaIndex, fullData); + emit StoreSetField(tableId, keyTuple, schemaIndex, fullData); // Call onBeforeSetField hooks (before modifying the state) bytes21[] memory hooks = StoreHooks.get(tableId); for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.BEFORE_SET_FIELD))) { - IStoreHook(hook.getAddress()).onBeforeSetField(tableId, key, schemaIndex, fullData, fieldLayout); + IStoreHook(hook.getAddress()).onBeforeSetField(tableId, keyTuple, schemaIndex, fullData, fieldLayout); } } - StoreCoreInternal._setDynamicFieldItem(tableId, key, fieldLayout, schemaIndex, startByteIndex, dataToSet); + StoreCoreInternal._setDynamicFieldItem(tableId, keyTuple, fieldLayout, schemaIndex, startByteIndex, dataToSet); // Call onAfterSetField hooks (after modifying the state) for (uint256 i; i < hooks.length; i++) { Hook hook = Hook.wrap(hooks[i]); if (hook.isEnabled(uint8(StoreHookType.AFTER_SET_FIELD))) { - IStoreHook(hook.getAddress()).onAfterSetField(tableId, key, schemaIndex, fullData, fieldLayout); + IStoreHook(hook.getAddress()).onAfterSetField(tableId, keyTuple, schemaIndex, fullData, fieldLayout); } } } @@ -452,7 +452,7 @@ library StoreCore { */ function emitEphemeralRecord( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, bytes memory data, FieldLayout fieldLayout ) internal { @@ -460,7 +460,7 @@ library StoreCore { StoreCoreInternal._validateDataLength(fieldLayout, data); // Emit event to notify indexers - emit StoreEphemeralRecord(tableId, key, data); + emit StoreEphemeralRecord(tableId, keyTuple, data); } /************************************************************************ @@ -474,7 +474,7 @@ library StoreCore { */ function getRecord( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, FieldLayout fieldLayout ) internal view returns (bytes memory) { // Get the static data length @@ -485,7 +485,7 @@ library StoreCore { PackedCounter dynamicDataLength; uint256 numDynamicFields = fieldLayout.numDynamicFields(); if (numDynamicFields > 0) { - dynamicDataLength = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, key); + dynamicDataLength = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple); // TODO should total output include dynamic data length even if it's 0? if (dynamicDataLength.total() > 0) { outputLength += 32 + dynamicDataLength.total(); // encoded length + data @@ -497,7 +497,7 @@ library StoreCore { uint256 memoryPointer = Memory.dataPointer(data); // Load the static data from storage - StoreCoreInternal._getStaticData(tableId, key, staticLength, memoryPointer); + StoreCoreInternal._getStaticData(tableId, keyTuple, staticLength, memoryPointer); // Early return if there are no dynamic fields if (dynamicDataLength.total() == 0) return data; @@ -513,7 +513,7 @@ library StoreCore { // Append dynamic data for (uint8 i; i < numDynamicFields; i++) { - uint256 dynamicDataLocation = StoreCoreInternal._getDynamicDataLocation(tableId, key, i); + uint256 dynamicDataLocation = StoreCoreInternal._getDynamicDataLocation(tableId, keyTuple, i); uint256 length = dynamicDataLength.atIndex(i); Storage.load({ storagePointer: dynamicDataLocation, length: length, offset: 0, memoryPointer: memoryPointer }); // Advance memoryPointer by the length of this dynamic field @@ -529,14 +529,14 @@ library StoreCore { */ function getField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, FieldLayout fieldLayout ) internal view returns (bytes memory) { if (schemaIndex < fieldLayout.numStaticFields()) { - return StoreCoreInternal._getStaticField(tableId, key, schemaIndex, fieldLayout); + return StoreCoreInternal._getStaticField(tableId, keyTuple, schemaIndex, fieldLayout); } else { - return StoreCoreInternal._getDynamicField(tableId, key, schemaIndex, fieldLayout); + return StoreCoreInternal._getDynamicField(tableId, keyTuple, schemaIndex, fieldLayout); } } @@ -545,7 +545,7 @@ library StoreCore { */ function getFieldLength( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, FieldLayout fieldLayout ) internal view returns (uint256) { @@ -555,7 +555,7 @@ library StoreCore { } else { // Get the length and storage location of the dynamic field uint8 dynamicFieldLayoutIndex = schemaIndex - numStaticFields; - return StoreCoreInternal._loadEncodedDynamicDataLength(tableId, key).atIndex(dynamicFieldLayoutIndex); + return StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple).atIndex(dynamicFieldLayoutIndex); } } @@ -565,7 +565,7 @@ library StoreCore { */ function getFieldSlice( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, FieldLayout fieldLayout, uint256 start, @@ -578,7 +578,7 @@ library StoreCore { // Get the length and storage location of the dynamic field uint8 dynamicSchemaIndex = schemaIndex - numStaticFields; - uint256 location = StoreCoreInternal._getDynamicDataLocation(tableId, key, dynamicSchemaIndex); + uint256 location = StoreCoreInternal._getDynamicDataLocation(tableId, keyTuple, dynamicSchemaIndex); return Storage.load({ storagePointer: location, length: end - start, offset: start }); } @@ -595,7 +595,7 @@ library StoreCoreInternal { function _setStaticField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, FieldLayout fieldLayout, uint8 schemaIndex, bytes memory data @@ -607,14 +607,14 @@ library StoreCoreInternal { } // Store the provided value in storage - uint256 location = _getStaticDataLocation(tableId, key); + uint256 location = _getStaticDataLocation(tableId, keyTuple); uint256 offset = _getStaticDataOffset(fieldLayout, schemaIndex); Storage.store({ storagePointer: location, offset: offset, data: data }); } function _setDynamicField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, FieldLayout fieldLayout, uint8 schemaIndex, bytes memory data @@ -622,16 +622,16 @@ library StoreCoreInternal { uint8 dynamicSchemaIndex = schemaIndex - uint8(fieldLayout.numStaticFields()); // Update the dynamic data length - _setDynamicDataLengthAtIndex(tableId, key, dynamicSchemaIndex, data.length); + _setDynamicDataLengthAtIndex(tableId, keyTuple, dynamicSchemaIndex, data.length); // Store the provided value in storage - uint256 dynamicDataLocation = _getDynamicDataLocation(tableId, key, dynamicSchemaIndex); + uint256 dynamicDataLocation = _getDynamicDataLocation(tableId, keyTuple, dynamicSchemaIndex); Storage.store({ storagePointer: dynamicDataLocation, offset: 0, data: data }); } function _pushToDynamicField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, FieldLayout fieldLayout, uint8 schemaIndex, bytes memory dataToPush @@ -639,7 +639,7 @@ library StoreCoreInternal { uint8 dynamicSchemaIndex = schemaIndex - uint8(fieldLayout.numStaticFields()); // Load dynamic data length from storage - uint256 dynamicDataLengthSlot = _getDynamicDataLengthLocation(tableId, key); + uint256 dynamicDataLengthSlot = _getDynamicDataLengthLocation(tableId, keyTuple); PackedCounter encodedLengths = PackedCounter.wrap(Storage.load({ storagePointer: dynamicDataLengthSlot })); // Update the encoded length @@ -650,12 +650,12 @@ library StoreCoreInternal { Storage.store({ storagePointer: dynamicDataLengthSlot, data: encodedLengths.unwrap() }); // Append `dataToPush` to the end of the data in storage - _setPartialDynamicData(tableId, key, dynamicSchemaIndex, oldFieldLength, dataToPush); + _setPartialDynamicData(tableId, keyTuple, dynamicSchemaIndex, oldFieldLength, dataToPush); } function _popFromDynamicField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, FieldLayout fieldLayout, uint8 schemaIndex, uint256 byteLengthToPop @@ -663,7 +663,7 @@ library StoreCoreInternal { uint8 dynamicSchemaIndex = schemaIndex - uint8(fieldLayout.numStaticFields()); // Load dynamic data length from storage - uint256 dynamicDataLengthSlot = _getDynamicDataLengthLocation(tableId, key); + uint256 dynamicDataLengthSlot = _getDynamicDataLengthLocation(tableId, keyTuple); PackedCounter encodedLengths = PackedCounter.wrap(Storage.load({ storagePointer: dynamicDataLengthSlot })); // Update the encoded length @@ -679,7 +679,7 @@ library StoreCoreInternal { // startOffset is measured in bytes function _setDynamicFieldItem( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, FieldLayout fieldLayout, uint8 schemaIndex, uint256 startByteIndex, @@ -688,7 +688,7 @@ library StoreCoreInternal { uint8 dynamicSchemaIndex = schemaIndex - uint8(fieldLayout.numStaticFields()); // Set `dataToSet` at the given index - _setPartialDynamicData(tableId, key, dynamicSchemaIndex, startByteIndex, dataToSet); + _setPartialDynamicData(tableId, keyTuple, dynamicSchemaIndex, startByteIndex, dataToSet); } /************************************************************************ @@ -700,11 +700,16 @@ library StoreCoreInternal { /** * Get full static data for the given tableId and key tuple, with the given static length */ - function _getStaticData(bytes32 tableId, bytes32[] memory key, uint256 length, uint256 memoryPointer) internal view { + function _getStaticData( + bytes32 tableId, + bytes32[] memory keyTuple, + uint256 length, + uint256 memoryPointer + ) internal view { if (length == 0) return; // Load the data from storage - uint256 location = _getStaticDataLocation(tableId, key); + uint256 location = _getStaticDataLocation(tableId, keyTuple); Storage.load({ storagePointer: location, length: length, offset: 0, memoryPointer: memoryPointer }); } @@ -713,13 +718,13 @@ library StoreCoreInternal { */ function _getStaticField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, FieldLayout fieldLayout ) internal view returns (bytes memory) { // Get the length, storage location and offset of the static field uint256 staticByteLength = fieldLayout.atIndex(schemaIndex); - uint256 location = _getStaticDataLocation(tableId, key); + uint256 location = _getStaticDataLocation(tableId, keyTuple); uint256 offset = _getStaticDataOffset(fieldLayout, schemaIndex); // Load the data from storage @@ -732,14 +737,14 @@ library StoreCoreInternal { */ function _getDynamicField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, FieldLayout fieldLayout ) internal view returns (bytes memory) { // Get the length and storage location of the dynamic field uint8 dynamicSchemaIndex = schemaIndex - uint8(fieldLayout.numStaticFields()); - uint256 location = _getDynamicDataLocation(tableId, key, dynamicSchemaIndex); - uint256 dataLength = _loadEncodedDynamicDataLength(tableId, key).atIndex(dynamicSchemaIndex); + uint256 location = _getDynamicDataLocation(tableId, keyTuple, dynamicSchemaIndex); + uint256 dataLength = _loadEncodedDynamicDataLength(tableId, keyTuple).atIndex(dynamicSchemaIndex); return Storage.load({ storagePointer: location, length: dataLength, offset: 0 }); } @@ -779,8 +784,8 @@ library StoreCoreInternal { /** * Compute the storage location based on tableId id and index tuple */ - function _getStaticDataLocation(bytes32 tableId, bytes32[] memory key) internal pure returns (uint256) { - return uint256(keccak256(abi.encode(SLOT, tableId, key))); + function _getStaticDataLocation(bytes32 tableId, bytes32[] memory keyTuple) internal pure returns (uint256) { + return uint256(keccak256(abi.encode(SLOT, tableId, keyTuple))); } /** @@ -803,25 +808,28 @@ library StoreCoreInternal { */ function _getDynamicDataLocation( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex ) internal pure returns (uint256) { - return uint256(keccak256(abi.encode(SLOT, tableId, key, schemaIndex))); + return uint256(keccak256(abi.encode(SLOT, tableId, keyTuple, schemaIndex))); } /** * Compute the storage location for the length of the dynamic data */ - function _getDynamicDataLengthLocation(bytes32 tableId, bytes32[] memory key) internal pure returns (uint256) { - return uint256(keccak256(abi.encode(SLOT, tableId, key, "length"))); + function _getDynamicDataLengthLocation(bytes32 tableId, bytes32[] memory keyTuple) internal pure returns (uint256) { + return uint256(keccak256(abi.encode(SLOT, tableId, keyTuple, "length"))); } /** * Get the length of the dynamic data for the given value field layout and index */ - function _loadEncodedDynamicDataLength(bytes32 tableId, bytes32[] memory key) internal view returns (PackedCounter) { + function _loadEncodedDynamicDataLength( + bytes32 tableId, + bytes32[] memory keyTuple + ) internal view returns (PackedCounter) { // Load dynamic data length from storage - uint256 dynamicDataLengthSlot = _getDynamicDataLengthLocation(tableId, key); + uint256 dynamicDataLengthSlot = _getDynamicDataLengthLocation(tableId, keyTuple); return PackedCounter.wrap(Storage.load({ storagePointer: dynamicDataLengthSlot })); } @@ -830,12 +838,12 @@ library StoreCoreInternal { */ function _setDynamicDataLengthAtIndex( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 dynamicSchemaIndex, // schemaIndex - numStaticFields uint256 newLengthAtIndex ) internal { // Load dynamic data length from storage - uint256 dynamicDataLengthSlot = _getDynamicDataLengthLocation(tableId, key); + uint256 dynamicDataLengthSlot = _getDynamicDataLengthLocation(tableId, keyTuple); PackedCounter encodedLengths = PackedCounter.wrap(Storage.load({ storagePointer: dynamicDataLengthSlot })); // Update the encoded lengths @@ -850,12 +858,12 @@ library StoreCoreInternal { */ function _setPartialDynamicData( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 dynamicSchemaIndex, uint256 startByteIndex, bytes memory partialData ) internal { - uint256 dynamicDataLocation = _getDynamicDataLocation(tableId, key, dynamicSchemaIndex); + uint256 dynamicDataLocation = _getDynamicDataLocation(tableId, keyTuple, dynamicSchemaIndex); // start index is in bytes, whereas storage slots are in 32-byte words dynamicDataLocation += startByteIndex / 32; // partial storage slot offset (there is no inherent offset, as each dynamic field starts at its own storage slot) diff --git a/packages/store/src/StoreRead.sol b/packages/store/src/StoreRead.sol index a4c35672b9..ced24eb297 100644 --- a/packages/store/src/StoreRead.sol +++ b/packages/store/src/StoreRead.sol @@ -22,39 +22,39 @@ contract StoreRead is IStoreRead { // Get full record (static and dynamic data) function getRecord( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, FieldLayout fieldLayout ) public view virtual returns (bytes memory data) { - data = StoreCore.getRecord(tableId, key, fieldLayout); + data = StoreCore.getRecord(tableId, keyTuple, fieldLayout); } // Get partial data at schema index function getField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, FieldLayout fieldLayout ) public view virtual returns (bytes memory data) { - data = StoreCore.getField(tableId, key, schemaIndex, fieldLayout); + data = StoreCore.getField(tableId, keyTuple, schemaIndex, fieldLayout); } function getFieldLength( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, FieldLayout fieldLayout ) public view virtual returns (uint256) { - return StoreCore.getFieldLength(tableId, key, schemaIndex, fieldLayout); + return StoreCore.getFieldLength(tableId, keyTuple, schemaIndex, fieldLayout); } function getFieldSlice( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, FieldLayout fieldLayout, uint256 start, uint256 end ) public view virtual returns (bytes memory) { - return StoreCore.getFieldSlice(tableId, key, schemaIndex, fieldLayout, start, end); + return StoreCore.getFieldSlice(tableId, keyTuple, schemaIndex, fieldLayout, start, end); } } diff --git a/packages/store/src/StoreSwitch.sol b/packages/store/src/StoreSwitch.sol index 86ddb3b22e..86aa1e311d 100644 --- a/packages/store/src/StoreSwitch.sol +++ b/packages/store/src/StoreSwitch.sol @@ -107,63 +107,63 @@ library StoreSwitch { } } - function setRecord(bytes32 tableId, bytes32[] memory key, bytes memory data, FieldLayout fieldLayout) internal { + function setRecord(bytes32 tableId, bytes32[] memory keyTuple, bytes memory data, FieldLayout fieldLayout) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.setRecord(tableId, key, data, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, data, fieldLayout); } else { - IStore(_storeAddress).setRecord(tableId, key, data, fieldLayout); + IStore(_storeAddress).setRecord(tableId, keyTuple, data, fieldLayout); } } function setField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 fieldIndex, bytes memory data, FieldLayout fieldLayout ) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.setField(tableId, key, fieldIndex, data, fieldLayout); + StoreCore.setField(tableId, keyTuple, fieldIndex, data, fieldLayout); } else { - IStore(_storeAddress).setField(tableId, key, fieldIndex, data, fieldLayout); + IStore(_storeAddress).setField(tableId, keyTuple, fieldIndex, data, fieldLayout); } } function pushToField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 fieldIndex, bytes memory dataToPush, FieldLayout fieldLayout ) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.pushToField(tableId, key, fieldIndex, dataToPush, fieldLayout); + StoreCore.pushToField(tableId, keyTuple, fieldIndex, dataToPush, fieldLayout); } else { - IStore(_storeAddress).pushToField(tableId, key, fieldIndex, dataToPush, fieldLayout); + IStore(_storeAddress).pushToField(tableId, keyTuple, fieldIndex, dataToPush, fieldLayout); } } function popFromField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 fieldIndex, uint256 byteLengthToPop, FieldLayout fieldLayout ) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.popFromField(tableId, key, fieldIndex, byteLengthToPop, fieldLayout); + StoreCore.popFromField(tableId, keyTuple, fieldIndex, byteLengthToPop, fieldLayout); } else { - IStore(_storeAddress).popFromField(tableId, key, fieldIndex, byteLengthToPop, fieldLayout); + IStore(_storeAddress).popFromField(tableId, keyTuple, fieldIndex, byteLengthToPop, fieldLayout); } } function updateInField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 fieldIndex, uint256 startByteIndex, bytes memory dataToSet, @@ -171,79 +171,79 @@ library StoreSwitch { ) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.updateInField(tableId, key, fieldIndex, startByteIndex, dataToSet, fieldLayout); + StoreCore.updateInField(tableId, keyTuple, fieldIndex, startByteIndex, dataToSet, fieldLayout); } else { - IStore(_storeAddress).updateInField(tableId, key, fieldIndex, startByteIndex, dataToSet, fieldLayout); + IStore(_storeAddress).updateInField(tableId, keyTuple, fieldIndex, startByteIndex, dataToSet, fieldLayout); } } - function deleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) internal { + function deleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.deleteRecord(tableId, key, fieldLayout); + StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); } else { - IStore(_storeAddress).deleteRecord(tableId, key, fieldLayout); + IStore(_storeAddress).deleteRecord(tableId, keyTuple, fieldLayout); } } function emitEphemeralRecord( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, bytes memory data, FieldLayout fieldLayout ) internal { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - StoreCore.emitEphemeralRecord(tableId, key, data, fieldLayout); + StoreCore.emitEphemeralRecord(tableId, keyTuple, data, fieldLayout); } else { - IStore(_storeAddress).emitEphemeralRecord(tableId, key, data, fieldLayout); + IStore(_storeAddress).emitEphemeralRecord(tableId, keyTuple, data, fieldLayout); } } function getRecord( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, FieldLayout fieldLayout ) internal view returns (bytes memory) { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - return StoreCore.getRecord(tableId, key, fieldLayout); + return StoreCore.getRecord(tableId, keyTuple, fieldLayout); } else { - return IStore(_storeAddress).getRecord(tableId, key, fieldLayout); + return IStore(_storeAddress).getRecord(tableId, keyTuple, fieldLayout); } } function getField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 fieldIndex, FieldLayout fieldLayout ) internal view returns (bytes memory) { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - return StoreCore.getField(tableId, key, fieldIndex, fieldLayout); + return StoreCore.getField(tableId, keyTuple, fieldIndex, fieldLayout); } else { - return IStore(_storeAddress).getField(tableId, key, fieldIndex, fieldLayout); + return IStore(_storeAddress).getField(tableId, keyTuple, fieldIndex, fieldLayout); } } function getFieldLength( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 fieldIndex, FieldLayout fieldLayout ) internal view returns (uint256) { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - return StoreCore.getFieldLength(tableId, key, fieldIndex, fieldLayout); + return StoreCore.getFieldLength(tableId, keyTuple, fieldIndex, fieldLayout); } else { - return IStore(_storeAddress).getFieldLength(tableId, key, fieldIndex, fieldLayout); + return IStore(_storeAddress).getFieldLength(tableId, keyTuple, fieldIndex, fieldLayout); } } function getFieldSlice( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 fieldIndex, FieldLayout fieldLayout, uint256 start, @@ -251,9 +251,9 @@ library StoreSwitch { ) internal view returns (bytes memory) { address _storeAddress = getStoreAddress(); if (_storeAddress == address(this)) { - return StoreCore.getFieldSlice(tableId, key, fieldIndex, fieldLayout, start, end); + return StoreCore.getFieldSlice(tableId, keyTuple, fieldIndex, fieldLayout, start, end); } else { - return IStore(_storeAddress).getFieldSlice(tableId, key, fieldIndex, fieldLayout, start, end); + return IStore(_storeAddress).getFieldSlice(tableId, keyTuple, fieldIndex, fieldLayout, start, end); } } } diff --git a/packages/store/test/EchoSubscriber.sol b/packages/store/test/EchoSubscriber.sol index b9e23c6b41..505502dcde 100644 --- a/packages/store/test/EchoSubscriber.sol +++ b/packages/store/test/EchoSubscriber.sol @@ -7,39 +7,49 @@ import { StoreHook } from "../src/StoreHook.sol"; contract EchoSubscriber is StoreHook { event HookCalled(bytes); - function onBeforeSetRecord(bytes32 tableId, bytes32[] memory key, bytes memory data, FieldLayout fieldLayout) public { - emit HookCalled(abi.encode(tableId, key, data, fieldLayout)); + function onBeforeSetRecord( + bytes32 tableId, + bytes32[] memory keyTuple, + bytes memory data, + FieldLayout fieldLayout + ) public { + emit HookCalled(abi.encode(tableId, keyTuple, data, fieldLayout)); } - function onAfterSetRecord(bytes32 tableId, bytes32[] memory key, bytes memory data, FieldLayout fieldLayout) public { - emit HookCalled(abi.encode(tableId, key, data, fieldLayout)); + function onAfterSetRecord( + bytes32 tableId, + bytes32[] memory keyTuple, + bytes memory data, + FieldLayout fieldLayout + ) public { + emit HookCalled(abi.encode(tableId, keyTuple, data, fieldLayout)); } function onBeforeSetField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, bytes memory data, FieldLayout fieldLayout ) public { - emit HookCalled(abi.encode(tableId, key, schemaIndex, data, fieldLayout)); + emit HookCalled(abi.encode(tableId, keyTuple, schemaIndex, data, fieldLayout)); } function onAfterSetField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, bytes memory data, FieldLayout fieldLayout ) public { - emit HookCalled(abi.encode(tableId, key, schemaIndex, data, fieldLayout)); + emit HookCalled(abi.encode(tableId, keyTuple, schemaIndex, data, fieldLayout)); } - function onBeforeDeleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) public { - emit HookCalled(abi.encode(tableId, key, fieldLayout)); + function onBeforeDeleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) public { + emit HookCalled(abi.encode(tableId, keyTuple, fieldLayout)); } - function onAfterDeleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) public { - emit HookCalled(abi.encode(tableId, key, fieldLayout)); + function onAfterDeleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) public { + emit HookCalled(abi.encode(tableId, keyTuple, fieldLayout)); } } diff --git a/packages/store/test/MirrorSubscriber.sol b/packages/store/test/MirrorSubscriber.sol index d30b615679..34d6179682 100644 --- a/packages/store/test/MirrorSubscriber.sol +++ b/packages/store/test/MirrorSubscriber.sol @@ -24,36 +24,46 @@ contract MirrorSubscriber is StoreHook { _tableId = tableId; } - function onBeforeSetRecord(bytes32 tableId, bytes32[] memory key, bytes memory data, FieldLayout fieldLayout) public { + function onBeforeSetRecord( + bytes32 tableId, + bytes32[] memory keyTuple, + bytes memory data, + FieldLayout fieldLayout + ) public { if (tableId != tableId) revert("invalid tableId"); - StoreSwitch.setRecord(indexerTableId, key, data, fieldLayout); + StoreSwitch.setRecord(indexerTableId, keyTuple, data, fieldLayout); } - function onAfterSetRecord(bytes32 tableId, bytes32[] memory key, bytes memory data, FieldLayout fieldLayout) public { + function onAfterSetRecord( + bytes32 tableId, + bytes32[] memory keyTuple, + bytes memory data, + FieldLayout fieldLayout + ) public { // NOOP } function onBeforeSetField( bytes32 tableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8 schemaIndex, bytes memory data, FieldLayout fieldLayout ) public { if (tableId != tableId) revert("invalid tableId"); - StoreSwitch.setField(indexerTableId, key, schemaIndex, data, fieldLayout); + StoreSwitch.setField(indexerTableId, keyTuple, schemaIndex, data, fieldLayout); } function onAfterSetField(bytes32, bytes32[] memory, uint8, bytes memory, FieldLayout) public { // NOOP } - function onBeforeDeleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) public { + function onBeforeDeleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) public { if (tableId != tableId) revert("invalid tableId"); - StoreSwitch.deleteRecord(indexerTableId, key, fieldLayout); + StoreSwitch.deleteRecord(indexerTableId, keyTuple, fieldLayout); } - function onAfterDeleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) public { + function onAfterDeleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) public { // NOOP } } diff --git a/packages/store/test/StoreCore.t.sol b/packages/store/test/StoreCore.t.sol index ad1b84685b..6f502597f2 100644 --- a/packages/store/test/StoreCore.t.sol +++ b/packages/store/test/StoreCore.t.sol @@ -58,12 +58,12 @@ contract StoreCoreTest is Test, StoreMock { bytes32 tableId = keccak256("some.tableId"); // Expect a StoreSetRecord event to be emitted - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32(tableId); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = bytes32(tableId); vm.expectEmit(true, true, true, true); emit StoreSetRecord( TablesTableId, - key, + keyTuple, Tables.encode( fieldLayout.unwrap(), keySchema.unwrap(), @@ -184,30 +184,30 @@ contract StoreCoreTest is Test, StoreMock { // Register table IStore(this).registerTable(tableId, fieldLayout, defaultKeySchema, valueSchema, new string[](1), new string[](5)); - // Create some key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some key"); + // Create some keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = bytes32("some key"); // Set dynamic data length of dynamic index 0 - StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, key, 0, 10); + StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, keyTuple, 0, 10); - PackedCounter encodedLength = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, key); + PackedCounter encodedLength = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple); assertEq(encodedLength.atIndex(0), 10); assertEq(encodedLength.atIndex(1), 0); assertEq(encodedLength.total(), 10); // Set dynamic data length of dynamic index 1 - StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, key, 1, 99); + StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, keyTuple, 1, 99); - encodedLength = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, key); + encodedLength = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple); assertEq(encodedLength.atIndex(0), 10); assertEq(encodedLength.atIndex(1), 99); assertEq(encodedLength.total(), 109); // Reduce dynamic data length of dynamic index 0 again - StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, key, 0, 5); + StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, keyTuple, 0, 5); - encodedLength = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, key); + encodedLength = StoreCoreInternal._loadEncodedDynamicDataLength(tableId, keyTuple); assertEq(encodedLength.atIndex(0), 5); assertEq(encodedLength.atIndex(1), 99); assertEq(encodedLength.total(), 104); @@ -229,17 +229,17 @@ contract StoreCoreTest is Test, StoreMock { // Set data bytes memory data = abi.encodePacked(bytes1(0x01), bytes2(0x0203), bytes1(0x04), bytes2(0x0506)); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some.key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // Expect a StoreSetRecord event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetRecord(tableId, key, data); + emit StoreSetRecord(tableId, keyTuple, data); - IStore(this).setRecord(tableId, key, data, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, data, fieldLayout); // Get data - bytes memory loadedData = IStore(this).getRecord(tableId, key, fieldLayout); + bytes memory loadedData = IStore(this).getRecord(tableId, keyTuple, fieldLayout); assertTrue(Bytes.equals(data, loadedData)); } @@ -259,11 +259,11 @@ contract StoreCoreTest is Test, StoreMock { // Set data bytes memory data = abi.encodePacked(bytes1(0x01), bytes2(0x0203), bytes1(0x04)); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some.key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // This should fail because the data is not 6 bytes long - IStore(this).setRecord(tableId, key, data, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, data, fieldLayout); } function testSetAndGetStaticDataSpanningWords() public { @@ -279,17 +279,17 @@ contract StoreCoreTest is Test, StoreMock { bytes32(0x1112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30) ); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some.key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // Expect a StoreSetRecord event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetRecord(tableId, key, data); + emit StoreSetRecord(tableId, keyTuple, data); - IStore(this).setRecord(tableId, key, data, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, data, fieldLayout); // Get data - bytes memory loadedData = IStore(this).getRecord(tableId, key, fieldLayout); + bytes memory loadedData = IStore(this).getRecord(tableId, keyTuple, fieldLayout); assertTrue(Bytes.equals(data, loadedData)); } @@ -338,19 +338,19 @@ contract StoreCoreTest is Test, StoreMock { thirdDataBytes ); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = bytes32("some key"); // Expect a StoreSetRecord event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetRecord(tableId, key, data); + emit StoreSetRecord(tableId, keyTuple, data); // Set data - IStore(this).setRecord(tableId, key, data, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, data, fieldLayout); // Get data - bytes memory loadedData = IStore(this).getRecord(tableId, key, fieldLayout); + bytes memory loadedData = IStore(this).getRecord(tableId, keyTuple, fieldLayout); assertEq(loadedData.length, data.length); assertEq(keccak256(loadedData), keccak256(data)); @@ -384,32 +384,32 @@ contract StoreCoreTest is Test, StoreMock { bytes16 firstDataBytes = bytes16(0x0102030405060708090a0b0c0d0e0f10); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = bytes32("some key"); bytes memory firstDataPacked = abi.encodePacked(firstDataBytes); // Expect a StoreSetField event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetField(tableId, key, 0, firstDataPacked); + emit StoreSetField(tableId, keyTuple, 0, firstDataPacked); // Set first field - IStore(this).setField(tableId, key, 0, firstDataPacked, fieldLayout); + IStore(this).setField(tableId, keyTuple, 0, firstDataPacked, fieldLayout); //////////////// // Static data //////////////// // Get first field - bytes memory loadedData = IStore(this).getField(tableId, key, 0, fieldLayout); + bytes memory loadedData = IStore(this).getField(tableId, keyTuple, 0, fieldLayout); // Verify loaded data is correct assertEq(loadedData.length, 16); assertEq(bytes16(loadedData), bytes16(firstDataBytes)); // Verify the second index is not set yet - assertEq(uint256(bytes32(IStore(this).getField(tableId, key, 1, fieldLayout))), 0); + assertEq(uint256(bytes32(IStore(this).getField(tableId, keyTuple, 1, fieldLayout))), 0); // Set second field bytes32 secondDataBytes = keccak256("some data"); @@ -418,27 +418,27 @@ contract StoreCoreTest is Test, StoreMock { // Expect a StoreSetField event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetField(tableId, key, 1, secondDataPacked); + emit StoreSetField(tableId, keyTuple, 1, secondDataPacked); - IStore(this).setField(tableId, key, 1, secondDataPacked, fieldLayout); + IStore(this).setField(tableId, keyTuple, 1, secondDataPacked, fieldLayout); // Get second field - loadedData = IStore(this).getField(tableId, key, 1, fieldLayout); + loadedData = IStore(this).getField(tableId, keyTuple, 1, fieldLayout); // Verify loaded data is correct assertEq(loadedData.length, 32); assertEq(bytes32(loadedData), secondDataBytes); // Verify the first field didn't change - assertEq(bytes16(IStore(this).getField(tableId, key, 0, fieldLayout)), bytes16(firstDataBytes)); + assertEq(bytes16(IStore(this).getField(tableId, keyTuple, 0, fieldLayout)), bytes16(firstDataBytes)); // Verify the full static data is correct assertEq(IStore(this).getFieldLayout(tableId).staticDataLength(), 48); assertEq(IStore(this).getValueSchema(tableId).staticDataLength(), 48); - assertEq(Bytes.slice16(IStore(this).getRecord(tableId, key, fieldLayout), 0), firstDataBytes); - assertEq(Bytes.slice32(IStore(this).getRecord(tableId, key, fieldLayout), 16), secondDataBytes); + assertEq(Bytes.slice16(IStore(this).getRecord(tableId, keyTuple, fieldLayout), 0), firstDataBytes); + assertEq(Bytes.slice32(IStore(this).getRecord(tableId, keyTuple, fieldLayout), 16), secondDataBytes); assertEq( - keccak256(SliceLib.getSubslice(IStore(this).getRecord(tableId, key, fieldLayout), 0, 48).toBytes()), + keccak256(SliceLib.getSubslice(IStore(this).getRecord(tableId, keyTuple, fieldLayout), 0, 48).toBytes()), keccak256(abi.encodePacked(firstDataBytes, secondDataBytes)) ); @@ -465,13 +465,13 @@ contract StoreCoreTest is Test, StoreMock { // Expect a StoreSetField event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetField(tableId, key, 2, thirdDataBytes); + emit StoreSetField(tableId, keyTuple, 2, thirdDataBytes); // Set third field - IStore(this).setField(tableId, key, 2, thirdDataBytes, fieldLayout); + IStore(this).setField(tableId, keyTuple, 2, thirdDataBytes, fieldLayout); // Get third field - loadedData = IStore(this).getField(tableId, key, 2, fieldLayout); + loadedData = IStore(this).getField(tableId, keyTuple, 2, fieldLayout); // Verify loaded data is correct assertEq(SliceLib.fromBytes(loadedData).decodeArray_uint32().length, 2); @@ -479,21 +479,21 @@ contract StoreCoreTest is Test, StoreMock { assertEq(keccak256(loadedData), keccak256(thirdDataBytes)); // Verify the fourth field is not set yet - assertEq(IStore(this).getField(tableId, key, 3, fieldLayout).length, 0); + assertEq(IStore(this).getField(tableId, keyTuple, 3, fieldLayout).length, 0); // Verify none of the previous fields were impacted - assertEq(bytes16(IStore(this).getField(tableId, key, 0, fieldLayout)), bytes16(firstDataBytes)); - assertEq(bytes32(IStore(this).getField(tableId, key, 1, fieldLayout)), bytes32(secondDataBytes)); + assertEq(bytes16(IStore(this).getField(tableId, keyTuple, 0, fieldLayout)), bytes16(firstDataBytes)); + assertEq(bytes32(IStore(this).getField(tableId, keyTuple, 1, fieldLayout)), bytes32(secondDataBytes)); // Expect a StoreSetField event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetField(tableId, key, 3, fourthDataBytes); + emit StoreSetField(tableId, keyTuple, 3, fourthDataBytes); // Set fourth field - IStore(this).setField(tableId, key, 3, fourthDataBytes, fieldLayout); + IStore(this).setField(tableId, keyTuple, 3, fourthDataBytes, fieldLayout); // Get fourth field - loadedData = IStore(this).getField(tableId, key, 3, fieldLayout); + loadedData = IStore(this).getField(tableId, keyTuple, 3, fieldLayout); // Verify loaded data is correct assertEq(loadedData.length, fourthDataBytes.length); @@ -502,7 +502,7 @@ contract StoreCoreTest is Test, StoreMock { // Verify all fields are correct PackedCounter encodedLengths = PackedCounterLib.pack(uint40(thirdDataBytes.length), uint40(fourthDataBytes.length)); assertEq( - keccak256(IStore(this).getRecord(tableId, key, fieldLayout)), + keccak256(IStore(this).getRecord(tableId, keyTuple, fieldLayout)), keccak256( abi.encodePacked(firstDataBytes, secondDataBytes, encodedLengths.unwrap(), thirdDataBytes, fourthDataBytes) ) @@ -553,34 +553,34 @@ contract StoreCoreTest is Test, StoreMock { thirdDataBytes ); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = bytes32("some key"); // Set data - IStore(this).setRecord(tableId, key, data, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, data, fieldLayout); // Get data - bytes memory loadedData = IStore(this).getRecord(tableId, key, fieldLayout); + bytes memory loadedData = IStore(this).getRecord(tableId, keyTuple, fieldLayout); assertEq(loadedData.length, data.length); assertEq(keccak256(loadedData), keccak256(data)); // Expect a StoreDeleteRecord event to be emitted vm.expectEmit(true, true, true, true); - emit StoreDeleteRecord(tableId, key); + emit StoreDeleteRecord(tableId, keyTuple); // Delete data - IStore(this).deleteRecord(tableId, key, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); // Verify data is deleted - loadedData = IStore(this).getRecord(tableId, key, fieldLayout); + loadedData = IStore(this).getRecord(tableId, keyTuple, fieldLayout); assertEq(keccak256(loadedData), keccak256(new bytes(fieldLayout.staticDataLength()))); } struct TestPushToFieldData { bytes32 tableId; - bytes32[] key; + bytes32[] keyTuple; bytes32 firstDataBytes; bytes secondDataBytes; bytes thirdDataBytes; @@ -612,9 +612,9 @@ contract StoreCoreTest is Test, StoreMock { new string[](3) ); - // Create key - data.key = new bytes32[](1); - data.key[0] = bytes32("some.key"); + // Create keyTuple + data.keyTuple = new bytes32[](1); + data.keyTuple[0] = bytes32("some key"); // Create data data.firstDataBytes = keccak256("some data"); @@ -634,10 +634,10 @@ contract StoreCoreTest is Test, StoreMock { } // Set fields - IStore(this).setField(data.tableId, data.key, 0, abi.encodePacked(data.firstDataBytes), fieldLayout); - IStore(this).setField(data.tableId, data.key, 1, data.secondDataBytes, fieldLayout); + 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.key, 2, data.thirdDataBytes, fieldLayout); + IStore(this).pushToField(data.tableId, data.keyTuple, 2, data.thirdDataBytes, fieldLayout); // Create data to push { @@ -649,13 +649,13 @@ contract StoreCoreTest is Test, StoreMock { // Expect a StoreSetField event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetField(data.tableId, data.key, 1, data.newSecondDataBytes); + emit StoreSetField(data.tableId, data.keyTuple, 1, data.newSecondDataBytes); // Push to second field - IStore(this).pushToField(data.tableId, data.key, 1, data.secondDataToPush, fieldLayout); + IStore(this).pushToField(data.tableId, data.keyTuple, 1, data.secondDataToPush, fieldLayout); // Get second field - data.loadedData = IStore(this).getField(data.tableId, data.key, 1, fieldLayout); + data.loadedData = IStore(this).getField(data.tableId, data.keyTuple, 1, fieldLayout); // Verify loaded data is correct assertEq(SliceLib.fromBytes(data.loadedData).decodeArray_uint32().length, 2 + 1); @@ -663,8 +663,8 @@ contract StoreCoreTest is Test, StoreMock { assertEq(data.loadedData, data.newSecondDataBytes); // Verify none of the other fields were impacted - assertEq(bytes32(IStore(this).getField(data.tableId, data.key, 0, fieldLayout)), data.firstDataBytes); - assertEq(IStore(this).getField(data.tableId, data.key, 2, fieldLayout), data.thirdDataBytes); + assertEq(bytes32(IStore(this).getField(data.tableId, data.keyTuple, 0, fieldLayout)), data.firstDataBytes); + assertEq(IStore(this).getField(data.tableId, data.keyTuple, 2, fieldLayout), data.thirdDataBytes); // Create data to push { @@ -685,13 +685,13 @@ contract StoreCoreTest is Test, StoreMock { // Expect a StoreSetField event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetField(data.tableId, data.key, 2, data.newThirdDataBytes); + emit StoreSetField(data.tableId, data.keyTuple, 2, data.newThirdDataBytes); // Push to third field - IStore(this).pushToField(data.tableId, data.key, 2, data.thirdDataToPush, fieldLayout); + IStore(this).pushToField(data.tableId, data.keyTuple, 2, data.thirdDataToPush, fieldLayout); // Get third field - data.loadedData = IStore(this).getField(data.tableId, data.key, 2, fieldLayout); + data.loadedData = IStore(this).getField(data.tableId, data.keyTuple, 2, fieldLayout); // Verify loaded data is correct assertEq(SliceLib.fromBytes(data.loadedData).decodeArray_uint32().length, 3 + 10); @@ -699,13 +699,13 @@ contract StoreCoreTest is Test, StoreMock { assertEq(data.loadedData, data.newThirdDataBytes); // Verify none of the other fields were impacted - assertEq(bytes32(IStore(this).getField(data.tableId, data.key, 0, fieldLayout)), data.firstDataBytes); - assertEq(IStore(this).getField(data.tableId, data.key, 1, fieldLayout), data.newSecondDataBytes); + assertEq(bytes32(IStore(this).getField(data.tableId, data.keyTuple, 0, fieldLayout)), data.firstDataBytes); + assertEq(IStore(this).getField(data.tableId, data.keyTuple, 1, fieldLayout), data.newSecondDataBytes); } struct TestUpdateInFieldData { bytes32 tableId; - bytes32[] key; + bytes32[] keyTuple; bytes32 firstDataBytes; uint32[] secondData; bytes secondDataBytes; @@ -752,9 +752,9 @@ contract StoreCoreTest is Test, StoreMock { new string[](3) ); - // Create key - data.key = new bytes32[](1); - data.key[0] = bytes32("some.key"); + // Create keyTuple + data.keyTuple = new bytes32[](1); + data.keyTuple[0] = bytes32("some key"); // Create data data.firstDataBytes = keccak256("some data"); @@ -773,9 +773,9 @@ contract StoreCoreTest is Test, StoreMock { data.thirdDataBytes = EncodeArray.encode(data.thirdData); // Set fields - IStore(this).setField(data.tableId, data.key, 0, abi.encodePacked(data.firstDataBytes), fieldLayout); - IStore(this).setField(data.tableId, data.key, 1, data.secondDataBytes, fieldLayout); - IStore(this).setField(data.tableId, data.key, 2, data.thirdDataBytes, fieldLayout); + IStore(this).setField(data.tableId, data.keyTuple, 0, abi.encodePacked(data.firstDataBytes), fieldLayout); + IStore(this).setField(data.tableId, data.keyTuple, 1, data.secondDataBytes, fieldLayout); + IStore(this).setField(data.tableId, data.keyTuple, 2, data.thirdDataBytes, fieldLayout); // Create data to use for the update { @@ -788,13 +788,13 @@ contract StoreCoreTest is Test, StoreMock { // Expect a StoreSetField event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetField(data.tableId, data.key, 1, data.newSecondDataBytes); + emit StoreSetField(data.tableId, data.keyTuple, 1, data.newSecondDataBytes); // Update index 1 in second field (4 = byte length of uint32) - IStore(this).updateInField(data.tableId, data.key, 1, 4 * 1, data.secondDataForUpdate, fieldLayout); + IStore(this).updateInField(data.tableId, data.keyTuple, 1, 4 * 1, data.secondDataForUpdate, fieldLayout); // Get second field - data.loadedData = IStore(this).getField(data.tableId, data.key, 1, fieldLayout); + data.loadedData = IStore(this).getField(data.tableId, data.keyTuple, 1, fieldLayout); // Verify loaded data is correct assertEq(SliceLib.fromBytes(data.loadedData).decodeArray_uint32().length, data.secondData.length); @@ -802,8 +802,8 @@ contract StoreCoreTest is Test, StoreMock { assertEq(data.loadedData, data.newSecondDataBytes); // Verify none of the other fields were impacted - assertEq(bytes32(IStore(this).getField(data.tableId, data.key, 0, fieldLayout)), data.firstDataBytes); - assertEq(IStore(this).getField(data.tableId, data.key, 2, fieldLayout), data.thirdDataBytes); + assertEq(bytes32(IStore(this).getField(data.tableId, data.keyTuple, 0, fieldLayout)), data.firstDataBytes); + assertEq(IStore(this).getField(data.tableId, data.keyTuple, 2, fieldLayout), data.thirdDataBytes); // Create data for update { @@ -826,13 +826,13 @@ contract StoreCoreTest is Test, StoreMock { // Expect a StoreSetField event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetField(data.tableId, data.key, 2, data.newThirdDataBytes); + emit StoreSetField(data.tableId, data.keyTuple, 2, data.newThirdDataBytes); // Update indexes 1,2,3,4 in third field (8 = byte length of uint64) - IStore(this).updateInField(data.tableId, data.key, 2, 8 * 1, data.thirdDataForUpdate, fieldLayout); + IStore(this).updateInField(data.tableId, data.keyTuple, 2, 8 * 1, data.thirdDataForUpdate, fieldLayout); // Get third field - data.loadedData = IStore(this).getField(data.tableId, data.key, 2, fieldLayout); + data.loadedData = IStore(this).getField(data.tableId, data.keyTuple, 2, fieldLayout); // Verify loaded data is correct assertEq(SliceLib.fromBytes(data.loadedData).decodeArray_uint64().length, data.thirdData.length); @@ -840,14 +840,14 @@ contract StoreCoreTest is Test, StoreMock { assertEq(data.loadedData, data.newThirdDataBytes); // Verify none of the other fields were impacted - assertEq(bytes32(IStore(this).getField(data.tableId, data.key, 0, fieldLayout)), data.firstDataBytes); - assertEq(IStore(this).getField(data.tableId, data.key, 1, fieldLayout), data.newSecondDataBytes); + assertEq(bytes32(IStore(this).getField(data.tableId, data.keyTuple, 0, fieldLayout)), data.firstDataBytes); + assertEq(IStore(this).getField(data.tableId, data.keyTuple, 1, fieldLayout), data.newSecondDataBytes); // startByteIndex must not overflow vm.expectRevert( abi.encodeWithSelector(IStoreErrors.StoreCore_DataIndexOverflow.selector, type(uint40).max, type(uint56).max) ); - IStore(this).updateInField(data.tableId, data.key, 2, type(uint56).max, data.thirdDataForUpdate, fieldLayout); + IStore(this).updateInField(data.tableId, data.keyTuple, 2, type(uint56).max, data.thirdDataForUpdate, fieldLayout); } function testAccessEmptyData() public { @@ -857,30 +857,30 @@ contract StoreCoreTest is Test, StoreMock { IStore(this).registerTable(tableId, fieldLayout, defaultKeySchema, valueSchema, new string[](1), new string[](2)); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = bytes32("some key"); - bytes memory data1 = IStore(this).getRecord(tableId, key, fieldLayout); + bytes memory data1 = IStore(this).getRecord(tableId, keyTuple, fieldLayout); assertEq(data1.length, fieldLayout.staticDataLength()); - bytes memory data2 = IStore(this).getField(tableId, key, 0, fieldLayout); + bytes memory data2 = IStore(this).getField(tableId, keyTuple, 0, fieldLayout); assertEq(data2.length, fieldLayout.staticDataLength()); - bytes memory data3 = IStore(this).getField(tableId, key, 1, fieldLayout); + bytes memory data3 = IStore(this).getField(tableId, keyTuple, 1, fieldLayout); assertEq(data3.length, 0); - uint256 data3Length = IStore(this).getFieldLength(tableId, key, 1, fieldLayout); + uint256 data3Length = IStore(this).getFieldLength(tableId, keyTuple, 1, fieldLayout); assertEq(data3Length, 0); - bytes memory data3Slice = IStore(this).getFieldSlice(tableId, key, 1, fieldLayout, 0, 0); + bytes memory data3Slice = IStore(this).getFieldSlice(tableId, keyTuple, 1, fieldLayout, 0, 0); assertEq(data3Slice.length, 0); } function testRegisterHook() public { bytes32 tableId = keccak256("some.tableId"); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // Register table FieldLayout fieldLayout = FieldLayoutEncodeHelper.encode(16, 0); @@ -912,31 +912,31 @@ contract StoreCoreTest is Test, StoreMock { bytes memory data = abi.encodePacked(bytes16(0x0102030405060708090a0b0c0d0e0f10)); - IStore(this).setRecord(tableId, key, data, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, data, fieldLayout); // Get data from indexed table - the indexer should have mirrored the data there - bytes memory indexedData = IStore(this).getRecord(indexerTableId, key, fieldLayout); + bytes memory indexedData = IStore(this).getRecord(indexerTableId, keyTuple, fieldLayout); assertEq(keccak256(data), keccak256(indexedData)); data = abi.encodePacked(bytes16(0x1112131415161718191a1b1c1d1e1f20)); - IStore(this).setField(tableId, key, 0, data, fieldLayout); + IStore(this).setField(tableId, keyTuple, 0, data, fieldLayout); // Get data from indexed table - the indexer should have mirrored the data there - indexedData = IStore(this).getRecord(indexerTableId, key, fieldLayout); + indexedData = IStore(this).getRecord(indexerTableId, keyTuple, fieldLayout); assertEq(keccak256(data), keccak256(indexedData)); - IStore(this).deleteRecord(tableId, key, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); // Get data from indexed table - the indexer should have mirrored the data there - indexedData = IStore(this).getRecord(indexerTableId, key, fieldLayout); + indexedData = IStore(this).getRecord(indexerTableId, keyTuple, fieldLayout); assertEq(keccak256(indexedData), keccak256(abi.encodePacked(bytes16(0)))); } function testUnregisterHook() public { bytes32 tableId = keccak256("some.tableId"); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // Register table's value schema FieldLayout fieldLayout = FieldLayoutEncodeHelper.encode(16, 0); @@ -978,54 +978,54 @@ contract StoreCoreTest is Test, StoreMock { // Expect a revert when the RevertSubscriber's onBeforeSetRecord hook is called vm.expectRevert(bytes("onBeforeSetRecord")); - IStore(this).setRecord(tableId, key, data, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, data, fieldLayout); // Expect a revert when the RevertSubscriber's onBeforeSetField hook is called vm.expectRevert(bytes("onBeforeSetField")); - IStore(this).setField(tableId, key, 0, data, fieldLayout); + IStore(this).setField(tableId, keyTuple, 0, data, fieldLayout); // Expect a revert when the RevertSubscriber's onBeforeDeleteRecord hook is called vm.expectRevert(bytes("onBeforeDeleteRecord")); - IStore(this).deleteRecord(tableId, key, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); // Unregister the RevertSubscriber IStore(this).unregisterStoreHook(tableId, revertSubscriber); // Expect a HookCalled event to be emitted when the EchoSubscriber's onBeforeSetRecord hook is called vm.expectEmit(true, true, true, true); - emit HookCalled(abi.encode(tableId, key, data, fieldLayout)); + emit HookCalled(abi.encode(tableId, keyTuple, data, fieldLayout)); // Expect a HookCalled event to be emitted when the EchoSubscriber's onAfterSetRecord hook is called vm.expectEmit(true, true, true, true); - emit HookCalled(abi.encode(tableId, key, data, fieldLayout)); + emit HookCalled(abi.encode(tableId, keyTuple, data, fieldLayout)); - IStore(this).setRecord(tableId, key, data, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, data, fieldLayout); // Expect a HookCalled event to be emitted when the EchoSubscriber's onBeforeSetField hook is called vm.expectEmit(true, true, true, true); - emit HookCalled(abi.encode(tableId, key, uint8(0), data, fieldLayout)); + emit HookCalled(abi.encode(tableId, keyTuple, uint8(0), data, fieldLayout)); // Expect a HookCalled event to be emitted when the EchoSubscriber's onAfterSetField hook is called vm.expectEmit(true, true, true, true); - emit HookCalled(abi.encode(tableId, key, uint8(0), data, fieldLayout)); + emit HookCalled(abi.encode(tableId, keyTuple, uint8(0), data, fieldLayout)); - IStore(this).setField(tableId, key, 0, data, fieldLayout); + IStore(this).setField(tableId, keyTuple, 0, data, fieldLayout); // Expect a HookCalled event to be emitted when the EchoSubscriber's onBeforeDeleteRecord hook is called vm.expectEmit(true, true, true, true); - emit HookCalled(abi.encode(tableId, key, fieldLayout)); + emit HookCalled(abi.encode(tableId, keyTuple, fieldLayout)); // Expect a HookCalled event to be emitted when the EchoSubscriber's onAfterDeleteRecord hook is called vm.expectEmit(true, true, true, true); - emit HookCalled(abi.encode(tableId, key, fieldLayout)); + emit HookCalled(abi.encode(tableId, keyTuple, fieldLayout)); - IStore(this).deleteRecord(tableId, key, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); } function testHooksDynamicData() public { bytes32 tableId = keccak256("some.tableId"); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // Register table FieldLayout fieldLayout = FieldLayoutEncodeHelper.encode(16, 1); @@ -1063,10 +1063,10 @@ contract StoreCoreTest is Test, StoreMock { bytes memory staticData = abi.encodePacked(bytes16(0x0102030405060708090a0b0c0d0e0f10)); bytes memory data = abi.encodePacked(staticData, dynamicData); - IStore(this).setRecord(tableId, key, data, fieldLayout); + IStore(this).setRecord(tableId, keyTuple, data, fieldLayout); // Get data from indexed table - the indexer should have mirrored the data there - bytes memory indexedData = IStore(this).getRecord(indexerTableId, key, fieldLayout); + bytes memory indexedData = IStore(this).getRecord(indexerTableId, keyTuple, fieldLayout); assertEq(keccak256(data), keccak256(indexedData)); // Update dynamic data @@ -1075,16 +1075,16 @@ contract StoreCoreTest is Test, StoreMock { dynamicData = abi.encodePacked(encodedArrayDataLength.unwrap(), arrayDataBytes); data = abi.encodePacked(staticData, dynamicData); - IStore(this).setField(tableId, key, 1, arrayDataBytes, fieldLayout); + IStore(this).setField(tableId, keyTuple, 1, arrayDataBytes, fieldLayout); // Get data from indexed table - the indexer should have mirrored the data there - indexedData = IStore(this).getRecord(indexerTableId, key, fieldLayout); + indexedData = IStore(this).getRecord(indexerTableId, keyTuple, fieldLayout); assertEq(keccak256(data), keccak256(indexedData)); - IStore(this).deleteRecord(tableId, key, fieldLayout); + IStore(this).deleteRecord(tableId, keyTuple, fieldLayout); // Get data from indexed table - the indexer should have mirrored the data there - indexedData = IStore(this).getRecord(indexerTableId, key, fieldLayout); + indexedData = IStore(this).getRecord(indexerTableId, keyTuple, fieldLayout); assertEq(keccak256(indexedData), keccak256(abi.encodePacked(bytes16(0)))); } } diff --git a/packages/store/test/StoreCoreDynamic.t.sol b/packages/store/test/StoreCoreDynamic.t.sol index c781320cf7..28c25130a0 100644 --- a/packages/store/test/StoreCoreDynamic.t.sol +++ b/packages/store/test/StoreCoreDynamic.t.sol @@ -16,7 +16,7 @@ import { SchemaEncodeHelper } from "./SchemaEncodeHelper.sol"; contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { Schema internal defaultKeySchema = SchemaEncodeHelper.encode(SchemaType.BYTES32); - bytes32[] internal _key; + bytes32[] internal _keyTuple; bytes32 internal _tableId = keccak256("some.tableId"); bytes32 internal firstDataBytes; @@ -28,12 +28,12 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { // Expose an external popFromField function for testing purposes of indexers (see testHooks) function popFromField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, uint256 byteLengthToPop, FieldLayout fieldLayout ) public override { - StoreCore.popFromField(tableId, key, schemaIndex, byteLengthToPop, fieldLayout); + StoreCore.popFromField(tableId, keyTuple, schemaIndex, byteLengthToPop, fieldLayout); } function setUp() public { @@ -46,9 +46,9 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { ); StoreCore.registerTable(_tableId, fieldLayout, defaultKeySchema, valueSchema, new string[](1), new string[](3)); - // Create key - _key = new bytes32[](1); - _key[0] = bytes32("some.key"); + // Create keyTuple + _keyTuple = new bytes32[](1); + _keyTuple[0] = bytes32("some.key"); // Initialize the data in setUp so that slots aren't warm in tests (to test cold update) @@ -73,10 +73,10 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { thirdDataBytes = EncodeArray.encode(thirdData); // Set fields - StoreCore.setField(_tableId, _key, 0, abi.encodePacked(firstDataBytes), fieldLayout); - StoreCore.setField(_tableId, _key, 1, secondDataBytes, fieldLayout); + StoreCore.setField(_tableId, _keyTuple, 0, abi.encodePacked(firstDataBytes), fieldLayout); + StoreCore.setField(_tableId, _keyTuple, 1, secondDataBytes, fieldLayout); // Initialize a field with push - StoreCore.pushToField(_tableId, _key, 2, thirdDataBytes, fieldLayout); + StoreCore.pushToField(_tableId, _keyTuple, 2, thirdDataBytes, fieldLayout); } function testPopFromSecondField() public { @@ -92,30 +92,30 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { // Expect a StoreSetField event to be emitted vm.expectEmit(true, true, true, true); - emit StoreSetField(_tableId, _key, 1, newDataBytes); + emit StoreSetField(_tableId, _keyTuple, 1, newDataBytes); // Pop from second field startGasReport("pop from field (cold, 1 slot, 1 uint32 item)"); - StoreCore.popFromField(_tableId, _key, 1, byteLengthToPop, fieldLayout); + StoreCore.popFromField(_tableId, _keyTuple, 1, byteLengthToPop, fieldLayout); endGasReport(); // Get second field - bytes memory loadedData = StoreCore.getField(_tableId, _key, 1, fieldLayout); + bytes memory loadedData = StoreCore.getField(_tableId, _keyTuple, 1, fieldLayout); // Verify loaded data is correct assertEq(loadedData, newDataBytes); // Reset the second field and pop again (but warm this time) - StoreCore.setField(_tableId, _key, 1, dataBytes, fieldLayout); + StoreCore.setField(_tableId, _keyTuple, 1, dataBytes, fieldLayout); startGasReport("pop from field (warm, 1 slot, 1 uint32 item)"); - StoreCore.popFromField(_tableId, _key, 1, byteLengthToPop, fieldLayout); + StoreCore.popFromField(_tableId, _keyTuple, 1, byteLengthToPop, fieldLayout); endGasReport(); // Get second field - loadedData = StoreCore.getField(_tableId, _key, 1, fieldLayout); + loadedData = StoreCore.getField(_tableId, _keyTuple, 1, fieldLayout); // Verify loaded data is correct assertEq(loadedData, newDataBytes); // Verify none of the other fields were impacted - assertEq(bytes32(StoreCore.getField(_tableId, _key, 0, fieldLayout)), firstDataBytes); - assertEq(StoreCore.getField(_tableId, _key, 2, fieldLayout), thirdDataBytes); + assertEq(bytes32(StoreCore.getField(_tableId, _keyTuple, 0, fieldLayout)), firstDataBytes); + assertEq(StoreCore.getField(_tableId, _keyTuple, 2, fieldLayout), thirdDataBytes); } function testPopFromThirdField() public { @@ -131,39 +131,39 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { // Expect a StoreSetField event to be emitted after pop vm.expectEmit(true, true, true, true); - emit StoreSetField(_tableId, _key, 2, dataBytes); + emit StoreSetField(_tableId, _keyTuple, 2, dataBytes); // Pop from the field startGasReport("pop from field (cold, 2 slots, 10 uint32 items)"); - StoreCore.popFromField(_tableId, _key, 2, byteLengthToPop, fieldLayout); + StoreCore.popFromField(_tableId, _keyTuple, 2, byteLengthToPop, fieldLayout); endGasReport(); // Load and verify the field - bytes memory loadedData = StoreCore.getField(_tableId, _key, 2, fieldLayout); + bytes memory loadedData = StoreCore.getField(_tableId, _keyTuple, 2, fieldLayout); assertEq(loadedData, newDataBytes); // Reset the field and pop again (but warm this time) - StoreCore.setField(_tableId, _key, 2, dataBytes, fieldLayout); + StoreCore.setField(_tableId, _keyTuple, 2, dataBytes, fieldLayout); startGasReport("pop from field (warm, 2 slots, 10 uint32 items)"); - StoreCore.popFromField(_tableId, _key, 2, byteLengthToPop, fieldLayout); + StoreCore.popFromField(_tableId, _keyTuple, 2, byteLengthToPop, fieldLayout); endGasReport(); // Load and verify the field - loadedData = StoreCore.getField(_tableId, _key, 2, fieldLayout); + loadedData = StoreCore.getField(_tableId, _keyTuple, 2, fieldLayout); assertEq(loadedData, newDataBytes); // Verify none of the other fields were impacted - assertEq(bytes32(StoreCore.getField(_tableId, _key, 0, fieldLayout)), firstDataBytes); - assertEq(StoreCore.getField(_tableId, _key, 1, fieldLayout), secondDataBytes); + assertEq(bytes32(StoreCore.getField(_tableId, _keyTuple, 0, fieldLayout)), firstDataBytes); + assertEq(StoreCore.getField(_tableId, _keyTuple, 1, fieldLayout), secondDataBytes); } function testGetSecondFieldLength() public { FieldLayout fieldLayout = StoreCore.getFieldLayout(_tableId); startGasReport("get field length (cold, 1 slot)"); - uint256 length = StoreCore.getFieldLength(_tableId, _key, 1, fieldLayout); + uint256 length = StoreCore.getFieldLength(_tableId, _keyTuple, 1, fieldLayout); endGasReport(); assertEq(length, secondDataBytes.length); startGasReport("get field length (warm, 1 slot)"); - length = StoreCore.getFieldLength(_tableId, _key, 1, fieldLayout); + length = StoreCore.getFieldLength(_tableId, _keyTuple, 1, fieldLayout); endGasReport(); assertEq(length, secondDataBytes.length); } @@ -172,11 +172,11 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { FieldLayout fieldLayout = StoreCore.getFieldLayout(_tableId); startGasReport("get field length (warm due to , 2 slots)"); - uint256 length = StoreCore.getFieldLength(_tableId, _key, 2, fieldLayout); + uint256 length = StoreCore.getFieldLength(_tableId, _keyTuple, 2, fieldLayout); endGasReport(); assertEq(length, thirdDataBytes.length); startGasReport("get field length (warm, 2 slots)"); - length = StoreCore.getFieldLength(_tableId, _key, 2, fieldLayout); + length = StoreCore.getFieldLength(_tableId, _keyTuple, 2, fieldLayout); endGasReport(); assertEq(length, thirdDataBytes.length); } @@ -185,20 +185,20 @@ contract StoreCoreDynamicTest is Test, GasReporter, StoreMock { FieldLayout fieldLayout = StoreCore.getFieldLayout(_tableId); startGasReport("get field slice (cold, 1 slot)"); - bytes memory secondFieldSlice = StoreCore.getFieldSlice(_tableId, _key, 1, fieldLayout, 0, 4); + bytes memory secondFieldSlice = StoreCore.getFieldSlice(_tableId, _keyTuple, 1, fieldLayout, 0, 4); endGasReport(); assertEq(secondFieldSlice, SliceLib.getSubslice(secondDataBytes, 0, 4).toBytes()); startGasReport("get field slice (warm, 1 slot)"); - secondFieldSlice = StoreCore.getFieldSlice(_tableId, _key, 1, fieldLayout, 4, 8); + secondFieldSlice = StoreCore.getFieldSlice(_tableId, _keyTuple, 1, fieldLayout, 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, _key, 2, fieldLayout, 4, 32); + bytes memory thirdFieldSlice = StoreCore.getFieldSlice(_tableId, _keyTuple, 2, fieldLayout, 4, 32); endGasReport(); assertEq(thirdFieldSlice, SliceLib.getSubslice(thirdDataBytes, 4, 32).toBytes()); startGasReport("get field slice (warm, 2 slots)"); - thirdFieldSlice = StoreCore.getFieldSlice(_tableId, _key, 2, fieldLayout, 8, 40); + thirdFieldSlice = StoreCore.getFieldSlice(_tableId, _keyTuple, 2, fieldLayout, 8, 40); endGasReport(); assertEq(thirdFieldSlice, SliceLib.getSubslice(thirdDataBytes, 8, 40).toBytes()); } diff --git a/packages/store/test/StoreCoreGas.t.sol b/packages/store/test/StoreCoreGas.t.sol index 8a826be357..badbc33472 100644 --- a/packages/store/test/StoreCoreGas.t.sol +++ b/packages/store/test/StoreCoreGas.t.sol @@ -107,22 +107,22 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { StoreCore.registerTable(tableId, fieldLayout, defaultKeySchema, valueSchema, new string[](1), new string[](5)); // Create some key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = bytes32("some key"); // Set dynamic data length of dynamic index 0 startGasReport("set dynamic length of dynamic index 0"); - StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, key, 0, 10); + StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, keyTuple, 0, 10); endGasReport(); // Set dynamic data length of dynamic index 1 startGasReport("set dynamic length of dynamic index 1"); - StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, key, 1, 99); + StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, keyTuple, 1, 99); endGasReport(); // Reduce dynamic data length of dynamic index 0 again startGasReport("reduce dynamic length of dynamic index 0"); - StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, key, 0, 5); + StoreCoreInternal._setDynamicDataLengthAtIndex(tableId, keyTuple, 0, 5); endGasReport(); } @@ -140,16 +140,16 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Set data bytes memory data = abi.encodePacked(bytes1(0x01), bytes2(0x0203), bytes1(0x04), bytes2(0x0506)); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some.key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; startGasReport("set static record (1 slot)"); - StoreCore.setRecord(tableId, key, data, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, data, fieldLayout); endGasReport(); // Get data startGasReport("get static record (1 slot)"); - StoreCore.getRecord(tableId, key, fieldLayout); + StoreCore.getRecord(tableId, keyTuple, fieldLayout); endGasReport(); } @@ -166,16 +166,16 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { bytes32(0x1112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30) ); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some.key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; startGasReport("set static record (2 slots)"); - StoreCore.setRecord(tableId, key, data, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, data, fieldLayout); endGasReport(); // Get data startGasReport("get static record (2 slots)"); - StoreCore.getRecord(tableId, key, fieldLayout); + StoreCore.getRecord(tableId, keyTuple, fieldLayout); endGasReport(); } @@ -223,18 +223,18 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { thirdDataBytes ); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // Set data startGasReport("set complex record with dynamic data (4 slots)"); - StoreCore.setRecord(tableId, key, data, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, data, fieldLayout); endGasReport(); // Get data startGasReport("get complex record with dynamic data (4 slots)"); - StoreCore.getRecord(tableId, key, fieldLayout); + StoreCore.getRecord(tableId, keyTuple, fieldLayout); endGasReport(); // Compare gas - setting the data as raw struct @@ -270,15 +270,15 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { bytes16 firstDataBytes = bytes16(0x0102030405060708090a0b0c0d0e0f10); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; bytes memory firstDataPacked = abi.encodePacked(firstDataBytes); // Set first field startGasReport("set static field (1 slot)"); - StoreCore.setField(tableId, key, 0, firstDataPacked, fieldLayout); + StoreCore.setField(tableId, keyTuple, 0, firstDataPacked, fieldLayout); endGasReport(); //////////////// @@ -287,7 +287,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Get first field startGasReport("get static field (1 slot)"); - StoreCore.getField(tableId, key, 0, fieldLayout); + StoreCore.getField(tableId, keyTuple, 0, fieldLayout); endGasReport(); // Set second field @@ -295,12 +295,12 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { bytes memory secondDataPacked = abi.encodePacked(secondDataBytes); startGasReport("set static field (overlap 2 slot)"); - StoreCore.setField(tableId, key, 1, secondDataPacked, fieldLayout); + StoreCore.setField(tableId, keyTuple, 1, secondDataPacked, fieldLayout); endGasReport(); // Get second field startGasReport("get static field (overlap 2 slot)"); - StoreCore.getField(tableId, key, 1, fieldLayout); + StoreCore.getField(tableId, keyTuple, 1, fieldLayout); endGasReport(); //////////////// @@ -326,22 +326,22 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Set third field startGasReport("set dynamic field (1 slot, first dynamic field)"); - StoreCore.setField(tableId, key, 2, thirdDataBytes, fieldLayout); + StoreCore.setField(tableId, keyTuple, 2, thirdDataBytes, fieldLayout); endGasReport(); // Get third field startGasReport("get dynamic field (1 slot, first dynamic field)"); - StoreCore.getField(tableId, key, 2, fieldLayout); + StoreCore.getField(tableId, keyTuple, 2, fieldLayout); endGasReport(); // Set fourth field startGasReport("set dynamic field (1 slot, second dynamic field)"); - StoreCore.setField(tableId, key, 3, fourthDataBytes, fieldLayout); + StoreCore.setField(tableId, keyTuple, 3, fourthDataBytes, fieldLayout); endGasReport(); // Get fourth field startGasReport("get dynamic field (1 slot, second dynamic field)"); - StoreCore.getField(tableId, key, 3, fieldLayout); + StoreCore.getField(tableId, keyTuple, 3, fieldLayout); endGasReport(); } @@ -389,16 +389,16 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { thirdDataBytes ); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // Set data - StoreCore.setRecord(tableId, key, data, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, data, fieldLayout); // Delete data startGasReport("delete record (complex data, 3 slots)"); - StoreCore.deleteRecord(tableId, key, fieldLayout); + StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); endGasReport(); } @@ -414,9 +414,9 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { ); StoreCore.registerTable(tableId, fieldLayout, defaultKeySchema, valueSchema, new string[](1), new string[](3)); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // Create data bytes32 firstDataBytes = keccak256("some data"); @@ -437,10 +437,10 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { } // Set fields - StoreCore.setField(tableId, key, 0, abi.encodePacked(firstDataBytes), fieldLayout); - StoreCore.setField(tableId, key, 1, secondDataBytes, fieldLayout); + StoreCore.setField(tableId, keyTuple, 0, abi.encodePacked(firstDataBytes), fieldLayout); + StoreCore.setField(tableId, keyTuple, 1, secondDataBytes, fieldLayout); // Initialize a field with push - StoreCore.pushToField(tableId, key, 2, thirdDataBytes, fieldLayout); + StoreCore.pushToField(tableId, keyTuple, 2, thirdDataBytes, fieldLayout); // Create data to push bytes memory secondDataToPush; @@ -452,7 +452,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Push to second field startGasReport("push to field (1 slot, 1 uint32 item)"); - StoreCore.pushToField(tableId, key, 1, secondDataToPush, fieldLayout); + StoreCore.pushToField(tableId, keyTuple, 1, secondDataToPush, fieldLayout); endGasReport(); // Create data to push @@ -474,7 +474,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { // Push to third field startGasReport("push to field (2 slots, 10 uint32 items)"); - StoreCore.pushToField(tableId, key, 2, thirdDataToPush, fieldLayout); + StoreCore.pushToField(tableId, keyTuple, 2, thirdDataToPush, fieldLayout); endGasReport(); } @@ -501,9 +501,9 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { ); StoreCore.registerTable(tableId, fieldLayout, defaultKeySchema, valueSchema, new string[](1), new string[](3)); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; // Create data data.firstDataBytes = keccak256("some data"); @@ -522,9 +522,9 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { data.thirdDataBytes = EncodeArray.encode(thirdData); // Set fields - StoreCore.setField(tableId, key, 0, abi.encodePacked(data.firstDataBytes), fieldLayout); - StoreCore.setField(tableId, key, 1, data.secondDataBytes, fieldLayout); - StoreCore.setField(tableId, key, 2, data.thirdDataBytes, fieldLayout); + StoreCore.setField(tableId, keyTuple, 0, abi.encodePacked(data.firstDataBytes), fieldLayout); + StoreCore.setField(tableId, keyTuple, 1, data.secondDataBytes, fieldLayout); + StoreCore.setField(tableId, keyTuple, 2, data.thirdDataBytes, fieldLayout); // Create data to use for the update { @@ -537,7 +537,7 @@ 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, key, 1, 4 * 1, data.secondDataForUpdate, fieldLayout); + StoreCore.updateInField(tableId, keyTuple, 1, 4 * 1, data.secondDataForUpdate, fieldLayout); endGasReport(); // Create data for update @@ -561,7 +561,7 @@ 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, key, 2, 8 * 1, data.thirdDataForUpdate, fieldLayout); + StoreCore.updateInField(tableId, keyTuple, 2, 8 * 1, data.thirdDataForUpdate, fieldLayout); endGasReport(); } @@ -572,35 +572,35 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { StoreCore.registerTable(tableId, fieldLayout, defaultKeySchema, valueSchema, new string[](1), new string[](2)); - // Create key - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32("some.key"); + // Create keyTuple + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = "some key"; startGasReport("access non-existing record"); - StoreCore.getRecord(tableId, key, fieldLayout); + StoreCore.getRecord(tableId, keyTuple, fieldLayout); endGasReport(); startGasReport("access static field of non-existing record"); - StoreCore.getField(tableId, key, 0, fieldLayout); + StoreCore.getField(tableId, keyTuple, 0, fieldLayout); endGasReport(); startGasReport("access dynamic field of non-existing record"); - StoreCore.getField(tableId, key, 1, fieldLayout); + StoreCore.getField(tableId, keyTuple, 1, fieldLayout); endGasReport(); startGasReport("access length of dynamic field of non-existing record"); - StoreCore.getFieldLength(tableId, key, 1, fieldLayout); + StoreCore.getFieldLength(tableId, keyTuple, 1, fieldLayout); endGasReport(); startGasReport("access slice of dynamic field of non-existing record"); - StoreCore.getFieldSlice(tableId, key, 1, fieldLayout, 0, 0); + StoreCore.getFieldSlice(tableId, keyTuple, 1, fieldLayout, 0, 0); endGasReport(); } function testHooks() public { bytes32 tableId = keccak256("some.tableId"); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = keccak256("some key"); // Register table FieldLayout fieldLayout = FieldLayoutEncodeHelper.encode(16, 0); @@ -635,24 +635,24 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { bytes memory data = abi.encodePacked(bytes16(0x0102030405060708090a0b0c0d0e0f10)); startGasReport("set record on table with subscriber"); - StoreCore.setRecord(tableId, key, data, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, data, fieldLayout); endGasReport(); data = abi.encodePacked(bytes16(0x1112131415161718191a1b1c1d1e1f20)); startGasReport("set static field on table with subscriber"); - StoreCore.setField(tableId, key, 0, data, fieldLayout); + StoreCore.setField(tableId, keyTuple, 0, data, fieldLayout); endGasReport(); startGasReport("delete record on table with subscriber"); - StoreCore.deleteRecord(tableId, key, fieldLayout); + StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); endGasReport(); } function testHooksDynamicData() public { bytes32 tableId = keccak256("some.tableId"); - bytes32[] memory key = new bytes32[](1); - key[0] = keccak256("some key"); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = keccak256("some key"); // Register table FieldLayout fieldLayout = FieldLayoutEncodeHelper.encode(16, 1); @@ -693,7 +693,7 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { bytes memory data = abi.encodePacked(staticData, dynamicData); startGasReport("set (dynamic) record on table with subscriber"); - StoreCore.setRecord(tableId, key, data, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, data, fieldLayout); endGasReport(); // Update dynamic data @@ -703,11 +703,11 @@ contract StoreCoreGasTest is Test, GasReporter, StoreMock { data = abi.encodePacked(staticData, dynamicData); startGasReport("set (dynamic) field on table with subscriber"); - StoreCore.setField(tableId, key, 1, arrayDataBytes, fieldLayout); + StoreCore.setField(tableId, keyTuple, 1, arrayDataBytes, fieldLayout); endGasReport(); startGasReport("delete (dynamic) record on table with subscriber"); - StoreCore.deleteRecord(tableId, key, fieldLayout); + StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); endGasReport(); } } diff --git a/packages/store/test/StoreMock.sol b/packages/store/test/StoreMock.sol index 7f41e95ba7..96e23f6664 100644 --- a/packages/store/test/StoreMock.sol +++ b/packages/store/test/StoreMock.sol @@ -19,71 +19,71 @@ contract StoreMock is IStore, StoreRead { // Set full record (including full dynamic data) function setRecord( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, bytes calldata data, FieldLayout fieldLayout ) public virtual { - StoreCore.setRecord(tableId, key, data, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, data, fieldLayout); } // Set partial data at schema index function setField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, bytes calldata data, FieldLayout fieldLayout ) public virtual { - StoreCore.setField(tableId, key, schemaIndex, data, fieldLayout); + StoreCore.setField(tableId, keyTuple, schemaIndex, data, fieldLayout); } // Push encoded items to the dynamic field at schema index function pushToField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, bytes calldata dataToPush, FieldLayout fieldLayout ) public virtual { - StoreCore.pushToField(tableId, key, schemaIndex, dataToPush, fieldLayout); + StoreCore.pushToField(tableId, keyTuple, schemaIndex, dataToPush, fieldLayout); } // Pop byte length from the dynamic field at schema index function popFromField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, uint256 byteLengthToPop, FieldLayout fieldLayout ) public virtual { - StoreCore.popFromField(tableId, key, schemaIndex, byteLengthToPop, fieldLayout); + StoreCore.popFromField(tableId, keyTuple, schemaIndex, byteLengthToPop, fieldLayout); } // Change encoded items within the dynamic field at schema index function updateInField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, uint256 startByteIndex, bytes calldata dataToSet, FieldLayout fieldLayout ) public virtual { - StoreCore.updateInField(tableId, key, schemaIndex, startByteIndex, dataToSet, fieldLayout); + StoreCore.updateInField(tableId, keyTuple, schemaIndex, startByteIndex, dataToSet, fieldLayout); } // Set full record (including full dynamic data) - function deleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) public virtual { - StoreCore.deleteRecord(tableId, key, fieldLayout); + function deleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) public virtual { + StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); } // Emit the ephemeral event without modifying storage function emitEphemeralRecord( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, bytes calldata data, FieldLayout fieldLayout ) public virtual { - StoreCore.emitEphemeralRecord(tableId, key, data, fieldLayout); + StoreCore.emitEphemeralRecord(tableId, keyTuple, data, fieldLayout); } function registerTable( diff --git a/packages/store/ts/storeEvents.ts b/packages/store/ts/storeEvents.ts index c2cb00a604..77b308b8e2 100644 --- a/packages/store/ts/storeEvents.ts +++ b/packages/store/ts/storeEvents.ts @@ -1,6 +1,6 @@ export const storeEvents = [ - "event StoreDeleteRecord(bytes32 tableId, bytes32[] key)", - "event StoreSetField(bytes32 tableId, bytes32[] key, uint8 schemaIndex, bytes data)", - "event StoreSetRecord(bytes32 tableId, bytes32[] key, bytes data)", - "event StoreEphemeralRecord(bytes32 tableId, bytes32[] key, bytes data)", + "event StoreDeleteRecord(bytes32 tableId, bytes32[] keyTuple)", + "event StoreSetField(bytes32 tableId, bytes32[] keyTuple, uint8 schemaIndex, bytes data)", + "event StoreSetRecord(bytes32 tableId, bytes32[] keyTuple, bytes data)", + "event StoreEphemeralRecord(bytes32 tableId, bytes32[] keyTuple, bytes data)", ] as const; diff --git a/packages/world/src/World.sol b/packages/world/src/World.sol index 9544c61608..3653102813 100644 --- a/packages/world/src/World.sol +++ b/packages/world/src/World.sol @@ -97,7 +97,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { */ function setRecord( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, bytes calldata data, FieldLayout fieldLayout ) public virtual { @@ -105,7 +105,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { AccessControl.requireAccess(tableId, msg.sender); // Set the record - StoreCore.setRecord(tableId, key, data, fieldLayout); + StoreCore.setRecord(tableId, keyTuple, data, fieldLayout); } /** @@ -114,7 +114,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { */ function setField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, bytes calldata data, FieldLayout fieldLayout @@ -123,7 +123,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { AccessControl.requireAccess(tableId, msg.sender); // Set the field - StoreCore.setField(tableId, key, schemaIndex, data, fieldLayout); + StoreCore.setField(tableId, keyTuple, schemaIndex, data, fieldLayout); } /** @@ -132,7 +132,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { */ function pushToField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, bytes calldata dataToPush, FieldLayout fieldLayout @@ -141,7 +141,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { AccessControl.requireAccess(tableId, msg.sender); // Push to the field - StoreCore.pushToField(tableId, key, schemaIndex, dataToPush, fieldLayout); + StoreCore.pushToField(tableId, keyTuple, schemaIndex, dataToPush, fieldLayout); } /** @@ -150,7 +150,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { */ function popFromField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, uint256 byteLengthToPop, FieldLayout fieldLayout @@ -159,7 +159,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { AccessControl.requireAccess(tableId, msg.sender); // Push to the field - StoreCore.popFromField(tableId, key, schemaIndex, byteLengthToPop, fieldLayout); + StoreCore.popFromField(tableId, keyTuple, schemaIndex, byteLengthToPop, fieldLayout); } /** @@ -168,7 +168,7 @@ contract World is StoreRead, IStoreData, IWorldKernel { */ function updateInField( bytes32 tableId, - bytes32[] calldata key, + bytes32[] calldata keyTuple, uint8 schemaIndex, uint256 startByteIndex, bytes calldata dataToSet, @@ -178,19 +178,19 @@ contract World is StoreRead, IStoreData, IWorldKernel { AccessControl.requireAccess(tableId, msg.sender); // Update data in the field - StoreCore.updateInField(tableId, key, schemaIndex, startByteIndex, dataToSet, fieldLayout); + StoreCore.updateInField(tableId, keyTuple, schemaIndex, startByteIndex, dataToSet, fieldLayout); } /** * Delete a record in the table at the given tableId. * Requires the caller to have access to the namespace or name. */ - function deleteRecord(bytes32 tableId, bytes32[] calldata key, FieldLayout fieldLayout) public virtual { + function deleteRecord(bytes32 tableId, bytes32[] calldata keyTuple, FieldLayout fieldLayout) public virtual { // Require access to namespace or name AccessControl.requireAccess(tableId, msg.sender); // Delete the record - StoreCore.deleteRecord(tableId, key, fieldLayout); + StoreCore.deleteRecord(tableId, keyTuple, fieldLayout); } /************************************************************************ diff --git a/packages/world/src/modules/core/implementations/EphemeralRecordSystem.sol b/packages/world/src/modules/core/implementations/EphemeralRecordSystem.sol index 14aa949c04..5a41ebf30b 100644 --- a/packages/world/src/modules/core/implementations/EphemeralRecordSystem.sol +++ b/packages/world/src/modules/core/implementations/EphemeralRecordSystem.sol @@ -18,7 +18,7 @@ contract EphemeralRecordSystem is IStoreEphemeral, System { */ function emitEphemeralRecord( bytes32 resourceSelector, - bytes32[] calldata key, + bytes32[] calldata keyTuple, bytes calldata data, FieldLayout fieldLayout ) public virtual { @@ -26,6 +26,6 @@ contract EphemeralRecordSystem is IStoreEphemeral, System { AccessControl.requireAccess(resourceSelector, msg.sender); // Set the record - StoreCore.emitEphemeralRecord(resourceSelector, key, data, fieldLayout); + StoreCore.emitEphemeralRecord(resourceSelector, keyTuple, data, fieldLayout); } } diff --git a/packages/world/src/modules/keysintable/KeysInTableHook.sol b/packages/world/src/modules/keysintable/KeysInTableHook.sol index 706ebac740..03622ade95 100644 --- a/packages/world/src/modules/keysintable/KeysInTableHook.sol +++ b/packages/world/src/modules/keysintable/KeysInTableHook.sol @@ -8,61 +8,61 @@ import { KeysInTable } from "./tables/KeysInTable.sol"; import { UsedKeysIndex } from "./tables/UsedKeysIndex.sol"; /** - * Note: if a table with composite keys is used, only the first key is indexed + * Note: if a table with composite keys is used, only the first five keys of the tuple are indexed */ contract KeysInTableHook is StoreHook { - function handleSet(bytes32 tableId, bytes32[] memory key) internal { - bytes32 keysHash = keccak256(abi.encode(key)); + function handleSet(bytes32 tableId, bytes32[] memory keyTuple) internal { + bytes32 keysHash = keccak256(abi.encode(keyTuple)); - // If the key has not yet been set in the table... + // If the keyTuple has not yet been set in the table... if (!UsedKeysIndex.getHas(tableId, keysHash)) { uint40 length = uint40(KeysInTable.lengthKeys0(tableId)); - // Push the key to the list of keys in this table - if (key.length > 0) { - KeysInTable.pushKeys0(tableId, key[0]); - if (key.length > 1) { - KeysInTable.pushKeys1(tableId, key[1]); - if (key.length > 2) { - KeysInTable.pushKeys2(tableId, key[2]); - if (key.length > 3) { - KeysInTable.pushKeys3(tableId, key[3]); - if (key.length > 4) { - KeysInTable.pushKeys4(tableId, key[4]); + // Push the keyTuple to the list of keys in this table + if (keyTuple.length > 0) { + KeysInTable.pushKeys0(tableId, keyTuple[0]); + if (keyTuple.length > 1) { + KeysInTable.pushKeys1(tableId, keyTuple[1]); + if (keyTuple.length > 2) { + KeysInTable.pushKeys2(tableId, keyTuple[2]); + if (keyTuple.length > 3) { + KeysInTable.pushKeys3(tableId, keyTuple[3]); + if (keyTuple.length > 4) { + KeysInTable.pushKeys4(tableId, keyTuple[4]); } } } } } - // Update the index to avoid duplicating this key in the array + // Update the index to avoid duplicating this keyTuple in the array UsedKeysIndex.set(tableId, keysHash, true, length); } } - function onBeforeSetRecord(bytes32 tableId, bytes32[] memory key, bytes memory, FieldLayout) public { - handleSet(tableId, key); + function onBeforeSetRecord(bytes32 tableId, bytes32[] memory keyTuple, bytes memory, FieldLayout) public { + handleSet(tableId, keyTuple); } - function onAfterSetRecord(bytes32 tableId, bytes32[] memory key, bytes memory, FieldLayout) public { + function onAfterSetRecord(bytes32 tableId, bytes32[] memory keyTuple, bytes memory, FieldLayout) public { // NOOP } - function onBeforeSetField(bytes32 tableId, bytes32[] memory key, uint8, bytes memory, FieldLayout) public { + function onBeforeSetField(bytes32 tableId, bytes32[] memory keyTuple, uint8, bytes memory, FieldLayout) public { // NOOP } - function onAfterSetField(bytes32 tableId, bytes32[] memory key, uint8, bytes memory, FieldLayout) public { - handleSet(tableId, key); + function onAfterSetField(bytes32 tableId, bytes32[] memory keyTuple, uint8, bytes memory, FieldLayout) public { + handleSet(tableId, keyTuple); } - function onBeforeDeleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout) public { - bytes32 keysHash = keccak256(abi.encode(key)); + function onBeforeDeleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout) public { + bytes32 keysHash = keccak256(abi.encode(keyTuple)); (bool has, uint40 index) = UsedKeysIndex.get(tableId, keysHash); - // If the key was part of the table... + // If the keyTuple was part of the table... if (has) { - // Delete the index as the key is not in the table + // Delete the index as the keyTuple is not in the table anymore UsedKeysIndex.deleteRecord(tableId, keysHash); uint40 length = uint40(KeysInTable.lengthKeys0(tableId)); @@ -71,37 +71,38 @@ contract KeysInTableHook is StoreHook { // Delete the list of keys in this table KeysInTable.deleteRecord(tableId); } else { - if (key.length > 0) { - bytes32[] memory lastKeyTuple = new bytes32[](key.length); + if (keyTuple.length > 0) { + bytes32[] memory lastKeyTuple = new bytes32[](keyTuple.length); bytes32 lastKey = KeysInTable.getItemKeys0(tableId, length - 1); lastKeyTuple[0] = lastKey; + // Remove the keyTuple from the list of keys in this table KeysInTable.updateKeys0(tableId, index, lastKey); KeysInTable.popKeys0(tableId); - if (key.length > 1) { + if (keyTuple.length > 1) { lastKey = KeysInTable.getItemKeys1(tableId, length - 1); lastKeyTuple[1] = lastKey; KeysInTable.updateKeys1(tableId, index, lastKey); KeysInTable.popKeys1(tableId); - if (key.length > 2) { + if (keyTuple.length > 2) { lastKey = KeysInTable.getItemKeys2(tableId, length - 1); lastKeyTuple[2] = lastKey; KeysInTable.updateKeys2(tableId, index, lastKey); KeysInTable.popKeys2(tableId); - if (key.length > 3) { + if (keyTuple.length > 3) { lastKey = KeysInTable.getItemKeys3(tableId, length - 1); lastKeyTuple[3] = lastKey; KeysInTable.updateKeys3(tableId, index, lastKey); KeysInTable.popKeys3(tableId); - if (key.length > 4) { + if (keyTuple.length > 4) { lastKey = KeysInTable.getItemKeys4(tableId, length - 1); lastKeyTuple[4] = lastKey; @@ -112,7 +113,7 @@ contract KeysInTableHook is StoreHook { } } - // Update the index of lastKey after swapping it with the deleted key + // Update the index of lastKeyTuple after swapping it with the deleted keyTuple bytes32 lastKeyHash = keccak256(abi.encode(lastKeyTuple)); UsedKeysIndex.setIndex(tableId, lastKeyHash, index); } @@ -120,7 +121,7 @@ contract KeysInTableHook is StoreHook { } } - function onAfterDeleteRecord(bytes32 tableId, bytes32[] memory key, FieldLayout fieldLayout) public { + function onAfterDeleteRecord(bytes32 tableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) public { // NOOP } } diff --git a/packages/world/src/modules/keysintable/hasKey.sol b/packages/world/src/modules/keysintable/hasKey.sol index d085a63e6c..637439047e 100644 --- a/packages/world/src/modules/keysintable/hasKey.sol +++ b/packages/world/src/modules/keysintable/hasKey.sol @@ -6,22 +6,22 @@ import { IStore } from "@latticexyz/store/src/IStore.sol"; import { UsedKeysIndex } from "./tables/UsedKeysIndex.sol"; /** - * Get whether the key is in the given table. + * Get whether the keyTuple is in the given table. * * Note: this util can only be called within the context of a Store (e.g. from a System or Module). * For usage outside of a Store, use the overload that takes an explicit store argument. */ -function hasKey(bytes32 tableId, bytes32[] memory key) view returns (bool) { - bytes32 keysHash = keccak256(abi.encode(key)); +function hasKey(bytes32 tableId, bytes32[] memory keyTuple) view returns (bool) { + bytes32 keysHash = keccak256(abi.encode(keyTuple)); return UsedKeysIndex.getHas(tableId, keysHash); } /** - * Get whether the key is in the given table for the given store. + * Get whether the keyTuple is in the given table for the given store. */ -function hasKey(IStore store, bytes32 tableId, bytes32[] memory key) view returns (bool) { - bytes32 keysHash = keccak256(abi.encode(key)); +function hasKey(IStore store, bytes32 tableId, bytes32[] memory keyTuple) view returns (bool) { + bytes32 keysHash = keccak256(abi.encode(keyTuple)); return UsedKeysIndex.getHas(store, tableId, keysHash); } diff --git a/packages/world/src/modules/keyswithvalue/KeysWithValueHook.sol b/packages/world/src/modules/keyswithvalue/KeysWithValueHook.sol index 63e66ed8d1..f0326407cd 100644 --- a/packages/world/src/modules/keyswithvalue/KeysWithValueHook.sol +++ b/packages/world/src/modules/keyswithvalue/KeysWithValueHook.sol @@ -19,7 +19,7 @@ import { getTargetTableSelector } from "../utils/getTargetTableSelector.sol"; * We can optimize this by adding support for `setIndexOfField` in Store * (See https://github.com/latticexyz/mud/issues/444) * - * Note: if a table with composite keys is used, only the first key is indexed + * Note: if a table with composite keys is used, only the first key of the tuple is indexed */ contract KeysWithValueHook is StoreHook { using ArrayLib for bytes32[]; @@ -31,25 +31,25 @@ contract KeysWithValueHook is StoreHook { function onBeforeSetRecord( bytes32 sourceTableId, - bytes32[] memory key, + bytes32[] memory keyTuple, bytes memory data, FieldLayout fieldLayout ) public { bytes32 targetTableId = getTargetTableSelector(MODULE_NAMESPACE, sourceTableId); // Get the previous value - bytes32 previousValue = keccak256(_world().getRecord(sourceTableId, key, fieldLayout)); + bytes32 previousValue = keccak256(_world().getRecord(sourceTableId, keyTuple, fieldLayout)); // Remove the key from the list of keys with the previous value - _removeKeyFromList(targetTableId, key[0], previousValue); + _removeKeyFromList(targetTableId, keyTuple[0], previousValue); // Push the key to the list of keys with the new value - KeysWithValue.push(targetTableId, keccak256(data), key[0]); + KeysWithValue.push(targetTableId, keccak256(data), keyTuple[0]); } function onAfterSetRecord( bytes32 sourceTableId, - bytes32[] memory key, + bytes32[] memory keyTuple, bytes memory data, FieldLayout fieldLayout ) public { @@ -58,38 +58,38 @@ contract KeysWithValueHook is StoreHook { function onBeforeSetField( bytes32 sourceTableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8, bytes memory, FieldLayout fieldLayout ) public { // Remove the key from the list of keys with the previous value - bytes32 previousValue = keccak256(_world().getRecord(sourceTableId, key, fieldLayout)); + bytes32 previousValue = keccak256(_world().getRecord(sourceTableId, keyTuple, fieldLayout)); bytes32 targetTableId = getTargetTableSelector(MODULE_NAMESPACE, sourceTableId); - _removeKeyFromList(targetTableId, key[0], previousValue); + _removeKeyFromList(targetTableId, keyTuple[0], previousValue); } function onAfterSetField( bytes32 sourceTableId, - bytes32[] memory key, + bytes32[] memory keyTuple, uint8, bytes memory, FieldLayout fieldLayout ) public { // Add the key to the list of keys with the new value - bytes32 newValue = keccak256(_world().getRecord(sourceTableId, key, fieldLayout)); + bytes32 newValue = keccak256(_world().getRecord(sourceTableId, keyTuple, fieldLayout)); bytes32 targetTableId = getTargetTableSelector(MODULE_NAMESPACE, sourceTableId); - KeysWithValue.push(targetTableId, newValue, key[0]); + KeysWithValue.push(targetTableId, newValue, keyTuple[0]); } - function onBeforeDeleteRecord(bytes32 sourceTableId, bytes32[] memory key, FieldLayout fieldLayout) public { + function onBeforeDeleteRecord(bytes32 sourceTableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) public { // Remove the key from the list of keys with the previous value - bytes32 previousValue = keccak256(_world().getRecord(sourceTableId, key, fieldLayout)); + bytes32 previousValue = keccak256(_world().getRecord(sourceTableId, keyTuple, fieldLayout)); bytes32 targetTableId = getTargetTableSelector(MODULE_NAMESPACE, sourceTableId); - _removeKeyFromList(targetTableId, key[0], previousValue); + _removeKeyFromList(targetTableId, keyTuple[0], previousValue); } - function onAfterDeleteRecord(bytes32 sourceTableId, bytes32[] memory key, FieldLayout fieldLayout) public { + function onAfterDeleteRecord(bytes32 sourceTableId, bytes32[] memory keyTuple, FieldLayout fieldLayout) public { // NOOP } diff --git a/packages/world/test/World.t.sol b/packages/world/test/World.t.sol index f130c04ebe..1d168ead9a 100644 --- a/packages/world/test/World.t.sol +++ b/packages/world/test/World.t.sol @@ -86,14 +86,14 @@ contract WorldTestSystem is System { } function writeData(bytes16 namespace, bytes16 name, bool data) public { - bytes32[] memory key = new bytes32[](0); + bytes32[] memory keyTuple = new bytes32[](0); bytes32 tableId = ResourceSelector.from(namespace, name); FieldLayout fieldLayout = StoreSwitch.getFieldLayout(tableId); if (StoreSwitch.getStoreAddress() == address(this)) { - StoreCore.setRecord(tableId, key, abi.encodePacked(data), fieldLayout); + StoreCore.setRecord(tableId, keyTuple, abi.encodePacked(data), fieldLayout); } else { - IBaseWorld(msg.sender).setRecord(tableId, key, abi.encodePacked(data), fieldLayout); + IBaseWorld(msg.sender).setRecord(tableId, keyTuple, abi.encodePacked(data), fieldLayout); } } diff --git a/packages/world/test/query.t.sol b/packages/world/test/query.t.sol index 4c4feb2176..0d7b3b63f8 100644 --- a/packages/world/test/query.t.sol +++ b/packages/world/test/query.t.sol @@ -297,9 +297,9 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); for (uint256 i; i < 100; i++) { - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32(i); - world.setRecord(table1, key, abi.encode(1), tableFieldLayout); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = bytes32(i); + world.setRecord(table1, keyTuple, abi.encode(1), tableFieldLayout); } world.setRecord(table2, key1, abi.encode(0), tableFieldLayout); @@ -318,9 +318,9 @@ contract QueryTest is Test, GasReporter { _installKeysInTableModule(); for (uint256 i; i < 1000; i++) { - bytes32[] memory key = new bytes32[](1); - key[0] = bytes32(i); - world.setRecord(table1, key, abi.encode(1), tableFieldLayout); + bytes32[] memory keyTuple = new bytes32[](1); + keyTuple[0] = bytes32(i); + world.setRecord(table1, keyTuple, abi.encode(1), tableFieldLayout); } world.setRecord(table2, key1, abi.encode(0), tableFieldLayout); diff --git a/test-data/world-logs.json b/test-data/world-logs.json index 1f79d89f7e..4faea58887 100644 --- a/test-data/world-logs.json +++ b/test-data/world-logs.json @@ -5,11 +5,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000016d756473746f726500000000000000005461626c65730000000000000000000000000000000000000000000000000000000000000000000000000000000003400060030220202000000000000000000000000000000000000000000000000000002001005f000000000000000000000000000000000000000000000000000000006003025f5f5fc4c40000000000000000000000000000000000000000000000000000000000000000000000000000000000022000000000a0000000000002c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000077461626c654964000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000000b6669656c644c61796f757400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000096b6579536368656d610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b76616c7565536368656d610000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012616269456e636f6465644b65794e616d657300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014616269456e636f6465644669656c644e616d6573000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x0", + "transactionIndex": "0x7", + "logIndex": "0x1", "transactionLogIndex": "0x0", "removed": false }, @@ -19,11 +19,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000016d756473746f7265000000000000000053746f7265486f6f6b7300000000000000000000000000000000000000000000000000000000000000000000000001c00000000100000000000000000000000000000000000000000000000000000000002001005f00000000000000000000000000000000000000000000000000000000000001b600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000a00000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x1", + "transactionIndex": "0x7", + "logIndex": "0x2", "transactionLogIndex": "0x1", "removed": false }, @@ -33,11 +33,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000004e616d6573706163654f776e6572000000000000000000000000000000000000000000000000000000000000000001c00014010014000000000000000000000000000000000000000000000000000000001001004f000000000000000000000000000000000000000000000000000000001401006100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000a00000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000096e616d657370616365000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000056f776e6572000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x2", + "transactionIndex": "0x7", + "logIndex": "0x3", "transactionLogIndex": "0x2", "removed": false }, @@ -47,11 +47,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000042616c616e636573000000000000000000000000000000000000000000000000000000000000000000000000000001c00020010020000000000000000000000000000000000000000000000000000000001001004f000000000000000000000000000000000000000000000000000000002001001f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000a00000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000096e616d6573706163650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000762616c616e636500000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x3", + "transactionIndex": "0x7", + "logIndex": "0x4", "transactionLogIndex": "0x3", "removed": false }, @@ -61,11 +61,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000496e7374616c6c65644d6f64756c657300000000000000000000000000000000000000000000000000000000000002200014010014000000000000000000000000000000000000000000000000000000003002004f5f0000000000000000000000000000000000000000000000000000001401006100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000100000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000a6d6f64756c654e616d6500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d617267756d656e74734861736800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d6d6f64756c654164647265737300000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x4", + "transactionIndex": "0x7", + "logIndex": "0x5", "transactionLogIndex": "0x4", "removed": false }, @@ -75,11 +75,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000044656c65676174696f6e730000000000000000000000000000000000000000000000000000000000000000000000022000200100200000000000000000000000000000000000000000000000000000000028020061610000000000000000000000000000000000000000000000000000002001005f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000100000000000001a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000964656c656761746f720000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000964656c6567617465650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001364656c65676174696f6e436f6e74726f6c496400000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x5", + "transactionIndex": "0x7", + "logIndex": "0x6", "transactionLogIndex": "0x5", "removed": false }, @@ -89,11 +89,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000005265736f75726365416363657373000000000000000000000000000000000000000000000000000000000000000002200001010001000000000000000000000000000000000000000000000000000000003402005f610000000000000000000000000000000000000000000000000000000101006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000100000000000001a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000107265736f7572636553656c6563746f7200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000663616c6c6572000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000066163636573730000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x6", + "transactionIndex": "0x7", + "logIndex": "0x7", "transactionLogIndex": "0x6", "removed": false }, @@ -103,11 +103,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000053797374656d7300000000000000000000000000000000000000000000000000000000000000000000000000000002200015020014010000000000000000000000000000000000000000000000000000002001005f0000000000000000000000000000000000000000000000000000000015020061600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000a0000000000001a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000107265736f7572636553656c6563746f72000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000673797374656d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c7075626c69634163636573730000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x7", + "transactionIndex": "0x7", + "logIndex": "0x8", "transactionLogIndex": "0x7", "removed": false }, @@ -117,11 +117,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000022000240200200400000000000000000000000000000000000000000000000000000004010043000000000000000000000000000000000000000000000000000000002402005f430000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000a0000000000001a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001066756e6374696f6e53656c6563746f7200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000107265736f7572636553656c6563746f7200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001673797374656d46756e6374696f6e53656c6563746f7200000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x8", + "transactionIndex": "0x7", + "logIndex": "0x9", "transactionLogIndex": "0x8", "removed": false }, @@ -131,11 +131,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000053797374656d486f6f6b73000000000000000000000000000000000000000000000000000000000000000000000001c00000000100000000000000000000000000000000000000000000000000000000002001005f00000000000000000000000000000000000000000000000000000000000001b600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000a00000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000107265736f7572636553656c6563746f7200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x9", + "transactionIndex": "0x7", + "logIndex": "0xa", "transactionLogIndex": "0x9", "removed": false }, @@ -145,11 +145,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000053797374656d5265676973747279000000000000000000000000000000000000000000000000000000000000000001c000200100200000000000000000000000000000000000000000000000000000000014010061000000000000000000000000000000000000000000000000000000002001005f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000a000000000000140000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000673797374656d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000107265736f7572636553656c6563746f7200000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0xa", + "transactionIndex": "0x7", + "logIndex": "0xb", "transactionLogIndex": "0xa", "removed": false }, @@ -159,11 +159,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000005265736f75726365547970650000000000000000000000000000000000000000000000000000000000000000000001c00001010001000000000000000000000000000000000000000000000000000000002001005f000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000a00000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000107265736f7572636553656c6563746f7200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000c7265736f75726365547970650000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0xb", + "transactionIndex": "0x7", + "logIndex": "0xc", "transactionLogIndex": "0xb", "removed": false }, @@ -173,11 +173,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000004e616d6573706163654f776e657200000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0xc", + "transactionIndex": "0x7", + "logIndex": "0xd", "transactionLogIndex": "0xc", "removed": false }, @@ -187,11 +187,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636541636365737300000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb9226600000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0xd", + "transactionIndex": "0x7", + "logIndex": "0xe", "transactionLogIndex": "0xd", "removed": false }, @@ -201,11 +201,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636554797065000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0xe", + "transactionIndex": "0x7", + "logIndex": "0xf", "transactionLogIndex": "0xe", "removed": false }, @@ -215,11 +215,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636554797065000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000636f72652e730000000000000000000000000000000000000000000000000000000000000000000000000000000000010300000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0xf", + "transactionIndex": "0x7", + "logIndex": "0x10", "transactionLogIndex": "0xf", "removed": false }, @@ -229,11 +229,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000053797374656d73000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000636f72652e73000000000000000000000000000000000000000000000000000000000000000000000000000000000015cafac3dd18ac6c6e92c921884f9e4176737c052c010000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x10", + "transactionIndex": "0x7", + "logIndex": "0x11", "transactionLogIndex": "0x10", "removed": false }, @@ -243,11 +243,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x0000000000000000000000000000000053797374656d526567697374727900000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000cafac3dd18ac6c6e92c921884f9e4176737c052c000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000636f72652e7300000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x11", + "transactionIndex": "0x7", + "logIndex": "0x12", "transactionLogIndex": "0x11", "removed": false }, @@ -257,11 +257,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636541636365737300000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cafac3dd18ac6c6e92c921884f9e4176737c052c00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x12", + "transactionIndex": "0x7", + "logIndex": "0x13", "transactionLogIndex": "0x12", "removed": false }, @@ -271,11 +271,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000140554c3a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e730000000000000000000040554c3a00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x13", + "transactionIndex": "0x7", + "logIndex": "0x14", "transactionLogIndex": "0x13", "removed": false }, @@ -285,11 +285,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000018d53b20800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e73000000000000000000008d53b20800000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x14", + "transactionIndex": "0x7", + "logIndex": "0x15", "transactionLogIndex": "0x14", "removed": false }, @@ -299,11 +299,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000125f6221000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e730000000000000000000025f6221000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x15", + "transactionIndex": "0x7", + "logIndex": "0x16", "transactionLogIndex": "0x15", "removed": false }, @@ -313,11 +313,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000012bfaa27400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e73000000000000000000002bfaa27400000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x16", + "transactionIndex": "0x7", + "logIndex": "0x17", "transactionLogIndex": "0x16", "removed": false }, @@ -327,11 +327,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000121293ca000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e730000000000000000000021293ca000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x17", + "transactionIndex": "0x7", + "logIndex": "0x18", "transactionLogIndex": "0x17", "removed": false }, @@ -341,11 +341,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000018818929400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e73000000000000000000008818929400000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x18", + "transactionIndex": "0x7", + "logIndex": "0x19", "transactionLogIndex": "0x18", "removed": false }, @@ -355,11 +355,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000018da798da00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e73000000000000000000008da798da00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x19", + "transactionIndex": "0x7", + "logIndex": "0x1a", "transactionLogIndex": "0x19", "removed": false }, @@ -369,11 +369,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010ba51f4900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e73000000000000000000000ba51f4900000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x1a", + "transactionIndex": "0x7", + "logIndex": "0x1b", "transactionLogIndex": "0x1a", "removed": false }, @@ -383,11 +383,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001530f4b6000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e7300000000000000000000530f4b6000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x1b", + "transactionIndex": "0x7", + "logIndex": "0x1c", "transactionLogIndex": "0x1b", "removed": false }, @@ -397,11 +397,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000010560912900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e73000000000000000000000560912900000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x1c", + "transactionIndex": "0x7", + "logIndex": "0x1d", "transactionLogIndex": "0x1c", "removed": false }, @@ -411,11 +411,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001a886545e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e7300000000000000000000a886545e00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x1d", + "transactionIndex": "0x7", + "logIndex": "0x1e", "transactionLogIndex": "0x1d", "removed": false }, @@ -425,11 +425,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001d5f8337f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e7300000000000000000000d5f8337f00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x1e", + "transactionIndex": "0x7", + "logIndex": "0x1f", "transactionLogIndex": "0x1e", "removed": false }, @@ -439,11 +439,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001a92813ad00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e7300000000000000000000a92813ad00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x1f", + "transactionIndex": "0x7", + "logIndex": "0x20", "transactionLogIndex": "0x1f", "removed": false }, @@ -453,11 +453,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000013350b6a900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e73000000000000000000003350b6a900000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x20", + "transactionIndex": "0x7", + "logIndex": "0x21", "transactionLogIndex": "0x20", "removed": false }, @@ -467,11 +467,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000013c03a51c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e73000000000000000000003c03a51c00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x21", + "transactionIndex": "0x7", + "logIndex": "0x22", "transactionLogIndex": "0x21", "removed": false }, @@ -481,11 +481,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001b7a3c75600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e7300000000000000000000b7a3c75600000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x22", + "transactionIndex": "0x7", + "logIndex": "0x23", "transactionLogIndex": "0x22", "removed": false }, @@ -495,11 +495,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000011d2257ba00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000636f72652e73000000000000000000001d2257ba00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x23", + "transactionIndex": "0x7", + "logIndex": "0x24", "transactionLogIndex": "0x23", "removed": false }, @@ -509,11 +509,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x00000000000000000000000000000000496e7374616c6c65644d6f64756c6573000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002636f72652e6d0000000000000000000000000000000000000000000000000000c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4700000000000000000000000000000000000000000000000000000000000000014e7f1725e7734ce288f8367e1bb143e90bb3f0512000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0xfe43f23153c69149ebe20b5941cccf8c55f4bf3acd82b33445ace71a2c5f8a9c", + "blockNumber": "0x2", "transactionHash": "0xae82b15a8c62db1e23d9c523e730d9b861eed20529b8cff4d3452f86ae3149df", - "transactionIndex": "0x0", - "logIndex": "0x24", + "transactionIndex": "0x7", + "logIndex": "0x25", "transactionLogIndex": "0x24", "removed": false }, @@ -523,11 +523,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636554797065000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000004e756d6265724c69737400000000000000000000000000000000000000000000000000000000000000000000000000010200000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0x7bca8d7dabf72bfa9ff127d2d2fac95a747b5cbd45e44d820789f14a6d340d2f", - "transactionIndex": "0x1", - "logIndex": "0x25", + "transactionIndex": "0x0", + "logIndex": "0x0", "transactionLogIndex": "0x0", "removed": false }, @@ -537,11 +537,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000004e756d6265724c697374000000000000000000000000000000000000000000000000000000000000000000000000016000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000040000000000000e000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0x7bca8d7dabf72bfa9ff127d2d2fac95a747b5cbd45e44d820789f14a6d340d2f", - "transactionIndex": "0x1", - "logIndex": "0x26", + "transactionIndex": "0x0", + "logIndex": "0x1", "transactionLogIndex": "0x1", "removed": false }, @@ -551,11 +551,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636554797065000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000437573746f6d4572726f72735379737400000000000000000000000000000000000000000000000000000000000000010300000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xb5f9defc11305940c4b08a6f34cdb4a671fde33905f288048b70c85b1d0875eb", - "transactionIndex": "0x2", - "logIndex": "0x27", + "transactionIndex": "0x1", + "logIndex": "0x2", "transactionLogIndex": "0x0", "removed": false }, @@ -565,11 +565,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000053797374656d73000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000437573746f6d4572726f72735379737400000000000000000000000000000000000000000000000000000000000000155fc8d32690cc91d4c39d9d3abcbd16989f875707010000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xb5f9defc11305940c4b08a6f34cdb4a671fde33905f288048b70c85b1d0875eb", - "transactionIndex": "0x2", - "logIndex": "0x28", + "transactionIndex": "0x1", + "logIndex": "0x3", "transactionLogIndex": "0x1", "removed": false }, @@ -579,11 +579,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x0000000000000000000000000000000053797374656d526567697374727900000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000005fc8d32690cc91d4c39d9d3abcbd16989f875707000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000437573746f6d4572726f727353797374", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xb5f9defc11305940c4b08a6f34cdb4a671fde33905f288048b70c85b1d0875eb", - "transactionIndex": "0x2", - "logIndex": "0x29", + "transactionIndex": "0x1", + "logIndex": "0x4", "transactionLogIndex": "0x2", "removed": false }, @@ -593,11 +593,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636541636365737300000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000005fc8d32690cc91d4c39d9d3abcbd16989f87570700000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xb5f9defc11305940c4b08a6f34cdb4a671fde33905f288048b70c85b1d0875eb", - "transactionIndex": "0x2", - "logIndex": "0x2a", + "transactionIndex": "0x1", + "logIndex": "0x5", "transactionLogIndex": "0x3", "removed": false }, @@ -607,11 +607,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636554797065000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000004e756d6265724c69737453797374656d00000000000000000000000000000000000000000000000000000000000000010300000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0x5e56042175cee9139c0439cc0df13d0efbdb1a57e93e5353f8fc713ea061bfce", - "transactionIndex": "0x3", - "logIndex": "0x2b", + "transactionIndex": "0x2", + "logIndex": "0x6", "transactionLogIndex": "0x0", "removed": false }, @@ -621,11 +621,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000053797374656d73000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000004e756d6265724c69737453797374656d00000000000000000000000000000000000000000000000000000000000000150165878a594ca255338adfa4d48449f69242eb8f010000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0x5e56042175cee9139c0439cc0df13d0efbdb1a57e93e5353f8fc713ea061bfce", - "transactionIndex": "0x3", - "logIndex": "0x2c", + "transactionIndex": "0x2", + "logIndex": "0x7", "transactionLogIndex": "0x1", "removed": false }, @@ -635,11 +635,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x0000000000000000000000000000000053797374656d526567697374727900000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000004e756d6265724c69737453797374656d", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0x5e56042175cee9139c0439cc0df13d0efbdb1a57e93e5353f8fc713ea061bfce", - "transactionIndex": "0x3", - "logIndex": "0x2d", + "transactionIndex": "0x2", + "logIndex": "0x8", "transactionLogIndex": "0x2", "removed": false }, @@ -649,11 +649,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636541636365737300000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000165878a594ca255338adfa4d48449f69242eb8f00000000000000000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0x5e56042175cee9139c0439cc0df13d0efbdb1a57e93e5353f8fc713ea061bfce", - "transactionIndex": "0x3", - "logIndex": "0x2e", + "transactionIndex": "0x2", + "logIndex": "0x9", "transactionLogIndex": "0x3", "removed": false }, @@ -663,11 +663,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636554797065000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000566563746f720000000000000000000000000000000000000000000000000000000000000000000000000000000000010200000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xb3febd63ed51098bd7062390e4e859508e55a1bbfa5ee8ec197a4df93586f632", - "transactionIndex": "0x4", - "logIndex": "0x2f", + "transactionIndex": "0x3", + "logIndex": "0xa", "transactionLogIndex": "0x0", "removed": false }, @@ -677,11 +677,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000566563746f72000000000000000000000000000000000000000000000000000000000000000000000000000000000220000802000404000000000000000000000000000000000000000000000000000000040100030000000000000000000000000000000000000000000000000000000008020023230000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000a0000000000001a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000036b6579000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000001780000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000017900000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xb3febd63ed51098bd7062390e4e859508e55a1bbfa5ee8ec197a4df93586f632", - "transactionIndex": "0x4", - "logIndex": "0x30", + "transactionIndex": "0x3", + "logIndex": "0xb", "transactionLogIndex": "0x1", "removed": false }, @@ -691,11 +691,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636554797065000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000004e756d6265720000000000000000000000000000000000000000000000000000000000000000000000000000000000010200000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xd9aea844188d36cd599b3d9ddd523b1269131ec10ebf5b107a50bffe8a03985e", - "transactionIndex": "0x5", - "logIndex": "0x31", + "transactionIndex": "0x4", + "logIndex": "0xc", "transactionLogIndex": "0x0", "removed": false }, @@ -705,11 +705,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000004e756d6265720000000000000000000000000000000000000000000000000000000000000000000000000000000001c000040100040000000000000000000000000000000000000000000000000000000004010003000000000000000000000000000000000000000000000000000000000401000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000a00000000000014000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000036b65790000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xd9aea844188d36cd599b3d9ddd523b1269131ec10ebf5b107a50bffe8a03985e", - "transactionIndex": "0x5", - "logIndex": "0x32", + "transactionIndex": "0x4", + "logIndex": "0xd", "transactionLogIndex": "0x1", "removed": false }, @@ -719,11 +719,11 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000005265736f7572636554797065000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000004d756c7469000000000000000000000000000000000000000000000000000000000000000000000000000000000000010200000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xa50c88a503c25f17dc6c8e4cc779f15341f6f8242da501989a64ec87a8f5a85b", - "transactionIndex": "0x6", - "logIndex": "0x33", + "transactionIndex": "0x5", + "logIndex": "0xe", "transactionLogIndex": "0x0", "removed": false }, @@ -733,11 +733,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x6d756473746f726500000000000000005461626c657300000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000004d756c74690000000000000000000000000000000000000000000000000000000000000000000000000000000000034000210200200100000000000000000000000000000000000000000000000000000034040003601f2e000000000000000000000000000000000000000000000000002102003f600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000001c0000000000002c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000016100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000162000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001630000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000036e756d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000576616c7565000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0xa50c88a503c25f17dc6c8e4cc779f15341f6f8242da501989a64ec87a8f5a85b", - "transactionIndex": "0x6", - "logIndex": "0x34", + "transactionIndex": "0x5", + "logIndex": "0xf", "transactionLogIndex": "0x1", "removed": false }, @@ -746,12 +746,12 @@ "topics": [ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], - "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001306d61a5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000004e756d6265724c69737453797374656d306d61a500000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", - "transactionHash": "0x2fc64bbab454451eca5989fa793399718795f92515de1032447065da3dec0201", - "transactionIndex": "0x7", - "logIndex": "0x35", + "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000015f644e3c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000437573746f6d4572726f7273537973745f644e3c00000000000000000000000000000000000000000000000000000000", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", + "transactionHash": "0xff27259bf2a15d32d629b5f2dce0f7b248400c760cd4a4f367670e87b4cf81fb", + "transactionIndex": "0x6", + "logIndex": "0x10", "transactionLogIndex": "0x0", "removed": false }, @@ -761,11 +761,11 @@ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001b8a44c7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000004e756d6265724c69737453797374656db8a44c7c00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", "transactionHash": "0x704d3a95376db47cabae3ba83743e46e1eb751b82a9b622af5a555e109d59a66", - "transactionIndex": "0x8", - "logIndex": "0x36", + "transactionIndex": "0x7", + "logIndex": "0x11", "transactionLogIndex": "0x0", "removed": false }, @@ -774,12 +774,12 @@ "topics": [ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], - "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001f7f0e440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000004e756d6265724c69737453797374656df7f0e44000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", - "transactionHash": "0x39116de046d5a63b1624f2556f78148c5bfaf0011b126598d96615cbbf89dc7f", - "transactionIndex": "0x9", - "logIndex": "0x37", + "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001a4ece52c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000004e756d6265724c69737453797374656da4ece52c00000000000000000000000000000000000000000000000000000000", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", + "transactionHash": "0x9d7756b56cd32ba0a3305788a5c412eae328b0a28c4ff2e46f5db939a1190a77", + "transactionIndex": "0x8", + "logIndex": "0x12", "transactionLogIndex": "0x0", "removed": false }, @@ -788,12 +788,12 @@ "topics": [ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], - "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000015f644e3c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000437573746f6d4572726f7273537973745f644e3c00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", - "transactionHash": "0x6f143315ee4b6e8f64a70bf520ea301db90a677eda48a9f423bd5d1f5b4a1c28", - "transactionIndex": "0xa", - "logIndex": "0x38", + "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001f7f0e440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000004e756d6265724c69737453797374656df7f0e44000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", + "transactionHash": "0x8a7d4a27b5a121f77b0011d084850b4502db7cc7e30f5a22e1fdf61247eac74c", + "transactionIndex": "0x9", + "logIndex": "0x13", "transactionLogIndex": "0x0", "removed": false }, @@ -802,12 +802,12 @@ "topics": [ "0x912af873e852235aae78a1d25ae9bb28b616a67c36898c53a14fd8184504ee32" ], - "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001a4ece52c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000004e756d6265724c69737453797374656da4ece52c00000000000000000000000000000000000000000000000000000000", - "blockHash": "0x29d9d51112d3304c99e265986b1b441446c3384dc8268d11e105c6f86c4a85ac", - "blockNumber": "0x4", - "transactionHash": "0x0f4f8c0ea36e9e8e88cdd2f5719f2ffa36a3698bdf7fe2b8443685d35517d6ea", - "transactionIndex": "0xb", - "logIndex": "0x39", + "data": "0x0000000000000000000000000000000046756e6374696f6e53656c6563746f72000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001306d61a5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000004e756d6265724c69737453797374656d306d61a500000000000000000000000000000000000000000000000000000000", + "blockHash": "0x40b6d1b700f1f3dc080ebe2d54c3553e6419da61cfeb5a5e2e2272ebe9840b9a", + "blockNumber": "0x3", + "transactionHash": "0xf97efde38e1aaee38023ff6669c33b26ac5230f364af583b6159dfec83099c02", + "transactionIndex": "0xa", + "logIndex": "0x14", "transactionLogIndex": "0x0", "removed": false }, @@ -817,8 +817,8 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000004e756d6265724c6973740000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000001a400000000000000000000000000000000000000000000000000000000", - "blockHash": "0xaff54c40af4b26fae5bfcbb5187e698f5e4a54c338fac1e9ddbcdef5eb979c6b", - "blockNumber": "0x5", + "blockHash": "0xcc9c86d971dbe128cf77e6c94d85c369dc31f6a9b0b75324cc5feb5215a4b045", + "blockNumber": "0x4", "transactionHash": "0x6b11c4b4d9257da889cd755a9aef98068339dea0770f3c43def5293c47977876", "transactionIndex": "0x0", "logIndex": "0x0", @@ -831,8 +831,8 @@ "0xd01f9f1368f831528fc9fe6442366b2b7d957fbfff3bcf7c24d9ab5fe51f8c46" ], "data": "0x000000000000000000000000000000004e756d6265724c6973740000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000001a400000045000000000000000000000000000000000000000000000000", - "blockHash": "0xaff54c40af4b26fae5bfcbb5187e698f5e4a54c338fac1e9ddbcdef5eb979c6b", - "blockNumber": "0x5", + "blockHash": "0xcc9c86d971dbe128cf77e6c94d85c369dc31f6a9b0b75324cc5feb5215a4b045", + "blockNumber": "0x4", "transactionHash": "0x2453e912dfab0eed54e6140d2f5c829034fe51fa844767991510eb71ecff8a3b", "transactionIndex": "0x1", "logIndex": "0x1",