Skip to content

Commit dc577b6

Browse files
committed
Fixed lint issues
1 parent 40ffb43 commit dc577b6

File tree

14 files changed

+42
-47
lines changed

14 files changed

+42
-47
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6464
- Use consistent `use` statements for fields. Replace `mina_hasher::Fp` with
6565
`mina_curves::pasta::Fp`.
6666
([#1269](https://github.com/o1-labs/openmina/pull/1269/)).
67+
- **Proof systems**: Updated proof systems to use same version as Ocaml node
6768
- **CI**: set fail-fast to false to prevent cancellation of other jobs
6869
([#1305](https://github.com/o1-labs/openmina/pull/1305))
6970

ledger/src/account/account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl TokenSymbol {
128128

129129
let value = FromBytes::read(&s[..]).expect("Shoudn't fail");
130130
let bigint = BigInteger256::new(value);
131-
F::try_from(bigint).unwrap() // Never fail, `self` contain 6 bytes at most
131+
F::from(bigint) // Never fail, `self` contain 6 bytes at most
132132
}
133133
}
134134

ledger/src/proofs/block.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ mod floating_point {
501501

502502
pub fn constant(value: &BigInteger256, precision: usize) -> anyhow::Result<Self> {
503503
Ok(Self {
504-
value: (*value).try_into()?,
504+
value: (*value).into(),
505505
precision,
506506
})
507507
}
@@ -1881,10 +1881,10 @@ pub(super) fn generate_block_proof(
18811881
};
18821882

18831883
let dlog_plonk_index = super::merge::dlog_plonk_index(block_wrap_prover);
1884-
let verifier_index = &*block_wrap_prover.index.verifier_index.as_ref().unwrap();
1884+
let verifier_index = block_wrap_prover.index.verifier_index.as_ref().unwrap();
18851885

18861886
let tx_dlog_plonk_index = super::merge::dlog_plonk_index(tx_wrap_prover);
1887-
let tx_verifier_index = &*tx_wrap_prover.index.verifier_index.as_ref().unwrap();
1887+
let tx_verifier_index = tx_wrap_prover.index.verifier_index.as_ref().unwrap();
18881888

18891889
let dlog_plonk_index_cvar = dlog_plonk_index.to_cvar(CircuitVar::Var);
18901890
let tx_dlog_plonk_index_cvar = tx_dlog_plonk_index.to_cvar(CircuitVar::Constant);

ledger/src/proofs/caching.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,7 @@ where
221221
let lagrange_bases = srs
222222
.lagrange_bases
223223
.iter()
224-
.map(|(key, value)| {
225-
(
226-
*key,
227-
value.iter().map(|poly| PolyComm::from(poly)).collect(),
228-
)
229-
})
224+
.map(|(key, value)| (*key, value.iter().map(PolyComm::from).collect()))
230225
.collect();
231226

232227
HashMapCache::new_from_hashmap(lagrange_bases)
@@ -452,7 +447,6 @@ impl From<&VerifierIndexCached> for VerifierIndex<Fq> {
452447
domain: domain.into(),
453448
max_poly_size: *max_poly_size,
454449
srs: {
455-
let srs = srs;
456450
let s: SRS<_> = SRS::from(srs);
457451
Arc::new(s)
458452
},

ledger/src/proofs/field.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl FromFpFq for Fq {
143143
fn from_fp(fp: Fp) -> Self {
144144
// `Fp` is smaller than `Fq`, so the conversion is fine
145145
let bigint: BigInteger256 = fp.into();
146-
bigint.try_into().unwrap()
146+
Self::from(bigint)
147147
}
148148
fn from_fq(fq: Fq) -> Self {
149149
fq

ledger/src/proofs/merge.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ fn merge_main(
9595
}
9696

9797
pub fn dlog_plonk_index(wrap_prover: &Prover<Fq>) -> PlonkVerificationKeyEvals<Fp> {
98-
PlonkVerificationKeyEvals::from(&*wrap_prover.index.verifier_index.as_ref().unwrap())
98+
PlonkVerificationKeyEvals::from(wrap_prover.index.verifier_index.as_ref().unwrap())
9999
}
100100

101101
impl From<&v2::PicklesProofProofsVerified2ReprStableV2StatementProofStateDeferredValuesPlonkFeatureFlags> for crate::proofs::step::FeatureFlags::<bool> {
@@ -260,7 +260,7 @@ pub(super) fn generate_merge_proof(
260260

261261
let dlog_plonk_index = dlog_plonk_index(wrap_prover);
262262
let dlog_plonk_index_cvar = dlog_plonk_index.to_cvar(CircuitVar::Var);
263-
let verifier_index = &*wrap_prover.index.verifier_index.as_ref().unwrap();
263+
let verifier_index = wrap_prover.index.verifier_index.as_ref().unwrap();
264264

265265
let tx_data = make_step_transaction_data(&dlog_plonk_index_cvar);
266266
let for_step_datas = [&tx_data, &tx_data];

ledger/src/proofs/public_input/prepared_statement.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl PreparedStatement {
9191

9292
let to_fq = |fp: Fp| -> Fq {
9393
let bigint: BigInteger256 = fp.into();
94-
bigint.try_into().unwrap() // Never fail, `Fq` is larger than `Fp`
94+
Fq::from(bigint) // Never fail, `Fq` is larger than `Fp`
9595
};
9696

9797
// Fp
@@ -226,7 +226,7 @@ impl PreparedStatement {
226226

227227
let to_fq = |fp: Fp| -> Fq {
228228
let bigint: BigInteger256 = fp.into();
229-
bigint.try_into().unwrap() // Never fail, `Fq` is larger than `Fp`
229+
Fq::from(bigint) // Never fail, `Fq` is larger than `Fp`
230230
};
231231

232232
let var = |x| Packed::Field(CircuitVar::Var(x));

ledger/src/proofs/public_input/scalars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ where
5050

5151
let value = FromBytes::read(&bytes[..]).expect("Should not fail");
5252
let bigint = BigInteger256::new(value);
53-
bigint.try_into().unwrap() // Never fail, we hardcode them with string literals
53+
F::from(bigint) // Never fail, we hardcode them with string literals
5454
}
5555

5656
fn field<F: FieldWitness>(s: &str) -> F {

ledger/src/proofs/step.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ pub mod step_verifier {
10671067
let v = if s_odd { s - F2::one() } else { s };
10681068
// TODO: Remove this ugly hack
10691069
let v: BigInteger256 = (v / F2::from(2u64)).into();
1070-
(F::try_from(v).unwrap(), s_odd.to_boolean()) // `unwrap` never fail
1070+
(F::from(v), s_odd.to_boolean()) // `unwrap` never fail
10711071
});
10721072

10731073
scale_fast2(g, s_parts, num_bits, w)

ledger/src/proofs/transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3686,7 +3686,7 @@ pub fn messages_for_next_wrap_proof_padding() -> Fp {
36863686
old_bulletproof_challenges: vec![], // Filled with padding, in `hash()` below
36873687
};
36883688
let hash: [u64; 4] = msg.hash();
3689-
Fp::try_from(BigInteger256::new(hash)).unwrap() // Never fail
3689+
Fp::from(BigInteger256::new(hash)) // Never fail
36903690
})
36913691
}
36923692

@@ -4247,7 +4247,7 @@ pub(super) fn generate_tx_proof(
42474247
let statement_with_sok = statement.with_digest(sok_digest);
42484248

42494249
let dlog_plonk_index =
4250-
PlonkVerificationKeyEvals::from(&*tx_wrap_prover.index.verifier_index.as_ref().unwrap());
4250+
PlonkVerificationKeyEvals::from(tx_wrap_prover.index.verifier_index.as_ref().unwrap());
42514251

42524252
let statement_with_sok = Rc::new(w.exists(statement_with_sok));
42534253
transaction_snark::main(&statement_with_sok, tx_witness, w)?;

0 commit comments

Comments
 (0)