Skip to content
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

docs: update how commitments are generated #919

Merged
merged 3 commits into from
Oct 26, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions x/payment/spec/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,6 @@ if err != nil {

### How the commitments are generated

1. create the final version of the message by adding the length delimiter, the namespace, and then the message together into a single string of bytes

```python
finalMessage = [length delimiter] + [namespace] + [message]
```

2. chunk the finalMessage into shares of size `appconsts.ShareSize`
3. pad until number of shares is a power of two
4. create the commitment by aranging the shares into a merkle mountain range
5. create a merkle root of the subtree roots
1. Split the message into shares of `appconsts.ShareSize`
1. Arrange the shares into a Merkle mountain range where each tree in the mountain range has a maximum size of `squareSize`
1. Take the roots of the trees in the Merkle mountain range and create a new Merkle tree. The message share commitment is the Markle root of this Merkle tree.
rootulp marked this conversation as resolved.
Show resolved Hide resolved