Skip to content

fix: Fix mixed signer/non-signer handling in post-delegation actions - #187

Open
snawaz wants to merge 4 commits into
mainfrom
snawaz/fix-indexing
Open

fix: Fix mixed signer/non-signer handling in post-delegation actions#187
snawaz wants to merge 4 commits into
mainfrom
snawaz/fix-indexing

Conversation

@snawaz

@snawaz snawaz commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator
  • fix cleartext_with_insertable construction so an inserted non-signer reused later as a signer gets a signer slot, while inserted signers can still be reused by later non-signer metas. Now the construction ensures that:
    • signer metas must use signer storage; this may cause a pubkey to be added twice: 1) first as a non-signer from the insertable actions, 2) and second as a signer from the new instructions.
    • but non-signer metas may safely reuse signer storage. we do not add pubkey twice in this case even if signer is from the insertable actions, and non-signer from the new instructions.
  • relax validation to enforce the correct one-way signer invariant: only signer metas must resolve to signer storage (non-signers can resolve to any storage), and signer-storage pubkeys must be backed by signed AccountInfos.
image

ref: https://explorer.solana.com/tx/2Kkr1hazsZXJ92qi8xL3cXLbx3f2gYr7c6iHcTvu2fH65pE45uqJ5P7UXpVAAhRGGVemPFvJNoGxBoS9AKksJ7ej

Summary by CodeRabbit

  • Bug Fixes
    • Improved signer handling when compacting delegated account metadata.
    • Prevented signer accounts from being incorrectly dropped or assigned incorrect indexes.
    • Enhanced validation to ensure signer accounts resolve to valid signer storage.
    • Added coverage for reusing inserted signer entries as non-signer metadata while preserving signer recognition.

snawaz commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b52a527d-577a-420e-bfed-a4800a2b14f2

📥 Commits

Reviewing files that changed from the base of the PR and between 47fcb60 and 874b3e7.

📒 Files selected for processing (1)
  • dlp-api/src/compact/mod.rs

📝 Walkthrough

Walkthrough

Updated cleartext compaction to preserve signer-storage indexing when insertable pubkeys are reused. Delegated-action validation now requires signer metas to resolve to signer storage while allowing non-signer metas to reference signer storage. Added signer security-model documentation and tests covering these cases.

Suggested reviewers: gabrielepicco

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch snawaz/fix-indexing

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@dlp-api/src/compact/mod.rs`:
- Around line 307-318: Document the invariant in the index_of_signer closure
before the signers.iter().position(...).unwrap() call, explicitly stating that
every non-skipped signer is inserted into signers before this closure runs. Keep
the existing lookup behavior unchanged while making the unwrap’s safety
assumption clear, matching the explanatory style of the sibling index_of
closure.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d1f8eadb-d198-4bc8-9385-c589825de971

📥 Commits

Reviewing files that changed from the base of the PR and between 37a8ae7 and 47fcb60.

📒 Files selected for processing (1)
  • dlp-api/src/compact/mod.rs

Comment thread dlp-api/src/compact/mod.rs
@snawaz snawaz changed the title fix: Fix signer role indexing in post-delegation actions fix: Fix mixed signer/non-signer handling in post-delegation actions Jul 15, 2026
@snawaz
snawaz marked this pull request as ready for review July 15, 2026 17:06
@snawaz
snawaz requested a review from GabrielePicco July 15, 2026 17:13
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