Skip to content

fix(api): skip malformed notes during shielded scans - #65

Open
Federico2014 wants to merge 2 commits into
release_v4.8.3from
hotfix/shielded_note_scan
Open

Federico2014 wants to merge 2 commits into
release_v4.8.3from
hotfix/shielded_note_scan

Conversation

@Federico2014

@Federico2014 Federico2014 commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

What does this PR do?

Skip notes with unsupported plaintext headers or negative decoded values in both note decryption paths. Add regression coverage for native shielded and TRC20 IVK/OVK scans, including valid notes before and after malformed entries.

Why are these changes required?

An authenticated but malformed note currently throws during decoding or value validation and aborts the entire requested scan range. Returning an empty result for that note lets scanning continue while preserving commitment checks and errors for invalid API inputs.

This PR has been tested by:

  • JDK 8 direct compilation of the current Note, NoteEncryption and Wallet sources against an existing local FullNode build, followed by JUnit: all 5 new regression tests and 2 existing SaplingNoteTest tests passed. Against the original Note implementation, 4 of the 5 new tests failed.
  • Direct Checkstyle 8.7 validation of both changed files using the repository configuration passed; the forbidden Math usage check and git diff whitespace check passed.
  • Offline Gradle clean build, full tests, focused tests and the CI Checkstyle task set were blocked during dependency resolution by missing cached commons-lang3:3.20.0, javax.annotation-api:1.3.2, httpclient:4.5.13 and httpcore:4.4.13. The direct tests do not replace a clean build or full-suite validation.

Follow up

Require successful standard build, tests and CI checks before merging. A complete signed-transaction-to-block-to-scan integration test has not been run.

Extra details

Limited to scan-time note decryption and regression tests. Public Note.decode behavior and consensus transaction validation are unchanged. The scanner tests use real note encryption with mocked block and transaction-info retrieval.


Summary by cubic

Skips malformed notes during shielded note scans so a single bad note no longer aborts the entire requested range. Notes with unsupported plaintext headers or negative decoded values are now discarded in both IVK and OVK decryption paths, while valid scan results, commitment checks, and errors for invalid API inputs are preserved.

  • Adds regression tests for native shielded and TRC20 IVK/OVK scans, covering valid notes on both sides of malformed entries.
  • Public Note.decode behavior and consensus transaction validation are unchanged.

Written for commit a7a1b45. Summary will update on new commits.

View guided diff Turn on auto-fix

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d2a98954-f430-4e32-b826-df457ce5b5cc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 2 files

Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack

View guided diff | Turn on auto-fix | Re-trigger cubic

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.

1 participant