-
Notifications
You must be signed in to change notification settings - Fork 210
feat: install module with delegation #3586
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
832ac42
add config
frolic 7997c41
wrap install in a delegation
frolic 087f6c3
fix types
frolic ea9add5
install metadata module with delegation
frolic 0c19288
todos
frolic 5637263
Merge remote-tracking branch 'origin/main' into holic/module-delegation
frolic a5044e6
migrate module calls to callFrom
frolic ea91731
update snapshots
frolic 748f1e7
update metadata module tests
frolic 2644311
nevermind
frolic 426d06d
update snapshots again
frolic 0648744
gas report
frolic cf53d68
rename
frolic b7ee1f7
fix conflict between IStore and IStoreRegistrationSystem
frolic 7001c51
generate world system libs
frolic 35c5ac5
calldata -> memory
frolic a681215
use system libs
frolic 64301f5
gas report
frolic f38cd84
separate configs
frolic f56fd3c
Merge remote-tracking branch 'origin/main' into holic/module-delegation
frolic 29947e2
fixes after merge
frolic f7978f7
import registration system ID from one place
frolic 293f652
update snapshots and gas reports
frolic 6a19df0
update import path
frolic 0186b23
Create dirty-pumas-dream.md
frolic 75d2ce8
Create hot-pans-love.md
frolic 9ba3d21
Create purple-houses-sell.md
frolic 447bb99
Update purple-houses-sell.md
frolic b402910
Update purple-houses-sell.md
frolic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
packages/cli/src/deploy/compat/moduleArtifactPathFromName.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Module } from "@latticexyz/world/internal"; | ||
import path from "node:path"; | ||
|
||
// Please don't add to this list! | ||
// | ||
// These are kept for backwards compatibility and assumes the downstream project has this module installed as a dependency. | ||
const knownModuleArtifacts = { | ||
KeysWithValueModule: "@latticexyz/world-modules/out/KeysWithValueModule.sol/KeysWithValueModule.json", | ||
KeysInTableModule: "@latticexyz/world-modules/out/KeysInTableModule.sol/KeysInTableModule.json", | ||
UniqueEntityModule: "@latticexyz/world-modules/out/UniqueEntityModule.sol/UniqueEntityModule.json", | ||
}; | ||
|
||
/** @internal For use with `config.modules.map(...)` */ | ||
export function moduleArtifactPathFromName( | ||
forgeOutDir: string, | ||
): (mod: Module) => Module & { readonly artifactPath: string } { | ||
return (mod) => { | ||
if (mod.artifactPath) return mod as never; | ||
if (!mod.name) throw new Error("No `artifactPath` provided for module."); | ||
|
||
const artifactPath = | ||
knownModuleArtifacts[mod.name as keyof typeof knownModuleArtifacts] ?? | ||
path.join(forgeOutDir, `${mod.name}.sol`, `${mod.name}.json`); | ||
|
||
console.warn( | ||
[ | ||
"", | ||
`⚠️ Your \`mud.config.ts\` is using a module with a \`name\`, but this option is deprecated.`, | ||
"", | ||
"To resolve this, you can replace this:", | ||
"", | ||
` name: ${JSON.stringify(mod.name)}`, | ||
"", | ||
"with this:", | ||
"", | ||
` artifactPath: ${JSON.stringify(artifactPath)}`, | ||
"", | ||
].join("\n"), | ||
); | ||
|
||
return { ...mod, artifactPath }; | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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