-
Notifications
You must be signed in to change notification settings - Fork 196
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
Proposal: move namespace/name out of the Store protocol #1148
Comments
TLDR: I think it's fine to embrace namespaces in StoreCore for the benefit of World, config and client sync; and possibly even people who use pure Store, since they might want access control too As you mention, we already effectively separate tableId into namespace/name in Store's typescript, only StoreCore remains unopinionated and treats tableId as monolithic |
Thought some more about this (and discussed some more with @holic and @ludns), here is a writeup of those thoughts Current situation
Why open this box
Modular audits
How might this look like?
Conclusion
|
seems like the key idea I didn't consider, which completes the unopinionated version. This'd reconcile World and Store, and avoid needless StoreCore complexity
this'd be my main concern, dynamically registering stuff on-chain can be expensive
we lose this, though an indexed tableId can achieve the same end with a wrapper and some more filtering |
One more thought about function selectors: we currently use namespace / name to register non-root function selectors mud/packages/world/src/modules/core/implementations/WorldRegistrationSystem.sol Lines 188 to 216 in 0bb5102
If we want to stop engraining
function registerFunctionSelector(
bytes32 functionPrefixResourceSelector,
bytes32 systemResourceSelector,
string memory systemFunctionSignature
) public returns (bytes4 worldFunctionSelector) |
One more place where we currently implicitly use namespaces is for calling systems via |
Is this considered done now that #1208 has landed? |
I think so, at least on the solidity side of things |
Store currently attempts to be unopinionated about table IDs where World creates table IDs from a namespace and name, using the namespace in access control.
However, Store's config "leaks" the World's concept of namespace/name when defining tables, because it's more user-friendly to think of tables with human-readable names.
While working on new store sync code, I was finding myself carrying around the namespace/name, because that's what the Store config uses and it allows us to carry through strong types for tables. I attempted to revert back to a more "Store-pure" approach of just using table IDs everywhere, but then I had no way to carry strong types through (and converting namespace/name to table ID in pure TS sounds painful/slow).
I want to explore using namespace/name everywhere as a first-class concept, even if Store doesn't really make use of them for things like access control.
Some advantages of this approach:
The text was updated successfully, but these errors were encountered: