Skip to content

Commit

Permalink
Fix maximum entries in polynomial interpolation approach (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
sifnoc authored Mar 18, 2024
1 parent 067431b commit bbd2a5f
Show file tree
Hide file tree
Showing 27 changed files with 972 additions and 898 deletions.
2 changes: 1 addition & 1 deletion backend/examples/summa_solvency_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
generate_setup_artifacts(K, Some(params_path), &univariate_grand_sum_circuit).unwrap();

// Create a proof
let instances = vec![Fp::one(); 1]; // This instance is necessary to verify proof on solidity verifier.
let instances = vec![Fp::zero(); 1]; // This instance is necessary to verify proof on solidity verifier.
let (zk_snark_proof, advice_polys, _) = full_prover(
&params,
&pk,
Expand Down
2 changes: 1 addition & 1 deletion backend/src/contracts/abi/SnarkVerifier.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/src/contracts/abi/Summa.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion backend/src/contracts/abi/VerifyingKey.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"_format":"hh-sol-artifact-1","contractName":"Halo2VerifyingKey","sourceName":"src/VerifyingKey.sol","abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"}],"bytecode":"0x608060405234801561001057600080fd5b5060007f0f4282e55a789d94ea57d4e200623dabb7ea67c998749f0370c890ab9ee6883f815260116020527f30643640b9f82f90e83b698e5ea6179c7c05542e859533b48b9953a2f53608016040527f304cd1e79cfa5b0f054e981a27ed7706e7ea6b06a7f266ef8db819c179c2c3ea6060527f193586da872cdeff023d6ab2263a131b4780db8878be3c3b7f8f019c06fcb0fb6080527f299110e6835fd73731fb3ce6de87151988da403c265467a96b9cda0d7daa72e460a052600160c0528060e0528061010052806101205280610140526001610160526002610180527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101a0527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101c0527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6101e0527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610200527f26186a2d65ee4d2f9c9a5b91f86597d35f192cd120caf7e935d8443d1938e23d610220527f30441fd1b5d3370482c42152a8899027716989a6996c2535bc9f7fee8aaef79e610240527f16f363f103c80d7bbc8ad3c6867e0822bbc6000be91a4689755c7df40221c145610260527f2b1cbb3e521edf5a622d82762a44a5e63f1e50b332d71154a4a7958d6011deff610280527f1404a2d17cd02c8f9fd79d74ac73c67d1881e62c6af354fa74d235c5e37dacfe6102a0527f2c1e30781f735e7977820d4ca9145010e28dcc808ee0f1e976477289057b7aec6102c0527f1b20314062560deca1b1bada262dbe3352a521ea2ef8973476cb7ad6f588c59d6102e0527f244ac9f0848be84d5a85e3c4e62e2a371ac7be27d68202ef3fe79541021ab99d610300527f2b1f7e2148bfab601e68f2e8133b9d05c10a9526d686b356b761eaa3713a70ba610320527f013345ea09966b06e4ae7d7e2919ddbb6e3f7e645aea515375ed729bff644dc5610340527f27a7a66087a8c17b00ffb7fe9b76ba2199ca308bcb0ad100fa181886d6c9b936610360527f23bc951a3c4307384bdec5d61be122a19c933db3266d6327a472e5203a9f785a610380527f0743ea40f14084db2673217283aa053f986896ee7c181f52118442e99c4529746103a0527f0203e3493a2594ece57d22cc75dd081ac68271ec7c758153cfd2152bfb5c19e36103c0527f1d81e0b06dea11d9b7a7a64458db5e5eb2f5dbe107a81f0555738f613b9b7d786103e0527f081e3e59de4615b05fef48f591d1ea23cb32f0ee841157094c1b81b95cfdb9fa610400527f0c28e0db2e4decc2a36413620cdc36ae237ccbc1cd1168841c5375d2a79478ce610420527f17b5790a11fcde00f8acf7edc4328f37883aec0f5955f8a6f7764078edf3cd05610440527f284ac053d96a33fca69eca00e16eea75ad1bf008d2a742fc846ac73d17d46d73610460527f14f45666a26b8d472186dbf78e606a82891e0f122a54264418cfe2615003dfb9610480527f1c517c335ad634422ef2eb5f615926e875afa9e9c589abf528d315a8a586b22d6104a0527f1220b1b13c91e8115106144bc417d4d3e6a9de3fb70406e68b4a5fd8a92f43276104c0527f1be0972afecdd013ffa6a3acc18998619b8df7834273d89825bf1abd1f2023ab6104e0527e19ea072d6d49fbf164929a19a76d4421f33d47647ff62c7230133fba915307610500527f0f09c585dc376dd0d5962c76ae444dc1cc3de9780f4fbdd5105a7040500d60ba610520527f13587a1e4799ba72f1d95e47a4e377086b83e5189903566e7422119ed28eba596105405261056081f3fe","deployedBytecode":"0x6080604052600080fdfea2646970667358221220e7575f4fe6578c13d0383c6c5b39fe580d12eec30351ca05204f256d8400d7f564736f6c63430008120033","linkReferences":{},"deployedLinkReferences":{}}
{"_format":"hh-sol-artifact-1","contractName":"Halo2VerifyingKey","sourceName":"src/VerifyingKey.sol","abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"}],"bytecode":"0x608060405234801561001057600080fd5b5060007e996ed64113d5d86f42caab0f3d25466b0856015472de4bb809f168aabc2567815260116020527f30643640b9f82f90e83b698e5ea6179c7c05542e859533b48b9953a2f53608016040527f304cd1e79cfa5b0f054e981a27ed7706e7ea6b06a7f266ef8db819c179c2c3ea6060527f193586da872cdeff023d6ab2263a131b4780db8878be3c3b7f8f019c06fcb0fb6080527f299110e6835fd73731fb3ce6de87151988da403c265467a96b9cda0d7daa72e460a052600160c0528060e0528061010052806101205280610140526001610160526002610180527f198e9393920d483a7260bfb731fb5d25f1aa493335a9e71297e485b7aef312c26101a0527f1800deef121f1e76426a00665e5c4479674322d4f75edadd46debd5cd992f6ed6101c0527f090689d0585ff075ec9e99ad690c3395bc4b313370b38ef355acdadcd122975b6101e0527f12c85ea5db8c6deb4aab71808dcb408fe3d1e7690c43d37b4ce6cc0166fa7daa610200527f26186a2d65ee4d2f9c9a5b91f86597d35f192cd120caf7e935d8443d1938e23d610220527f30441fd1b5d3370482c42152a8899027716989a6996c2535bc9f7fee8aaef79e610240527f16f363f103c80d7bbc8ad3c6867e0822bbc6000be91a4689755c7df40221c145610260527f2b1cbb3e521edf5a622d82762a44a5e63f1e50b332d71154a4a7958d6011deff610280527f1404a2d17cd02c8f9fd79d74ac73c67d1881e62c6af354fa74d235c5e37dacfe6102a0527f2c1e30781f735e7977820d4ca9145010e28dcc808ee0f1e976477289057b7aec6102c0527f2dd3fd59098a5b4b4a616568bb6ba1a1e4c40e4b0df9ae94e37944d55ab651cf6102e0527f25680c3525ba04435a9034d6e69c96de5133edfe37c226d3e31b60eff6b34ef0610300527f1a224e6aeb9bb7de12c761fd1f49a733ff410c3f772aad6a2ec3c4decad43307610320527f300a66b376af1187694e25dbcea3aac63114716af822fd4661519adbf9c649e9610340527f27a7a66087a8c17b00ffb7fe9b76ba2199ca308bcb0ad100fa181886d6c9b936610360527f23bc951a3c4307384bdec5d61be122a19c933db3266d6327a472e5203a9f785a610380527f0743ea40f14084db2673217283aa053f986896ee7c181f52118442e99c4529746103a0527f0203e3493a2594ece57d22cc75dd081ac68271ec7c758153cfd2152bfb5c19e36103c0527f0f85936c44708409e3e9fb5e2a7ea6604b06997f0ac7fd488e3f147e05a88dbe6103e0527f0497fbb7c4436dcf36ede6a30ad62e016e059a11a6548eb6980edeb2f1052133610400527f0dcbacf368c01f61375c242e35edab12a22147e9d46bf685fb75454d60f5edbc610420527f17720c95139aa3f5dec5b6bd56082f8deded2e4a1425d0a91e2743dd294fdc9c610440527f284ac053d96a33fca69eca00e16eea75ad1bf008d2a742fc846ac73d17d46d73610460527f14f45666a26b8d472186dbf78e606a82891e0f122a54264418cfe2615003dfb9610480527f1c517c335ad634422ef2eb5f615926e875afa9e9c589abf528d315a8a586b22d6104a0527f1220b1b13c91e8115106144bc417d4d3e6a9de3fb70406e68b4a5fd8a92f43276104c0527f0cbaead666e172b1801b7ad17c3450ea2ce7d53c1e392cedf05023e59e53c95a6104e0527f0ce200ab515efc390c459e0b492c15a50024c57fa70768c18389924e1e72982b610500527f1d4848e8db74251fd01e018fedb71ca8e04c41746474ad4b4a39da132f86f30b610520527f148a2252b7b6a07e21aa1bc5b1cc4826ac7f4a7a3e29fb7399dd7029d4bdaf276105405261056081f3fe","deployedBytecode":"0x6080604052600080fdfea26469706673582212207c80617d071a4e94f54a68097fd35e2444402dadbf01772e6352e9def6be37da64736f6c63430008120033","linkReferences":{},"deployedLinkReferences":{}}
45 changes: 24 additions & 21 deletions backend/src/contracts/generated/grandsum_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ pub use grand_sum_verifier::*;
clippy::upper_case_acronyms,
clippy::type_complexity,
dead_code,
non_camel_case_types
non_camel_case_types,
)]
pub mod grand_sum_verifier {
#[rustfmt::skip]
const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"vk\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\",\"components\":[]},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\",\"components\":[]}],\"stateMutability\":\"nonpayable\",\"type\":\"function\",\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
///The parsed JSON ABI of the contract.
pub static GRANDSUMVERIFIER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> =
::ethers::contract::Lazy::new(|| {
::ethers::core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid")
});
pub static GRANDSUMVERIFIER_ABI: ::ethers::contract::Lazy<
::ethers::core::abi::Abi,
> = ::ethers::contract::Lazy::new(|| {
::ethers::core::utils::__serde_json::from_str(__ABI)
.expect("ABI is always valid")
});
#[rustfmt::skip]
const __BYTECODE: &[u8] = &[
96,
Expand Down Expand Up @@ -1331,8 +1333,9 @@ pub mod grand_sum_verifier {
51,
];
///The bytecode of the contract.
pub static GRANDSUMVERIFIER_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__BYTECODE);
pub static GRANDSUMVERIFIER_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__BYTECODE,
);
#[rustfmt::skip]
const __DEPLOYED_BYTECODE: &[u8] = &[
96,
Expand Down Expand Up @@ -2615,8 +2618,9 @@ pub mod grand_sum_verifier {
51,
];
///The deployed bytecode of the contract.
pub static GRANDSUMVERIFIER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE);
pub static GRANDSUMVERIFIER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__DEPLOYED_BYTECODE,
);
pub struct GrandSumVerifier<M>(::ethers::contract::Contract<M>);
impl<M> ::core::clone::Clone for GrandSumVerifier<M> {
fn clone(&self) -> Self {
Expand All @@ -2636,9 +2640,7 @@ pub mod grand_sum_verifier {
}
impl<M> ::core::fmt::Debug for GrandSumVerifier<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(stringify!(GrandSumVerifier))
.field(&self.address())
.finish()
f.debug_tuple(stringify!(GrandSumVerifier)).field(&self.address()).finish()
}
}
impl<M: ::ethers::providers::Middleware> GrandSumVerifier<M> {
Expand All @@ -2648,11 +2650,13 @@ pub mod grand_sum_verifier {
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
Self(::ethers::contract::Contract::new(
address.into(),
GRANDSUMVERIFIER_ABI.clone(),
client,
))
Self(
::ethers::contract::Contract::new(
address.into(),
GRANDSUMVERIFIER_ABI.clone(),
client,
),
)
}
/// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it.
/// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction
Expand Down Expand Up @@ -2706,8 +2710,7 @@ pub mod grand_sum_verifier {
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for GrandSumVerifier<M>
{
for GrandSumVerifier<M> {
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
Expand All @@ -2721,7 +2724,7 @@ pub mod grand_sum_verifier {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
#[ethcall(name = "verifyProof", abi = "verifyProof(address,bytes,uint256[])")]
pub struct VerifyProofCall {
Expand All @@ -2738,7 +2741,7 @@ pub mod grand_sum_verifier {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
pub struct VerifyProofReturn(pub bool);
}
45 changes: 24 additions & 21 deletions backend/src/contracts/generated/inclusion_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ pub use inclusion_verifier::*;
clippy::upper_case_acronyms,
clippy::type_complexity,
dead_code,
non_camel_case_types
non_camel_case_types,
)]
pub mod inclusion_verifier {
#[rustfmt::skip]
const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"vk\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"proofs\",\"type\":\"bytes\",\"components\":[]},{\"internalType\":\"uint256[]\",\"name\":\"challenges\",\"type\":\"uint256[]\",\"components\":[]},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\",\"components\":[]}],\"stateMutability\":\"view\",\"type\":\"function\",\"name\":\"verifyProof\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\",\"components\":[]}]}]";
///The parsed JSON ABI of the contract.
pub static INCLUSIONVERIFIER_ABI: ::ethers::contract::Lazy<::ethers::core::abi::Abi> =
::ethers::contract::Lazy::new(|| {
::ethers::core::utils::__serde_json::from_str(__ABI).expect("ABI is always valid")
});
pub static INCLUSIONVERIFIER_ABI: ::ethers::contract::Lazy<
::ethers::core::abi::Abi,
> = ::ethers::contract::Lazy::new(|| {
::ethers::core::utils::__serde_json::from_str(__ABI)
.expect("ABI is always valid")
});
#[rustfmt::skip]
const __BYTECODE: &[u8] = &[
96,
Expand Down Expand Up @@ -1166,8 +1168,9 @@ pub mod inclusion_verifier {
51,
];
///The bytecode of the contract.
pub static INCLUSIONVERIFIER_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__BYTECODE);
pub static INCLUSIONVERIFIER_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__BYTECODE,
);
#[rustfmt::skip]
const __DEPLOYED_BYTECODE: &[u8] = &[
96,
Expand Down Expand Up @@ -2285,8 +2288,9 @@ pub mod inclusion_verifier {
51,
];
///The deployed bytecode of the contract.
pub static INCLUSIONVERIFIER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE);
pub static INCLUSIONVERIFIER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__DEPLOYED_BYTECODE,
);
pub struct InclusionVerifier<M>(::ethers::contract::Contract<M>);
impl<M> ::core::clone::Clone for InclusionVerifier<M> {
fn clone(&self) -> Self {
Expand All @@ -2306,9 +2310,7 @@ pub mod inclusion_verifier {
}
impl<M> ::core::fmt::Debug for InclusionVerifier<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(stringify!(InclusionVerifier))
.field(&self.address())
.finish()
f.debug_tuple(stringify!(InclusionVerifier)).field(&self.address()).finish()
}
}
impl<M: ::ethers::providers::Middleware> InclusionVerifier<M> {
Expand All @@ -2318,11 +2320,13 @@ pub mod inclusion_verifier {
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
Self(::ethers::contract::Contract::new(
address.into(),
INCLUSIONVERIFIER_ABI.clone(),
client,
))
Self(
::ethers::contract::Contract::new(
address.into(),
INCLUSIONVERIFIER_ABI.clone(),
client,
),
)
}
/// Constructs the general purpose `Deployer` instance based on the provided constructor arguments and sends it.
/// Returns a new instance of a deployer that returns an instance of this contract after sending the transaction
Expand Down Expand Up @@ -2377,8 +2381,7 @@ pub mod inclusion_verifier {
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for InclusionVerifier<M>
{
for InclusionVerifier<M> {
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
Expand All @@ -2392,7 +2395,7 @@ pub mod inclusion_verifier {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
#[ethcall(
name = "verifyProof",
Expand All @@ -2413,7 +2416,7 @@ pub mod inclusion_verifier {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
pub struct VerifyProofReturn(pub bool);
}
Loading

0 comments on commit bbd2a5f

Please sign in to comment.