Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Lohachov Mykhailo <[email protected]>
  • Loading branch information
aoyako committed Dec 7, 2024
1 parent 07cb9fe commit 2c14c7f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
12 changes: 5 additions & 7 deletions crates/iroha/tests/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,11 @@ fn upgrade_executor(client: &Client, executor: impl AsRef<str>) -> Result<()> {
let profile = load_wasm_build_profile();

if !profile.is_optimized() {
client.submit_all_blocking::<InstructionBox>([
InstructionBox::SetParameter(SetParameter::new(
Parameter::Executor(SmartContractParameter::Fuel(
std::num::NonZeroU64::new(80_000_000_u64).expect("Fuel must be positive."),
))
))
])?;
client.submit_all_blocking::<InstructionBox>([InstructionBox::SetParameter(
SetParameter::new(Parameter::Executor(SmartContractParameter::Fuel(
std::num::NonZeroU64::new(80_000_000_u64).expect("Fuel must be positive."),
))),
)])?;
}

client.submit_blocking(upgrade_executor)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/iroha_core/src/smartcontracts/wasm/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{

/// Executor related things (linker initialization, module instantiation, memory free)
/// takes significant amount of time in case of single peer transactions handling.
/// (https://github.com/hyperledger/iroha/issues/3716#issuecomment-2348417005).
/// (https://github.com/hyperledger-iroha/iroha/issues/3716#issuecomment-2348417005).
/// So this cache is used to share `Store` and `Instance` for different transaction validation.
#[derive(Default)]
pub struct WasmCache<'world, 'block, 'state> {
Expand Down
18 changes: 11 additions & 7 deletions crates/iroha_test_samples/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Utility crate for standardized and random signatories.
use std::{
fs,
io::Read,
path::{Path, PathBuf},
sync::LazyLock,
Expand All @@ -9,7 +10,6 @@ use std::{
use iroha_crypto::KeyPair;
use iroha_data_model::prelude::{AccountId, WasmSmartContract};
use iroha_wasm_builder::Profile;
use std::fs;

/// Generate [`AccountId`](iroha_data_model::account::AccountId) in the given `domain`.
///
Expand Down Expand Up @@ -150,11 +150,15 @@ pub fn load_wasm_build_profile() -> Profile {
panic!("could not read WASM build profile");
}
Ok(content) => {
let parsed: toml::Value = toml::from_str(content.as_str()).expect("must parse config file");
let profile_str = parsed.get("profile")
.and_then(toml::Value::as_str)
.expect("profile must be present in config");
profile_str.parse().expect(format!("unrecognized profile {profile_str}").as_str())
let parsed: toml::Value =
toml::from_str(content.as_str()).expect("must parse config file");
let profile_str = parsed
.get("profile")
.and_then(toml::Value::as_str)
.expect("profile must be present in config");
profile_str
.parse()
.unwrap_or_else(|_| panic!("unrecognized profile {profile_str}"))
}
}
}
}
6 changes: 3 additions & 3 deletions crates/iroha_wasm_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub enum Profile {
impl Profile {
/// Checks whether profile uses optimizations from wasm-opt
pub fn is_optimized(self) -> bool {
return self == Profile::Deploy;
self == Profile::Deploy
}
}

Expand All @@ -40,7 +40,7 @@ impl Profile {
///
/// ```no_run
/// use eyre::Result;
/// use iroha_wasm_builder::Builder;
/// use iroha_wasm_builder::{Builder, Profile};
///
/// fn main() -> Result<()> {
/// let bytes = Builder::new("relative/path/to/smartcontract/", Profile::Deploy)
Expand Down Expand Up @@ -223,7 +223,7 @@ mod internal {
}

fn build_profile(&self) -> String {
return format!("--profile={}", self.profile.clone());
format!("--profile={}", self.profile.clone())
}

fn build_options() -> impl Iterator<Item = &'static str> {
Expand Down

0 comments on commit 2c14c7f

Please sign in to comment.