From 0744a91883b5a90310f2ed969cc011cf1702ca4e Mon Sep 17 00:00:00 2001 From: Steven Date: Sat, 4 May 2024 22:34:50 -0600 Subject: [PATCH 01/14] draft --- crates/sozo/ops/src/migration/migrate.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index 0bd52eeb91..c263ff2e2e 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -708,6 +708,7 @@ where if let Some(world) = &strategy.world { ui.print_header("# World"); ui.print_sub(format!("declare (class hash: {:#x})\n", world.diff.local_class_hash)); + ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); } if !&strategy.models.is_empty() { From a8e7491e4f6f5939ff7485638932bad376b66af7 Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 5 May 2024 12:24:47 -0600 Subject: [PATCH 02/14] world_addres and contract_address print --- crates/sozo/ops/src/migration/migrate.rs | 8 +++++++- crates/sozo/ops/src/migration/mod.rs | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index c263ff2e2e..75300b1213 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -694,11 +694,17 @@ where format!("deploy {}", contract.diff.name) } -pub async fn print_strategy

(ui: &Ui, provider: &P, strategy: &MigrationStrategy) +pub async fn print_strategy

(ui: &Ui, provider: &P, strategy: &MigrationStrategy, world_address: FieldElement, contract: &ContractMigration, base_class_hash: FieldElement) where P: Provider + Sync + Send + 'static, { + + let contract_address = + get_contract_address(contract.salt, base_class_hash, &[], world_address); + ui.print("\nšŸ“‹ Migration Strategy\n"); + ui.print_sub(format!("World address: {:#x})\n", world_address)); + ui.print_sub(format!("Contract address: {:#x})\n", contract_address)); if let Some(base) = &strategy.base { ui.print_header("# Base Contract"); diff --git a/crates/sozo/ops/src/migration/mod.rs b/crates/sozo/ops/src/migration/mod.rs index b5f478202d..7edaa75e87 100644 --- a/crates/sozo/ops/src/migration/mod.rs +++ b/crates/sozo/ops/src/migration/mod.rs @@ -5,6 +5,7 @@ use dojo_lang::compiler::MANIFESTS_DIR; use dojo_world::contracts::WorldContract; use dojo_world::migration::world::WorldDiff; use dojo_world::migration::{DeployOutput, TxnConfig, UpgradeOutput}; +use dojo_world::migration::contract::ContractMigration; use scarb::core::Workspace; use starknet::accounts::{ConnectedAccount, SingleOwnerAccount}; use starknet::core::types::FieldElement; @@ -52,6 +53,8 @@ pub async fn migrate( name: &str, dry_run: bool, txn_config: TxnConfig, + base_class_hash: FieldElement, + contract: &ContractMigration ) -> Result<()> where P: Provider + Sync + Send + 'static, @@ -97,7 +100,7 @@ where let world_address = strategy.world_address().expect("world address must exist"); if dry_run { - print_strategy(&ui, account.provider(), &strategy).await; + print_strategy(&ui, account.provider(), &strategy, world_address, contract, base_class_hash).await; update_manifests_and_abis( ws, From 6aa99a69e98adf7e39afadd626761630d25c3e3a Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 10 May 2024 16:45:56 -0600 Subject: [PATCH 03/14] fix --- crates/sozo/ops/src/migration/migrate.rs | 14 ++++++-------- crates/sozo/ops/src/migration/mod.rs | 5 +---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index 75300b1213..36750bd221 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -694,17 +694,14 @@ where format!("deploy {}", contract.diff.name) } -pub async fn print_strategy

(ui: &Ui, provider: &P, strategy: &MigrationStrategy, world_address: FieldElement, contract: &ContractMigration, base_class_hash: FieldElement) +pub async fn print_strategy

(ui: &Ui, provider: &P, strategy: &MigrationStrategy) where P: Provider + Sync + Send + 'static, { - - let contract_address = - get_contract_address(contract.salt, base_class_hash, &[], world_address); - ui.print("\nšŸ“‹ Migration Strategy\n"); - ui.print_sub(format!("World address: {:#x})\n", world_address)); - ui.print_sub(format!("Contract address: {:#x})\n", contract_address)); + if let Some(world) = &strategy.world { + ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); + } if let Some(base) = &strategy.base { ui.print_header("# Base Contract"); @@ -714,7 +711,6 @@ where if let Some(world) = &strategy.world { ui.print_header("# World"); ui.print_sub(format!("declare (class hash: {:#x})\n", world.diff.local_class_hash)); - ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); } if !&strategy.models.is_empty() { @@ -733,6 +729,8 @@ where for c in &strategy.contracts { let op_name = get_contract_operation_name(provider, c, strategy.world_address).await; ui.print_sub(format!("{op_name} (class hash: {:#x})", c.diff.local_class_hash)); + let contract_address = get_contract_address(c.salt, c.diff.base_class_hash, &[], c.contract_address); + ui.print_sub(format!("{op_name} (contract address: {:#x})", contract_address)); } ui.print(" "); } diff --git a/crates/sozo/ops/src/migration/mod.rs b/crates/sozo/ops/src/migration/mod.rs index 7edaa75e87..b5f478202d 100644 --- a/crates/sozo/ops/src/migration/mod.rs +++ b/crates/sozo/ops/src/migration/mod.rs @@ -5,7 +5,6 @@ use dojo_lang::compiler::MANIFESTS_DIR; use dojo_world::contracts::WorldContract; use dojo_world::migration::world::WorldDiff; use dojo_world::migration::{DeployOutput, TxnConfig, UpgradeOutput}; -use dojo_world::migration::contract::ContractMigration; use scarb::core::Workspace; use starknet::accounts::{ConnectedAccount, SingleOwnerAccount}; use starknet::core::types::FieldElement; @@ -53,8 +52,6 @@ pub async fn migrate( name: &str, dry_run: bool, txn_config: TxnConfig, - base_class_hash: FieldElement, - contract: &ContractMigration ) -> Result<()> where P: Provider + Sync + Send + 'static, @@ -100,7 +97,7 @@ where let world_address = strategy.world_address().expect("world address must exist"); if dry_run { - print_strategy(&ui, account.provider(), &strategy, world_address, contract, base_class_hash).await; + print_strategy(&ui, account.provider(), &strategy).await; update_manifests_and_abis( ws, From 54590308049b30b7dbfeed7ca80a18ff07780670 Mon Sep 17 00:00:00 2001 From: stevencartavia Date: Thu, 16 May 2024 16:02:27 -0600 Subject: [PATCH 04/14] s --- Cargo.lock | 178 +++++++++--------- crates/dojo-lang/src/plugin.rs | 12 +- crates/dojo-world/src/metadata_test.rs | 25 ++- crates/katana/core/src/sequencer.rs | 11 +- .../src/implementation/blockifier/state.rs | 6 +- crates/katana/executor/tests/executor.rs | 6 +- crates/katana/primitives/src/genesis/json.rs | 10 +- crates/katana/rpc/rpc-api/src/torii.rs | 2 +- crates/katana/runner/runner-macro/src/lib.rs | 6 +- crates/katana/runner/src/lib.rs | 6 +- crates/katana/storage/db/src/mdbx/cursor.rs | 6 +- .../provider/src/providers/db/state.rs | 6 +- .../storage/provider/src/traits/contract.rs | 2 +- .../storage/provider/src/traits/state.rs | 2 +- crates/sozo/ops/src/migration/migrate.rs | 7 +- crates/sozo/ops/src/tests/call.rs | 114 ++++++----- crates/sozo/ops/src/tests/migration.rs | 18 +- crates/torii/client/src/client/storage.rs | 8 +- .../torii/client/src/client/subscription.rs | 6 +- crates/torii/graphql/src/object/entity.rs | 12 +- crates/torii/graphql/src/object/event.rs | 12 +- .../torii/graphql/src/object/event_message.rs | 54 +++--- crates/torii/graphql/src/object/model.rs | 12 +- crates/torii/libp2p/src/typed_data.rs | 6 +- 24 files changed, 279 insertions(+), 248 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c082a928a7..99c94fa6fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -149,9 +149,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dffe3984d3ca3a2319eb4472eca0e09df9d251ad2487af6c0c08d8d20e65e89" +checksum = "8425a283510106b1a6ad25dd4bb648ecde7da3fd2baeb9400a85ad62f51ec90b" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -191,9 +191,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eca3f5e6068d2c7d33cde559b6bd4aaa3254e5ecc9b6dd6ad1e65e8a201fc46" +checksum = "7e30946aa6173020259055a44971f5cf40a7d76c931d209caeb51b333263df4f" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c466f488c032bac81e925fcd9f22bc0a50ae7a71f3ba27cfc2911b8a47c1938" +checksum = "db8aa973e647ec336810a9356af8aea787249c9d00b1525359f3db29a68d231b" dependencies = [ "alloy-rlp", "bytes", @@ -300,7 +300,7 @@ checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -393,23 +393,23 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86c9b8062b642b96e73bfa60fede65c89bc09e7e05e8ba2ac8b333978b28d7a" +checksum = "7dbd17d67f3e89478c8a634416358e539e577899666c927bc3d2b1328ee9b6ca" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00385c3d833fb56adf9e4af209c9d32267c01f0efd04ba5d40811822fac7e3e4" +checksum = "2c6da95adcf4760bb4b108fefa51d50096c5e5fdd29ee72fed3e86ee414f2e34" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -419,16 +419,16 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "867a7ca511817f8b86f347f63367e6423a764096e205352578e551d474650db4" +checksum = "32c8da04c1343871fb6ce5a489218f9c85323c8340a36e9106b5fc98d4dd59d5" dependencies = [ "alloy-json-abi", "const-hex", @@ -437,24 +437,24 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.61", + "syn 2.0.64", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "641c79d46584814fb3d0a2bcbf0296f2d3b9b82f4a84eba298ce448aaebb4523" +checksum = "368cae4dc052cad1d8f72eb2ae0c38027116933eeb49213c200a9e9875f208d7" dependencies = [ "winnow 0.6.1", ] [[package]] name = "alloy-sol-types" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9da874df320c90c0f33567a90a74ba1f988e135e7d199fe68e6977cba9e0142e" +checksum = "40a64d2d2395c1ac636b62419a7b17ec39031d6b2367e66e9acbf566e6055e9c" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -967,7 +967,7 @@ dependencies = [ "proc-macro2", "quote", "strum 0.25.0", - "syn 2.0.61", + "syn 2.0.64", "thiserror", ] @@ -1074,7 +1074,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -1122,7 +1122,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -1139,7 +1139,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -1199,7 +1199,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -1404,7 +1404,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -1756,7 +1756,7 @@ dependencies = [ "quote", "serde_json", "starknet", - "syn 2.0.61", + "syn 2.0.64", "thiserror", ] @@ -1774,7 +1774,7 @@ dependencies = [ "quote", "serde_json", "starknet", - "syn 2.0.61", + "syn 2.0.64", "thiserror", ] @@ -1791,7 +1791,7 @@ dependencies = [ "quote", "serde_json", "starknet", - "syn 2.0.61", + "syn 2.0.64", "thiserror", ] @@ -1999,7 +1999,7 @@ source = "git+https://github.com/software-mansion/scarb?tag=v2.6.4#c4c7c0bac3a30 dependencies = [ "quote", "scarb-stable-hash", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -2054,7 +2054,7 @@ checksum = "67f9da66325ce7ed6c002360f26106fe79deb9f8a2fca30abdbb8d388da7bb46" dependencies = [ "cairo-lang-debug", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -2794,7 +2794,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3235,7 +3235,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3296,7 +3296,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3318,7 +3318,7 @@ checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be" dependencies = [ "darling_core 0.20.6", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3449,7 +3449,7 @@ dependencies = [ "darling 0.20.6", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3459,7 +3459,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" dependencies = [ "derive_builder_core", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3596,7 +3596,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3977,7 +3977,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -3989,7 +3989,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -4455,7 +4455,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -4544,7 +4544,7 @@ checksum = "d4cf186fea4af17825116f72932fe52cce9a13bae39ff63b4dc0cfdb3fb4bde1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -4977,7 +4977,7 @@ checksum = "d75e7ab728059f595f6ddc1ad8771b8d6a231971ae493d9d5948ecad366ee8bb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -6838,7 +6838,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -7652,7 +7652,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -7845,7 +7845,7 @@ checksum = "adf157a4dc5a29b7b464aa8fe7edeff30076e07e13646a1c3874f58477dc99f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -8038,7 +8038,7 @@ checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -8728,7 +8728,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -9004,7 +9004,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -9058,7 +9058,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -9102,7 +9102,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -9353,7 +9353,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -9488,7 +9488,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -9570,7 +9570,7 @@ dependencies = [ "prost 0.12.3", "prost-types 0.12.3", "regex", - "syn 2.0.61", + "syn 2.0.64", "tempfile", "which 4.4.2", ] @@ -9598,7 +9598,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -10078,7 +10078,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -10242,7 +10242,7 @@ dependencies = [ "regex", "relative-path", "rustc_version 0.4.0", - "syn 2.0.61", + "syn 2.0.64", "unicode-ident", ] @@ -10255,7 +10255,7 @@ dependencies = [ "quote", "rand", "rustc_version 0.4.0", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -10342,7 +10342,7 @@ name = "runner-macro" version = "0.7.0-alpha.2" dependencies = [ "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -10488,9 +10488,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" [[package]] name = "rustls-webpki" @@ -10988,9 +10988,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.201" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] @@ -11026,13 +11026,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.201" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -11076,7 +11076,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -11125,7 +11125,7 @@ dependencies = [ "darling 0.20.6", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -11160,7 +11160,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -11918,7 +11918,7 @@ checksum = "bbc159a1934c7be9761c237333a57febe060ace2bc9e3b337a59a37af206d19f" dependencies = [ "starknet-curve 0.4.2", "starknet-ff", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -11961,7 +11961,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95d549d3078bdbe775d0deaa8ddb57a19942989ce7c1f2dfd60beeb322bb4945" dependencies = [ "starknet-core", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -12121,7 +12121,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -12209,9 +12209,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.61" +version = "2.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f" dependencies = [ "proc-macro2", "quote", @@ -12220,14 +12220,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049973c5d349854d03a194f0c0c554d1cddd9a6ae30018f08c88a77851fdd33e" +checksum = "b8db114c44cf843a8bacd37a146e37987a0b823a0e8bc4fdc610c9c72ab397a5" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -12342,7 +12342,7 @@ checksum = "7ba277e77219e9eea169e8508942db1bf5d8a41ff2db9b20aab5a5aadc9fa25d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -12362,7 +12362,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -12508,7 +12508,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -12708,7 +12708,7 @@ dependencies = [ "proc-macro2", "prost-build 0.12.3", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -13126,7 +13126,7 @@ checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -13155,7 +13155,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -13293,7 +13293,7 @@ checksum = "563b3b88238ec95680aef36bdece66896eaa7ce3c0f1b4f39d38fb2435261352" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -13622,7 +13622,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", "wasm-bindgen-shared", ] @@ -13656,7 +13656,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -13689,7 +13689,7 @@ checksum = "a5211b7550606857312bba1d978a8ec75692eae187becc5e680444fffc5e6f89" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -14482,7 +14482,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] @@ -14502,7 +14502,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.64", ] [[package]] diff --git a/crates/dojo-lang/src/plugin.rs b/crates/dojo-lang/src/plugin.rs index 9341807f78..af884f2a37 100644 --- a/crates/dojo-lang/src/plugin.rs +++ b/crates/dojo-lang/src/plugin.rs @@ -70,7 +70,11 @@ impl GeneratedFileAuxData for DojoAuxData { self } fn eq(&self, other: &dyn GeneratedFileAuxData) -> bool { - if let Some(other) = other.as_any().downcast_ref::() { self == other } else { false } + if let Some(other) = other.as_any().downcast_ref::() { + self == other + } else { + false + } } } @@ -88,7 +92,11 @@ impl GeneratedFileAuxData for ComputedValuesAuxData { self } fn eq(&self, other: &dyn GeneratedFileAuxData) -> bool { - if let Some(other) = other.as_any().downcast_ref::() { self == other } else { false } + if let Some(other) = other.as_any().downcast_ref::() { + self == other + } else { + false + } } } diff --git a/crates/dojo-world/src/metadata_test.rs b/crates/dojo-world/src/metadata_test.rs index ec48befb6f..6f34df68b6 100644 --- a/crates/dojo-world/src/metadata_test.rs +++ b/crates/dojo-world/src/metadata_test.rs @@ -132,23 +132,22 @@ async fn get_full_dojo_metadata_from_workspace() { assert!(env.rpc_url.unwrap().eq("http://localhost:5050/")); assert!(env.account_address.is_some()); - assert!( - env.account_address - .unwrap() - .eq("0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03") - ); + assert!(env + .account_address + .unwrap() + .eq("0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03")); assert!(env.private_key.is_some()); - assert!( - env.private_key.unwrap().eq("0x1800000000300000180000000000030000000000003006001800006600") - ); + assert!(env + .private_key + .unwrap() + .eq("0x1800000000300000180000000000030000000000003006001800006600")); assert!(env.world_address.is_some()); - assert!( - env.world_address - .unwrap() - .eq("0x3898144a24151443f0c6501a1de46a6e9e27abd9fb5d08cdeeff5a5127d1d25") - ); + assert!(env + .world_address + .unwrap() + .eq("0x3898144a24151443f0c6501a1de46a6e9e27abd9fb5d08cdeeff5a5127d1d25")); assert!(env.keystore_path.is_none()); assert!(env.keystore_password.is_none()); diff --git a/crates/katana/core/src/sequencer.rs b/crates/katana/core/src/sequencer.rs index 0a0db8678d..3dfdea5568 100644 --- a/crates/katana/core/src/sequencer.rs +++ b/crates/katana/core/src/sequencer.rs @@ -286,10 +286,13 @@ impl KatanaSequencer { let tx @ Some(_) = tx else { return Ok(self.pending_executor().as_ref().and_then(|exec| { - exec.read() - .transactions() - .iter() - .find_map(|tx| if tx.0.hash == *hash { Some(tx.0.clone()) } else { None }) + exec.read().transactions().iter().find_map(|tx| { + if tx.0.hash == *hash { + Some(tx.0.clone()) + } else { + None + } + }) })); }; diff --git a/crates/katana/executor/src/implementation/blockifier/state.rs b/crates/katana/executor/src/implementation/blockifier/state.rs index c6d7f27572..cbe21e1e45 100644 --- a/crates/katana/executor/src/implementation/blockifier/state.rs +++ b/crates/katana/executor/src/implementation/blockifier/state.rs @@ -171,7 +171,11 @@ impl StateProvider for CachedState { }; let hash = hash.0.into(); - if hash == FieldElement::ZERO { Ok(None) } else { Ok(Some(hash)) } + if hash == FieldElement::ZERO { + Ok(None) + } else { + Ok(Some(hash)) + } } fn nonce( diff --git a/crates/katana/executor/tests/executor.rs b/crates/katana/executor/tests/executor.rs index 1573174fc7..676c65acde 100644 --- a/crates/katana/executor/tests/executor.rs +++ b/crates/katana/executor/tests/executor.rs @@ -55,7 +55,11 @@ fn test_executor_with_valid_blocks_impl( // ensure that all transactions succeeded, if not panic with the error message and tx index let has_failed = transactions.iter().enumerate().find_map(|(i, (_, res))| { - if let ExecutionResult::Failed { error } = res { Some((i, error)) } else { None } + if let ExecutionResult::Failed { error } = res { + Some((i, error)) + } else { + None + } }); if let Some((pos, error)) = has_failed { diff --git a/crates/katana/primitives/src/genesis/json.rs b/crates/katana/primitives/src/genesis/json.rs index 102020e7c9..5a65d9059a 100644 --- a/crates/katana/primitives/src/genesis/json.rs +++ b/crates/katana/primitives/src/genesis/json.rs @@ -1071,12 +1071,10 @@ mod tests { fn genesis_from_json_with_unresolved_paths() { let file = File::open("./src/genesis/test-genesis.json").unwrap(); let json: GenesisJson = serde_json::from_reader(file).unwrap(); - assert!( - Genesis::try_from(json) - .unwrap_err() - .to_string() - .contains("Unresolved class artifact path") - ); + assert!(Genesis::try_from(json) + .unwrap_err() + .to_string() + .contains("Unresolved class artifact path")); } #[test] diff --git a/crates/katana/rpc/rpc-api/src/torii.rs b/crates/katana/rpc/rpc-api/src/torii.rs index 272497041a..3308806004 100644 --- a/crates/katana/rpc/rpc-api/src/torii.rs +++ b/crates/katana/rpc/rpc-api/src/torii.rs @@ -7,5 +7,5 @@ use katana_rpc_types::transaction::{TransactionsPage, TransactionsPageCursor}; pub trait ToriiApi { #[method(name = "getTransactions")] async fn get_transactions(&self, cursor: TransactionsPageCursor) - -> RpcResult; + -> RpcResult; } diff --git a/crates/katana/runner/runner-macro/src/lib.rs b/crates/katana/runner/runner-macro/src/lib.rs index 77867a284f..8cb426c16e 100644 --- a/crates/katana/runner/runner-macro/src/lib.rs +++ b/crates/katana/runner/runner-macro/src/lib.rs @@ -28,7 +28,11 @@ fn parse_metadata(metadata: String) -> (u16, Option, Option) { // if set to `true`, we use a default block time. let block_time = if args.len() >= 2 { if let Ok(b) = args[1].trim().parse::() { - if !b { None } else { Some(DEFAULT_BLOCK_TIME) } + if !b { + None + } else { + Some(DEFAULT_BLOCK_TIME) + } } else if let Ok(block_time_ms) = args[1].trim().parse::() { Some(block_time_ms) } else { diff --git a/crates/katana/runner/src/lib.rs b/crates/katana/runner/src/lib.rs index 13a19fe771..adf9051ad2 100644 --- a/crates/katana/runner/src/lib.rs +++ b/crates/katana/runner/src/lib.rs @@ -185,7 +185,11 @@ impl Drop for KatanaRunner { /// Determines the default program path for the katana runner based on the KATANA_RUNNER_BIN /// environment variable. If not set, try to to use katana from the PATH. fn determine_default_program_path() -> String { - if let Ok(bin) = std::env::var("KATANA_RUNNER_BIN") { bin } else { "katana".to_string() } + if let Ok(bin) = std::env::var("KATANA_RUNNER_BIN") { + bin + } else { + "katana".to_string() + } } #[cfg(test)] diff --git a/crates/katana/storage/db/src/mdbx/cursor.rs b/crates/katana/storage/db/src/mdbx/cursor.rs index 9cac3876e3..e08ca8499a 100644 --- a/crates/katana/storage/db/src/mdbx/cursor.rs +++ b/crates/katana/storage/db/src/mdbx/cursor.rs @@ -304,7 +304,11 @@ impl Walker<'_, RW, T> { impl std::iter::Iterator for Walker<'_, K, T> { type Item = Result, DatabaseError>; fn next(&mut self) -> Option { - if let value @ Some(_) = self.start.take() { value } else { self.cursor.next().transpose() } + if let value @ Some(_) = self.start.take() { + value + } else { + self.cursor.next().transpose() + } } } diff --git a/crates/katana/storage/provider/src/providers/db/state.rs b/crates/katana/storage/provider/src/providers/db/state.rs index bb8f070646..286b16920d 100644 --- a/crates/katana/storage/provider/src/providers/db/state.rs +++ b/crates/katana/storage/provider/src/providers/db/state.rs @@ -292,7 +292,11 @@ fn recent_change_from_block( // 1. the list is empty // 2. there are no prior changes occured before/at `block_number` let rank = block_list.rank(block_number); - if rank == 0 { None } else { block_list.select(rank - 1) } + if rank == 0 { + None + } else { + block_list.select(rank - 1) + } } #[cfg(test)] diff --git a/crates/katana/storage/provider/src/traits/contract.rs b/crates/katana/storage/provider/src/traits/contract.rs index 8ad2d5c700..5a2d6fbcd8 100644 --- a/crates/katana/storage/provider/src/traits/contract.rs +++ b/crates/katana/storage/provider/src/traits/contract.rs @@ -33,5 +33,5 @@ pub trait ContractClassWriter: Send + Sync { /// Retrieves the Sierra class definition of a contract class given its class hash. fn set_sierra_class(&self, hash: ClassHash, sierra: FlattenedSierraClass) - -> ProviderResult<()>; + -> ProviderResult<()>; } diff --git a/crates/katana/storage/provider/src/traits/state.rs b/crates/katana/storage/provider/src/traits/state.rs index 3ec9aade09..c18d4f72d1 100644 --- a/crates/katana/storage/provider/src/traits/state.rs +++ b/crates/katana/storage/provider/src/traits/state.rs @@ -26,7 +26,7 @@ pub trait StateProvider: ContractClassProvider + Send + Sync { /// Returns the class hash of a contract. fn class_hash_of_contract(&self, address: ContractAddress) - -> ProviderResult>; + -> ProviderResult>; } /// A type which can create [`StateProvider`] for states at a particular block. diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index 36750bd221..e302131b9d 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -699,9 +699,6 @@ where P: Provider + Sync + Send + 'static, { ui.print("\nšŸ“‹ Migration Strategy\n"); - if let Some(world) = &strategy.world { - ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); - } if let Some(base) = &strategy.base { ui.print_header("# Base Contract"); @@ -711,6 +708,7 @@ where if let Some(world) = &strategy.world { ui.print_header("# World"); ui.print_sub(format!("declare (class hash: {:#x})\n", world.diff.local_class_hash)); + ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); } if !&strategy.models.is_empty() { @@ -729,7 +727,8 @@ where for c in &strategy.contracts { let op_name = get_contract_operation_name(provider, c, strategy.world_address).await; ui.print_sub(format!("{op_name} (class hash: {:#x})", c.diff.local_class_hash)); - let contract_address = get_contract_address(c.salt, c.diff.base_class_hash, &[], c.contract_address); + let contract_address = + get_contract_address(c.salt, c.diff.base_class_hash, &[], c.contract_address); ui.print_sub(format!("{op_name} (contract address: {:#x})", contract_address)); } ui.print(" "); diff --git a/crates/sozo/ops/src/tests/call.rs b/crates/sozo/ops/src/tests/call.rs index 84d6c4f5bc..f93b498fd3 100644 --- a/crates/sozo/ops/src/tests/call.rs +++ b/crates/sozo/ops/src/tests/call.rs @@ -20,17 +20,15 @@ async fn call_with_bad_address() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!( - call::call( - world_reader, - "0xBadCoffeeBadCode".to_string(), - ENTRYPOINT.to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None - ) - .await - .is_err() - ); + assert!(call::call( + world_reader, + "0xBadCoffeeBadCode".to_string(), + ENTRYPOINT.to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None + ) + .await + .is_err()); } #[tokio::test] @@ -41,17 +39,15 @@ async fn call_with_bad_name() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!( - call::call( - world_reader, - "BadName".to_string(), - ENTRYPOINT.to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None - ) - .await - .is_err() - ); + assert!(call::call( + world_reader, + "BadName".to_string(), + ENTRYPOINT.to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None + ) + .await + .is_err()); } #[tokio::test] @@ -62,17 +58,15 @@ async fn call_with_bad_entrypoint() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!( - call::call( - world_reader, - CONTRACT_NAME.to_string(), - "BadEntryPoint".to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None - ) - .await - .is_err() - ); + assert!(call::call( + world_reader, + CONTRACT_NAME.to_string(), + "BadEntryPoint".to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None + ) + .await + .is_err()); } #[tokio::test] @@ -83,11 +77,15 @@ async fn call_with_bad_calldata() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!( - call::call(world_reader, CONTRACT_NAME.to_string(), ENTRYPOINT.to_string(), vec![], None) - .await - .is_err() - ); + assert!(call::call( + world_reader, + CONTRACT_NAME.to_string(), + ENTRYPOINT.to_string(), + vec![], + None + ) + .await + .is_err()); } #[tokio::test] @@ -98,17 +96,15 @@ async fn call_with_contract_name() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!( - call::call( - world_reader, - CONTRACT_NAME.to_string(), - ENTRYPOINT.to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None, - ) - .await - .is_ok() - ); + assert!(call::call( + world_reader, + CONTRACT_NAME.to_string(), + ENTRYPOINT.to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None, + ) + .await + .is_ok()); } #[tokio::test] @@ -125,15 +121,13 @@ async fn call_with_contract_address() { .await .unwrap(); - assert!( - call::call( - world_reader, - format!("{:#x}", contract_address), - ENTRYPOINT.to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None, - ) - .await - .is_ok() - ); + assert!(call::call( + world_reader, + format!("{:#x}", contract_address), + ENTRYPOINT.to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None, + ) + .await + .is_ok()); } diff --git a/crates/sozo/ops/src/tests/migration.rs b/crates/sozo/ops/src/tests/migration.rs index 06903c5f37..84c45e90ba 100644 --- a/crates/sozo/ops/src/tests/migration.rs +++ b/crates/sozo/ops/src/tests/migration.rs @@ -81,16 +81,14 @@ async fn migrate_with_small_fee_multiplier_will_fail() { let account = sequencer.account(0); - assert!( - execute_strategy( - &ws, - &migration, - &account, - TxnConfig { fee_estimate_multiplier: Some(0.2f64), ..Default::default() }, - ) - .await - .is_err() - ); + assert!(execute_strategy( + &ws, + &migration, + &account, + TxnConfig { fee_estimate_multiplier: Some(0.2f64), ..Default::default() }, + ) + .await + .is_err()); } #[tokio::test] diff --git a/crates/torii/client/src/client/storage.rs b/crates/torii/client/src/client/storage.rs index 48541a2314..caa00dee5c 100644 --- a/crates/torii/client/src/client/storage.rs +++ b/crates/torii/client/src/client/storage.rs @@ -264,10 +264,8 @@ mod tests { ); assert!(actual_values == expected_values); assert!(storage.storage.read().len() == model.packed_size as usize); - assert!( - actual_storage_addresses - .into_iter() - .all(|address| expected_storage_addresses.contains(&address)) - ); + assert!(actual_storage_addresses + .into_iter() + .all(|address| expected_storage_addresses.contains(&address))); } } diff --git a/crates/torii/client/src/client/subscription.rs b/crates/torii/client/src/client/subscription.rs index ac21707104..b167e6a614 100644 --- a/crates/torii/client/src/client/subscription.rs +++ b/crates/torii/client/src/client/subscription.rs @@ -192,7 +192,11 @@ impl SubscriptionService { let storage_entries = diff.storage_diffs.into_iter().find_map(|d| { let expected = self.world_metadata.read().world_address; let current = d.address; - if current == expected { Some(d.storage_entries) } else { None } + if current == expected { + Some(d.storage_entries) + } else { + None + } }); let Some(entries) = storage_entries else { diff --git a/crates/torii/graphql/src/object/entity.rs b/crates/torii/graphql/src/object/entity.rs index dd73c9c6fd..209fd28141 100644 --- a/crates/torii/graphql/src/object/entity.rs +++ b/crates/torii/graphql/src/object/entity.rs @@ -63,8 +63,10 @@ impl ResolvableObject for EntityObject { } fn subscriptions(&self) -> Option> { - Some(vec![ - SubscriptionField::new("entityUpdated", TypeRef::named_nn(self.type_name()), |ctx| { + Some(vec![SubscriptionField::new( + "entityUpdated", + TypeRef::named_nn(self.type_name()), + |ctx| { SubscriptionFieldFuture::new(async move { let id = match ctx.args.get("id") { Some(id) => Some(id.string()?.to_string()), @@ -81,9 +83,9 @@ impl ResolvableObject for EntityObject { } })) }) - }) - .argument(InputValue::new("id", TypeRef::named(TypeRef::ID))), - ]) + }, + ) + .argument(InputValue::new("id", TypeRef::named(TypeRef::ID)))]) } } diff --git a/crates/torii/graphql/src/object/event.rs b/crates/torii/graphql/src/object/event.rs index f0063f76c1..975d98afe9 100644 --- a/crates/torii/graphql/src/object/event.rs +++ b/crates/torii/graphql/src/object/event.rs @@ -44,15 +44,17 @@ impl ResolvableObject for EventObject { } fn subscriptions(&self) -> Option> { - Some(vec![ - SubscriptionField::new("eventEmitted", TypeRef::named_nn(self.type_name()), |ctx| { + Some(vec![SubscriptionField::new( + "eventEmitted", + TypeRef::named_nn(self.type_name()), + |ctx| { SubscriptionFieldFuture::new(async move { let input_keys = parse_keys_argument(&ctx)?; Ok(EventObject::subscription_stream(input_keys)) }) - }) - .argument(InputValue::new("keys", TypeRef::named_list(TypeRef::STRING))), - ]) + }, + ) + .argument(InputValue::new("keys", TypeRef::named_list(TypeRef::STRING)))]) } } diff --git a/crates/torii/graphql/src/object/event_message.rs b/crates/torii/graphql/src/object/event_message.rs index 007573b3ca..11da937cfb 100644 --- a/crates/torii/graphql/src/object/event_message.rs +++ b/crates/torii/graphql/src/object/event_message.rs @@ -63,35 +63,31 @@ impl ResolvableObject for EventMessageObject { } fn subscriptions(&self) -> Option> { - Some(vec![ - SubscriptionField::new( - "eventMessageUpdated", - TypeRef::named_nn(self.type_name()), - |ctx| { - SubscriptionFieldFuture::new(async move { - let id = match ctx.args.get("id") { - Some(id) => Some(id.string()?.to_string()), - None => None, - }; - // if id is None, then subscribe to all entities - // if id is Some, then subscribe to only the entity with that id - Ok(SimpleBroker::::subscribe().filter_map( - move |entity: EventMessage| { - if id.is_none() || id == Some(entity.id.clone()) { - Some(Ok(Value::Object(EventMessageObject::value_mapping( - entity, - )))) - } else { - // id != entity.id , then don't send anything, still listening - None - } - }, - )) - }) - }, - ) - .argument(InputValue::new("id", TypeRef::named(TypeRef::ID))), - ]) + Some(vec![SubscriptionField::new( + "eventMessageUpdated", + TypeRef::named_nn(self.type_name()), + |ctx| { + SubscriptionFieldFuture::new(async move { + let id = match ctx.args.get("id") { + Some(id) => Some(id.string()?.to_string()), + None => None, + }; + // if id is None, then subscribe to all entities + // if id is Some, then subscribe to only the entity with that id + Ok(SimpleBroker::::subscribe().filter_map( + move |entity: EventMessage| { + if id.is_none() || id == Some(entity.id.clone()) { + Some(Ok(Value::Object(EventMessageObject::value_mapping(entity)))) + } else { + // id != entity.id , then don't send anything, still listening + None + } + }, + )) + }) + }, + ) + .argument(InputValue::new("id", TypeRef::named(TypeRef::ID)))]) } } diff --git a/crates/torii/graphql/src/object/model.rs b/crates/torii/graphql/src/object/model.rs index a9ecb13607..4b326b0207 100644 --- a/crates/torii/graphql/src/object/model.rs +++ b/crates/torii/graphql/src/object/model.rs @@ -74,8 +74,10 @@ impl ResolvableObject for ModelObject { } fn subscriptions(&self) -> Option> { - Some(vec![ - SubscriptionField::new("modelRegistered", TypeRef::named_nn(self.type_name()), |ctx| { + Some(vec![SubscriptionField::new( + "modelRegistered", + TypeRef::named_nn(self.type_name()), + |ctx| { { SubscriptionFieldFuture::new(async move { let id = match ctx.args.get("id") { @@ -94,9 +96,9 @@ impl ResolvableObject for ModelObject { })) }) } - }) - .argument(InputValue::new("id", TypeRef::named(TypeRef::ID))), - ]) + }, + ) + .argument(InputValue::new("id", TypeRef::named(TypeRef::ID)))]) } } diff --git a/crates/torii/libp2p/src/typed_data.rs b/crates/torii/libp2p/src/typed_data.rs index dc752f751b..e018184814 100644 --- a/crates/torii/libp2p/src/typed_data.rs +++ b/crates/torii/libp2p/src/typed_data.rs @@ -149,7 +149,11 @@ pub fn encode_type(name: &str, types: &IndexMap>) -> Result>() .join(","); From 8246919d66863d292d4aa077f51e9dcc8826752a Mon Sep 17 00:00:00 2001 From: stevencartavia Date: Thu, 16 May 2024 21:09:50 -0600 Subject: [PATCH 05/14] fix --- crates/sozo/ops/src/migration/migrate.rs | 17 ++++++++++------- rust_fmt.sh | 6 ++++++ 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 rust_fmt.sh diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index e302131b9d..f57378d993 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -714,10 +714,16 @@ where if !&strategy.models.is_empty() { ui.print_header(format!("# Models ({})", &strategy.models.len())); for m in &strategy.models { - ui.print_sub(format!( - "register {} (class hash: {:#x})", - m.diff.name, m.diff.local_class_hash - )); + ui.print_sub(format!("{}", m.diff.name)); + ui.print_sub(format!("(class hash: {:#x})", m.diff.local_class_hash)); + let salt = generate_salt(&m.diff.name); + let contract_address = get_contract_address( + salt, + m.diff.local_class_hash, + &[], + strategy.world_address.unwrap(), + ); + ui.print_sub(format!("(contract address: {:#x})", contract_address)); } ui.print(" "); } @@ -727,9 +733,6 @@ where for c in &strategy.contracts { let op_name = get_contract_operation_name(provider, c, strategy.world_address).await; ui.print_sub(format!("{op_name} (class hash: {:#x})", c.diff.local_class_hash)); - let contract_address = - get_contract_address(c.salt, c.diff.base_class_hash, &[], c.contract_address); - ui.print_sub(format!("{op_name} (contract address: {:#x})", contract_address)); } ui.print(" "); } diff --git a/rust_fmt.sh b/rust_fmt.sh new file mode 100644 index 0000000000..6ec06c63b6 --- /dev/null +++ b/rust_fmt.sh @@ -0,0 +1,6 @@ +Script started on Thu May 16 18:05:45 2024 +Command: local +script: local: No such file or directory + +Command exit status: 1 +Script done on Thu May 16 18:05:45 2024 From 2a8fd7581cfc4b926e4f72f32e7801456c94750e Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 5 May 2024 12:24:47 -0600 Subject: [PATCH 06/14] world_addres and contract_address print --- crates/sozo/ops/src/migration/migrate.rs | 8 +++++++- crates/sozo/ops/src/migration/mod.rs | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index f57378d993..5a75bc691e 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -694,11 +694,17 @@ where format!("deploy {}", contract.diff.name) } -pub async fn print_strategy

(ui: &Ui, provider: &P, strategy: &MigrationStrategy) +pub async fn print_strategy

(ui: &Ui, provider: &P, strategy: &MigrationStrategy, world_address: FieldElement, contract: &ContractMigration, base_class_hash: FieldElement) where P: Provider + Sync + Send + 'static, { + + let contract_address = + get_contract_address(contract.salt, base_class_hash, &[], world_address); + ui.print("\nšŸ“‹ Migration Strategy\n"); + ui.print_sub(format!("World address: {:#x})\n", world_address)); + ui.print_sub(format!("Contract address: {:#x})\n", contract_address)); if let Some(base) = &strategy.base { ui.print_header("# Base Contract"); diff --git a/crates/sozo/ops/src/migration/mod.rs b/crates/sozo/ops/src/migration/mod.rs index b5f478202d..7edaa75e87 100644 --- a/crates/sozo/ops/src/migration/mod.rs +++ b/crates/sozo/ops/src/migration/mod.rs @@ -5,6 +5,7 @@ use dojo_lang::compiler::MANIFESTS_DIR; use dojo_world::contracts::WorldContract; use dojo_world::migration::world::WorldDiff; use dojo_world::migration::{DeployOutput, TxnConfig, UpgradeOutput}; +use dojo_world::migration::contract::ContractMigration; use scarb::core::Workspace; use starknet::accounts::{ConnectedAccount, SingleOwnerAccount}; use starknet::core::types::FieldElement; @@ -52,6 +53,8 @@ pub async fn migrate( name: &str, dry_run: bool, txn_config: TxnConfig, + base_class_hash: FieldElement, + contract: &ContractMigration ) -> Result<()> where P: Provider + Sync + Send + 'static, @@ -97,7 +100,7 @@ where let world_address = strategy.world_address().expect("world address must exist"); if dry_run { - print_strategy(&ui, account.provider(), &strategy).await; + print_strategy(&ui, account.provider(), &strategy, world_address, contract, base_class_hash).await; update_manifests_and_abis( ws, From 74fc620dcae5a7c61a4beaca395b59864b1e0fa1 Mon Sep 17 00:00:00 2001 From: Steven Date: Fri, 10 May 2024 16:45:56 -0600 Subject: [PATCH 07/14] fix --- crates/sozo/ops/src/migration/migrate.rs | 14 ++++++-------- crates/sozo/ops/src/migration/mod.rs | 5 +---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index 5a75bc691e..c88d0f8599 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -694,17 +694,14 @@ where format!("deploy {}", contract.diff.name) } -pub async fn print_strategy

(ui: &Ui, provider: &P, strategy: &MigrationStrategy, world_address: FieldElement, contract: &ContractMigration, base_class_hash: FieldElement) +pub async fn print_strategy

(ui: &Ui, provider: &P, strategy: &MigrationStrategy) where P: Provider + Sync + Send + 'static, { - - let contract_address = - get_contract_address(contract.salt, base_class_hash, &[], world_address); - ui.print("\nšŸ“‹ Migration Strategy\n"); - ui.print_sub(format!("World address: {:#x})\n", world_address)); - ui.print_sub(format!("Contract address: {:#x})\n", contract_address)); + if let Some(world) = &strategy.world { + ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); + } if let Some(base) = &strategy.base { ui.print_header("# Base Contract"); @@ -714,7 +711,6 @@ where if let Some(world) = &strategy.world { ui.print_header("# World"); ui.print_sub(format!("declare (class hash: {:#x})\n", world.diff.local_class_hash)); - ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); } if !&strategy.models.is_empty() { @@ -739,6 +735,8 @@ where for c in &strategy.contracts { let op_name = get_contract_operation_name(provider, c, strategy.world_address).await; ui.print_sub(format!("{op_name} (class hash: {:#x})", c.diff.local_class_hash)); + let contract_address = get_contract_address(c.salt, c.diff.base_class_hash, &[], c.contract_address); + ui.print_sub(format!("{op_name} (contract address: {:#x})", contract_address)); } ui.print(" "); } diff --git a/crates/sozo/ops/src/migration/mod.rs b/crates/sozo/ops/src/migration/mod.rs index 7edaa75e87..b5f478202d 100644 --- a/crates/sozo/ops/src/migration/mod.rs +++ b/crates/sozo/ops/src/migration/mod.rs @@ -5,7 +5,6 @@ use dojo_lang::compiler::MANIFESTS_DIR; use dojo_world::contracts::WorldContract; use dojo_world::migration::world::WorldDiff; use dojo_world::migration::{DeployOutput, TxnConfig, UpgradeOutput}; -use dojo_world::migration::contract::ContractMigration; use scarb::core::Workspace; use starknet::accounts::{ConnectedAccount, SingleOwnerAccount}; use starknet::core::types::FieldElement; @@ -53,8 +52,6 @@ pub async fn migrate( name: &str, dry_run: bool, txn_config: TxnConfig, - base_class_hash: FieldElement, - contract: &ContractMigration ) -> Result<()> where P: Provider + Sync + Send + 'static, @@ -100,7 +97,7 @@ where let world_address = strategy.world_address().expect("world address must exist"); if dry_run { - print_strategy(&ui, account.provider(), &strategy, world_address, contract, base_class_hash).await; + print_strategy(&ui, account.provider(), &strategy).await; update_manifests_and_abis( ws, From 8f0f4d8d78c966317df1a305b1835702a7d224a5 Mon Sep 17 00:00:00 2001 From: stevencartavia Date: Fri, 17 May 2024 15:00:04 -0600 Subject: [PATCH 08/14] fix --- crates/sozo/ops/src/migration/migrate.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index c88d0f8599..f57378d993 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -699,9 +699,6 @@ where P: Provider + Sync + Send + 'static, { ui.print("\nšŸ“‹ Migration Strategy\n"); - if let Some(world) = &strategy.world { - ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); - } if let Some(base) = &strategy.base { ui.print_header("# Base Contract"); @@ -711,6 +708,7 @@ where if let Some(world) = &strategy.world { ui.print_header("# World"); ui.print_sub(format!("declare (class hash: {:#x})\n", world.diff.local_class_hash)); + ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); } if !&strategy.models.is_empty() { @@ -735,8 +733,6 @@ where for c in &strategy.contracts { let op_name = get_contract_operation_name(provider, c, strategy.world_address).await; ui.print_sub(format!("{op_name} (class hash: {:#x})", c.diff.local_class_hash)); - let contract_address = get_contract_address(c.salt, c.diff.base_class_hash, &[], c.contract_address); - ui.print_sub(format!("{op_name} (contract address: {:#x})", contract_address)); } ui.print(" "); } From e89de6d56b599f8ce28a81b697f872b48d62431d Mon Sep 17 00:00:00 2001 From: stevencartavia Date: Fri, 17 May 2024 22:34:32 -0600 Subject: [PATCH 09/14] formatting --- crates/dojo-lang/src/plugin.rs | 12 +- crates/dojo-world/src/metadata_test.rs | 25 ++-- crates/katana/core/src/sequencer.rs | 11 +- .../src/implementation/blockifier/state.rs | 6 +- crates/katana/executor/tests/executor.rs | 6 +- crates/katana/primitives/src/genesis/json.rs | 10 +- crates/katana/rpc/rpc-api/src/torii.rs | 2 +- crates/katana/runner/runner-macro/src/lib.rs | 6 +- crates/katana/runner/src/lib.rs | 6 +- crates/katana/storage/db/src/mdbx/cursor.rs | 6 +- .../provider/src/providers/db/state.rs | 6 +- .../storage/provider/src/traits/contract.rs | 2 +- .../storage/provider/src/traits/state.rs | 2 +- crates/sozo/ops/src/tests/call.rs | 114 +++++++++--------- crates/sozo/ops/src/tests/migration.rs | 18 +-- crates/torii/client/src/client/storage.rs | 8 +- .../torii/client/src/client/subscription.rs | 6 +- crates/torii/graphql/src/object/entity.rs | 12 +- crates/torii/graphql/src/object/event.rs | 12 +- .../torii/graphql/src/object/event_message.rs | 54 +++++---- crates/torii/graphql/src/object/model.rs | 12 +- crates/torii/libp2p/src/typed_data.rs | 6 +- 22 files changed, 155 insertions(+), 187 deletions(-) diff --git a/crates/dojo-lang/src/plugin.rs b/crates/dojo-lang/src/plugin.rs index af884f2a37..9341807f78 100644 --- a/crates/dojo-lang/src/plugin.rs +++ b/crates/dojo-lang/src/plugin.rs @@ -70,11 +70,7 @@ impl GeneratedFileAuxData for DojoAuxData { self } fn eq(&self, other: &dyn GeneratedFileAuxData) -> bool { - if let Some(other) = other.as_any().downcast_ref::() { - self == other - } else { - false - } + if let Some(other) = other.as_any().downcast_ref::() { self == other } else { false } } } @@ -92,11 +88,7 @@ impl GeneratedFileAuxData for ComputedValuesAuxData { self } fn eq(&self, other: &dyn GeneratedFileAuxData) -> bool { - if let Some(other) = other.as_any().downcast_ref::() { - self == other - } else { - false - } + if let Some(other) = other.as_any().downcast_ref::() { self == other } else { false } } } diff --git a/crates/dojo-world/src/metadata_test.rs b/crates/dojo-world/src/metadata_test.rs index 6f34df68b6..ec48befb6f 100644 --- a/crates/dojo-world/src/metadata_test.rs +++ b/crates/dojo-world/src/metadata_test.rs @@ -132,22 +132,23 @@ async fn get_full_dojo_metadata_from_workspace() { assert!(env.rpc_url.unwrap().eq("http://localhost:5050/")); assert!(env.account_address.is_some()); - assert!(env - .account_address - .unwrap() - .eq("0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03")); + assert!( + env.account_address + .unwrap() + .eq("0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03") + ); assert!(env.private_key.is_some()); - assert!(env - .private_key - .unwrap() - .eq("0x1800000000300000180000000000030000000000003006001800006600")); + assert!( + env.private_key.unwrap().eq("0x1800000000300000180000000000030000000000003006001800006600") + ); assert!(env.world_address.is_some()); - assert!(env - .world_address - .unwrap() - .eq("0x3898144a24151443f0c6501a1de46a6e9e27abd9fb5d08cdeeff5a5127d1d25")); + assert!( + env.world_address + .unwrap() + .eq("0x3898144a24151443f0c6501a1de46a6e9e27abd9fb5d08cdeeff5a5127d1d25") + ); assert!(env.keystore_path.is_none()); assert!(env.keystore_password.is_none()); diff --git a/crates/katana/core/src/sequencer.rs b/crates/katana/core/src/sequencer.rs index 3dfdea5568..0a0db8678d 100644 --- a/crates/katana/core/src/sequencer.rs +++ b/crates/katana/core/src/sequencer.rs @@ -286,13 +286,10 @@ impl KatanaSequencer { let tx @ Some(_) = tx else { return Ok(self.pending_executor().as_ref().and_then(|exec| { - exec.read().transactions().iter().find_map(|tx| { - if tx.0.hash == *hash { - Some(tx.0.clone()) - } else { - None - } - }) + exec.read() + .transactions() + .iter() + .find_map(|tx| if tx.0.hash == *hash { Some(tx.0.clone()) } else { None }) })); }; diff --git a/crates/katana/executor/src/implementation/blockifier/state.rs b/crates/katana/executor/src/implementation/blockifier/state.rs index cbe21e1e45..c6d7f27572 100644 --- a/crates/katana/executor/src/implementation/blockifier/state.rs +++ b/crates/katana/executor/src/implementation/blockifier/state.rs @@ -171,11 +171,7 @@ impl StateProvider for CachedState { }; let hash = hash.0.into(); - if hash == FieldElement::ZERO { - Ok(None) - } else { - Ok(Some(hash)) - } + if hash == FieldElement::ZERO { Ok(None) } else { Ok(Some(hash)) } } fn nonce( diff --git a/crates/katana/executor/tests/executor.rs b/crates/katana/executor/tests/executor.rs index 676c65acde..1573174fc7 100644 --- a/crates/katana/executor/tests/executor.rs +++ b/crates/katana/executor/tests/executor.rs @@ -55,11 +55,7 @@ fn test_executor_with_valid_blocks_impl( // ensure that all transactions succeeded, if not panic with the error message and tx index let has_failed = transactions.iter().enumerate().find_map(|(i, (_, res))| { - if let ExecutionResult::Failed { error } = res { - Some((i, error)) - } else { - None - } + if let ExecutionResult::Failed { error } = res { Some((i, error)) } else { None } }); if let Some((pos, error)) = has_failed { diff --git a/crates/katana/primitives/src/genesis/json.rs b/crates/katana/primitives/src/genesis/json.rs index 5a65d9059a..102020e7c9 100644 --- a/crates/katana/primitives/src/genesis/json.rs +++ b/crates/katana/primitives/src/genesis/json.rs @@ -1071,10 +1071,12 @@ mod tests { fn genesis_from_json_with_unresolved_paths() { let file = File::open("./src/genesis/test-genesis.json").unwrap(); let json: GenesisJson = serde_json::from_reader(file).unwrap(); - assert!(Genesis::try_from(json) - .unwrap_err() - .to_string() - .contains("Unresolved class artifact path")); + assert!( + Genesis::try_from(json) + .unwrap_err() + .to_string() + .contains("Unresolved class artifact path") + ); } #[test] diff --git a/crates/katana/rpc/rpc-api/src/torii.rs b/crates/katana/rpc/rpc-api/src/torii.rs index 3308806004..272497041a 100644 --- a/crates/katana/rpc/rpc-api/src/torii.rs +++ b/crates/katana/rpc/rpc-api/src/torii.rs @@ -7,5 +7,5 @@ use katana_rpc_types::transaction::{TransactionsPage, TransactionsPageCursor}; pub trait ToriiApi { #[method(name = "getTransactions")] async fn get_transactions(&self, cursor: TransactionsPageCursor) - -> RpcResult; + -> RpcResult; } diff --git a/crates/katana/runner/runner-macro/src/lib.rs b/crates/katana/runner/runner-macro/src/lib.rs index 8cb426c16e..77867a284f 100644 --- a/crates/katana/runner/runner-macro/src/lib.rs +++ b/crates/katana/runner/runner-macro/src/lib.rs @@ -28,11 +28,7 @@ fn parse_metadata(metadata: String) -> (u16, Option, Option) { // if set to `true`, we use a default block time. let block_time = if args.len() >= 2 { if let Ok(b) = args[1].trim().parse::() { - if !b { - None - } else { - Some(DEFAULT_BLOCK_TIME) - } + if !b { None } else { Some(DEFAULT_BLOCK_TIME) } } else if let Ok(block_time_ms) = args[1].trim().parse::() { Some(block_time_ms) } else { diff --git a/crates/katana/runner/src/lib.rs b/crates/katana/runner/src/lib.rs index adf9051ad2..13a19fe771 100644 --- a/crates/katana/runner/src/lib.rs +++ b/crates/katana/runner/src/lib.rs @@ -185,11 +185,7 @@ impl Drop for KatanaRunner { /// Determines the default program path for the katana runner based on the KATANA_RUNNER_BIN /// environment variable. If not set, try to to use katana from the PATH. fn determine_default_program_path() -> String { - if let Ok(bin) = std::env::var("KATANA_RUNNER_BIN") { - bin - } else { - "katana".to_string() - } + if let Ok(bin) = std::env::var("KATANA_RUNNER_BIN") { bin } else { "katana".to_string() } } #[cfg(test)] diff --git a/crates/katana/storage/db/src/mdbx/cursor.rs b/crates/katana/storage/db/src/mdbx/cursor.rs index e08ca8499a..9cac3876e3 100644 --- a/crates/katana/storage/db/src/mdbx/cursor.rs +++ b/crates/katana/storage/db/src/mdbx/cursor.rs @@ -304,11 +304,7 @@ impl Walker<'_, RW, T> { impl std::iter::Iterator for Walker<'_, K, T> { type Item = Result, DatabaseError>; fn next(&mut self) -> Option { - if let value @ Some(_) = self.start.take() { - value - } else { - self.cursor.next().transpose() - } + if let value @ Some(_) = self.start.take() { value } else { self.cursor.next().transpose() } } } diff --git a/crates/katana/storage/provider/src/providers/db/state.rs b/crates/katana/storage/provider/src/providers/db/state.rs index 286b16920d..bb8f070646 100644 --- a/crates/katana/storage/provider/src/providers/db/state.rs +++ b/crates/katana/storage/provider/src/providers/db/state.rs @@ -292,11 +292,7 @@ fn recent_change_from_block( // 1. the list is empty // 2. there are no prior changes occured before/at `block_number` let rank = block_list.rank(block_number); - if rank == 0 { - None - } else { - block_list.select(rank - 1) - } + if rank == 0 { None } else { block_list.select(rank - 1) } } #[cfg(test)] diff --git a/crates/katana/storage/provider/src/traits/contract.rs b/crates/katana/storage/provider/src/traits/contract.rs index 5a2d6fbcd8..8ad2d5c700 100644 --- a/crates/katana/storage/provider/src/traits/contract.rs +++ b/crates/katana/storage/provider/src/traits/contract.rs @@ -33,5 +33,5 @@ pub trait ContractClassWriter: Send + Sync { /// Retrieves the Sierra class definition of a contract class given its class hash. fn set_sierra_class(&self, hash: ClassHash, sierra: FlattenedSierraClass) - -> ProviderResult<()>; + -> ProviderResult<()>; } diff --git a/crates/katana/storage/provider/src/traits/state.rs b/crates/katana/storage/provider/src/traits/state.rs index c18d4f72d1..3ec9aade09 100644 --- a/crates/katana/storage/provider/src/traits/state.rs +++ b/crates/katana/storage/provider/src/traits/state.rs @@ -26,7 +26,7 @@ pub trait StateProvider: ContractClassProvider + Send + Sync { /// Returns the class hash of a contract. fn class_hash_of_contract(&self, address: ContractAddress) - -> ProviderResult>; + -> ProviderResult>; } /// A type which can create [`StateProvider`] for states at a particular block. diff --git a/crates/sozo/ops/src/tests/call.rs b/crates/sozo/ops/src/tests/call.rs index f93b498fd3..84d6c4f5bc 100644 --- a/crates/sozo/ops/src/tests/call.rs +++ b/crates/sozo/ops/src/tests/call.rs @@ -20,15 +20,17 @@ async fn call_with_bad_address() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!(call::call( - world_reader, - "0xBadCoffeeBadCode".to_string(), - ENTRYPOINT.to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None - ) - .await - .is_err()); + assert!( + call::call( + world_reader, + "0xBadCoffeeBadCode".to_string(), + ENTRYPOINT.to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None + ) + .await + .is_err() + ); } #[tokio::test] @@ -39,15 +41,17 @@ async fn call_with_bad_name() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!(call::call( - world_reader, - "BadName".to_string(), - ENTRYPOINT.to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None - ) - .await - .is_err()); + assert!( + call::call( + world_reader, + "BadName".to_string(), + ENTRYPOINT.to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None + ) + .await + .is_err() + ); } #[tokio::test] @@ -58,15 +62,17 @@ async fn call_with_bad_entrypoint() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!(call::call( - world_reader, - CONTRACT_NAME.to_string(), - "BadEntryPoint".to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None - ) - .await - .is_err()); + assert!( + call::call( + world_reader, + CONTRACT_NAME.to_string(), + "BadEntryPoint".to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None + ) + .await + .is_err() + ); } #[tokio::test] @@ -77,15 +83,11 @@ async fn call_with_bad_calldata() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!(call::call( - world_reader, - CONTRACT_NAME.to_string(), - ENTRYPOINT.to_string(), - vec![], - None - ) - .await - .is_err()); + assert!( + call::call(world_reader, CONTRACT_NAME.to_string(), ENTRYPOINT.to_string(), vec![], None) + .await + .is_err() + ); } #[tokio::test] @@ -96,15 +98,17 @@ async fn call_with_contract_name() { let provider = sequencer.provider(); let world_reader = WorldContractReader::new(world.address, provider); - assert!(call::call( - world_reader, - CONTRACT_NAME.to_string(), - ENTRYPOINT.to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None, - ) - .await - .is_ok()); + assert!( + call::call( + world_reader, + CONTRACT_NAME.to_string(), + ENTRYPOINT.to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None, + ) + .await + .is_ok() + ); } #[tokio::test] @@ -121,13 +125,15 @@ async fn call_with_contract_address() { .await .unwrap(); - assert!(call::call( - world_reader, - format!("{:#x}", contract_address), - ENTRYPOINT.to_string(), - vec![FieldElement::ZERO, FieldElement::ZERO], - None, - ) - .await - .is_ok()); + assert!( + call::call( + world_reader, + format!("{:#x}", contract_address), + ENTRYPOINT.to_string(), + vec![FieldElement::ZERO, FieldElement::ZERO], + None, + ) + .await + .is_ok() + ); } diff --git a/crates/sozo/ops/src/tests/migration.rs b/crates/sozo/ops/src/tests/migration.rs index 84c45e90ba..06903c5f37 100644 --- a/crates/sozo/ops/src/tests/migration.rs +++ b/crates/sozo/ops/src/tests/migration.rs @@ -81,14 +81,16 @@ async fn migrate_with_small_fee_multiplier_will_fail() { let account = sequencer.account(0); - assert!(execute_strategy( - &ws, - &migration, - &account, - TxnConfig { fee_estimate_multiplier: Some(0.2f64), ..Default::default() }, - ) - .await - .is_err()); + assert!( + execute_strategy( + &ws, + &migration, + &account, + TxnConfig { fee_estimate_multiplier: Some(0.2f64), ..Default::default() }, + ) + .await + .is_err() + ); } #[tokio::test] diff --git a/crates/torii/client/src/client/storage.rs b/crates/torii/client/src/client/storage.rs index caa00dee5c..48541a2314 100644 --- a/crates/torii/client/src/client/storage.rs +++ b/crates/torii/client/src/client/storage.rs @@ -264,8 +264,10 @@ mod tests { ); assert!(actual_values == expected_values); assert!(storage.storage.read().len() == model.packed_size as usize); - assert!(actual_storage_addresses - .into_iter() - .all(|address| expected_storage_addresses.contains(&address))); + assert!( + actual_storage_addresses + .into_iter() + .all(|address| expected_storage_addresses.contains(&address)) + ); } } diff --git a/crates/torii/client/src/client/subscription.rs b/crates/torii/client/src/client/subscription.rs index b167e6a614..ac21707104 100644 --- a/crates/torii/client/src/client/subscription.rs +++ b/crates/torii/client/src/client/subscription.rs @@ -192,11 +192,7 @@ impl SubscriptionService { let storage_entries = diff.storage_diffs.into_iter().find_map(|d| { let expected = self.world_metadata.read().world_address; let current = d.address; - if current == expected { - Some(d.storage_entries) - } else { - None - } + if current == expected { Some(d.storage_entries) } else { None } }); let Some(entries) = storage_entries else { diff --git a/crates/torii/graphql/src/object/entity.rs b/crates/torii/graphql/src/object/entity.rs index 209fd28141..dd73c9c6fd 100644 --- a/crates/torii/graphql/src/object/entity.rs +++ b/crates/torii/graphql/src/object/entity.rs @@ -63,10 +63,8 @@ impl ResolvableObject for EntityObject { } fn subscriptions(&self) -> Option> { - Some(vec![SubscriptionField::new( - "entityUpdated", - TypeRef::named_nn(self.type_name()), - |ctx| { + Some(vec![ + SubscriptionField::new("entityUpdated", TypeRef::named_nn(self.type_name()), |ctx| { SubscriptionFieldFuture::new(async move { let id = match ctx.args.get("id") { Some(id) => Some(id.string()?.to_string()), @@ -83,9 +81,9 @@ impl ResolvableObject for EntityObject { } })) }) - }, - ) - .argument(InputValue::new("id", TypeRef::named(TypeRef::ID)))]) + }) + .argument(InputValue::new("id", TypeRef::named(TypeRef::ID))), + ]) } } diff --git a/crates/torii/graphql/src/object/event.rs b/crates/torii/graphql/src/object/event.rs index 975d98afe9..f0063f76c1 100644 --- a/crates/torii/graphql/src/object/event.rs +++ b/crates/torii/graphql/src/object/event.rs @@ -44,17 +44,15 @@ impl ResolvableObject for EventObject { } fn subscriptions(&self) -> Option> { - Some(vec![SubscriptionField::new( - "eventEmitted", - TypeRef::named_nn(self.type_name()), - |ctx| { + Some(vec![ + SubscriptionField::new("eventEmitted", TypeRef::named_nn(self.type_name()), |ctx| { SubscriptionFieldFuture::new(async move { let input_keys = parse_keys_argument(&ctx)?; Ok(EventObject::subscription_stream(input_keys)) }) - }, - ) - .argument(InputValue::new("keys", TypeRef::named_list(TypeRef::STRING)))]) + }) + .argument(InputValue::new("keys", TypeRef::named_list(TypeRef::STRING))), + ]) } } diff --git a/crates/torii/graphql/src/object/event_message.rs b/crates/torii/graphql/src/object/event_message.rs index 11da937cfb..007573b3ca 100644 --- a/crates/torii/graphql/src/object/event_message.rs +++ b/crates/torii/graphql/src/object/event_message.rs @@ -63,31 +63,35 @@ impl ResolvableObject for EventMessageObject { } fn subscriptions(&self) -> Option> { - Some(vec![SubscriptionField::new( - "eventMessageUpdated", - TypeRef::named_nn(self.type_name()), - |ctx| { - SubscriptionFieldFuture::new(async move { - let id = match ctx.args.get("id") { - Some(id) => Some(id.string()?.to_string()), - None => None, - }; - // if id is None, then subscribe to all entities - // if id is Some, then subscribe to only the entity with that id - Ok(SimpleBroker::::subscribe().filter_map( - move |entity: EventMessage| { - if id.is_none() || id == Some(entity.id.clone()) { - Some(Ok(Value::Object(EventMessageObject::value_mapping(entity)))) - } else { - // id != entity.id , then don't send anything, still listening - None - } - }, - )) - }) - }, - ) - .argument(InputValue::new("id", TypeRef::named(TypeRef::ID)))]) + Some(vec![ + SubscriptionField::new( + "eventMessageUpdated", + TypeRef::named_nn(self.type_name()), + |ctx| { + SubscriptionFieldFuture::new(async move { + let id = match ctx.args.get("id") { + Some(id) => Some(id.string()?.to_string()), + None => None, + }; + // if id is None, then subscribe to all entities + // if id is Some, then subscribe to only the entity with that id + Ok(SimpleBroker::::subscribe().filter_map( + move |entity: EventMessage| { + if id.is_none() || id == Some(entity.id.clone()) { + Some(Ok(Value::Object(EventMessageObject::value_mapping( + entity, + )))) + } else { + // id != entity.id , then don't send anything, still listening + None + } + }, + )) + }) + }, + ) + .argument(InputValue::new("id", TypeRef::named(TypeRef::ID))), + ]) } } diff --git a/crates/torii/graphql/src/object/model.rs b/crates/torii/graphql/src/object/model.rs index 4b326b0207..a9ecb13607 100644 --- a/crates/torii/graphql/src/object/model.rs +++ b/crates/torii/graphql/src/object/model.rs @@ -74,10 +74,8 @@ impl ResolvableObject for ModelObject { } fn subscriptions(&self) -> Option> { - Some(vec![SubscriptionField::new( - "modelRegistered", - TypeRef::named_nn(self.type_name()), - |ctx| { + Some(vec![ + SubscriptionField::new("modelRegistered", TypeRef::named_nn(self.type_name()), |ctx| { { SubscriptionFieldFuture::new(async move { let id = match ctx.args.get("id") { @@ -96,9 +94,9 @@ impl ResolvableObject for ModelObject { })) }) } - }, - ) - .argument(InputValue::new("id", TypeRef::named(TypeRef::ID)))]) + }) + .argument(InputValue::new("id", TypeRef::named(TypeRef::ID))), + ]) } } diff --git a/crates/torii/libp2p/src/typed_data.rs b/crates/torii/libp2p/src/typed_data.rs index e018184814..dc752f751b 100644 --- a/crates/torii/libp2p/src/typed_data.rs +++ b/crates/torii/libp2p/src/typed_data.rs @@ -149,11 +149,7 @@ pub fn encode_type(name: &str, types: &IndexMap>) -> Result>() .join(","); From a72a2a06d12120981c2b33b835cfba3cce2a042e Mon Sep 17 00:00:00 2001 From: lambda-0x <0xlambda@protonmail.com> Date: Sun, 19 May 2024 16:54:48 +0530 Subject: [PATCH 10/14] fix implementation and clean up --- crates/sozo/ops/src/migration/migrate.rs | 59 +++++++++++++++--------- crates/sozo/ops/src/migration/mod.rs | 2 +- rust_fmt.sh | 6 --- 3 files changed, 38 insertions(+), 29 deletions(-) delete mode 100644 rust_fmt.sh diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index f57378d993..5201f2c85c 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -681,61 +681,76 @@ where .await { Ok(current_class_hash) if current_class_hash != contract.diff.local_class_hash => { - return format!("upgrade {}", contract.diff.name); + return format!("{}: Upgrade", contract.diff.name); } Err(ProviderError::StarknetError(StarknetError::ContractNotFound)) => { - return format!("deploy {}", contract.diff.name); + return format!("{}: Deploy", contract.diff.name); } - Ok(_) => return "already deployed".to_string(), - Err(_) => return format!("deploy {}", contract.diff.name), + Ok(_) => return "Already Deployed".to_string(), + Err(_) => return format!("{}: Deploy", contract.diff.name), } } } format!("deploy {}", contract.diff.name) } -pub async fn print_strategy

(ui: &Ui, provider: &P, strategy: &MigrationStrategy) -where +pub async fn print_strategy

( + ui: &Ui, + provider: &P, + strategy: &MigrationStrategy, + world_address: FieldElement, +) where P: Provider + Sync + Send + 'static, { ui.print("\nšŸ“‹ Migration Strategy\n"); + ui.print_header(format!("World address: {:#x}", world_address)); + + ui.print(" "); + if let Some(base) = &strategy.base { ui.print_header("# Base Contract"); - ui.print_sub(format!("declare (class hash: {:#x})\n", base.diff.local_class_hash)); + ui.print_sub(format!("Class hash: {:#x}", base.diff.local_class_hash)); } + ui.print(" "); + if let Some(world) = &strategy.world { ui.print_header("# World"); - ui.print_sub(format!("declare (class hash: {:#x})\n", world.diff.local_class_hash)); - ui.print_sub(format!("declare (contract address: {:#x})\n", world.contract_address)); + ui.print_sub(format!("Class hash: {:#x}", world.diff.local_class_hash)); } + ui.print(" "); + if !&strategy.models.is_empty() { ui.print_header(format!("# Models ({})", &strategy.models.len())); for m in &strategy.models { - ui.print_sub(format!("{}", m.diff.name)); - ui.print_sub(format!("(class hash: {:#x})", m.diff.local_class_hash)); - let salt = generate_salt(&m.diff.name); - let contract_address = get_contract_address( - salt, - m.diff.local_class_hash, - &[], - strategy.world_address.unwrap(), - ); - ui.print_sub(format!("(contract address: {:#x})", contract_address)); + ui.print(format!("{}", m.diff.name)); + ui.print_sub(format!("Class hash: {:#x}", m.diff.local_class_hash)); } - ui.print(" "); } + ui.print(" "); + if !&strategy.contracts.is_empty() { ui.print_header(format!("# Contracts ({})", &strategy.contracts.len())); for c in &strategy.contracts { let op_name = get_contract_operation_name(provider, c, strategy.world_address).await; - ui.print_sub(format!("{op_name} (class hash: {:#x})", c.diff.local_class_hash)); + + ui.print(format!("{op_name}")); + ui.print_sub(format!("Class hash: {:#x}", c.diff.local_class_hash)); + let salt = generate_salt(&c.diff.name); + let contract_address = get_contract_address( + salt, + c.diff.base_class_hash, + &[], + strategy.world_address.unwrap(), + ); + ui.print_sub(format!("Contract address: {:#x}", contract_address)); } - ui.print(" "); } + + ui.print(" "); } #[allow(clippy::too_many_arguments)] diff --git a/crates/sozo/ops/src/migration/mod.rs b/crates/sozo/ops/src/migration/mod.rs index b5f478202d..bf5e417a2f 100644 --- a/crates/sozo/ops/src/migration/mod.rs +++ b/crates/sozo/ops/src/migration/mod.rs @@ -97,7 +97,7 @@ where let world_address = strategy.world_address().expect("world address must exist"); if dry_run { - print_strategy(&ui, account.provider(), &strategy).await; + print_strategy(&ui, account.provider(), &strategy, world_address).await; update_manifests_and_abis( ws, diff --git a/rust_fmt.sh b/rust_fmt.sh deleted file mode 100644 index 6ec06c63b6..0000000000 --- a/rust_fmt.sh +++ /dev/null @@ -1,6 +0,0 @@ -Script started on Thu May 16 18:05:45 2024 -Command: local -script: local: No such file or directory - -Command exit status: 1 -Script done on Thu May 16 18:05:45 2024 From 4969bf9f376aaaa80015cf82879c583e9402d5df Mon Sep 17 00:00:00 2001 From: lambda-0x <0xlambda@protonmail.com> Date: Sun, 19 May 2024 16:56:46 +0530 Subject: [PATCH 11/14] revert cargo.lock changes --- Cargo.lock | 178 ++++++++++++++++++++++++++--------------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 99c94fa6fb..c082a928a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -149,9 +149,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8425a283510106b1a6ad25dd4bb648ecde7da3fd2baeb9400a85ad62f51ec90b" +checksum = "0dffe3984d3ca3a2319eb4472eca0e09df9d251ad2487af6c0c08d8d20e65e89" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -191,9 +191,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e30946aa6173020259055a44971f5cf40a7d76c931d209caeb51b333263df4f" +checksum = "7eca3f5e6068d2c7d33cde559b6bd4aaa3254e5ecc9b6dd6ad1e65e8a201fc46" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8aa973e647ec336810a9356af8aea787249c9d00b1525359f3db29a68d231b" +checksum = "5c466f488c032bac81e925fcd9f22bc0a50ae7a71f3ba27cfc2911b8a47c1938" dependencies = [ "alloy-rlp", "bytes", @@ -300,7 +300,7 @@ checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -393,23 +393,23 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dbd17d67f3e89478c8a634416358e539e577899666c927bc3d2b1328ee9b6ca" +checksum = "d86c9b8062b642b96e73bfa60fede65c89bc09e7e05e8ba2ac8b333978b28d7a" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6da95adcf4760bb4b108fefa51d50096c5e5fdd29ee72fed3e86ee414f2e34" +checksum = "00385c3d833fb56adf9e4af209c9d32267c01f0efd04ba5d40811822fac7e3e4" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -419,16 +419,16 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32c8da04c1343871fb6ce5a489218f9c85323c8340a36e9106b5fc98d4dd59d5" +checksum = "867a7ca511817f8b86f347f63367e6423a764096e205352578e551d474650db4" dependencies = [ "alloy-json-abi", "const-hex", @@ -437,24 +437,24 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.64", + "syn 2.0.61", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368cae4dc052cad1d8f72eb2ae0c38027116933eeb49213c200a9e9875f208d7" +checksum = "641c79d46584814fb3d0a2bcbf0296f2d3b9b82f4a84eba298ce448aaebb4523" dependencies = [ "winnow 0.6.1", ] [[package]] name = "alloy-sol-types" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a64d2d2395c1ac636b62419a7b17ec39031d6b2367e66e9acbf566e6055e9c" +checksum = "9da874df320c90c0f33567a90a74ba1f988e135e7d199fe68e6977cba9e0142e" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -967,7 +967,7 @@ dependencies = [ "proc-macro2", "quote", "strum 0.25.0", - "syn 2.0.64", + "syn 2.0.61", "thiserror", ] @@ -1074,7 +1074,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -1122,7 +1122,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -1139,7 +1139,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -1199,7 +1199,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -1404,7 +1404,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -1756,7 +1756,7 @@ dependencies = [ "quote", "serde_json", "starknet", - "syn 2.0.64", + "syn 2.0.61", "thiserror", ] @@ -1774,7 +1774,7 @@ dependencies = [ "quote", "serde_json", "starknet", - "syn 2.0.64", + "syn 2.0.61", "thiserror", ] @@ -1791,7 +1791,7 @@ dependencies = [ "quote", "serde_json", "starknet", - "syn 2.0.64", + "syn 2.0.61", "thiserror", ] @@ -1999,7 +1999,7 @@ source = "git+https://github.com/software-mansion/scarb?tag=v2.6.4#c4c7c0bac3a30 dependencies = [ "quote", "scarb-stable-hash", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -2054,7 +2054,7 @@ checksum = "67f9da66325ce7ed6c002360f26106fe79deb9f8a2fca30abdbb8d388da7bb46" dependencies = [ "cairo-lang-debug", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -2794,7 +2794,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -3235,7 +3235,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -3296,7 +3296,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -3318,7 +3318,7 @@ checksum = "c5a91391accf613803c2a9bf9abccdbaa07c54b4244a5b64883f9c3c137c86be" dependencies = [ "darling_core 0.20.6", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -3449,7 +3449,7 @@ dependencies = [ "darling 0.20.6", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -3459,7 +3459,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" dependencies = [ "derive_builder_core", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -3596,7 +3596,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -3977,7 +3977,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -3989,7 +3989,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -4455,7 +4455,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -4544,7 +4544,7 @@ checksum = "d4cf186fea4af17825116f72932fe52cce9a13bae39ff63b4dc0cfdb3fb4bde1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -4977,7 +4977,7 @@ checksum = "d75e7ab728059f595f6ddc1ad8771b8d6a231971ae493d9d5948ecad366ee8bb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -6838,7 +6838,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -7652,7 +7652,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -7845,7 +7845,7 @@ checksum = "adf157a4dc5a29b7b464aa8fe7edeff30076e07e13646a1c3874f58477dc99f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -8038,7 +8038,7 @@ checksum = "38b4faf00617defe497754acde3024865bc143d44a86799b24e191ecff91354f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -8728,7 +8728,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -9004,7 +9004,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -9058,7 +9058,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -9102,7 +9102,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -9353,7 +9353,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -9488,7 +9488,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -9570,7 +9570,7 @@ dependencies = [ "prost 0.12.3", "prost-types 0.12.3", "regex", - "syn 2.0.64", + "syn 2.0.61", "tempfile", "which 4.4.2", ] @@ -9598,7 +9598,7 @@ dependencies = [ "itertools 0.11.0", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -10078,7 +10078,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -10242,7 +10242,7 @@ dependencies = [ "regex", "relative-path", "rustc_version 0.4.0", - "syn 2.0.64", + "syn 2.0.61", "unicode-ident", ] @@ -10255,7 +10255,7 @@ dependencies = [ "quote", "rand", "rustc_version 0.4.0", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -10342,7 +10342,7 @@ name = "runner-macro" version = "0.7.0-alpha.2" dependencies = [ "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -10488,9 +10488,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.5.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" @@ -10988,9 +10988,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "780f1cebed1629e4753a1a38a3c72d30b97ec044f0aef68cb26650a3c5cf363c" dependencies = [ "serde_derive", ] @@ -11026,13 +11026,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.201" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "c5e405930b9796f1c00bee880d03fc7e0bb4b9a11afc776885ffe84320da2865" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -11076,7 +11076,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -11125,7 +11125,7 @@ dependencies = [ "darling 0.20.6", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -11160,7 +11160,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -11918,7 +11918,7 @@ checksum = "bbc159a1934c7be9761c237333a57febe060ace2bc9e3b337a59a37af206d19f" dependencies = [ "starknet-curve 0.4.2", "starknet-ff", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -11961,7 +11961,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95d549d3078bdbe775d0deaa8ddb57a19942989ce7c1f2dfd60beeb322bb4945" dependencies = [ "starknet-core", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -12121,7 +12121,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -12209,9 +12209,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.64" +version = "2.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ad3dee41f36859875573074334c200d1add8e4a87bb37113ebd31d926b7b11f" +checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" dependencies = [ "proc-macro2", "quote", @@ -12220,14 +12220,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8db114c44cf843a8bacd37a146e37987a0b823a0e8bc4fdc610c9c72ab397a5" +checksum = "049973c5d349854d03a194f0c0c554d1cddd9a6ae30018f08c88a77851fdd33e" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -12342,7 +12342,7 @@ checksum = "7ba277e77219e9eea169e8508942db1bf5d8a41ff2db9b20aab5a5aadc9fa25d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -12362,7 +12362,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -12508,7 +12508,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -12708,7 +12708,7 @@ dependencies = [ "proc-macro2", "prost-build 0.12.3", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -13126,7 +13126,7 @@ checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -13155,7 +13155,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -13293,7 +13293,7 @@ checksum = "563b3b88238ec95680aef36bdece66896eaa7ce3c0f1b4f39d38fb2435261352" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -13622,7 +13622,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", "wasm-bindgen-shared", ] @@ -13656,7 +13656,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -13689,7 +13689,7 @@ checksum = "a5211b7550606857312bba1d978a8ec75692eae187becc5e680444fffc5e6f89" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -14482,7 +14482,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] @@ -14502,7 +14502,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.64", + "syn 2.0.61", ] [[package]] From 466a12f6f8c7e8bead1c51ae7d6226e3c046bad3 Mon Sep 17 00:00:00 2001 From: lambda-0x <0xlambda@protonmail.com> Date: Sun, 19 May 2024 17:05:18 +0530 Subject: [PATCH 12/14] clippy lints --- crates/sozo/ops/src/migration/migrate.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index 5201f2c85c..70a8a3ba29 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -725,7 +725,7 @@ pub async fn print_strategy

( if !&strategy.models.is_empty() { ui.print_header(format!("# Models ({})", &strategy.models.len())); for m in &strategy.models { - ui.print(format!("{}", m.diff.name)); + ui.print(m.diff.name.to_string()); ui.print_sub(format!("Class hash: {:#x}", m.diff.local_class_hash)); } } @@ -737,7 +737,7 @@ pub async fn print_strategy

( for c in &strategy.contracts { let op_name = get_contract_operation_name(provider, c, strategy.world_address).await; - ui.print(format!("{op_name}")); + ui.print(op_name); ui.print_sub(format!("Class hash: {:#x}", c.diff.local_class_hash)); let salt = generate_salt(&c.diff.name); let contract_address = get_contract_address( From e72236a763c73abcf6694e082ca6da3c7d4b7eb8 Mon Sep 17 00:00:00 2001 From: lambda-0x <0xlambda@protonmail.com> Date: Sun, 19 May 2024 18:56:07 +0530 Subject: [PATCH 13/14] fix CI --- bin/sozo/src/commands/clean.rs | 2 +- crates/sozo/ops/src/migration/migrate.rs | 8 ++------ scripts/rebuild_test_artifacts.sh | 0 3 files changed, 3 insertions(+), 7 deletions(-) mode change 100644 => 100755 scripts/rebuild_test_artifacts.sh diff --git a/bin/sozo/src/commands/clean.rs b/bin/sozo/src/commands/clean.rs index 06fcd0a142..09ef44e2db 100644 --- a/bin/sozo/src/commands/clean.rs +++ b/bin/sozo/src/commands/clean.rs @@ -92,7 +92,7 @@ mod tests { runner.endpoint(), runner.account(0), "dojo_examples", - true, + false, TxnConfig::default(), ) .await diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index 70a8a3ba29..c2b80a3aa8 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -740,12 +740,8 @@ pub async fn print_strategy

( ui.print(op_name); ui.print_sub(format!("Class hash: {:#x}", c.diff.local_class_hash)); let salt = generate_salt(&c.diff.name); - let contract_address = get_contract_address( - salt, - c.diff.base_class_hash, - &[], - strategy.world_address.unwrap(), - ); + let contract_address = + get_contract_address(salt, c.diff.base_class_hash, &[], world_address); ui.print_sub(format!("Contract address: {:#x}", contract_address)); } } diff --git a/scripts/rebuild_test_artifacts.sh b/scripts/rebuild_test_artifacts.sh old mode 100644 new mode 100755 From 42425123cdff9c5f29b4ccb1e47dbc0d91248c4c Mon Sep 17 00:00:00 2001 From: lambda-0x <0xlambda@protonmail.com> Date: Sun, 19 May 2024 20:34:12 +0530 Subject: [PATCH 14/14] restore unnecessary changes --- bin/sozo/src/commands/clean.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sozo/src/commands/clean.rs b/bin/sozo/src/commands/clean.rs index 09ef44e2db..06fcd0a142 100644 --- a/bin/sozo/src/commands/clean.rs +++ b/bin/sozo/src/commands/clean.rs @@ -92,7 +92,7 @@ mod tests { runner.endpoint(), runner.account(0), "dojo_examples", - false, + true, TxnConfig::default(), ) .await