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: sparse merkle trees #105

Merged
merged 7 commits into from
Nov 8, 2023
Merged

docs: sparse merkle trees #105

merged 7 commits into from
Nov 8, 2023

Conversation

CjS77
Copy link
Contributor

@CjS77 CjS77 commented Aug 1, 2023

This Request for Comment (RFC) proposes replacing the current Mutable Merkle Mountain Range (MMMR) data structure
used for tracking the commitment to the UTXO set, with a Sparse Merkle tree (SMT).

A sparse Merkle tree ([SMT]) is a Merkle-type structure, except the contained data is indexed, and each datapoint is
placed at the leaf that corresponds to that datapoint’s index. Empty nodes are represented by a predefined "null" value.

Since every empty node has the same hash, and the tree is sparse, it is possible to prune the tree in a way such
that only the non-zero leaf nodes and placeholders marking the empty sub-trees are stored. Therefore, SMTs are
relatively compact.

@CjS77 CjS77 changed the title docs: draft for sparse merkle trees docs: sparse merkle trees Aug 2, 2023
@CjS77
Copy link
Contributor Author

CjS77 commented Sep 12, 2023

ACK

Copy link
Contributor

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
Co-authored-by: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com>
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
src/RFC-0141_Sparse_Merkle_Trees.md Outdated Show resolved Hide resolved
stringhandler pushed a commit to tari-project/tari that referenced this pull request Oct 12, 2023
Description
---
This replaces the UTXO MMR and the Roaring bitmap with a single SMT. 

Motivation and Context
---
See: tari-project/rfcs#105 as to why the SMT is
the better choice.

How Has This Been Tested?
---
Manual
SWvheerden added a commit to tari-project/tari that referenced this pull request Oct 25, 2023
Description
---
This replaces the UTXO MMR and the Roaring bitmap with a single SMT. 

Motivation and Context
---
See: tari-project/rfcs#105 as to why the SMT is
the better choice.

How Has This Been Tested?
---
Manual
SWvheerden added a commit to tari-project/tari that referenced this pull request Nov 1, 2023
Description
---
This replaces the UTXO MMR and the Roaring bitmap with a single SMT. 

Motivation and Context
---
See: tari-project/rfcs#105 as to why the SMT is
the better choice.

How Has This Been Tested?
---
Manual
SWvheerden added a commit to tari-project/tari that referenced this pull request Nov 2, 2023
Description
---
This replaces the UTXO MMR and the Roaring bitmap with a single SMT. 

Motivation and Context
---
See: tari-project/rfcs#105 as to why the SMT is
the better choice.

How Has This Been Tested?
---
Manual
SWvheerden added a commit to tari-project/tari that referenced this pull request Nov 2, 2023
Description
---
This replaces the UTXO MMR and the Roaring bitmap with a single SMT. 

Motivation and Context
---
See: tari-project/rfcs#105 as to why the SMT is
the better choice.

How Has This Been Tested?
---
Manual
SWvheerden added a commit to tari-project/tari that referenced this pull request Nov 2, 2023
Description
---
This replaces the UTXO MMR and the Roaring bitmap with a single SMT.

Motivation and Context
---
See: tari-project/rfcs#105 as to why the SMT is
the better choice.
CRoaring, the library that is used by Tari for the roaring bitmap also
has a few security issues such as panicking on certain random inputs.

How Has This Been Tested?
---
Manual, and unit tests

What process can a PR reviewer use to test or verify this change?
---

---------

Co-authored-by: Hansie Odendaal <39146854+hansieodendaal@users.noreply.github.com>
@CjS77 CjS77 merged commit 14e9943 into main Nov 8, 2023
2 checks passed
@CjS77 CjS77 deleted the cjs77-smt branch November 8, 2023 11:41
CjS77 added a commit that referenced this pull request Dec 19, 2023
This Request for Comment (RFC) proposes replacing the current Mutable
Merkle Mountain Range (MMMR) data structure
used for tracking the commitment to the UTXO set, with a Sparse Merkle
tree (SMT).

A sparse Merkle tree ([SMT]) is a Merkle-type structure, except the
contained data is indexed, and each datapoint is
placed at the leaf that corresponds to that datapoint’s index. Empty
nodes are represented by a predefined "null" value.

Since every empty node has the same hash, and the tree is sparse, it is
possible to prune the tree in a way such
that only the non-zero leaf nodes and placeholders marking the empty
sub-trees are stored. Therefore, SMTs are
relatively compact.

---------

Co-authored-by: Aaron Feickert <66188213+AaronFeickert@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants