diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b7a4170ab..68de387ca9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: Swatinem/rust-cache@v2 + - name: Install wasm32 target + run: rustup target add wasm32-unknown-unknown - run: cargo build -r --target wasm32-unknown-unknown -p torii-client ensure-windows: @@ -74,7 +76,7 @@ jobs: with: repo-token: ${{ secrets.github_token }} - run: cargo build --target x86_64-pc-windows-msvc --bins - + # This job is used to ensure the built katana image doesn't depend on any # libraries that don't exist in the base docker image we use for distribution ensure-docker: diff --git a/crates/dojo-world/src/manifest/mod.rs b/crates/dojo-world/src/manifest/mod.rs index d3906595ab..2ce8178ea3 100644 --- a/crates/dojo-world/src/manifest/mod.rs +++ b/crates/dojo-world/src/manifest/mod.rs @@ -369,7 +369,7 @@ impl DeploymentManifest { // #[async_trait] // impl RemoteLoadable

for DeploymentManifest {} -async fn get_remote_models_and_contracts( +async fn get_remote_models_and_contracts

( world: FieldElement, provider: P, ) -> Result<(Vec>, Vec>), AbstractManifestError> diff --git a/crates/katana/core/src/service/messaging/ethereum.rs b/crates/katana/core/src/service/messaging/ethereum.rs index 40990876dc..90267b8a77 100644 --- a/crates/katana/core/src/service/messaging/ethereum.rs +++ b/crates/katana/core/src/service/messaging/ethereum.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use std::collections::HashMap; use std::str::FromStr; use std::sync::Arc; diff --git a/crates/katana/executor/src/implementation/blockifier/mod.rs b/crates/katana/executor/src/implementation/blockifier/mod.rs index 617624bf0b..94a344aab8 100644 --- a/crates/katana/executor/src/implementation/blockifier/mod.rs +++ b/crates/katana/executor/src/implementation/blockifier/mod.rs @@ -98,8 +98,10 @@ impl<'a> StarknetVMProcessor<'a> { // TODO: should we enforce the gas price to not be 0, // as there's a flag to disable gas uasge instead? - let eth_l1_gas_price = unsafe { NonZeroU128::new_unchecked(header.gas_prices.eth) }; - let strk_l1_gas_price = unsafe { NonZeroU128::new_unchecked(header.gas_prices.strk) }; + let eth_l1_gas_price = + NonZeroU128::new(header.gas_prices.eth).unwrap_or(NonZeroU128::new(1).unwrap()); + let strk_l1_gas_price = + NonZeroU128::new(header.gas_prices.strk).unwrap_or(NonZeroU128::new(1).unwrap()); // TODO: which values is correct for those one? let eth_l1_data_gas_price = eth_l1_gas_price; diff --git a/crates/katana/executor/src/implementation/blockifier/utils.rs b/crates/katana/executor/src/implementation/blockifier/utils.rs index 0298d8426f..6a22e5b9b4 100644 --- a/crates/katana/executor/src/implementation/blockifier/utils.rs +++ b/crates/katana/executor/src/implementation/blockifier/utils.rs @@ -363,8 +363,10 @@ pub fn block_context_from_envs(block_env: &BlockEnv, cfg_env: &CfgEnv) -> BlockC strk_fee_token_address: to_blk_address(cfg_env.fee_token_addresses.strk), }; - let eth_l1_gas_price = unsafe { NonZeroU128::new_unchecked(block_env.l1_gas_prices.eth) }; - let strk_l1_gas_price = unsafe { NonZeroU128::new_unchecked(block_env.l1_gas_prices.strk) }; + let eth_l1_gas_price = + NonZeroU128::new(block_env.l1_gas_prices.eth).unwrap_or(NonZeroU128::new(1).unwrap()); + let strk_l1_gas_price = + NonZeroU128::new(block_env.l1_gas_prices.strk).unwrap_or(NonZeroU128::new(1).unwrap()); let gas_prices = GasPrices { eth_l1_gas_price, diff --git a/crates/katana/executor/tests/executor.rs b/crates/katana/executor/tests/executor.rs index 1573174fc7..6e1bbf46a0 100644 --- a/crates/katana/executor/tests/executor.rs +++ b/crates/katana/executor/tests/executor.rs @@ -305,15 +305,15 @@ fn test_executor_with_valid_blocks_impl( let actual_storage_updates = states.state_updates.storage_updates; assert_eq!(actual_storage_updates.len(), 3, "only 3 contracts whose storage should be updated"); assert!( - actual_storage_updates.get(&DEFAULT_FEE_TOKEN_ADDRESS).is_some(), + actual_storage_updates.contains_key(&DEFAULT_FEE_TOKEN_ADDRESS), "fee token storage must get updated" ); assert!( - actual_storage_updates.get(&(deployed_contract.into())).is_some(), + actual_storage_updates.contains_key(&(deployed_contract.into())), "deployed contract storage must get updated" ); assert!( - actual_storage_updates.get(&new_acc).is_some(), + actual_storage_updates.contains_key(&new_acc), "newly deployed account storage must get updated" ); } diff --git a/crates/katana/primitives/src/genesis/mod.rs b/crates/katana/primitives/src/genesis/mod.rs index d8c46b5170..78e817801d 100644 --- a/crates/katana/primitives/src/genesis/mod.rs +++ b/crates/katana/primitives/src/genesis/mod.rs @@ -530,7 +530,7 @@ mod tests { ); assert!( - actual_state_updates.declared_sierra_classes.get(&fee_token.class_hash).is_none(), + !actual_state_updates.declared_sierra_classes.contains_key(&fee_token.class_hash), "The default fee token class doesnt have a sierra class" ); @@ -553,7 +553,7 @@ mod tests { ); assert!( - actual_state_updates.declared_sierra_classes.get(&ud.class_hash).is_none(), + !actual_state_updates.declared_sierra_classes.contains_key(&ud.class_hash), "The default universal deployer class doesnt have a sierra class" ); diff --git a/crates/katana/storage/provider/src/providers/fork/state.rs b/crates/katana/storage/provider/src/providers/fork/state.rs index 793dc540d2..83e099c28e 100644 --- a/crates/katana/storage/provider/src/providers/fork/state.rs +++ b/crates/katana/storage/provider/src/providers/fork/state.rs @@ -188,7 +188,7 @@ impl StateProvider for ForkedSnapshot { impl ContractClassProvider for ForkedSnapshot { fn sierra_class(&self, hash: ClassHash) -> ProviderResult> { - if self.inner.compiled_class_hashes.get(&hash).is_some() { + if self.inner.compiled_class_hashes.contains_key(&hash) { Ok(self.classes.sierra_classes.read().get(&hash).cloned()) } else { ContractClassProvider::sierra_class(&self.inner.db, hash) @@ -206,7 +206,7 @@ impl ContractClassProvider for ForkedSnapshot { } fn class(&self, hash: ClassHash) -> ProviderResult> { - if self.inner.compiled_class_hashes.get(&hash).is_some() { + if self.inner.compiled_class_hashes.contains_key(&hash) { Ok(self.classes.compiled_classes.read().get(&hash).cloned()) } else { ContractClassProvider::class(&self.inner.db, hash) diff --git a/crates/sozo/ops/src/migration/migrate.rs b/crates/sozo/ops/src/migration/migrate.rs index 420c269237..1ab610e24e 100644 --- a/crates/sozo/ops/src/migration/migrate.rs +++ b/crates/sozo/ops/src/migration/migrate.rs @@ -781,7 +781,7 @@ pub async fn update_manifests_and_abis( }; local_manifest.world.inner.address = Some(world_address); - local_manifest.world.inner.seed = salt.to_owned(); + salt.clone_into(&mut local_manifest.world.inner.seed); // when the migration has not been applied because in `plan` mode or because of an error, // the `migration_output` is empty. diff --git a/crates/sozo/ops/src/migration/mod.rs b/crates/sozo/ops/src/migration/mod.rs index 21351004a2..915fb5fa5e 100644 --- a/crates/sozo/ops/src/migration/mod.rs +++ b/crates/sozo/ops/src/migration/mod.rs @@ -172,11 +172,13 @@ where Ok(()) } +#[allow(dead_code)] enum ContractDeploymentOutput { AlreadyDeployed(FieldElement), Output(DeployOutput), } +#[allow(dead_code)] enum ContractUpgradeOutput { Output(UpgradeOutput), } diff --git a/crates/torii/core/src/model.rs b/crates/torii/core/src/model.rs index fff8ae6c53..39a28aad14 100644 --- a/crates/torii/core/src/model.rs +++ b/crates/torii/core/src/model.rs @@ -474,7 +474,7 @@ pub fn map_row_to_ty( let option = row.try_get::(&column_name)?; enum_ty.set_option(&option)?; - let path = [path, &name].join("$"); + let path = [path, name].join("$"); for option in &mut enum_ty.options { map_row_to_ty(&path, &option.name, &mut option.ty, row, arrays_rows)?; } @@ -483,21 +483,21 @@ pub fn map_row_to_ty( // struct can be the main entrypoint to our model schema // so we dont format the table name if the path is empty let path = - if path.is_empty() { struct_ty.name.clone() } else { [path, &name].join("$") }; + if path.is_empty() { struct_ty.name.clone() } else { [path, name].join("$") }; for member in &mut struct_ty.children { map_row_to_ty(&path, &member.name, &mut member.ty, row, arrays_rows)?; } } Ty::Tuple(ty) => { - let path = [path, &name].join("$"); + let path = [path, name].join("$"); for (i, member) in ty.iter_mut().enumerate() { map_row_to_ty(&path, &format!("_{}", i), member, row, arrays_rows)?; } } Ty::Array(ty) => { - let path = [path, &name].join("$"); + let path = [path, name].join("$"); // filter by entity id in case we have multiple entities let rows = arrays_rows .get(&path) diff --git a/crates/torii/graphql/src/tests/mod.rs b/crates/torii/graphql/src/tests/mod.rs index ddfc8fa182..4a39faae1d 100644 --- a/crates/torii/graphql/src/tests/mod.rs +++ b/crates/torii/graphql/src/tests/mod.rs @@ -180,6 +180,7 @@ pub struct Content { pub socials: Vec, } +#[allow(dead_code)] #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub struct Metadata { diff --git a/crates/torii/libp2p/src/client/events.rs b/crates/torii/libp2p/src/client/events.rs index 120caa3376..d47a2e5330 100644 --- a/crates/torii/libp2p/src/client/events.rs +++ b/crates/torii/libp2p/src/client/events.rs @@ -1,6 +1,7 @@ use gossipsub::Event as GossipsubEvent; use libp2p::{gossipsub, identify, ping}; +#[allow(dead_code)] #[derive(Debug)] pub(crate) enum ClientEvent { Gossipsub(GossipsubEvent), diff --git a/crates/torii/libp2p/src/server/mod.rs b/crates/torii/libp2p/src/server/mod.rs index 4a78db033b..83803a55ab 100644 --- a/crates/torii/libp2p/src/server/mod.rs +++ b/crates/torii/libp2p/src/server/mod.rs @@ -601,7 +601,7 @@ pub fn parse_value_to_ty(value: &PrimitiveType, ty: &mut Ty) -> Result<(), Error } }, Ty::ByteArray(s) => { - *s = string.clone(); + s.clone_from(string); } _ => { return Err(Error::InvalidMessageError(format!(