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

namespaced systems should default to namespace config #3228

Open
alvrs opened this issue Sep 24, 2024 · 0 comments
Open

namespaced systems should default to namespace config #3228

alvrs opened this issue Sep 24, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@alvrs
Copy link
Member

alvrs commented Sep 24, 2024

If a project is in multi-namespace mode, and has systems in a directory root, the directory name becomes the default namespace, even if the namespace is defined in the config with an explicit namespace override. I would expect the config namespace override to become the system's namespace, while the directory name is used as the namespace label (and is used to find the corresponding namespace in the config).

Example:

import { defineWorld } from "@latticexyz/world";

export default defineWorld({
  namespaces: {
    root: {
      namespace: "",
      tables: {
        Position: {
          schema: {
            user: "address",
            x: "uint256",
            y: "uint256",
          },
          key: ["user"],
        },
      },
    },
  },
});
src
└── namespaces
    └── root
        └── systems
            └── MoveSystem.sol

Results in

{
  "systems": [
    {
      "namespaceLabel": "root",
      "label": "MoveSystem",
      "namespace": "root",
      "name": "MoveSystem",
      "systemId": "0x7379726f6f740000000000000000000041646d696e53797374656d0000000000",
      "abi": [
        "function move(uint256 x, uint256 y)"
      ],
      "worldAbi": [
        "function root__move(uint256 x, uint256 y)"
      ]
    }
  ]
}

But I would expect
Results in

{
  "systems": [
    {
      "namespaceLabel": "root",
      "label": "MoveSystem",
      "namespace": "",
      "name": "MoveSystem",
      "systemId": "0x7379726f6f740000000000000000000041646d696e53797374656d0000000000",
      "abi": [
        "function move(uint256 x, uint256 y)"
      ],
      "worldAbi": [
        "function move(uint256 x, uint256 y)"
      ]
    }
  ]
}
@alvrs alvrs added the good first issue Good for newcomers label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

1 participant