-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Tree
trait
#179
feat: Tree
trait
#179
Changes from 1 commit
15a6d0a
400fc49
d538b28
c750083
be0f52d
022dde6
b3990eb
35478ec
e17e493
d3c5562
391f37c
2f14b36
3e8c855
c80e964
d42af95
0c5153b
4e180b2
5a9120f
c575a29
3afa5d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,7 @@ use serde::{Deserialize, Serialize}; | |
use std::error::Error; | ||
|
||
use super::csv_parser::parse_asset_csv; | ||
use crate::contracts::{ | ||
generated::summa_contract::summa::Asset, | ||
signer::{AddressInput, SummaSigner}, | ||
}; | ||
use crate::contracts::{generated::summa_contract::summa::Asset, signer::SummaSigner}; | ||
use summa_solvency::{ | ||
circuits::{ | ||
merkle_sum_tree::MstInclusionCircuit, | ||
|
@@ -65,28 +62,25 @@ pub struct Snapshot<const LEVELS: usize, const N_ASSETS: usize, const N_BYTES: u | |
trusted_setup: [SetupArtifacts; 2], | ||
} | ||
|
||
pub struct Round<const LEVELS: usize, const N_ASSETS: usize, const N_BYTES: usize> { | ||
pub struct Round<'a, const LEVELS: usize, const N_ASSETS: usize, const N_BYTES: usize> { | ||
timestamp: u64, | ||
snapshot: Snapshot<LEVELS, N_ASSETS, N_BYTES>, | ||
signer: SummaSigner, | ||
signer: &'a SummaSigner, | ||
} | ||
|
||
impl<const LEVELS: usize, const N_ASSETS: usize, const N_BYTES: usize> | ||
Round<LEVELS, N_ASSETS, N_BYTES> | ||
Round<'_, LEVELS, N_ASSETS, N_BYTES> | ||
where | ||
[usize; N_ASSETS + 1]: Sized, | ||
[usize; 2 * (1 + N_ASSETS)]: Sized, | ||
{ | ||
pub fn new( | ||
signer_key: &str, | ||
chain_id: u64, | ||
rpc_url: &str, | ||
summa_address_input: AddressInput, | ||
pub fn new<'a>( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main point of the PR for me was that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, that's what you were looking for. Honestly, I was trying to figure out how to define the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is that? Can't you define it like this? https://github.com/summa-dev/summa-solvency/blob/enrico-tree-trait/zk_prover/src/circuits/solvency.rs#L76 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It because the pub struct Snapshot<const LEVELS: usize, const N_ASSETS: usize, const N_BYTES: usize> {
mst: Box<dyn Tree<N_ASSETS, N_BYTES>>, // Instead of MerkleSumTree<N_ASSETS, N_BYTES>,
assets_state: [Asset; N_ASSETS],
trusted_setup: SetupArtifacts,
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated at 5a9120f |
||
signer: &'a SummaSigner, | ||
entry_csv_path: &str, | ||
asset_csv_path: &str, | ||
params_path: &str, | ||
timestamp: u64, | ||
) -> Result<Round<LEVELS, N_ASSETS, N_BYTES>, Box<dyn Error>> { | ||
) -> Result<Round<'a, LEVELS, N_ASSETS, N_BYTES>, Box<dyn Error>> { | ||
Ok(Round { | ||
timestamp, | ||
snapshot: Snapshot::<LEVELS, N_ASSETS, N_BYTES>::new( | ||
|
@@ -95,7 +89,7 @@ where | |
params_path, | ||
) | ||
.unwrap(), | ||
signer: SummaSigner::new(signer_key, chain_id, rpc_url, summa_address_input), | ||
signer: &signer, | ||
}) | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an example of such config file? Can you add it to the comments if possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is "backend/src/contracts/deployments.json".
I will add comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated c575a29