Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into holic/fieldlayout-nev…
Browse files Browse the repository at this point in the history
…er-empty
  • Loading branch information
holic committed Jan 12, 2024
2 parents 7cc8209 + b1f5816 commit a2e806e
Show file tree
Hide file tree
Showing 18 changed files with 391 additions and 151 deletions.
5 changes: 5 additions & 0 deletions .changeset/beige-ads-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/store": patch
---

Storage events are now emitted after "before" hooks, so that the resulting logs are now correctly ordered and reflect onchain logic. This resolves issues with store writes and event emissions happening in "before" hooks.
5 changes: 5 additions & 0 deletions .changeset/seven-carpets-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/world": patch
---

Namespace balances can no longer be transferred to non-existent namespaces.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- main
pull_request:

env:
FOUNDRY_VERBOSITY: 5

jobs:
test:
name: Run tests
Expand Down
92 changes: 52 additions & 40 deletions packages/store/gas-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"file": "test/Callbacks.t.sol",
"test": "testSetAndGet",
"name": "Callbacks: set field",
"gasUsed": 56256
"gasUsed": 56271
},
{
"file": "test/Callbacks.t.sol",
Expand All @@ -75,7 +75,7 @@
"file": "test/Callbacks.t.sol",
"test": "testSetAndGet",
"name": "Callbacks: push 1 element",
"gasUsed": 32514
"gasUsed": 32530
},
{
"file": "test/FieldLayout.t.sol",
Expand Down Expand Up @@ -369,7 +369,7 @@
"file": "test/KeyEncoding.t.sol",
"test": "testRegisterAndGetFieldLayout",
"name": "register KeyEncoding table",
"gasUsed": 718993
"gasUsed": 719023
},
{
"file": "test/Mixed.t.sol",
Expand All @@ -393,7 +393,7 @@
"file": "test/Mixed.t.sol",
"test": "testSetGetDeleteExternal",
"name": "set record in Mixed (external, cold)",
"gasUsed": 108527
"gasUsed": 108528
},
{
"file": "test/Mixed.t.sol",
Expand All @@ -411,7 +411,7 @@
"file": "test/Mixed.t.sol",
"test": "testSetGetDeleteInternal",
"name": "set record in Mixed (internal, cold)",
"gasUsed": 103281
"gasUsed": 103282
},
{
"file": "test/Mixed.t.sol",
Expand Down Expand Up @@ -669,25 +669,25 @@
"file": "test/StoreCoreDynamic.t.sol",
"test": "testPopFromSecondField",
"name": "pop from field (cold, 1 slot, 1 uint32 item)",
"gasUsed": 18032
"gasUsed": 18041
},
{
"file": "test/StoreCoreDynamic.t.sol",
"test": "testPopFromSecondField",
"name": "pop from field (warm, 1 slot, 1 uint32 item)",
"gasUsed": 12039
"gasUsed": 12049
},
{
"file": "test/StoreCoreDynamic.t.sol",
"test": "testPopFromThirdField",
"name": "pop from field (cold, 2 slots, 10 uint32 items)",
"gasUsed": 15800
"gasUsed": 15810
},
{
"file": "test/StoreCoreDynamic.t.sol",
"test": "testPopFromThirdField",
"name": "pop from field (warm, 2 slots, 10 uint32 items)",
"gasUsed": 11807
"gasUsed": 11818
},
{
"file": "test/StoreCoreGas.t.sol",
Expand Down Expand Up @@ -719,6 +719,12 @@
"name": "delete record (complex data, 3 slots)",
"gasUsed": 8015
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testDeleteDataOffchainTable",
"name": "StoreCore: delete record in offchain table",
"gasUsed": 4687
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testGetStaticDataLocation",
Expand Down Expand Up @@ -753,19 +759,19 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testHooks",
"name": "set record on table with subscriber",
"gasUsed": 72296
"gasUsed": 72385
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testHooks",
"name": "set static field on table with subscriber",
"gasUsed": 19791
"gasUsed": 19837
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testHooks",
"name": "delete record on table with subscriber",
"gasUsed": 18617
"gasUsed": 18595
},
{
"file": "test/StoreCoreGas.t.sol",
Expand All @@ -777,37 +783,37 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testHooksDynamicData",
"name": "set (dynamic) record on table with subscriber",
"gasUsed": 165451
"gasUsed": 165525
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testHooksDynamicData",
"name": "set (dynamic) field on table with subscriber",
"gasUsed": 24469
"gasUsed": 24446
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testHooksDynamicData",
"name": "delete (dynamic) record on table with subscriber",
"gasUsed": 20283
"gasUsed": 20261
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testPushToDynamicField",
"name": "push to field (1 slot, 1 uint32 item)",
"gasUsed": 9459
"gasUsed": 9475
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testPushToDynamicField",
"name": "push to field (2 slots, 10 uint32 items)",
"gasUsed": 32129
"gasUsed": 32150
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testRegisterAndGetFieldLayout",
"name": "StoreCore: register table",
"gasUsed": 640875
"gasUsed": 640905
},
{
"file": "test/StoreCoreGas.t.sol",
Expand All @@ -831,7 +837,7 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testSetAndGetDynamicData",
"name": "set complex record with dynamic data (4 slots)",
"gasUsed": 102512
"gasUsed": 102513
},
{
"file": "test/StoreCoreGas.t.sol",
Expand Down Expand Up @@ -873,7 +879,7 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testSetAndGetField",
"name": "set static field (1 slot)",
"gasUsed": 31224
"gasUsed": 31252
},
{
"file": "test/StoreCoreGas.t.sol",
Expand All @@ -885,7 +891,7 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testSetAndGetField",
"name": "set static field (overlap 2 slot)",
"gasUsed": 29877
"gasUsed": 29908
},
{
"file": "test/StoreCoreGas.t.sol",
Expand All @@ -897,7 +903,7 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testSetAndGetField",
"name": "set dynamic field (1 slot, first dynamic field)",
"gasUsed": 53945
"gasUsed": 53961
},
{
"file": "test/StoreCoreGas.t.sol",
Expand All @@ -909,7 +915,7 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testSetAndGetField",
"name": "set dynamic field (1 slot, second dynamic field)",
"gasUsed": 32168
"gasUsed": 32186
},
{
"file": "test/StoreCoreGas.t.sol",
Expand All @@ -921,7 +927,7 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testSetAndGetStaticData",
"name": "set static record (1 slot)",
"gasUsed": 32756
"gasUsed": 32782
},
{
"file": "test/StoreCoreGas.t.sol",
Expand All @@ -933,25 +939,31 @@
"file": "test/StoreCoreGas.t.sol",
"test": "testSetAndGetStaticDataSpanningWords",
"name": "set static record (2 slots)",
"gasUsed": 55260
"gasUsed": 55289
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testSetAndGetStaticDataSpanningWords",
"name": "get static record (2 slots)",
"gasUsed": 1740
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testSetDataOffchainTable",
"name": "StoreCore: set record in offchain table",
"gasUsed": 8093
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testUpdateInDynamicField",
"name": "update in field (1 slot, 1 uint32 item)",
"gasUsed": 8807
"gasUsed": 8835
},
{
"file": "test/StoreCoreGas.t.sol",
"test": "testUpdateInDynamicField",
"name": "push to field (2 slots, 6 uint64 items)",
"gasUsed": 9253
"gasUsed": 9282
},
{
"file": "test/StoreHook.t.sol",
Expand Down Expand Up @@ -981,13 +993,13 @@
"file": "test/StoreHooks.t.sol",
"test": "testOneSlot",
"name": "StoreHooks: set field with one elements (cold)",
"gasUsed": 58262
"gasUsed": 58275
},
{
"file": "test/StoreHooks.t.sol",
"test": "testTable",
"name": "StoreHooks: set field (cold)",
"gasUsed": 58262
"gasUsed": 58275
},
{
"file": "test/StoreHooks.t.sol",
Expand All @@ -999,25 +1011,25 @@
"file": "test/StoreHooks.t.sol",
"test": "testTable",
"name": "StoreHooks: push 1 element (cold)",
"gasUsed": 12612
"gasUsed": 12626
},
{
"file": "test/StoreHooks.t.sol",
"test": "testTable",
"name": "StoreHooks: pop 1 element (warm)",
"gasUsed": 9946
"gasUsed": 9958
},
{
"file": "test/StoreHooks.t.sol",
"test": "testTable",
"name": "StoreHooks: push 1 element (warm)",
"gasUsed": 10629
"gasUsed": 10646
},
{
"file": "test/StoreHooks.t.sol",
"test": "testTable",
"name": "StoreHooks: update 1 element (warm)",
"gasUsed": 29855
"gasUsed": 29886
},
{
"file": "test/StoreHooks.t.sol",
Expand All @@ -1029,19 +1041,19 @@
"file": "test/StoreHooks.t.sol",
"test": "testTable",
"name": "StoreHooks: set field (warm)",
"gasUsed": 30407
"gasUsed": 30427
},
{
"file": "test/StoreHooks.t.sol",
"test": "testThreeSlots",
"name": "StoreHooks: set field with three elements (cold)",
"gasUsed": 80950
"gasUsed": 80966
},
{
"file": "test/StoreHooks.t.sol",
"test": "testTwoSlots",
"name": "StoreHooks: set field with two elements (cold)",
"gasUsed": 80862
"gasUsed": 80878
},
{
"file": "test/StoreHooksColdLoad.t.sol",
Expand Down Expand Up @@ -1071,13 +1083,13 @@
"file": "test/StoreHooksColdLoad.t.sol",
"test": "testPop",
"name": "StoreHooks: pop 1 element (cold)",
"gasUsed": 18381
"gasUsed": 18390
},
{
"file": "test/StoreHooksColdLoad.t.sol",
"test": "testUpdate",
"name": "StoreHooks: update 1 element (cold)",
"gasUsed": 20310
"gasUsed": 20333
},
{
"file": "test/StoreSwitch.t.sol",
Expand Down Expand Up @@ -1143,13 +1155,13 @@
"file": "test/Vector2.t.sol",
"test": "testRegisterAndGetFieldLayout",
"name": "register Vector2 field layout",
"gasUsed": 442379
"gasUsed": 442408
},
{
"file": "test/Vector2.t.sol",
"test": "testSetAndGet",
"name": "set Vector2 record",
"gasUsed": 33658
"gasUsed": 33684
},
{
"file": "test/Vector2.t.sol",
Expand Down
Loading

0 comments on commit a2e806e

Please sign in to comment.