Skip to content

chore: improve nullify in registry#2345

Draft
SwenSchaeferjohann wants to merge 13 commits intomainfrom
swen/opt-nullify
Draft

chore: improve nullify in registry#2345
SwenSchaeferjohann wants to merge 13 commits intomainfrom
swen/opt-nullify

Conversation

@SwenSchaeferjohann
Copy link
Contributor

@SwenSchaeferjohann SwenSchaeferjohann commented Mar 15, 2026

new registry program instruction nullify2

  • moves proof nodes from ix data to remaining accounts
  • this enables the following:

if client sends 2 instructions in one txn, Solana will deduplicate any overlapping proof nodes between those two instructions, reducing overall txn size.

pr also adds pairing logic inside forester client for v1 state nullification

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 15, 2026

Important

Review skipped

Draft detected.

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

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ab12c49e-5f2e-42e4-a58c-a7026479ade7

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch swen/opt-nullify
📝 Coding Plan
  • Generate coding plan for human review comments

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@SwenSchaeferjohann
Copy link
Contributor Author

Mechanism:

Each nullify has 16 proof accounts (pubkeys).
Solana deduplicates account keys in a transaction.
If two nullifies share proof nodes, the combined tx is smaller.
Pairing is only attempted when the combined tx fits under 1232 bytes.

Algorithm:

Build a graph of all state nullifies.
For each pair (i, j): if a 2-instruction tx fits, add edge with weight 10_000 + overlap (overlap = shared proof nodes).
Run maximum cardinality matching to pair as many instructions as possible, preferring higher overlap.
Paired instructions go into one tx; unpaired go into single-instruction txs.
Batches are ordered by leaf index for deterministic behavior.

Guards:

Pairing only if batch_size >= 2.
Pairing only if enough blocks left before blockhash expiry (>25).
Pairing only if nullify count ≤ 96 and pair candidates ≤ 2000 (to cap matching cost).

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