Skip to content

Commit 653f378

Browse files
authored
fix(world): use WorldContextConsumerLib._msgSender() instead of msg.sender (#3436)
1 parent ff8a065 commit 653f378

5 files changed

Lines changed: 16 additions & 4 deletions

File tree

.changeset/heavy-eggs-smell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@latticexyz/world": patch
3+
---
4+
5+
Use `WorldContextConsumerLib._msgSender()` instead of `msg.sender` in system libraries.

packages/world/ts/node/render-solidity/renderSystemLibrary.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ export function renderSystemLibrary(options: RenderSystemLibraryOptions) {
3737
symbol: "SystemCall",
3838
path: `${worldImportPath}/SystemCall.sol`,
3939
},
40+
{
41+
symbol: "WorldContextConsumerLib",
42+
path: `${worldImportPath}/WorldContext.sol`,
43+
},
4044
{
4145
symbol: "Systems",
4246
path: `${worldImportPath}/codegen/tables/Systems.sol`,
@@ -96,7 +100,7 @@ export function renderSystemLibrary(options: RenderSystemLibraryOptions) {
96100
}
97101
98102
function callAsRoot(${userTypeName} self) internal view returns (RootCallWrapper memory) {
99-
return RootCallWrapper(self.toResourceId(), msg.sender);
103+
return RootCallWrapper(self.toResourceId(), WorldContextConsumerLib._msgSender());
100104
}
101105
102106
function callAsRootFrom(${userTypeName} self, address from) internal pure returns (RootCallWrapper memory) {

test/system-libraries/src/namespaces/a/codegen/systems/ASystemLib.sol

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/system-libraries/src/namespaces/b/codegen/systems/BSystemLib.sol

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/system-libraries/src/namespaces/root/codegen/systems/RootSystemLib.sol

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)