Skip to content

Commit

Permalink
Merge pull request #22 from RedaOps/clippy
Browse files Browse the repository at this point in the history
Fix Clippy + comments from previous PR
  • Loading branch information
mimoo authored Jan 27, 2024
2 parents 19405dc + 3e71725 commit 601b6a4
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -D warnings
args: --all-features -- -D warnings -A clippy::absurd_extreme_comparisons
6 changes: 3 additions & 3 deletions src/bin/zkbtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ async fn main() -> Result<()> {

info!(
"deploying circuit {} with {num_public_inputs} public inputs",
hex::encode(&vk_hash)
hex::encode(vk_hash)
);

// sanity check for stateful zkapps
Expand Down Expand Up @@ -421,7 +421,7 @@ async fn main() -> Result<()> {
{
let path = output_dir.join("publickey-package.json");
let file =
std::fs::File::create(&path).expect("couldn't create file given output dir");
std::fs::File::create(path).expect("couldn't create file given output dir");
serde_json::to_writer_pretty(file, &pubkey_package).unwrap();
}

Expand All @@ -445,7 +445,7 @@ async fn main() -> Result<()> {
};
let path = output_dir.join("committee-cfg.json");
let file =
std::fs::File::create(&path).expect("couldn't create file given output dir");
std::fs::File::create(path).expect("couldn't create file given output dir");
serde_json::to_writer_pretty(file, &committee_cfg).unwrap();
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/bob_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl BobRequest {
// extract new_state
let new_state = public_inputs
.0
.get(0)
.first()
.cloned()
.context("the full public input does not contain a new state")?;

Expand Down Expand Up @@ -196,13 +196,13 @@ impl BobRequest {
let amount_in = string_to_amount(
proof_inputs
.get("amount_in")
.and_then(|x| x.get(0))
.and_then(|x| x.first())
.context("amount_in in proof inputs must be of length 1")?,
)?;
let amount_out = string_to_amount(
proof_inputs
.get("amount_out")
.and_then(|x| x.get(0))
.and_then(|x| x.first())
.context("amount_out in proof inputs must be of length 1")?,
)?;
let new_value = smart_contract.locked_value + amount_in - amount_out;
Expand Down Expand Up @@ -284,7 +284,7 @@ impl BobRequest {
let new_state = new_state.unwrap();
ensure!(
public_inputs.0.len()
== 1 * 2 /* prev/new_state */ + 1 /* truncated txid */ + 1 /* amount_out */ + 1, /* amount_in */
== 2 /* prev/new_state */ + 1 /* truncated txid */ + 1 /* amount_out */ + 1, /* amount_in */
"the number of public inputs is not correct"
);

Expand Down
2 changes: 1 addition & 1 deletion src/committee/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ async fn round_2_signing(
}

async fn is_alive(params: Params<'static>, _context: Arc<NodeState>) -> RpcResult<u64> {
Ok(params.parse::<[u64; 1]>()?[0].clone())
Ok(params.parse::<[u64; 1]>()?[0])
}

//
Expand Down
Loading

0 comments on commit 601b6a4

Please sign in to comment.