mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 00:03:10 +00:00
Clippy
This commit is contained in:
parent
c276596092
commit
17ed6a2b04
@ -87,7 +87,7 @@ impl<F: RichField + Extendable<D>, const D: usize> ProofWithPublicInputs<F, D> {
|
|||||||
|
|
||||||
pub fn to_bytes(&self) -> anyhow::Result<Vec<u8>> {
|
pub fn to_bytes(&self) -> anyhow::Result<Vec<u8>> {
|
||||||
let mut buffer = Buffer::new(Vec::new());
|
let mut buffer = Buffer::new(Vec::new());
|
||||||
buffer.write_proof_with_public_inputs(&self)?;
|
buffer.write_proof_with_public_inputs(self)?;
|
||||||
Ok(buffer.bytes())
|
Ok(buffer.bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CompressedProofWithPublicInpu
|
|||||||
|
|
||||||
pub fn to_bytes(&self) -> anyhow::Result<Vec<u8>> {
|
pub fn to_bytes(&self) -> anyhow::Result<Vec<u8>> {
|
||||||
let mut buffer = Buffer::new(Vec::new());
|
let mut buffer = Buffer::new(Vec::new());
|
||||||
buffer.write_compressed_proof_with_public_inputs(&self)?;
|
buffer.write_compressed_proof_with_public_inputs(self)?;
|
||||||
Ok(buffer.bytes())
|
Ok(buffer.bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,21 +1,18 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use std::fmt;
|
|
||||||
use std::io::Cursor;
|
use std::io::Cursor;
|
||||||
use std::io::{Error, ErrorKind, Read, Result, Write};
|
use std::io::{Read, Result, Write};
|
||||||
use std::iter::FromIterator;
|
use std::iter::FromIterator;
|
||||||
|
|
||||||
use crate::field::crandall_field::CrandallField;
|
|
||||||
use crate::field::extension_field::quartic::QuarticExtension;
|
|
||||||
use crate::field::extension_field::{Extendable, FieldExtension};
|
use crate::field::extension_field::{Extendable, FieldExtension};
|
||||||
use crate::field::field_types::{Field, PrimeField, RichField};
|
use crate::field::field_types::{PrimeField, RichField};
|
||||||
use crate::fri::proof::{
|
use crate::fri::proof::{
|
||||||
CompressedFriProof, CompressedFriQueryRounds, FriInitialTreeProof, FriProof, FriQueryRound,
|
CompressedFriProof, CompressedFriQueryRounds, FriInitialTreeProof, FriProof, FriQueryRound,
|
||||||
FriQueryStep,
|
FriQueryStep,
|
||||||
};
|
};
|
||||||
use crate::hash::hash_types::HashOut;
|
use crate::hash::hash_types::HashOut;
|
||||||
use crate::hash::merkle_proofs::MerkleProof;
|
use crate::hash::merkle_proofs::MerkleProof;
|
||||||
use crate::hash::merkle_tree::{MerkleCap, MerkleTree};
|
use crate::hash::merkle_tree::MerkleCap;
|
||||||
use crate::plonk::circuit_data::{CircuitConfig, CommonCircuitData};
|
use crate::plonk::circuit_data::{CircuitConfig, CommonCircuitData};
|
||||||
use crate::plonk::proof::{
|
use crate::plonk::proof::{
|
||||||
CompressedProof, CompressedProofWithPublicInputs, OpeningSet, Proof, ProofWithPublicInputs,
|
CompressedProof, CompressedProofWithPublicInputs, OpeningSet, Proof, ProofWithPublicInputs,
|
||||||
@ -119,9 +116,9 @@ impl Buffer {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
fn read_field_vec<F: PrimeField>(&mut self, length: usize) -> Result<Vec<F>> {
|
fn read_field_vec<F: PrimeField>(&mut self, length: usize) -> Result<Vec<F>> {
|
||||||
Ok((0..length)
|
(0..length)
|
||||||
.map(|_| self.read_field())
|
.map(|_| self.read_field())
|
||||||
.collect::<Result<Vec<_>>>()?)
|
.collect::<Result<Vec<_>>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_field_ext_vec<F: Extendable<D>, const D: usize>(
|
fn write_field_ext_vec<F: Extendable<D>, const D: usize>(
|
||||||
@ -137,9 +134,9 @@ impl Buffer {
|
|||||||
&mut self,
|
&mut self,
|
||||||
length: usize,
|
length: usize,
|
||||||
) -> Result<Vec<F::Extension>> {
|
) -> Result<Vec<F::Extension>> {
|
||||||
Ok((0..length)
|
(0..length)
|
||||||
.map(|_| self.read_field_ext::<F, D>())
|
.map(|_| self.read_field_ext::<F, D>())
|
||||||
.collect::<Result<Vec<_>>>()?)
|
.collect::<Result<Vec<_>>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn write_opening_set<F: Extendable<D>, const D: usize>(
|
fn write_opening_set<F: Extendable<D>, const D: usize>(
|
||||||
@ -187,7 +184,7 @@ impl Buffer {
|
|||||||
length
|
length
|
||||||
.try_into()
|
.try_into()
|
||||||
.expect("Merkle proof length must fit in u8."),
|
.expect("Merkle proof length must fit in u8."),
|
||||||
);
|
)?;
|
||||||
for &h in &p.siblings {
|
for &h in &p.siblings {
|
||||||
self.write_hash(h)?;
|
self.write_hash(h)?;
|
||||||
}
|
}
|
||||||
@ -278,7 +275,7 @@ impl Buffer {
|
|||||||
config: &CircuitConfig,
|
config: &CircuitConfig,
|
||||||
) -> Result<Vec<FriQueryRound<F, D>>> {
|
) -> Result<Vec<FriQueryRound<F, D>>> {
|
||||||
let mut fqrs = Vec::with_capacity(config.fri_config.num_query_rounds);
|
let mut fqrs = Vec::with_capacity(config.fri_config.num_query_rounds);
|
||||||
for i in 0..config.fri_config.num_query_rounds {
|
for _ in 0..config.fri_config.num_query_rounds {
|
||||||
let initial_trees_proof = self.read_fri_initial_proof(common_data, config)?;
|
let initial_trees_proof = self.read_fri_initial_proof(common_data, config)?;
|
||||||
let steps = config
|
let steps = config
|
||||||
.fri_config
|
.fri_config
|
||||||
@ -413,7 +410,7 @@ impl Buffer {
|
|||||||
.map(|_| self.read_u32().map(|i| i as usize))
|
.map(|_| self.read_u32().map(|i| i as usize))
|
||||||
.collect::<Result<Vec<_>>>()?;
|
.collect::<Result<Vec<_>>>()?;
|
||||||
let mut indices = original_indices.clone();
|
let mut indices = original_indices.clone();
|
||||||
indices.sort();
|
indices.sort_unstable();
|
||||||
indices.dedup();
|
indices.dedup();
|
||||||
let mut pairs = Vec::new();
|
let mut pairs = Vec::new();
|
||||||
for &i in &indices {
|
for &i in &indices {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user