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(store): add missing FieldLayout and Schema validations [L-07] #2046

Merged
merged 28 commits into from
Jan 18, 2024
Merged

Conversation

dk1a
Copy link
Contributor

@dk1a dk1a commented Dec 8, 2023

No description provided.

Copy link

changeset-bot bot commented Dec 8, 2023

🦋 Changeset detected

Latest commit: d01ad1f

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

This PR includes changesets to release 30 packages
Name Type
@latticexyz/store Patch
@latticexyz/cli Patch
@latticexyz/dev-tools Patch
@latticexyz/react Patch
@latticexyz/store-indexer Patch
@latticexyz/store-sync Patch
@latticexyz/world-modules Patch
@latticexyz/world 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/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/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

@dk1a dk1a changed the title fix(store): add missing FieldLayout and Schema validations fix(store): add missing FieldLayout and Schema validations [L-07] Dec 8, 2023
IWorldErrors,
AccessManagementSystem,
BalanceTransferSystem,
BatchCallSystem,
ModuleInstallationSystem,
StoreRegistrationSystem,
WorldRegistrationSystem
Copy link
Member

@holic holic Jan 12, 2024

Choose a reason for hiding this comment

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

I kinda wonder if we should just go all the way and register all of these individually (and get rid of this file) rather than grouping some of them here?

target: coreSystem,
callData: abi.encodeCall(WorldRegistrationSystem.registerSystem, (CORE_SYSTEM_ID, CoreSystem(coreSystem), true))
target: coreRegistrationSystem,
callData: abi.encodeCall(WorldRegistrationSystem.registerSystem, (systemId, WorldContextConsumer(target), true))
Copy link
Member

Choose a reason for hiding this comment

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

re: above, this is the bit that confused me and makes me wonder if we should just have all the systems registered individually rather than grouping some under CoreRegistrationSystem

it was a little unclear that CoreRegistrationSystem is a WorldRegistrationSystem and we're doing a delegatecall using the WorldRegistrationSystem interface rather than CoreRegistrationSystem interface

// --- AccessManagementSystem ---
"grantAccess(bytes32,address)",
"revokeAccess(bytes32,address)",
"transferOwnership(bytes32,address)",
"transferOwnership(bytes32,address)"
Copy link
Member

@holic holic Jan 12, 2024

Choose a reason for hiding this comment

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

just thinking aloud but I wonder if it'd be worth our codegen creating a solidity file for system function signatures, so we can import from that instead of maintaining a list here

Copy link
Member

Choose a reason for hiding this comment

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

---

- Added `CoreSystem2` and moved `BalanceTransferSystem` from `CoreSystem` to `CoreSystem2`
- Added `CoreModule2`, which registers `CoreSystem2`
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs to be updated?

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.

thoughts on moving out the core module split into its own PR so we can keep the audit fix PRs scoped to just the things they fix?

@holic
Copy link
Member

holic commented Jan 16, 2024

core module split was moved to #2128

Copy link
Contributor

@yonadaa yonadaa Jan 16, 2024

Choose a reason for hiding this comment

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

There was a suggestion to simplify and split this loop into two in N-8:
7a11ba4#diff-565f54743c2cafcf49b62c6c994b044ce220955a9faa2167d9c34fbe13f02ac1

Just a heads up in case that gets merged first

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Since this is an L-rated fix, gonna suggest we merge this first and then rebase/figure out how to apply the N-08 fix after.

alvrs
alvrs previously approved these changes Jan 18, 2024
for (uint256 i; i < _numStaticFields; ) {
uint256 staticByteLength = fieldLayout.atIndex(i);
if (staticByteLength == 0) {
revert FieldLayoutLib.FieldLayoutLib_StaticLengthIsZero();
revert FieldLayoutLib.FieldLayoutLib_StaticLengthIsZero(i);
} else if (staticByteLength > WORD_SIZE) {
revert FieldLayoutLib.FieldLayoutLib_StaticLengthDoesNotFitInAWord();
Copy link
Member

Choose a reason for hiding this comment

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

should we add the index param to this error as well for consistency?

@holic holic merged commit ad4ac44 into main Jan 18, 2024
10 of 11 checks passed
@holic holic deleted the dk1a/L-07 branch January 18, 2024 11: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.

4 participants