From 26d54da13dc79c213367c4de2914fcf9ea227d96 Mon Sep 17 00:00:00 2001 From: Fraser Scott Date: Mon, 26 Feb 2024 14:11:27 +0000 Subject: [PATCH] docs(world): add comments for prohibitDirectCallback modifier --- packages/world/src/World.sol | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/world/src/World.sol b/packages/world/src/World.sol index e6480edc1d..d14282a9fb 100644 --- a/packages/world/src/World.sol +++ b/packages/world/src/World.sol @@ -51,6 +51,9 @@ contract World is StoreData, IWorldKernel { /** * @dev Prevents the World contract from calling itself. + * The world is not able to call itself; all operations to internal tables happen as internal library calls, and all calls to root system happen as a delegatecall to the system. + * However, since this is an important invariant, we make it explicit by reverting if `msg.sender` is `address(this)` in all `World` methods. + * If it was possible to make the `World` call itself, it would be possible to access internal tables that only the `World` should have access to. */ modifier prohibitDirectCallback() { if (msg.sender == address(this)) {