Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Clippy + comments from previous PR #22

Merged
merged 2 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to add #[allow(clippy::absurd_Extreme_comparisons)] next to where the the warning is being given :o

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, tried that but there were some issues with the ensure! macro where most absurd checks are being done. For some reason clippy ignored the decoration.

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
Loading