Skip to content

Commit

Permalink
feat: check models and events upgradability
Browse files Browse the repository at this point in the history
  • Loading branch information
remybar committed Nov 4, 2024
1 parent 131cd89 commit 25deaa8
Show file tree
Hide file tree
Showing 39 changed files with 1,866 additions and 919 deletions.
109 changes: 22 additions & 87 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,14 @@ rpassword = "7.2.0"
rstest = "0.18.2"
rstest_reuse = "0.6.0"
salsa = "0.16.1"
#scarb = { git = "/~https://github.com/remybar/scarb", rev = "e5011654899e3f48e3503973729d7b37a28f58be" }
#scarb-ui = { git = "/~https://github.com/remybar/scarb", rev = "e5011654899e3f48e3503973729d7b37a28f58be" }
#scarb = { git = "/~https://github.com/software-mansion/scarb", tag = "v2.8.4" }
#scarb-ui = { git = "/~https://github.com/software-mansion/scarb", tag = "v2.8.4" }
scarb = { git = "/~https://github.com/dojoengine/scarb", branch = "dojo-284" }
scarb-ui = { git = "/~https://github.com/dojoengine/scarb", branch = "dojo-284" }
#scarb = { path = "/Users/glihm/swm/scarb/scarb" }
#scarb-ui = { path = "/Users/glihm/swm/scarb/utils/scarb-ui" }
#scarb = { git = "/~https://github.com/dojoengine/scarb", branch = "dojo-284" }
#scarb-ui = { git = "/~https://github.com/dojoengine/scarb", branch = "dojo-284" }
scarb = { path = "/Users/remybaranx/pro/projets/contribs/dojo/scarb/scarb" }
scarb-ui = { path = "/Users/remybaranx/pro/projets/contribs/dojo/scarb/utils/scarb-ui" }
semver = "1.0.5"
serde = { version = "1.0", features = [ "derive" ] }
serde_json = { version = "1.0", features = [ "arbitrary_precision" ] }
Expand Down
35 changes: 32 additions & 3 deletions crates/dojo/core-cairo-test/src/lib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,42 @@ mod tests {
pub(crate) mod selector_attack;
}

mod helpers;
mod helpers {
mod helpers;
pub use helpers::{
DOJO_NSH, SimpleEvent, e_SimpleEvent, Foo, m_Foo, foo_invalid_name, foo_setter,
test_contract, test_contract_with_dojo_init_args, Sword, Case, Character, Abilities,
Stats, Weapon, Ibar, bar, deploy_world, deploy_world_and_bar, deploy_world_and_foo,
drop_all_events, IFooSetter, IFooSetterDispatcher, IFooSetterDispatcherTrait
};

mod event;
pub use event::{
FooEventBadLayoutType, e_FooEventBadLayoutType, FooEventMemberRemoved,
e_FooEventMemberRemoved, FooEventMemberAddedButRemoved, e_FooEventMemberAddedButRemoved,
FooEventMemberAddedButMoved, e_FooEventMemberAddedButMoved, FooEventMemberAdded,
e_FooEventMemberAdded, deploy_world_for_event_upgrades
};

mod model;
pub use model::{
SimpleModel, m_SimpleModel, FooModelBadLayoutType, m_FooModelBadLayoutType,
FooModelMemberRemoved, m_FooModelMemberRemoved, FooModelMemberAddedButRemoved,
m_FooModelMemberAddedButRemoved, FooModelMemberAddedButMoved,
m_FooModelMemberAddedButMoved, FooModelMemberAdded, m_FooModelMemberAdded,
deploy_world_for_model_upgrades
};
}

mod world {
mod acl;
mod contract;
//mod entities;
//mod resources;
//mod world;
mod event;
mod metadata;
mod model;
mod namespace;
//mod world;
}

mod utils {
Expand Down
6 changes: 5 additions & 1 deletion crates/dojo/core-cairo-test/src/tests/contract.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub trait IQuantumLeap<T> {
#[starknet::contract]
pub mod test_contract_upgrade {
use dojo::contract::IContract;
use dojo::meta::IDeployedResource;
use dojo::world::IWorldDispatcher;
use dojo::contract::components::world_provider::IWorldProvider;

Expand All @@ -58,7 +59,10 @@ pub mod test_contract_upgrade {
}

#[abi(embed_v0)]
pub impl ContractImpl of IContract<ContractState> {
pub impl ContractImpl of IContract<ContractState> {}

#[abi(embed_v0)]
pub impl Contract_DeployedContractImpl of IDeployedResource<ContractState> {
fn dojo_name(self: @ContractState) -> ByteArray {
"test_contract"
}
Expand Down
1 change: 0 additions & 1 deletion crates/dojo/core-cairo-test/src/tests/event/event.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ fn test_event_definition() {
let definition = dojo::event::Event::<FooEvent>::definition();

assert_eq!(definition.name, dojo::event::Event::<FooEvent>::name());
assert_eq!(definition.version, dojo::event::Event::<FooEvent>::version());
assert_eq!(definition.layout, dojo::event::Event::<FooEvent>::layout());
assert_eq!(definition.schema, dojo::event::Event::<FooEvent>::schema());
}
Loading

0 comments on commit 25deaa8

Please sign in to comment.