Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,8 @@ pub const DELEGATION_PROGRAM_ID: Pubkey = crate::id();
/// Default validator identity (used when none is provided during delegation).
pub const DEFAULT_VALIDATOR_IDENTITY: Pubkey =
pubkey!("MAS1Dt9qreoRMQ14YQuhg8UTZMMzDdKhmkZMECCzk57");

/// The broadcast identity marks an account as undelegatable.
/// Validators treat it as always delegatable, which is safe since such accounts
/// cannot be committed or delegated
pub const BROADCAST_IDENTITY: Pubkey = pubkey!("Broadcast1111111111111111111111111111111111");
Comment thread
GabrielePicco marked this conversation as resolved.
12 changes: 12 additions & 0 deletions src/processor/commit_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,18 @@ pub(crate) fn process_commit_state_internal(
let delegation_record =
DelegationRecord::try_from_bytes_with_discriminator(&delegation_record_data)?;

// Check that the authority is allowed to commit
if !delegation_record.authority.eq(args.validator.key)
&& delegation_record.authority.ne(&Pubkey::default())
{
msg!(
"validator ({}) is not the delegation authority ({})",
args.validator.key,
delegation_record.authority
);
return Err(DlpError::InvalidAuthority.into());
}

// If there was an issue with the lamport accounting in the past, abort (this should never happen)
if args.delegated_account.lamports() < delegation_record.lamports {
msg!(
Expand Down