jarry-xiao / candyland

Proof of concept program for compressing NFTs
GNU Affero General Public License v3.0
111 stars 13 forks source link

CMT: Subtree Append #171

Open samwise2 opened 2 years ago

samwise2 commented 2 years ago

This PR adds functionality to append a subtree to a CMT!

The high-level process roughly goes as follows (similar to what @jarry-xiao initially outlined):

Why we only need one changelog in order to accurately fast-forward proofs for subsequent replace_leaf calls.

Screen Shot 2022-08-11 at 4 26 02 PM

Why we don't allow initializing a CMT via subtree append (for now, worth for the future?):

Screen Shot 2022-08-11 at 4 26 57 PM
jarry-xiao commented 2 years ago

I think the logic here is looking sound after your explainer comment. The main thing that still seems somewhat uncertain to me is how to actually go about performing a tree migration. Operationally, it seems difficult to "wait" for the desired indices to become available for append. Maybe this can be handled purely from the controlling contract level where aggregated trees completely ban regular appends and only allow for subtrees of a certain size to be appended. Still, this is definitely a step in the right direction