Skip to content

Commit

Permalink
fix: updated README and modify dispatch behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
sifnoc committed Sep 26, 2023
1 parent dfb0de3 commit e65280b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 4 additions & 3 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 5 additions & 6 deletions backend/src/apis/round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn Error>> {
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(
Expand Down

0 comments on commit e65280b

Please sign in to comment.