Skip to content

Commit

Permalink
chore: Fix regular lints for sgx and pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
petarvujovic98 committed May 17, 2024
1 parent 470beb8 commit 28686c4
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions pipeline/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ impl CommandBuilder {
// ├── build/
// ├── main --> this is the output (same)
// └── bin2 --> this is the output (same)
pub fn build_command(&self, profile: &str, bins: &Vec<String>) -> Executor {
pub fn build_command(&self, profile: &str, bins: &[String]) -> Executor {
let args = vec!["build".to_string()];
let cmd = self.inner_command(args, profile, bins.clone());
let cmd = self.inner_command(args, profile, bins.to_owned());
let target_path: PathBuf = self
.meta
.target_directory
Expand Down Expand Up @@ -362,7 +362,7 @@ fn to_strings(strs: &[&str]) -> Vec<String> {
strs.iter().map(|s| s.to_string()).collect()
}

pub fn format_flags(flag: &str, items: &Vec<String>) -> Vec<String> {
pub fn format_flags(flag: &str, items: &[String]) -> Vec<String> {
let res = items.iter().fold(Vec::new(), |mut res, i| {
res.extend([flag.to_owned(), i.to_owned()]);
res
Expand Down
4 changes: 2 additions & 2 deletions pipeline/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use anyhow::Result;

use crate::ROOT_DIR;
use regex::Regex;
use std::fs::File;
use std::io::BufRead;
use std::{
fs,
Expand All @@ -11,6 +10,7 @@ use std::{
process::{Command, Stdio},
thread,
};
use std::{fs::File, path::Path};

#[derive(Debug)]
pub struct Executor {
Expand Down Expand Up @@ -107,7 +107,7 @@ impl Executor {
}
}

fn file_name(path: &PathBuf) -> String {
fn file_name(path: &Path) -> String {
String::from(path.file_name().unwrap().to_str().unwrap())
}

Expand Down
2 changes: 2 additions & 0 deletions pipeline/src/risc0_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::{

pub const DIGEST_WORDS: usize = 8;

#[allow(dead_code)]
pub fn risc0_data() -> Result<PathBuf> {
let dir = if let Ok(dir) = std::env::var("RISC0_DATA_DIR") {
dir.into()
Expand All @@ -27,6 +28,7 @@ pub struct GuestListEntry {
/// The name of the guest binary
pub name: Cow<'static, str>,
/// The compiled ELF guest binary
#[allow(dead_code)]
pub elf: Cow<'static, [u8]>,
/// The image id of the guest
pub image_id: [u32; DIGEST_WORDS],
Expand Down
1 change: 1 addition & 0 deletions provers/sgx/guest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ raiko-lib = { workspace = true, features = ["sgx"] }
raiko-primitives = { workspace = true }
tokio = { workspace = true }
anyhow = { workspace = true }
thiserror = { workspace = true }
secp256k1 = { workspace = true }
serde = { workspace = true }
rand = { workspace = true }
Expand Down
6 changes: 5 additions & 1 deletion provers/sgx/guest/src/one_shot.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
fs::{self, File, OpenOptions},
io::prelude::*,
io::{prelude::*, Write},
os::unix::fs::PermissionsExt,
path::{Path, PathBuf},
};
Expand Down Expand Up @@ -78,12 +78,16 @@ fn save_bootstrap_details(
Ok(())
}

#[derive(Debug, thiserror::Error)]
pub enum BootStrapError {
// file does not exist
#[error("File does not exist")]
NotExist,
// file exists but has wrong permissions
#[error("File exists but has wrong permissions")]
WithWrongPermissions,
// file exists but could not be read normally due to mrenclave change
#[error("File exists but could not be read normally due to mrenclave change: {0}")]
DecryptionError(String),
}

Expand Down
1 change: 1 addition & 0 deletions provers/sgx/prover/src/sgx_register_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ sol! {
}

#[sol(rpc)]
#[allow(dead_code)]
contract SgxVerifier {
event InstanceAdded(
uint256 indexed id, address indexed instance, address replaced, uint256 validSince
Expand Down

0 comments on commit 28686c4

Please sign in to comment.