Skip to content

Commit

Permalink
fix: update to insert_account_info
Browse files Browse the repository at this point in the history
  • Loading branch information
han0110 committed Jul 10, 2022
1 parent 7e84b2c commit 6bf26cc
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ jobs:
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --all --all-features -- -D warnings
run: cargo clippy --all --all-features --all-targets -- -D warnings
2 changes: 1 addition & 1 deletion src/loader/evm/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn execute(code: Vec<u8>, calldata: Vec<u8>) -> (bool, u64, Vec<u64>) {
let mut evm = builder.build(Backend::simple());

evm.db
.insert_cache(callee, AccountInfo::new(0.into(), 1, code.into()));
.insert_account_info(callee, AccountInfo::new(0.into(), 1, code.into()));

let result = evm
.call_raw(caller, callee, calldata.into(), 0.into())
Expand Down
16 changes: 0 additions & 16 deletions src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,4 @@ impl<C: Curve> Protocol<C> {
pub fn vanishing_poly(&self) -> usize {
self.preprocessed.len() + self.num_statement + self.num_auxiliary.iter().sum::<usize>()
}

pub fn langranges<T>(&self, statements: &[Vec<T>]) -> impl IntoIterator<Item = i32> {
self.relations
.iter()
.cloned()
.sum::<Expression<_>>()
.used_langrange()
.into_iter()
.chain(
0..statements
.iter()
.map(|statement| statement.len())
.max()
.unwrap_or_default() as i32,
)
}
}
25 changes: 25 additions & 0 deletions src/scheme/kzg.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
use crate::{
protocol::Protocol,
util::{Curve, Expression},
};

mod accumulation;
mod msm;

Expand All @@ -6,3 +11,23 @@ pub use accumulation::{
AccumulationStrategy, Accumulator, SameCurveAccumulation,
};
pub use msm::MSM;

pub fn langranges<C: Curve, T>(
protocol: &Protocol<C>,
statements: &[Vec<T>],
) -> impl IntoIterator<Item = i32> {
protocol
.relations
.iter()
.cloned()
.sum::<Expression<_>>()
.used_langrange()
.into_iter()
.chain(
0..statements
.iter()
.map(|statement| statement.len())
.max()
.unwrap_or_default() as i32,
)
}
3 changes: 2 additions & 1 deletion src/scheme/kzg/accumulation/plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{
protocol::Protocol,
scheme::kzg::{
accumulation::{AccumulationScheme, AccumulationStrategy, Accumulator},
langranges,
msm::MSM,
},
util::{
Expand Down Expand Up @@ -42,7 +43,7 @@ where
let mut common_poly_eval = CommonPolynomialEvaluation::new(
&protocol.domain,
loader,
protocol.langranges(&proof.statements),
langranges(protocol, &proof.statements),
&proof.z,
);

Expand Down
3 changes: 2 additions & 1 deletion src/scheme/kzg/accumulation/shplonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use crate::{
protocol::Protocol,
scheme::kzg::{
accumulation::{AccumulationScheme, AccumulationStrategy, Accumulator},
langranges,
msm::MSM,
},
util::{
Expand Down Expand Up @@ -45,7 +46,7 @@ where
let mut common_poly_eval = CommonPolynomialEvaluation::new(
&protocol.domain,
loader,
protocol.langranges(&proof.statements),
langranges(protocol, &proof.statements),
&proof.z,
);
let mut sets = intermediate_sets(protocol, loader, &proof.z, &proof.z_prime);
Expand Down

0 comments on commit 6bf26cc

Please sign in to comment.