smartcontract: use validate_program_account! macro across processors#3436
Open
smartcontract: use validate_program_account! macro across processors#3436
Conversation
5eb914d to
b4a1ebd
Compare
vihu
reviewed
Apr 3, 2026
smartcontract/programs/doublezero-serviceability/src/processors/link/delete.rs
Outdated
Show resolved
Hide resolved
vihu
reviewed
Apr 3, 2026
smartcontract/programs/doublezero-serviceability/src/processors/link/delete.rs
Show resolved
Hide resolved
Replace manual assert_eq!/assert! account validation checks with the validate_program_account! macro in 19 processor files. This adds consistent data_is_empty checks that were previously missing and fixes a bug in link/resume.rs where is_writable was not validated despite the account being written to.
a0561b9 to
63cfed0
Compare
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.
Summary
assert_eq!/assert!account validation with thevalidate_program_account!macro across 19 processor files in doublezero-serviceabilitylink/resume.rswherelink_account.is_writablewas never validated despite the account being written to viatry_acc_writedata_is_emptychecks (via the macro) to accounts that previously lacked themDetails
The
validate_program_account!macro consolidates four common checks (owner, non-empty, writable, PDA match) into a single call. Many processors were doing these checks manually and inconsistently. This PR standardizes them while preserving custom error handling where needed (e.g.,AccessPassNotFoundfor empty accesspass accounts).Files modified
Bug fix
link/resume.rswrites tolink_account(line 83) but never checkedis_writable. All other link processors that write validate writability. The macro now enforces this.Testing Verification
make rust-fmtpassesmake rust-lintpasses (clippy clean)cargo test -p doublezero-serviceability— all tests pass