-
Notifications
You must be signed in to change notification settings - Fork 3
CSHLD-1208: Add retention flags when appending commitments in Merkle tree logic #319
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -100,12 +100,14 @@ public void ping() { | |
| * | ||
| * @param blockHeight block height (u32 range) | ||
| * @param commitments shielded note commitment values (cmx) for this block | ||
| * @param owned per-commitment ownership flags; {@code null} or shorter list → remaining are false | ||
| * @param expectedRoot root to verify against; {@code null} to skip | ||
| * @return computed root after appending | ||
| * @throws WasmException with code {@code ROOT_MISMATCH} if verification fails | ||
| */ | ||
| public ShieldedRoot appendCommitments( | ||
| long blockHeight, List<ShieldedCommitment> commitments, ShieldedRoot expectedRoot) { | ||
| long blockHeight, List<ShieldedCommitment> commitments, List<Boolean> owned, | ||
| ShieldedRoot expectedRoot) { | ||
| requireU32(blockHeight, "blockHeight"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing the 2-arg and 3-arg Separately: Generated by Claude Code |
||
| Objects.requireNonNull(commitments, "commitments must not be null"); | ||
|
|
||
|
|
@@ -115,6 +117,9 @@ public ShieldedRoot appendCommitments( | |
| .addAllCommitments(commitments.stream() | ||
| .map(c -> ByteString.copyFrom(c.bytes())) | ||
| .toList()); | ||
| if (owned != null && !owned.isEmpty()) { | ||
| req.addAllOwned(owned); | ||
| } | ||
| if (expectedRoot != null) { | ||
| req.setExpectedRoot(ByteString.copyFrom(expectedRoot.bytes())); | ||
| } | ||
|
|
@@ -123,11 +128,6 @@ public ShieldedRoot appendCommitments( | |
| return ShieldedRoot.of(unwrap(r, resp -> resp.getBytesValue().toByteArray())); | ||
| } | ||
|
|
||
| /** Convenience overload — appends without root verification. */ | ||
| public ShieldedRoot appendCommitments(long blockHeight, List<ShieldedCommitment> commitments) { | ||
| return appendCommitments(blockHeight, commitments, null); | ||
| } | ||
|
|
||
| /** | ||
| * Rolls the tree back to the checkpoint at the given block height. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually now you don't need this any longer