Repository navigation
feat: enforce identity and add broadcast consts - #85
Merged
Merged
Conversation
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.
feat: enforce identity and add broadcast consts
Description
Greptile Summary
Updated On: 2025-09-05 13:36:34 UTC
This PR introduces two key changes to the delegation program: identity enforcement and a new broadcast constant. The main security enhancement is in
src/processor/commit_state.rs, where the code now validates that only authorized validators can commit state changes for delegated accounts. The validation checks that the validator making the commit either matches the delegation record's authority field or that no specific authority was set (usingPubkey::default()). If an unauthorized validator attempts to commit, the operation fails withDlpError::InvalidAuthority.Additionally, the PR adds a new constant
BROADCAST_IDENTITYinsrc/consts.rswith the pubkey"Broadcast1111111111111111111111111111111111". This constant appears to be a special placeholder identity used for broadcast operations in the SDK, following the same pattern as the existingDEFAULT_VALIDATOR_IDENTITYconstant.These changes fit into the broader delegation system by strengthening access control - previously any validator could commit state for any delegated account, which was a potential security vulnerability. The new authority check ensures proper ownership validation while maintaining backward compatibility for delegations without explicit authorities set. The broadcast identity provides the SDK with a standardized way to handle special broadcast cases where a specific validator identity may not be applicable.
Confidence score: 4/5