Skip to content

Functionality Infinite Private Money Trees - #26

Open
hooperben wants to merge 13 commits into
devfrom
ben/scaling
Open

Functionality Infinite Private Money Trees#26
hooperben wants to merge 13 commits into
devfrom
ben/scaling

Conversation

@hooperben

@hooperben hooperben commented May 20, 2026

Copy link
Copy Markdown
Owner

This PR introduces a new way of scaling commbank.eth's state tree - by adding the ability for n+1 tree's in the contracts state

the stress directory is a test harness that runs simulations of commbank.eth's intended behaviour. In this case - it was to test that the scaling of these trees rolled over well when a tree filled. See stress/TEST_REPORT.md for full simulation behaviour report

@hooperben hooperben changed the title Functionality Infinite Money Trees Functionality Infinite Private Money Trees May 28, 2026
fn assert_balanced(input_notes: [InputNote; NOTE_COUNT], output_notes: [OutputNote; NOTE_COUNT]) {
// Pass A: anchor on each non-empty input asset_id.
for i in 0..NOTE_COUNT {
if input_notes[i].asset_amount != 0 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think this if-statement is helpful. I would expect the following constraints to still hold if the condition were false so we're just multiplying in an extra predicate unnecessarily.

// Pass B: anchor on each non-empty output asset_id. Catches
// assets that appear only on the output side (mint attempts).
for i in 0..NOTE_COUNT {
if output_notes[i].asset_amount != 0 {

@TomAFrench TomAFrench May 28, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ditto here, and you could simplify this to just assert that there is a note with a matching id in the inputs (as then the value equality has been asserted in the first pass).

Comment on lines +127 to +128
in_sum += input_notes[j].asset_amount * in_match;
out_sum += output_notes[j].asset_amount * out_match;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Watch out for field overflows here. consider the inputs [0] and the outputs [1, p-1] which looks like it would pass this.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

pretty certain this is addressed in the most recent commit. Really appreciate your review and time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants