Store reclaim_recipient address in the state PDA - #84
Open
kaze-cow wants to merge 19 commits into
Open
Conversation
`Initialize` now takes a `receiver` pubkey and records it verbatim in the settlement state PDA, growing the account from 1 byte (bare discriminator) to 33. The body gets the same `StateAccount`/`EncodedStateAccount` encode- decode treatment as the other account types. `receiver` is the account that will collect reclaimed buffer funds; nothing reads it yet. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
fedgiac
reviewed
Jul 31, 2026
fedgiac
left a comment
Contributor
There was a problem hiding this comment.
One major discussion point: how do we plan to initialize the program in the first place? Right now, anyone can front-run our initialization.
Apart from that and some more minor comment, the design looks reasonable.
Also, I think we should update DESIGN.md (minimally!) to explain the role of this new "receiver" account.
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
…olana-programs into kaze/sc-151-state-receiver
receiver address in the state PDAreclaim_recipient address in the state PDA
fedgiac
reviewed
Aug 3, 2026
Contributor
There was a problem hiding this comment.
Looks good to me and I like the current design, I don't expect further comments after the current ones are addressed.
The "who calls it" discussion is still open but doesn't need to be addressed here (#86 is fine for tracking).
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
Co-authored-by: Federico Giacon <58218759+fedgiac@users.noreply.github.com>
…olana-programs into kaze/sc-151-state-receiver
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Split out of #60 so the state PDA layout change can be reviewed on its own.
Up to now the settlement state PDA has been initialized with no data beyond its discriminator. This adds a single field to it: a
reclaim_recipientaccount, configured once atInitializetime.Changes
Initializegrows areclaim_recipientparameter, and its wire format goes from[discriminator=3](1 byte) to[discriminator=3, reclaim_recipient (32 bytes)](33 bytes). The state PDA's data area grows to match.The state body gets the same
StateAccount/EncodedStateAccountencode-decode treatment as the other account types ininterface/src/data, replacing the bareDISCRIMINATORconstant anddecodehelper.Nothing reads
reclaim_recipientyet — #60 is what puts it to use, as the account allowed to callReclaimBufferand the destination for reclaimed buffer funds.Out of scope
Authorization, frontrunning prevention of calling
Initialize. See #86How to test
reclaim_recipientnaming and that a single configurable account is the right shape for this role.cargo test --workspace— theinitializeintegration tests assert the PDA holds exactly the discriminator followed by the configured reclaim_recipient.🤖 Generated with Claude Code