Skip to content

Commit

Permalink
chore: remove unused args
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench committed Feb 28, 2025
1 parent 7a8cb30 commit 2f3f53e
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 22 deletions.
18 changes: 1 addition & 17 deletions tooling/artifact_cli/src/commands/execute_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,9 @@ pub struct ExecuteCommand {
#[clap(long)]
pub contract_fn: Option<String>,

/// Part to the Oracle.toml file which contains the Oracle transcript,
/// which is a list of responses captured during an earlier execution.
///
/// Note that a transcript might be invalid if the inputs change and
/// the circuit takes a different path during execution.
#[clap(long, conflicts_with = "oracle_resolver")]
pub oracle_file: Option<String>,

/// JSON RPC url to solve oracle calls.
#[clap(long, conflicts_with = "oracle_file")]
pub oracle_resolver: Option<String>,

/// Root directory for the RPC oracle resolver.
#[clap(long, value_parser = parse_and_normalize_path)]
pub oracle_root_dir: Option<PathBuf>,

/// Package name for the RPC oracle resolver
#[clap(long)]
pub oracle_package_name: Option<String>,
pub oracle_resolver: Option<String>,

/// Use pedantic ACVM solving, i.e. double-check some black-box function assumptions when solving.
#[clap(long, default_value_t = false)]
Expand Down
3 changes: 0 additions & 3 deletions tooling/nargo_cli/src/cli/execute_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ pub(crate) fn run(args: ExecuteCommand, workspace: Workspace) -> Result<(), CliE
args.witness_name.clone().unwrap_or_else(|| package.name.to_string()),
),
contract_fn: None,
oracle_file: None,
oracle_resolver: args.oracle_resolver.clone(),
oracle_root_dir: Some(workspace.root_dir.clone()),
oracle_package_name: Some(package.name.to_string()),
pedantic_solving: args.compile_options.pedantic_solving,
};

Expand Down
113 changes: 111 additions & 2 deletions tooling/noirc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,92 @@ pub fn display_abi_error<F: AcirField>(
}

#[cfg(test)]
mod test {
mod abi_tests {
use std::collections::BTreeMap;

use proptest::prelude::*;

use crate::arbitrary::arb_abi_and_input_map;
use crate::{
Abi, AbiParameter, AbiReturnType, AbiType, AbiVisibility, arbitrary::arb_abi_and_input_map,
};

#[test]
fn is_empty_returns_expected_value() {
let param = AbiParameter {
name: "foo".to_owned(),
typ: AbiType::Field,
visibility: AbiVisibility::Private,
};
let abi =
Abi { parameters: vec![param], return_type: None, error_types: BTreeMap::default() };
assert!(!abi.is_empty());

let empty_abi =
Abi { parameters: Vec::new(), return_type: None, error_types: BTreeMap::default() };
assert!(empty_abi.is_empty());
}

#[test]
fn has_public_inputs_returns_expected_value() {
// Private input
let private_param = AbiParameter {
name: "foo".to_owned(),
typ: AbiType::Field,
visibility: AbiVisibility::Public,
};
let abi = Abi {
parameters: vec![private_param],
return_type: None,
error_types: BTreeMap::default(),
};
assert!(abi.has_public_inputs());

// Public input
let public_param = AbiParameter {
name: "foo".to_owned(),
typ: AbiType::Field,
visibility: AbiVisibility::Private,
};
let abi = Abi {
parameters: vec![public_param],
return_type: None,
error_types: BTreeMap::default(),
};
assert!(!abi.has_public_inputs());

// Public output
let abi = Abi {
parameters: Vec::new(),
return_type: Some(AbiReturnType {
abi_type: AbiType::Field,
visibility: AbiVisibility::Public,
}),
error_types: BTreeMap::default(),
};
assert!(abi.has_public_inputs());

// Private output (not valid!)
let abi = Abi {
parameters: Vec::new(),
return_type: Some(AbiReturnType {
abi_type: AbiType::Field,
visibility: AbiVisibility::Private,
}),
error_types: BTreeMap::default(),
};
assert!(!abi.has_public_inputs());

// Databus output
let abi = Abi {
parameters: Vec::new(),
return_type: Some(AbiReturnType {
abi_type: AbiType::Field,
visibility: AbiVisibility::DataBus,
}),
error_types: BTreeMap::default(),
};
assert!(!abi.has_public_inputs());
}

proptest! {
#[test]
Expand All @@ -520,3 +602,30 @@ mod test {
}
}
}

#[cfg(test)]
mod abi_param_tests {
use crate::{AbiParameter, AbiType, AbiVisibility};

#[test]
fn is_public_returns_expected_value() {
let public_param = AbiParameter {
name: "foo".to_owned(),
typ: AbiType::Field,
visibility: AbiVisibility::Public,
};
assert!(public_param.is_public());
let private_param = AbiParameter {
name: "foo".to_owned(),
typ: AbiType::Field,
visibility: AbiVisibility::Private,
};
assert!(!private_param.is_public());
let databus_param = AbiParameter {
name: "foo".to_owned(),
typ: AbiType::Field,
visibility: AbiVisibility::DataBus,
};
assert!(!databus_param.is_public());
}
}

0 comments on commit 2f3f53e

Please sign in to comment.