Skip to content

Align optimized SMT appendix with hashed-zero algorithm and fix example encoding - #319

Merged
jintekc merged 2 commits into
mainfrom
fix/smt-proof-conflicts-317-318
Jun 17, 2026
Merged

Align optimized SMT appendix with hashed-zero algorithm and fix example encoding #319
jintekc merged 2 commits into
mainfrom
fix/smt-proof-conflicts-317-318

Conversation

@jintekc

@jintekc jintekc commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Closes #317
Closes #318

@jintekc
jintekc requested review from danpape and parasyte and removed request for danpape June 16, 2026 18:17
@parasyte

Copy link
Copy Markdown
Collaborator

One thing that might be useful to avoid some confusion is specifying that the concatenation operator (+) and concat() function takes a byte array, not a string. And that the encoded hashes in SMT proofs must be decoded before operating on them. If this is already specified somewhere and I missed it, please point it out.

I can imagine a scenario where the word "concatenation" is interpreted as "string concatenation" instead of "byte array concatenation".

Also, the SMT Proof Verification algorithm description and pseudocode currently do not work with "non-updates" (i.e., with a proof of non-inclusion). It's a simple fix; make the concatenation of hashed-nonce and update hash optional (while maintaining the outer hash - very important). The updateId property on the SMT Proof data structure is already optional, but the algorithm and pseudocode do not acknowledge that.


Still reviewing the changes. This is just a thought that came up while going over it.

parasyte
parasyte previously approved these changes Jun 16, 2026

@parasyte parasyte left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great! I found only one minor suggestion.

The new diagram reads better (IMHO) with every level of the tree covered and each node receiving a meaningful identifier. I'll create a separate PR for fixing the unrelated SMT Proof Verification algorithm issue I noticed.

Comment thread src/data-structures.md Outdated
@jintekc

jintekc commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

Looks great! I found only one minor suggestion.

The new diagram reads better (IMHO) with every level of the tree covered and each node receiving a meaningful identifier. I'll create a separate PR for fixing the unrelated SMT Proof Verification algorithm issue I noticed.

Thanks for the prompt review! Addressed here:

  1. added a note that hash()/concat()/+ operate on byte arrays (not strings) and that the base64url proof fields must be decoded to raw bytes first
  2. the hashes bullet now states each hash MUST be base64url without padding. Left the non-update (proof-of-non-inclusion) algorithm fix for your separate PR, as you suggested.

parasyte
parasyte previously approved these changes Jun 16, 2026

@parasyte parasyte left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The + operator is also used in the Optimized SMT chapter. But this works for me.

@danpape

danpape commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

I also approve, looks great! Like Jay mentioned though, maybe you can also add the "Throughout this section, hash() denotes SHA-256..." paragraph from src/algorithms.md to src/appendix/optimized-smt.md?

@jintekc
jintekc force-pushed the fix/smt-proof-conflicts-317-318 branch from 7009890 to e002f1d Compare June 17, 2026 13:11
@jintekc

jintekc commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

@danpape @parasyte - pushed one follow-up commit addressing the review: added the hash()/+ byte-array and base64url-decoding note to src/appendix/optimized-smt.md, and linked the appendix to the normative [SMT Proof Verification] algorithm. No algorithm changes. Needs two more approvals.

@jintekc
jintekc force-pushed the fix/smt-proof-conflicts-317-318 branch from 60a124e to 3f70bd9 Compare June 17, 2026 15:56
@jintekc
jintekc requested a review from parasyte June 17, 2026 15:56
@jintekc
jintekc merged commit 95e2024 into main Jun 17, 2026
1 check passed
@jintekc
jintekc deleted the fix/smt-proof-conflicts-317-318 branch June 17, 2026 21:04
jintekc pushed a commit that referenced this pull request Jul 1, 2026
This was discussed in
#319 (comment)

Adds support for non-inclusion proofs to the algorithm description and
pseudocode. Fixes some minor syntactic errors (missing semicolons) and
slightly improves readability with whitespace.

The `cachedZero` pseudocode was also updated to use `n` as the index
variable name to better match the longer pseudocode.

And today I learned that mdBook's `smart-punctuation` option allows
rendering em dashes with triple-hyphens.
https://rust-lang.github.io/mdBook/format/markdown.html#smart-punctuation
Em dashes looked better than parentheses and commas.
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.

Conflicting SMT Proof Data Structure Defs Conflicting SMT Proof Verification Algorithms

3 participants