fix(validation): enforce fee payer policy for ALT instructions#419
fix(validation): enforce fee payer policy for ALT instructions#419
Conversation
📊 TypeScript Coverage ReportCoverage: 33.9% View detailed reportCoverage artifacts have been uploaded to this workflow run. |
Greptile SummaryThis PR enforces fee-payer policy for Address Lookup Table instructions by adding a new Existing deployments without an explicit Confidence Score: 5/5Safe to merge; implementation is logically correct and secure-by-default ALT policy is appropriate All findings are P2 (style and testing gaps). Parsing logic, account-index constants, and per-instruction enforcement conditions are correct. The false default for all ALT flags is consistent with every other policy field in the codebase. crates/lib/src/config.rs (add #[serde(default)] to AltInstructionPolicy) and crates/lib/src/validator/transaction_validator.rs (add validator tests for Extend, Deactivate, and Close policy enforcement) Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Transaction submitted] --> B[get_or_parse_alt_instructions]
B --> C{ALT program instructions found?}
C -- No --> D[Skip ALT validation]
C -- Yes --> E{Instruction type}
E -- CreateLookupTable --> F{authority == fee_payer OR payer == fee_payer?}
E -- ExtendLookupTable --> G{authority == fee_payer OR optional payer == fee_payer?}
E -- FreezeLookupTable --> H{authority == fee_payer?}
E -- DeactivateLookupTable --> I{authority == fee_payer?}
E -- CloseLookupTable --> J{authority == fee_payer?}
F -- Yes --> K{allow_create?}
G -- Yes --> L{allow_extend?}
H -- Yes --> M{allow_freeze?}
I -- Yes --> N{allow_deactivate?}
J -- Yes --> O{allow_close?}
K -- No --> P[Error: fee payer not allowed]
L -- No --> P
M -- No --> P
N -- No --> P
O -- No --> P
K -- Yes --> Q[OK]
L -- Yes --> Q
M -- Yes --> Q
N -- Yes --> Q
O -- Yes --> Q
F -- No --> Q
G -- No --> Q
H -- No --> Q
I -- No --> Q
J -- No --> Q
Reviews (1): Last reviewed commit: "fix(validation): enforce fee payer polic..." | Re-trigger Greptile |
Add ALT instruction parsing and validation in the transaction validator so fee payer authority/payer usage for create, extend, freeze, deactivate, and close is explicitly controlled by config. Introduce fee_payer_policy.alt flags (default deny), wire parsed ALT instruction caching, add config-validator warnings/tests, and update getConfig + example TOMLs with the new policy section.
16b5d9e to
35c5350
Compare
Summary
Test Plan (if applicable)
Breaking Changes (if applicable)
📊 Unit Test Coverage
Unit Test Coverage: 84.8%
View Detailed Coverage Report