Models with same name are mixed up in cairo test runner
glihm opened this issue · 5 comments
Describe the bug
If a projects defines a model that has the name of a model into dojo-core
, then the cairo test runner returns erroneous class hash of the dojo-core
model, which is not even included in the tests...
Debugging this at the moment, opening this issue to track this behavior.
To Reproduce
Steps to reproduce the behavior:
- Add a model that is named
Character
to a project. - Compilation works fine and manifests are generated.
- Try to add a test, and the
dojo
namespace will be required when it shouldn't. This is because theCharacter
model of the project is actually being mapped to the class hash of thedojo-core
one.
Expected behavior
We shouldn't have this issue and we can have several models with same name, as they are isolated by the namespaces.
Additional context
We had the idea before to internalize the models, and a recent discussion on the dojo discord was also evoking this aspect of why do we need models having their own contract?
? We don't make direct use of the contracts, and we could easily have a ModelDefinition
struct being held into the world's storage. Due to the use of Span
, an easy workaround is to keep the model's definition serialized (but this adds some extra steps too).
Hello @glihm can you please assign this issue to me?
@ScottyDavies and @Code03hi happy to have your idea on how to solve that.
I'm afraid we may change the test runner, or simply internalize the models into the world contract.
ok