From e65280b43d1bab6ed80f7f626fa270560c4526c3 Mon Sep 17 00:00:00 2001 From: sifnoc Date: Tue, 26 Sep 2023 10:03:24 +0000 Subject: [PATCH] fix: updated README and modify dispatch behavior --- backend/README.md | 7 ++++--- backend/src/apis/round.rs | 11 +++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/README.md b/backend/README.md index 3a3eec46..5168e2b4 100644 --- a/backend/README.md +++ b/backend/README.md @@ -97,11 +97,12 @@ If executed successfully, you'll see: ### 2. Submit Proof of Solvency -Before generate inclusion proof for every user of the current round, You should submit proof of solvency to Summa contract. Currently, we made this as mandatory way to commit the root hash of the Merkle Sum Tree. +This step is crucial for two primary reasons: first, to validate the root hash of the Merkle Sum Tree (`mst_root`); and second, to ensure that the assets held by the CEX exceed their liabilities, as confirmed through the proof verification on the Summa contract. +The CEX must submit this proof of solvency to the Summa contract. Currently, it's a mandatory requirement to provide this proof before generating the inclusion proof for each user in the current round. -Without this process, It seems the user may not trust to the inclusion proof for the round. becuase the `mst_root` is not published on contract. More specifically, it means that the `mst_root` is not correctly verified on the Summa contract. +Without this verification, It seems the user may not trust to the inclusion proof for the round. becuase the `mst_root` is not published on contract. More specifically, it means that the `mst_root` is not correctly verified on the Summa contract. -In this example, we'll guide you through the process of submitting a solvency proof using the Round to the Summa contract. +In this step, we'll guide you through the process of submitting a solvency proof using the Round to the Summa contract. The Round serves as the core of the backend in Summa, and we have briefly described it in the Components section. To initialize the `Round` instance, you'll need paths to specific CSV files (`assets.csv` and `entry_16.csv`) and the `ptau/hermez-raw-11` file. Here's what each file does: diff --git a/backend/src/apis/round.rs b/backend/src/apis/round.rs index a344c84a..c1f47b45 100644 --- a/backend/src/apis/round.rs +++ b/backend/src/apis/round.rs @@ -104,23 +104,22 @@ where self.timestamp } - pub async fn dispatch_solvency_proof(&mut self) -> Result<(), &'static str> { + pub async fn dispatch_solvency_proof(&mut self) -> Result<(), Box> { let proof: SolvencyProof = match self.snapshot.generate_proof_of_solvency() { Ok(p) => p, - Err(_) => return Err("Failed to generate proof of solvency"), + Err(e) => return Err(format!("Failed to generate proof of solvency: {}", e).into()), }; - let result = self - .signer + self.signer .submit_proof_of_solvency( proof.public_inputs[0], self.snapshot.assets_state.to_vec(), proof.proof_calldata, U256::from(self.get_timestamp()), ) - .await; + .await?; - Ok(result.unwrap()) + Ok(()) } pub fn get_proof_of_inclusion(