Skip to content

Commit

Permalink
fix: set instance value as zero for using in range check
Browse files Browse the repository at this point in the history
  • Loading branch information
sifnoc committed Mar 14, 2024
1 parent a034aac commit 8ac54c8
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 89 deletions.
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);
}
41 changes: 21 additions & 20 deletions backend/src/contracts/generated/snark_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ pub use verifier::*;
clippy::upper_case_acronyms,
clippy::type_complexity,
dead_code,
non_camel_case_types
non_camel_case_types,
)]
pub mod verifier {
#[rustfmt::skip]
const __ABI: &str = "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"vk\",\"type\":\"address\",\"components\":[]},{\"internalType\":\"bytes\",\"name\":\"proof\",\"type\":\"bytes\",\"components\":[]},{\"internalType\":\"uint256[]\",\"name\":\"instances\",\"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 VERIFIER_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 VERIFIER_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 @@ -8637,8 +8635,9 @@ pub mod verifier {
51,
];
///The bytecode of the contract.
pub static VERIFIER_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__BYTECODE);
pub static VERIFIER_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__BYTECODE,
);
#[rustfmt::skip]
const __DEPLOYED_BYTECODE: &[u8] = &[
96,
Expand Down Expand Up @@ -17227,8 +17226,9 @@ pub mod verifier {
51,
];
///The deployed bytecode of the contract.
pub static VERIFIER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes =
::ethers::core::types::Bytes::from_static(__DEPLOYED_BYTECODE);
pub static VERIFIER_DEPLOYED_BYTECODE: ::ethers::core::types::Bytes = ::ethers::core::types::Bytes::from_static(
__DEPLOYED_BYTECODE,
);
pub struct Verifier<M>(::ethers::contract::Contract<M>);
impl<M> ::core::clone::Clone for Verifier<M> {
fn clone(&self) -> Self {
Expand All @@ -17248,9 +17248,7 @@ pub mod verifier {
}
impl<M> ::core::fmt::Debug for Verifier<M> {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_tuple(stringify!(Verifier))
.field(&self.address())
.finish()
f.debug_tuple(stringify!(Verifier)).field(&self.address()).finish()
}
}
impl<M: ::ethers::providers::Middleware> Verifier<M> {
Expand All @@ -17260,11 +17258,13 @@ pub mod verifier {
address: T,
client: ::std::sync::Arc<M>,
) -> Self {
Self(::ethers::contract::Contract::new(
address.into(),
VERIFIER_ABI.clone(),
client,
))
Self(
::ethers::contract::Contract::new(
address.into(),
VERIFIER_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 @@ -17317,7 +17317,8 @@ pub mod verifier {
.expect("method not found (this should never happen)")
}
}
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>> for Verifier<M> {
impl<M: ::ethers::providers::Middleware> From<::ethers::contract::Contract<M>>
for Verifier<M> {
fn from(contract: ::ethers::contract::Contract<M>) -> Self {
Self::new(contract.address(), contract.client())
}
Expand All @@ -17331,7 +17332,7 @@ pub mod verifier {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
#[ethcall(name = "verifyProof", abi = "verifyProof(address,bytes,uint256[])")]
pub struct VerifyProofCall {
Expand All @@ -17348,7 +17349,7 @@ pub mod verifier {
Debug,
PartialEq,
Eq,
Hash,
Hash
)]
pub struct VerifyProofReturn(pub bool);
}
Loading

0 comments on commit 8ac54c8

Please sign in to comment.