-
Notifications
You must be signed in to change notification settings - Fork 184
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] Allow choosing the class in the genesis file without affecting the actual class hash #1502
Comments
I would like to give it a try please. |
Assigned! |
@Yogalholic don't hesitate to ask question/help about the implementation |
Ok, I'm used to contribute on Madara where we use cargo to compile/test but on dojo we have to compile with scarb instead? |
Nope, it's like you're used to do with madara, to compile the project and run the tests dojo also uses cargo. # All the project
cargo build
# Running katana for instance
cargo run --bin katana
# Run the tests
cargo nextest run --all-features Scarb is used internally by Sozo, so usually you don't use scarb explicitly when working with dojo. |
Hey, @Yogalholic. Any updates on this? Let me know if there's something blocking you. |
It took me some time to get accustomed to the Dojo/Katana stack. And my server needs one hour to compile dojo, that's why Im so long. |
I see. Are you compiling the entire project? The scope of the issue doesn't expand outside of the
Yes, that would certainly be very helpful. |
I've created the draft PR here |
I've created the final PR here |
… w/o affecting the actual class hash (#1975) * resolving issue #1502 * run clippy * create custom deserializer * Fills up name_classes HashMap after hash classes computation * stuff --------- Co-authored-by: Ammar Arif <[email protected]>
resolved in #1975 |
An improvement to how one can specify a class to be used by a contract in the genesis file as suggested in #1483.
Currently, when writing the genesis file, you can specify the allocated accounts/fee token/udc to use a user-defined class instead of the default class provided by Katana. This is done by specifying exactly the class hash of the class you want to use in the
class
field of the contract entry.Example of a genesis file, where the fee token contract is set to use a custom contract class.
This method requires the user to input the exact class hash. For instance, if a class at "../path/to/class/file" computes to a hash of
0x1234
, but0xdeadbeef
is specified in the genesis file, the latter becomes the canonical class hash. So, ideally we should favour an approach that doesn't involve affecting the resultant class hash.To improve flexibility and avoid affecting the resultant class hash, a suggestion from the aforementioned PR
recommends introducing a
name
field in[GenesisClassJson](https://github.com/dojoengine/dojo/blob/042a2c0d3659d76e08091919971573805c503f70/crates/katana/primitives/src/genesis/json.rs#L40)
. This field would allow class identification by a unique name rather than by hash, specifically for lookup purposes within the classes section of the genesis file. The scope of the field should only be limited to the lookup functionality in theclasses
section of the JSON file and should not have any significant outside of that.The text was updated successfully, but these errors were encountered: