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: install module with delegation #3586

Merged
merged 29 commits into from
Feb 11, 2025
Merged

feat: install module with delegation #3586

merged 29 commits into from
Feb 11, 2025

Conversation

holic
Copy link
Member

@holic holic commented Feb 6, 2025

fixes #3569

Copy link

changeset-bot bot commented Feb 6, 2025

🦋 Changeset detected

Latest commit: b402910

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

This PR includes changesets to release 30 packages
Name Type
@latticexyz/cli Patch
@latticexyz/world Patch
@latticexyz/world-module-metadata Patch
@latticexyz/world-module-erc20 Patch
@latticexyz/world-modules Patch
@latticexyz/dev-tools Patch
@latticexyz/entrykit Patch
@latticexyz/explorer Patch
@latticexyz/store-sync Patch
@latticexyz/world-consumer Patch
@latticexyz/world-module-callwithsignature Patch
@latticexyz/store-indexer Patch
@latticexyz/abi-ts Patch
@latticexyz/block-logs-stream Patch
@latticexyz/common Patch
@latticexyz/config Patch
create-mud Patch
@latticexyz/faucet Patch
@latticexyz/gas-report Patch
@latticexyz/paymaster Patch
@latticexyz/protocol-parser Patch
@latticexyz/react Patch
@latticexyz/recs Patch
@latticexyz/schema-type Patch
solhint-config-mud Patch
solhint-plugin-mud Patch
@latticexyz/stash Patch
@latticexyz/store Patch
@latticexyz/utils Patch
vite-plugin-mud 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

@vercel vercel bot temporarily deployed to Preview – explorer February 7, 2025 00:59 Inactive
Copy link
Member Author

Choose a reason for hiding this comment

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

so cool to see the delegation in action via these store log changes for the mock game contracts

Comment on lines -88 to +86
installAsRoot: false,
installStrategy: "delegation",
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to install the metadata module via a delegation? (Do we want to give the installer ownership over the metadata tables or keep it like anyone can install it but it's immutable after it's been installed?)

Copy link
Member Author

@holic holic Feb 11, 2025

Choose a reason for hiding this comment

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

chatted in discord:

this doesn't change the current behavior, which passed namespace ownership back to the deployer: https://github.com/latticexyz/mud/pull/3586/files#diff-4b5b7ac0dc35d7914ce67b4dfcee8d54a4814b759a87d0ddce84efe17d3ade08L55

which is ~almost always going to be the world creator, since this is a default module installed with the world deploy, and only in cases where you're deploying to an old world with a new MUD version would this be a potential issue

can separately decide what we wanna do going forward

Comment on lines 8 to +14
readonly root: boolean;
/**
* Allow the module to call systems on your behalf.
* Useful when modules need to create namespaces or
* upgrade systems in namespaces you own.
*/
readonly useDelegation: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

Do we throw an error/warning if both root and useDelegation are set to true?

Copy link
Member Author

Choose a reason for hiding this comment

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

would be nice but we have no module config validation yet, nor super strong types, so didn't feel like adding it

what happens in this case is root is picked first, then useDelegation, then regular/default path

Copy link
Member Author

Choose a reason for hiding this comment

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

these config options will ideally be abstracted away into helpers provided by the module like defineERC20Module

Copy link
Member Author

Choose a reason for hiding this comment

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

could make sense to use the same installStrategy: "root" | "delegation" | "default" approach in config but will tackle that later when we clean up module config (needs a rethink for args anyway: #2957)

@holic holic changed the title feat(cli): install module with delegation feat: install module with delegation Feb 11, 2025
@holic holic merged commit 3187081 into main Feb 11, 2025
16 checks passed
@holic holic deleted the holic/module-delegation branch February 11, 2025 11:37
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.

add option to register delegation during module install
2 participants