Skip to content

Commit

Permalink
fix(world): module supports world context consumer id [L-12] (#2032)
Browse files Browse the repository at this point in the history
  • Loading branch information
yonadaaa committed Jan 4, 2024
1 parent c207d35 commit f6f4028
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-rats-hide.md
@@ -0,0 +1,5 @@
---
"@latticexyz/world": patch
---

Added the WorldContextConsumer interface ID to `supportsInterface` in the Module contract.
22 changes: 11 additions & 11 deletions packages/world-modules/gas-report.json
Expand Up @@ -75,13 +75,13 @@
"file": "test/KeysInTableModule.t.sol",
"test": "testInstallComposite",
"name": "install keys in table module",
"gasUsed": 1413004
"gasUsed": 1413089
},
{
"file": "test/KeysInTableModule.t.sol",
"test": "testInstallGas",
"name": "install keys in table module",
"gasUsed": 1413004
"gasUsed": 1413089
},
{
"file": "test/KeysInTableModule.t.sol",
Expand All @@ -93,13 +93,13 @@
"file": "test/KeysInTableModule.t.sol",
"test": "testInstallSingleton",
"name": "install keys in table module",
"gasUsed": 1413004
"gasUsed": 1413089
},
{
"file": "test/KeysInTableModule.t.sol",
"test": "testSetAndDeleteRecordHookCompositeGas",
"name": "install keys in table module",
"gasUsed": 1413004
"gasUsed": 1413089
},
{
"file": "test/KeysInTableModule.t.sol",
Expand All @@ -117,7 +117,7 @@
"file": "test/KeysInTableModule.t.sol",
"test": "testSetAndDeleteRecordHookGas",
"name": "install keys in table module",
"gasUsed": 1413004
"gasUsed": 1413089
},
{
"file": "test/KeysInTableModule.t.sol",
Expand All @@ -135,7 +135,7 @@
"file": "test/KeysWithValueModule.t.sol",
"test": "testGetKeysWithValueGas",
"name": "install keys with value module",
"gasUsed": 653351
"gasUsed": 653436
},
{
"file": "test/KeysWithValueModule.t.sol",
Expand All @@ -153,7 +153,7 @@
"file": "test/KeysWithValueModule.t.sol",
"test": "testInstall",
"name": "install keys with value module",
"gasUsed": 653351
"gasUsed": 653436
},
{
"file": "test/KeysWithValueModule.t.sol",
Expand All @@ -165,7 +165,7 @@
"file": "test/KeysWithValueModule.t.sol",
"test": "testSetAndDeleteRecordHook",
"name": "install keys with value module",
"gasUsed": 653351
"gasUsed": 653436
},
{
"file": "test/KeysWithValueModule.t.sol",
Expand All @@ -183,7 +183,7 @@
"file": "test/KeysWithValueModule.t.sol",
"test": "testSetField",
"name": "install keys with value module",
"gasUsed": 653351
"gasUsed": 653436
},
{
"file": "test/KeysWithValueModule.t.sol",
Expand Down Expand Up @@ -303,7 +303,7 @@
"file": "test/UniqueEntityModule.t.sol",
"test": "testInstall",
"name": "install unique entity module",
"gasUsed": 681647
"gasUsed": 681732
},
{
"file": "test/UniqueEntityModule.t.sol",
Expand All @@ -315,7 +315,7 @@
"file": "test/UniqueEntityModule.t.sol",
"test": "testInstallRoot",
"name": "installRoot unique entity module",
"gasUsed": 648044
"gasUsed": 648129
},
{
"file": "test/UniqueEntityModule.t.sol",
Expand Down
6 changes: 5 additions & 1 deletion packages/world/src/Module.sol
Expand Up @@ -2,6 +2,7 @@
pragma solidity >=0.8.21;

import { WorldContextConsumer } from "./WorldContext.sol";
import { WORLD_CONTEXT_CONSUMER_INTERFACE_ID } from "./IWorldContextConsumer.sol";
import { IModule, MODULE_INTERFACE_ID } from "./IModule.sol";
import { IERC165, ERC165_INTERFACE_ID } from "./IERC165.sol";
import { InstalledModules } from "./codegen/tables/InstalledModules.sol";
Expand All @@ -20,7 +21,10 @@ abstract contract Module is IModule, WorldContextConsumer {
function supportsInterface(
bytes4 interfaceId
) public pure virtual override(IERC165, WorldContextConsumer) returns (bool) {
return interfaceId == MODULE_INTERFACE_ID || interfaceId == ERC165_INTERFACE_ID;
return
interfaceId == MODULE_INTERFACE_ID ||
interfaceId == WORLD_CONTEXT_CONSUMER_INTERFACE_ID ||
interfaceId == ERC165_INTERFACE_ID;
}

/**
Expand Down

0 comments on commit f6f4028

Please sign in to comment.