Skip to content

Commit

Permalink
cargo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mason Liang committed Oct 31, 2023
1 parent cd572d4 commit b024f00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
26 changes: 5 additions & 21 deletions src/gadgets/mpt_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ pub use path::PathType;
use segment::SegmentType;

use super::{
byte_representation::BytesLookup,
canonical_representation::{FrHiLoLookup, FrRlcLookup},
is_zero::IsZeroGadget,
key_bit::KeyBitLookup,
one_hot::OneHot,
poseidon::PoseidonLookup,
byte_representation::BytesLookup, canonical_representation::FrHiLoLookup,
is_zero::IsZeroGadget, key_bit::KeyBitLookup, one_hot::OneHot, poseidon::PoseidonLookup,
};
use crate::{
constraint_builder::{
Expand All @@ -21,15 +17,13 @@ use crate::{
trie::{next_domain, TrieRows},
ClaimKind, HashDomain, Proof,
},
util::{
account_key, domain_hash, fr_to_u256, lagrange_polynomial, rlc, u256_hi_lo, u256_to_fr,
},
util::{account_key, domain_hash, fr_to_u256, lagrange_polynomial, u256_hi_lo, u256_to_fr},
MPTProofType,
};
use ethers_core::types::Address;
use halo2_proofs::{
arithmetic::{Field, FieldExt},
circuit::{Region, Value},
circuit::Region,
halo2curves::{bn256::Fr, group::ff::PrimeField},
plonk::ConstraintSystem,
};
Expand Down Expand Up @@ -91,12 +85,8 @@ impl<F: FieldExt> MptUpdateLookup<F> for MptUpdateConfig {
let storage_key_lo = self.storage_key.lo().current() * is_start();
let old_root_hi = old_root_hi.current() * is_start();
let old_root_lo = old_root_lo.current() * is_start();
// let old_root_lo = self.old_hash.current()
// - old_root_hi.current() * Query::from(1u64 << 32).square().square() * is_start();
let new_root_hi = new_root_hi.current() * is_start();
let new_root_lo = new_root_lo.current() * is_start();
// let new_root_lo = self.new_hash.current()
// - new_root_hi.current() * Query::from(1u64 << 32).square().square() * is_start();
[
is_start().into(),
address,
Expand All @@ -122,7 +112,6 @@ impl MptUpdateConfig {
poseidon: &impl PoseidonLookup,
key_bit: &impl KeyBitLookup,
bytes: &impl BytesLookup,
fr_rlc: &impl FrRlcLookup,
fr_hi_lo: &impl FrHiLoLookup,
) -> Self {
let proof_type: OneHot<MPTProofType> = OneHot::configure(cs, cb);
Expand Down Expand Up @@ -356,12 +345,7 @@ impl MptUpdateConfig {
}

/// ..
pub fn assign(
&self,
region: &mut Region<'_, Fr>,
proofs: &[Proof],
randomness: Value<Fr>,
) -> usize {
pub fn assign(&self, region: &mut Region<'_, Fr>, proofs: &[Proof]) -> usize {
let mut n_rows = 0;
let mut offset = 1; // selector on first row is disabled.
for proof in proofs {
Expand Down
3 changes: 1 addition & 2 deletions src/mpt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ impl MptCircuitConfig {
&key_bit,
&byte_representation,
&canonical_representation,
&canonical_representation,
);

// This ensures that the final mpt update in the circuit is complete, since the padding
Expand Down Expand Up @@ -158,7 +157,7 @@ impl MptCircuitConfig {
randomness,
);

let n_assigned_rows = self.mpt_update.assign(&mut region, proofs, randomness);
let n_assigned_rows = self.mpt_update.assign(&mut region, proofs);

assert!(
2 + n_assigned_rows <= n_rows,
Expand Down

0 comments on commit b024f00

Please sign in to comment.