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

feat(store,world): replace ResourceSelector with ResourceId and WorldResourceId #1544

Merged
merged 48 commits into from Sep 21, 2023

Conversation

alvrs
Copy link
Member

@alvrs alvrs commented Sep 18, 2023

fixes #1394
fixes #1367

TODO

  • Turn ResourceId into a user type - had a bunch of runtime errors where bytes14 was automatically casted into bytes32, which would have been caught at compile time if resource type was a user type

TODOs in followups

@changeset-bot
Copy link

changeset-bot bot commented Sep 18, 2023

🦋 Changeset detected

Latest commit: de9124e

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

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

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 title [WIP] feat(store,world): add ResourceType, ResourceId feat(store,world): add ResourceId and WorldResourceId Sep 19, 2023
bytes32 constant _tableId = bytes32(abi.encodePacked(bytes16(""), bytes16("Multi")));
bytes32 constant MultiTableId = _tableId;
ResourceId constant _tableId = ResourceId.wrap(
bytes32(abi.encodePacked(RESOURCE_TABLE, bytes14(""), bytes16("Multi")))
Copy link
Member

Choose a reason for hiding this comment

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

ooc is there any gas benefit to bytes.concat instead of abi.encodePacked here?

Copy link
Member Author

@alvrs alvrs Sep 21, 2023

Choose a reason for hiding this comment

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

bytes.concat is not considered a static function (so can't be used for constants), abi.encodePacked is 🤦‍♂️

Comment on lines 14 to 15
error RootInstallModeNotSupported();
error NonRootInstallNotSupported();
Copy link
Member

Choose a reason for hiding this comment

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

maybe for followup: should we make these more consistent by removing "mode" from one or adding it to the other?

Copy link
Member Author

Choose a reason for hiding this comment

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

can do that in #1126

Copy link
Member

Choose a reason for hiding this comment

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

Oh I mean "root install mode not supported" vs "non root install not supported", we call it a "mode" in one instance but not the other

but yeah, can resolve as part of naming pass in #1126

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I mean "root install mode not supported" vs "non root install not supported", we call it a "mode" in one instance but not the other

I understood, I meant we can do this renaming as part of the naming pass in 1126

holic
holic previously approved these changes Sep 21, 2023
Co-authored-by: Kevin Ingersoll <kingersoll@gmail.com>
holic
holic previously approved these changes Sep 21, 2023
@alvrs alvrs merged commit 5e723b9 into main Sep 21, 2023
10 checks passed
@alvrs alvrs deleted the alvrs/resourcetype branch September 21, 2023 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants