Skip to content

Commit

Permalink
fix: update porfile parsing
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 40416e0 commit 0cba0b8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
1 change: 0 additions & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
retries = { backoff = "fixed", count = 3, delay = "3s" }

[profile.ci]
retries = { backoff = "fixed", count = 3, delay = "3s" }
fail-fast = false
failure-output = "immediate-final"
slow-timeout = { period = "30s", terminate-after = 4 }
Expand Down
16 changes: 10 additions & 6 deletions crates/iroha_core/src/sumeragi/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,17 @@ impl Sumeragi {
}
};

if let Some(error) = block.as_ref().errors().next() {
error!(
peer_id=%self.peer,
role=%self.role(),
?error
);
let mut errors = block.as_ref().errors().peekable();
if errors.peek().is_some() {
error!("Genesis contains invalid transactions");

for error in block.as_ref().errors() {
error!(
peer_id=%self.peer,
role=%self.role(),
?error
);
}
continue;
}

Expand Down
13 changes: 3 additions & 10 deletions crates/iroha_wasm_builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Profile {
/// use iroha_wasm_builder::Builder;
///
/// fn main() -> Result<()> {
/// let bytes = Builder::new("relative/path/to/smartcontract/", "deploy")
/// let bytes = Builder::new("relative/path/to/smartcontract/", Profile::Deploy)
/// .out_dir("path/to/out/dir") // Optional: Set output directory
/// .build()? // Run build
/// .into_bytes()?; // Get resulting WASM bytes
Expand Down Expand Up @@ -214,19 +214,12 @@ mod internal {

pub fn build(self) -> Result<Output> {
let absolute_path = self.absolute_path.clone();
let optimize = Profile::is_optimized(self.profile);
let output = self.build_smartcontract().wrap_err_with(|| {
self.build_smartcontract().wrap_err_with(|| {
format!(
"Failed to build the smartcontract at path: {}",
absolute_path.display()
)
})?;

if optimize {
output.optimize()
} else {
Ok(output)
}
})
}

fn build_profile(&self) -> String {
Expand Down
6 changes: 2 additions & 4 deletions crates/iroha_wasm_builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ enum Cli {
#[command(flatten)]
common: CommonArgs,
#[arg(long, default_value = "release")]
profile: String,
profile: Profile,
},
/// Build the smartcontract
Build {
#[command(flatten)]
common: CommonArgs,
/// Build profile
#[arg(long, default_value = "release")]
profile: String,
profile: Profile,
/// Where to store the output WASM. If the file exists, it will be overwritten.
#[arg(long)]
out_file: PathBuf,
Expand All @@ -42,7 +42,6 @@ fn main() -> color_eyre::Result<()> {
common: CommonArgs { path },
profile,
} => {
let profile: Profile = profile.parse().expect("Invalid profile provided");
let builder = Builder::new(&path, profile).show_output();
builder.check()?;
}
Expand All @@ -51,7 +50,6 @@ fn main() -> color_eyre::Result<()> {
out_file,
profile,
} => {
let profile: Profile = profile.parse().expect("Invalid profile provided");
let builder = Builder::new(&path, profile).show_output();

let output = {
Expand Down

0 comments on commit 0cba0b8

Please sign in to comment.