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

katana: specifying class using name instead of class hash #278

Closed
kariy opened this issue May 22, 2024 · 2 comments · Fixed by #279
Closed

katana: specifying class using name instead of class hash #278

kariy opened this issue May 22, 2024 · 2 comments · Fixed by #279
Assignees

Comments

@kariy
Copy link
Member

kariy commented May 22, 2024

Since dojoengine/dojo#1975, we can now specify the class hash for a contract using a user-defined name.

Prior to this change, in order for you to specify a specific class when defining a contract allocation, you have to explicitly provide a class hash to the class entry, which would later be the actual class hash of the class itself.

With the new update, instead of a class hash that would affect the resultant state, you can just give the class a name (the scope of the name is only within the JSON file, so it doesn't affect the actual genesis state) when you want to specify which class a contract should have.

To give more context:

Before

The class hash of the class will exactly be 0x10.

{
   "contracts": {
      "0x1": {
         "class": "0x10",
         ...
      }
   },
   "classes": [
      {
         "class:" "...",
         "classHash": "0x10"
      }
   ]
}

After

The class hash of the class will be computed directly from the class artifact, and the contract would still have the correct class.

{
   "contracts": {
      "0x1": {
         "class": "MyClass",
      }
   },
   "classes": [
      {
         "class:" "...",
         "name": "MyClass"
      }
   ]
}
@mimiethetechsis
Copy link
Contributor

Hello @kariy, I can do this. Can it be given to me to work on?

@kariy
Copy link
Member Author

kariy commented May 23, 2024

Hello @kariy, I can do this. Can it be given to me to work on?

assigned, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants