Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(world): limit call context of CoreSystem to delegatecall [C-02] #2111

Merged
merged 5 commits into from
Jan 18, 2024

Conversation

alvrs
Copy link
Member

@alvrs alvrs commented Jan 11, 2024

No description provided.

Copy link

changeset-bot bot commented Jan 11, 2024

🦋 Changeset detected

Latest commit: 34c019c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@latticexyz/world Patch
@latticexyz/cli Patch
@latticexyz/dev-tools Patch
@latticexyz/store-sync Patch
@latticexyz/world-modules Patch
@latticexyz/store-indexer Patch
@latticexyz/abi-ts Patch
@latticexyz/block-logs-stream Patch
@latticexyz/common Patch
@latticexyz/config Patch
create-mud Patch
@latticexyz/ecs-browser Patch
@latticexyz/faucet Patch
@latticexyz/gas-report Patch
@latticexyz/network Patch
@latticexyz/noise Patch
@latticexyz/phaserx Patch
@latticexyz/protocol-parser Patch
@latticexyz/react Patch
@latticexyz/recs Patch
@latticexyz/schema-type Patch
@latticexyz/services Patch
@latticexyz/solecs Patch
solhint-config-mud Patch
solhint-plugin-mud Patch
@latticexyz/std-client Patch
@latticexyz/std-contracts Patch
@latticexyz/store-cache Patch
@latticexyz/store Patch
@latticexyz/utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@alvrs alvrs changed the base branch from main to alvrs/require-namespace-owner January 11, 2024 12:09
@alvrs alvrs changed the title fix(world): limit call context of CoreSystem to delegatecall fix(world): limit call context of CoreSystem to delegatecall [C-02] Jan 11, 2024
@alvrs alvrs force-pushed the alvrs/limit-core-system-call-context branch from 8faf955 to 123f241 Compare January 11, 2024 12:10
Depending on whether it is a root or non-root system, the call is performed via `delegatecall` or `call`.
Since Systems are expected to be stateless and only interact with the World state, it is not necessary to prevent direct calls to the systems.
However, since the `CoreSystem` is known to always be registered as a root system in the World, it is always expected to be delegatecalled,
so we made this expectation explicit by reverting if it is not delegatecalled.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your notes here are great! can we add these notes to LimitedCallContext as well, so folks know the why behind using this contract/set of modifiers?

Base automatically changed from alvrs/require-namespace-owner to main January 11, 2024 14:41
@alvrs alvrs force-pushed the alvrs/limit-core-system-call-context branch from 8b6961d to 7695ebb Compare January 11, 2024 17:10
@alvrs
Copy link
Member Author

alvrs commented Jan 11, 2024

this one brought the core module over the size limit as well, blocked on #2046

@alvrs alvrs force-pushed the alvrs/limit-core-system-call-context branch from 52808d4 to a66e583 Compare January 16, 2024 13:17
@alvrs alvrs marked this pull request as ready for review January 16, 2024 13:45
holic
holic previously approved these changes Jan 16, 2024
Copy link
Member

@holic holic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not blocking but do we have/want tests for these methods to make sure they revert?

@alvrs
Copy link
Member Author

alvrs commented Jan 18, 2024

Not blocking but do we have/want tests for these methods to make sure they revert?

Agree with this and started implementing it but it actually requires a lot of boilerplate for testing that each method reverts as expected, and I didn't find a way to test that no methods can be called directly, so i would leave this for a followup

@holic holic merged commit 08b4221 into main Jan 18, 2024
11 checks passed
@holic holic deleted the alvrs/limit-core-system-call-context branch January 18, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants