From ea79c9fba89a9e2b24dbcd45e18ae1770a31345e Mon Sep 17 00:00:00 2001 From: Kevin Ingersoll Date: Tue, 1 Oct 2024 14:48:45 +0100 Subject: [PATCH] add tests --- packages/common/src/index.ts | 1 + packages/common/src/logSort.ts | 16 + packages/store-sync/test/logsToBlocks.ts | 3 +- packages/store/package.json | 2 + packages/store/ts/flattenStoreLogs.test.ts | 180 ++++++++++++ packages/store/ts/getStoreLogs.test.ts | 323 +++++++++++++++++++++ packages/store/ts/getStoreLogs.ts | 2 +- packages/store/ts/test/common.ts | 16 + packages/store/ts/test/globalSetup.ts | 19 ++ packages/store/ts/test/logsToBlocks.ts | 18 ++ packages/store/ts/test/mockGame.ts | 35 +++ packages/store/ts/test/setup.ts | 18 ++ packages/store/ts/test/summarizeLogs.ts | 12 + packages/store/vitest.config.ts | 13 +- pnpm-lock.yaml | 73 +++-- 15 files changed, 705 insertions(+), 26 deletions(-) create mode 100644 packages/common/src/logSort.ts create mode 100644 packages/store/ts/flattenStoreLogs.test.ts create mode 100644 packages/store/ts/getStoreLogs.test.ts create mode 100644 packages/store/ts/test/common.ts create mode 100644 packages/store/ts/test/globalSetup.ts create mode 100644 packages/store/ts/test/logsToBlocks.ts create mode 100644 packages/store/ts/test/mockGame.ts create mode 100644 packages/store/ts/test/setup.ts create mode 100644 packages/store/ts/test/summarizeLogs.ts diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts index 51248832f45..00d17b57356 100644 --- a/packages/common/src/index.ts +++ b/packages/common/src/index.ts @@ -7,6 +7,7 @@ export * from "./getBurnerPrivateKey"; export * from "./getNonceManager"; export * from "./getNonceManagerId"; export * from "./hexToResource"; +export * from "./logSort"; export * from "./LruMap"; export * from "./readHex"; export * from "./resourceToLabel"; diff --git a/packages/common/src/logSort.ts b/packages/common/src/logSort.ts new file mode 100644 index 00000000000..f3e9da14393 --- /dev/null +++ b/packages/common/src/logSort.ts @@ -0,0 +1,16 @@ +import { Log } from "viem"; + +export function logSort(a: Log, b: Log): number { + if (a.blockNumber === b.blockNumber) { + if (a.logIndex === b.logIndex) return 0; + if (a.logIndex == null) return 1; + if (b.logIndex == null) return -1; + return a.logIndex - b.logIndex; + } + + if (a.blockNumber == null) return 1; + if (b.blockNumber == null) return -1; + if (a.blockNumber > b.blockNumber) return 1; + if (a.blockNumber < b.blockNumber) return -1; + return 0; +} diff --git a/packages/store-sync/test/logsToBlocks.ts b/packages/store-sync/test/logsToBlocks.ts index 2cfbcdf50e0..d219bc87b92 100644 --- a/packages/store-sync/test/logsToBlocks.ts +++ b/packages/store-sync/test/logsToBlocks.ts @@ -14,8 +14,7 @@ export function logsToBlocks( topics: log.topics as [Hex, ...Hex[]], strict: true, }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return formatLog(log as any as RpcLog, { args, eventName: eventName as string }) as StoreEventsLog; + return formatLog(log as RpcLog, { args, eventName: eventName as string }) as StoreEventsLog; }), ); } diff --git a/packages/store/package.json b/packages/store/package.json index bdaba1cdea8..4ec6d2777e3 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -76,8 +76,10 @@ "@types/ejs": "^3.1.1", "@types/mocha": "^9.1.1", "@types/node": "^18.15.11", + "@viem/anvil": "^0.0.7", "ds-test": "https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0", "forge-std": "https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1", + "mock-game-contracts": "workspace:*", "solhint": "^3.3.7", "tsup": "^6.7.0", "tsx": "^3.12.6", diff --git a/packages/store/ts/flattenStoreLogs.test.ts b/packages/store/ts/flattenStoreLogs.test.ts new file mode 100644 index 00000000000..5270224450d --- /dev/null +++ b/packages/store/ts/flattenStoreLogs.test.ts @@ -0,0 +1,180 @@ +/* eslint-disable max-len */ +import { beforeAll, describe, expect, it } from "vitest"; +import { deployMockGame } from "./test/mockGame"; +import { testClient } from "./test/common"; +import { getStoreLogs } from "./getStoreLogs"; +import { summarizeLogs } from "./test/summarizeLogs"; +import { flattenStoreLogs } from "./flattenStoreLogs"; + +describe("flattenStoreLogs", async () => { + beforeAll(async () => { + await deployMockGame(); + }); + + it("flattens store logs", async () => { + const logs = await getStoreLogs(testClient, { fromBlock: "earliest", toBlock: "latest" }); + const flattenedLogs = flattenStoreLogs(logs); + + expect(summarizeLogs(flattenedLogs)).toMatchInlineSnapshot(` + [ + "Store_SetRecord world__InitModuleAddres ()", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__Tables (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__Tables (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SetRecord store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SetRecord store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__NamespaceOwner (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e7373746f726500000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SetRecord store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__NamespaceOwner (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e73776f726c6400000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SetRecord world__SystemRegistry (0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SetRecord store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SetRecord store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SetRecord world__SystemRegistry (0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SetRecord store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SetRecord world__FunctionSelector (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__InstalledModules (0x000000000000000000000000da4e062e8c69d39d9472945232a53f579904ac45,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SetRecord world__NamespaceOwner (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SetRecord store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SetRecord store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SetRecord world__FunctionSelector (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SetRecord store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SetRecord store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SetRecord world__SystemRegistry (0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SetRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SetRecord world__FunctionSelector (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__InstalledModules (0x000000000000000000000000576a2cef28fbe49215143ae4d87e03ea1e99e37a,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SetRecord store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SetRecord store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SetRecord store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SetRecord world__Systems (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SetRecord world__SystemRegistry (0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SetRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SetRecord world__FunctionSelector (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc6972e9300000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x116e68f200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xf128760200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__NamespaceOwner (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SetRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SetRecord world__InstalledModules (0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SetRecord metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x6162690000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x776f726c64416269000000000000000000000000000000000000000000000000)", + "Store_SetRecord Position (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SetRecord Health (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SetRecord Position (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SetRecord Health (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SetRecord Position (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SetRecord Health (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SetRecord Position (0x000000000000000000000000dba86119a787422c593cef119e40887f396024e2)", + "Store_SetRecord Terrain (0x0000000000000000000000000000000000000000000000000000000000000003,0x0000000000000000000000000000000000000000000000000000000000000005)", + ] + `); + }); +}); diff --git a/packages/store/ts/getStoreLogs.test.ts b/packages/store/ts/getStoreLogs.test.ts new file mode 100644 index 00000000000..5292ac47f58 --- /dev/null +++ b/packages/store/ts/getStoreLogs.test.ts @@ -0,0 +1,323 @@ +/* eslint-disable max-len */ +import { beforeAll, describe, expect, it } from "vitest"; +import { deployMockGame } from "./test/mockGame"; +import { testClient } from "./test/common"; +import { getStoreLogs } from "./getStoreLogs"; +import config from "../mud.config"; +import { summarizeLogs } from "./test/summarizeLogs"; + +describe("getStoreLogs", async () => { + beforeAll(async () => { + await deployMockGame(); + }); + + it("fetches only store logs", async () => { + const logs = await getStoreLogs(testClient, { fromBlock: "earliest", toBlock: "latest" }); + expect(summarizeLogs(logs)).toMatchInlineSnapshot(` + [ + "Store_SpliceStaticData world__InitModuleAddres ()", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__Tables (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__Tables (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SpliceStaticData store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__ResourceAccess (0x6e7373746f726500000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SpliceStaticData store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73776f726c6400000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SpliceStaticData world__SystemRegistry (0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000017ffdeff94ed0b80c493a179d4b3b09d6d71f627)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000a274b9a7e743cd8df3c6fd0abd47ed55fc943bc3)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SpliceStaticData world__SystemRegistry (0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x00000000000000000000000053e5c08d82a377167069ade46d087ab753538608)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord world__Systems (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d416f26aafcaaeca50b0dc35bd023e7286be2961)", + "Store_SetRecord world__FunctionSelector (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x40554c3a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8d53b20800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xef5d6bbb00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x219adc2e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc9c85a6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x45afd19900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xce5e8dd900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8fc8cf7e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x8da798da00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0ba51f4900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x530f4b6000000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x0560912900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb29e408900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xd5f8337f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xa92813ad00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x3350b6a900000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x26d9810200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x6548a90a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1d2257ba00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xcdc938c500000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xbfdfaff700000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xaa66e9c800000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__InstalledModules (0x000000000000000000000000da4e062e8c69d39d9472945232a53f579904ac45,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_DeleteRecord world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000573802f86c51b61d7cf620952217ec6ce0537d2e)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord world__Systems (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000b7b226e8dc03ee1e9c28eb37309c1c48dd5d88f3)", + "Store_SetRecord world__FunctionSelector (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xb591186e00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SetRecord world__Systems (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SpliceStaticData world__SystemRegistry (0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SpliceStaticData world__ResourceAccess (0x6e73000000000000000000000000000000000000000000000000000000000000,0x000000000000000000000000d09016b5b55461012d558a0945e9e7ce48bbad90)", + "Store_SetRecord world__FunctionSelector (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x1fae630800000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__InstalledModules (0x000000000000000000000000576a2cef28fbe49215143ae4d87e03ea1e99e37a,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SpliceStaticData store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901)", + "Store_SetRecord store__Tables (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SetRecord world__Systems (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + "Store_SpliceStaticData world__SystemRegistry (0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SpliceStaticData world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000000d0a0ad663793e3d078fec50a85cf32d95c3a3c4)", + "Store_SetRecord world__FunctionSelector (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xc6972e9300000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xff66f05f00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x116e68f200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xefc1704200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSelector (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0xf128760200000000000000000000000000000000000000000000000000000000)", + "Store_SetRecord world__FunctionSignatur (0x5ce7ca1a00000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData world__NamespaceOwner (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_DeleteRecord world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901)", + "Store_SpliceStaticData world__ResourceAccess (0x6e736d6574616461746100000000000000000000000000000000000000000000,0x000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266)", + "Store_SpliceStaticData world__InstalledModules (0x0000000000000000000000002ff959c7d78a64356c28bcf5f6e3cd56f1463901,0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470)", + "Store_SpliceDynamicData metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x6162690000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceDynamicData metadata__ResourceTag (0x737900000000000000000000000000004d6f766553797374656d000000000000,0x776f726c64416269000000000000000000000000000000000000000000000000)", + "Store_SetRecord Position (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SpliceStaticData Health (0x0000000000000000000000001d96f2f6bef1202e4ce1ff6dad0c2cb002861d3e)", + "Store_SetRecord Position (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SpliceStaticData Health (0x000000000000000000000000328809bc894f92807417d2dad6b7c998c1afdac6)", + "Store_SetRecord Position (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SpliceStaticData Health (0x000000000000000000000000078cf0753dd50f7c56f20b3ae02719ea199be2eb)", + "Store_SetRecord Position (0x000000000000000000000000dba86119a787422c593cef119e40887f396024e2)", + "Store_SpliceStaticData Terrain (0x0000000000000000000000000000000000000000000000000000000000000003,0x0000000000000000000000000000000000000000000000000000000000000005)", + ] + `); + }); + + it("fetches only store logs for a specific table", async () => { + const logs = await getStoreLogs(testClient, { + fromBlock: "earliest", + toBlock: "latest", + tableId: config.tables.store__ResourceIds.tableId, + }); + expect(summarizeLogs(logs)).toMatchInlineSnapshot(` + [ + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SpliceStaticData store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + ] + `); + }); + + it("fetches only store logs for specific tables", async () => { + const logs = await getStoreLogs(testClient, { + fromBlock: "earliest", + toBlock: "latest", + tableId: [config.tables.store__ResourceIds.tableId, config.tables.store__Tables.tableId], + }); + expect(summarizeLogs(logs)).toMatchInlineSnapshot(` + [ + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SetRecord store__Tables (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005461626c657300000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f72650000000000000000005265736f757263654964730000000000)", + "Store_SetRecord store__Tables (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746273746f726500000000000000000053746f7265486f6f6b73000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d6573706163654f776e65720000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000042616c616e6365730000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e7374616c6c65644d6f64756c6573)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005573657244656c65676174696f6e436f)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000004e616d65737061636544656c65676174)", + "Store_SetRecord store__Tables (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c640000000000000000005265736f757263654163636573730000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d73000000000000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000046756e6374696f6e53656c6563746f72)", + "Store_SetRecord store__Tables (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x6f74776f726c6400000000000000000046756e6374696f6e5369676e61747572)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d486f6f6b730000000000)", + "Store_SetRecord store__Tables (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c6400000000000000000053797374656d52656769737472790000)", + "Store_SetRecord store__Tables (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x7462776f726c64000000000000000000496e69744d6f64756c65416464726573)", + "Store_SpliceStaticData store__ResourceIds (0x6e73000000000000000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e7373746f726500000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e73776f726c6400000000000000000000000000000000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004163636573734d616e6167656d656e74)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000042616c616e63655472616e7366657200)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000426174636843616c6c00000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73790000000000000000000000000000526567697374726174696f6e00000000)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000506f736974696f6e0000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000004865616c746800000000000000000000)", + "Store_SetRecord store__Tables (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74620000000000000000000000000000496e76656e746f727900000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000053636f72650000000000000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000057696e6e657200000000000000000000)", + "Store_SetRecord store__Tables (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x746200000000000000000000000000005465727261696e000000000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x737900000000000000000000000000004d6f766553797374656d000000000000)", + "Store_SetRecord store__Tables (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7462000000000000000000000000000043616c6c576974685369676e61747572)", + "Store_SpliceStaticData store__ResourceIds (0x7379000000000000000000000000000044656c65676174696f6e000000000000)", + "Store_SpliceStaticData store__ResourceIds (0x6e736d6574616461746100000000000000000000000000000000000000000000)", + "Store_SetRecord store__Tables (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x74626d657461646174610000000000005265736f757263655461670000000000)", + "Store_SpliceStaticData store__ResourceIds (0x73796d657461646174610000000000004d6574616461746153797374656d0000)", + ] + `); + }); +}); diff --git a/packages/store/ts/getStoreLogs.ts b/packages/store/ts/getStoreLogs.ts index 06b1e4e0c47..16d3aeeb772 100644 --- a/packages/store/ts/getStoreLogs.ts +++ b/packages/store/ts/getStoreLogs.ts @@ -40,7 +40,7 @@ export type GetStoreLogsReturnType< export type GetStoreLogsErrorType = GetLogsErrorType; /** - * Returns a list of store event logs matching the provided parameters. + * Returns an unordered list of store event logs matching the provided parameters. * * @param client - Client to use * @param parameters - {@link GetStoreLogsParameters} diff --git a/packages/store/ts/test/common.ts b/packages/store/ts/test/common.ts new file mode 100644 index 00000000000..e0fe53774e5 --- /dev/null +++ b/packages/store/ts/test/common.ts @@ -0,0 +1,16 @@ +import { createTestClient, http } from "viem"; + +export const anvilHost = "127.0.0.1"; +export const anvilPort = 8555; + +// ID of the current test worker. Used by the `@viem/anvil` proxy server. +export const poolId = Number(process.env.VITEST_POOL_ID ?? 1); + +export const anvilRpcUrl = `http://${anvilHost}:${anvilPort}/${poolId}`; + +export const testClient = createTestClient({ + mode: "anvil", + // TODO: if tests get slow, try switching to websockets? + transport: http(anvilRpcUrl), + pollingInterval: 10, +}); diff --git a/packages/store/ts/test/globalSetup.ts b/packages/store/ts/test/globalSetup.ts new file mode 100644 index 00000000000..f1594c04836 --- /dev/null +++ b/packages/store/ts/test/globalSetup.ts @@ -0,0 +1,19 @@ +import { startProxy as startAnvilProxy } from "@viem/anvil"; +import { anvilHost, anvilPort } from "./common"; +import { execa } from "execa"; + +export default async function globalSetup(): Promise<() => Promise> { + console.log("building mock game"); + await execa("pnpm", ["run", "build"], { + cwd: `${__dirname}/../../../../test/mock-game-contracts`, + }); + + const shutdownAnvilProxy = await startAnvilProxy({ + host: anvilHost, + port: anvilPort, + }); + + return async () => { + await shutdownAnvilProxy(); + }; +} diff --git a/packages/store/ts/test/logsToBlocks.ts b/packages/store/ts/test/logsToBlocks.ts new file mode 100644 index 00000000000..46534644c2a --- /dev/null +++ b/packages/store/ts/test/logsToBlocks.ts @@ -0,0 +1,18 @@ +import { GroupLogsByBlockNumberResult, groupLogsByBlockNumber } from "@latticexyz/block-logs-stream"; +import { storeEventsAbi } from "@latticexyz/store"; +import { RpcLog, formatLog, decodeEventLog, Hex } from "viem"; +import { StoreLog } from "../storeLog"; + +export function logsToBlocks(rpcLogs: { data: string; topics: string[] }[]): GroupLogsByBlockNumberResult { + return groupLogsByBlockNumber( + rpcLogs.map((log) => { + const { eventName, args } = decodeEventLog({ + abi: storeEventsAbi, + data: log.data as Hex, + topics: log.topics as [Hex, ...Hex[]], + strict: true, + }); + return formatLog(log as RpcLog, { args, eventName: eventName as string }) as StoreLog; + }), + ); +} diff --git a/packages/store/ts/test/mockGame.ts b/packages/store/ts/test/mockGame.ts new file mode 100644 index 00000000000..908a069f036 --- /dev/null +++ b/packages/store/ts/test/mockGame.ts @@ -0,0 +1,35 @@ +import { execa } from "execa"; +import { anvilRpcUrl } from "./common"; +import { Hex, isHex } from "viem"; +import config from "mock-game-contracts/mud.config"; +import worldAbi from "mock-game-contracts/out/IWorld.sol/IWorld.abi.json"; + +export { config, worldAbi }; + +export async function deployMockGame(): Promise { + console.log("deploying mock game to", anvilRpcUrl); + const { stdout, stderr } = await execa( + "pnpm", + // skip build because its slow and we do it in global setup + // if we don't skip build here, it regenerates ABIs which cause the tests to re-run (because we import the ABI here), which re-runs this deploy... + ["mud", "deploy", "--rpc", anvilRpcUrl, "--saveDeployment", "false", "--skipBuild"], + { + cwd: `${__dirname}/../../../../test/mock-game-contracts`, + env: { + // anvil default account + PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", + DEBUG: "mud:*", + }, + }, + ); + if (stderr) console.error(stderr); + if (stdout) console.log(stdout); + + const [, worldAddress] = stdout.match(/worldAddress: '(0x[0-9a-f]+)'/i) ?? []; + if (!isHex(worldAddress)) { + throw new Error("world address not found in output, did the deploy fail?"); + } + console.log("deployed mock game", worldAddress); + + return worldAddress; +} diff --git a/packages/store/ts/test/setup.ts b/packages/store/ts/test/setup.ts new file mode 100644 index 00000000000..35d83f43043 --- /dev/null +++ b/packages/store/ts/test/setup.ts @@ -0,0 +1,18 @@ +import { beforeAll, beforeEach } from "vitest"; +import { testClient } from "./common"; + +// Some test suites deploy contracts in a `beforeAll` handler, so we restore chain state here. +beforeAll(async () => { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +}); + +// Some tests execute transactions, so we restore chain state here. +beforeEach(async () => { + const state = await testClient.dumpState(); + return async (): Promise => { + await testClient.loadState({ state }); + }; +}); diff --git a/packages/store/ts/test/summarizeLogs.ts b/packages/store/ts/test/summarizeLogs.ts new file mode 100644 index 00000000000..69698630762 --- /dev/null +++ b/packages/store/ts/test/summarizeLogs.ts @@ -0,0 +1,12 @@ +import { logSort, resourceToLabel, hexToResource } from "@latticexyz/common"; +import { StoreLog } from "../storeLog"; + +export function summarizeLogs(logs: StoreLog[]) { + return logs + .slice() + .sort(logSort) + .map( + ({ eventName, args: { tableId, keyTuple } }) => + `${eventName} ${resourceToLabel(hexToResource(tableId))} (${keyTuple})`, + ); +} diff --git a/packages/store/vitest.config.ts b/packages/store/vitest.config.ts index b6a66f2a98c..c1a0c3a874a 100644 --- a/packages/store/vitest.config.ts +++ b/packages/store/vitest.config.ts @@ -2,6 +2,17 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ test: { - globalSetup: "vitestSetup.ts", + globalSetup: ["vitestSetup.ts", "ts/test/globalSetup.ts"], + setupFiles: ["ts/test/setup.ts"], + // Temporarily set a low teardown timeout because anvil hangs otherwise + // Could move this timeout to anvil setup after https://github.com/wevm/anvil.js/pull/46 + teardownTimeout: 500, + hookTimeout: 15000, + }, + server: { + watch: { + // we build+import this file in test setup, which causes vitest to restart in a loop unless we ignore it here + ignored: ["**/test/mock-game-contracts/out/IWorld.sol/IWorld.abi.json"], + }, }, }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fdd02822408..7692e031ded 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -119,7 +119,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/block-logs-stream: dependencies: @@ -147,7 +147,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/cli: dependencies: @@ -289,7 +289,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/common: dependencies: @@ -341,7 +341,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/config: dependencies: @@ -455,7 +455,7 @@ importers: version: 6.7.0(postcss@8.4.23)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/explorer: dependencies: @@ -670,7 +670,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/gas-report: dependencies: @@ -716,7 +716,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/protocol-parser: dependencies: @@ -741,7 +741,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/react: dependencies: @@ -793,7 +793,7 @@ importers: version: 4.5.5(@types/node@20.12.12)(terser@5.33.0) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/recs: dependencies: @@ -818,10 +818,10 @@ importers: version: 8.3.4 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@20.12.12) + version: 29.5.0(@types/node@18.15.11) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) @@ -852,7 +852,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/solhint-config-mud: devDependencies: @@ -917,7 +917,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store: dependencies: @@ -967,12 +967,18 @@ importers: '@types/node': specifier: ^18.15.11 version: 18.15.11 + '@viem/anvil': + specifier: ^0.0.7 + version: 0.0.7(bufferutil@4.0.8)(debug@4.3.7)(utf-8-validate@5.0.10) ds-test: specifier: https://github.com/dapphub/ds-test.git#e282159d5170298eb2455a6c05280ab5a73a4ef0 version: https://codeload.github.com/dapphub/ds-test/tar.gz/e282159d5170298eb2455a6c05280ab5a73a4ef0 forge-std: specifier: https://github.com/foundry-rs/forge-std.git#74cfb77e308dd188d2f58864aaf44963ae6b88b1 version: https://codeload.github.com/foundry-rs/forge-std/tar.gz/74cfb77e308dd188d2f58864aaf44963ae6b88b1 + mock-game-contracts: + specifier: workspace:* + version: link:../../test/mock-game-contracts solhint: specifier: ^3.3.7 version: 3.3.7 @@ -984,7 +990,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store-indexer: dependencies: @@ -1099,7 +1105,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/store-sync: dependencies: @@ -1196,7 +1202,7 @@ importers: version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/utils: dependencies: @@ -1215,10 +1221,10 @@ importers: version: 27.4.1 jest: specifier: ^29.3.1 - version: 29.5.0(@types/node@18.15.11) + version: 29.5.0(@types/node@20.12.12) ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.21.4)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.21.4))(jest@29.5.0(@types/node@18.15.11))(typescript@5.4.2) + version: 29.0.5(@babel/core@7.25.2)(@jest/types@29.6.3)(babel-jest@29.5.0(@babel/core@7.25.2))(jest@29.5.0(@types/node@20.12.12))(typescript@5.4.2) tsup: specifier: ^6.7.0 version: 6.7.0(postcss@8.4.31)(typescript@5.4.2) @@ -1297,7 +1303,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/world-module-metadata: dependencies: @@ -1337,7 +1343,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) packages/world-modules: dependencies: @@ -1398,7 +1404,7 @@ importers: version: 3.12.6 vitest: specifier: 0.34.6 - version: 0.34.6(jsdom@22.1.0)(terser@5.33.0) + version: 0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0) test/mock-game-contracts: devDependencies: @@ -16275,6 +16281,17 @@ snapshots: - debug - utf-8-validate + '@viem/anvil@0.0.7(bufferutil@4.0.8)(debug@4.3.7)(utf-8-validate@5.0.10)': + dependencies: + execa: 7.2.0 + get-port: 6.1.2 + http-proxy: 1.18.1(debug@4.3.7) + ws: 8.13.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - debug + - utf-8-validate + '@vitejs/plugin-react@4.3.1(vite@4.5.5(@types/node@20.12.12)(terser@5.33.0))': dependencies: '@babel/core': 7.25.2 @@ -18922,6 +18939,10 @@ snapshots: optionalDependencies: debug: 4.3.4 + follow-redirects@1.15.2(debug@4.3.7): + optionalDependencies: + debug: 4.3.7 + for-each@0.3.3: dependencies: is-callable: 1.2.7 @@ -19296,6 +19317,14 @@ snapshots: transitivePeerDependencies: - debug + http-proxy@1.18.1(debug@4.3.7): + dependencies: + eventemitter3: 4.0.7 + follow-redirects: 1.15.2(debug@4.3.7) + requires-port: 1.0.0 + transitivePeerDependencies: + - debug + http-shutdown@1.2.2: {} https-proxy-agent@5.0.1: @@ -23375,7 +23404,7 @@ snapshots: fsevents: 2.3.3 terser: 5.33.0 - vitest@0.34.6(jsdom@22.1.0)(terser@5.33.0): + vitest@0.34.6(jsdom@22.1.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))(terser@5.33.0): dependencies: '@types/chai': 4.3.19 '@types/chai-subset': 1.3.5