Skip to content
Draft
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
18 changes: 15 additions & 3 deletions magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,7 @@ where
&action_dependencies_to_fetch,
);

// CHECKPOINT: why this?
if !not_found.is_empty() {
return Err(ChainlinkError::MissingDelegationActionAccounts(
not_found.iter().map(|(pubkey, _)| *pubkey).collect(),
Expand All @@ -1326,6 +1327,10 @@ where
)
.await?;

// CHECKPOINT: This enforces a strict policy for normal-path action dependencies:
// if a dependency is DLP-owned but lacks delegation-record companion, we fail.
// This may reject valid future DLP-internal account types unless we classify
// those explicitly via dlp_api (instead of treating all such cases as fatal).
if !action_dep_missing_delegation_record.is_empty() {
return Err(ChainlinkError::MissingDelegationActionAccounts(
action_dep_missing_delegation_record
Expand Down Expand Up @@ -1407,6 +1412,8 @@ where
in_bank: &AccountSharedData,
fetch_origin: AccountFetchOrigin,
) -> RefreshDecision {
// CHECKPOINT: does it handle this race: say if it is undelegating == true,
// and then enters if-block, and by the time it executes, the undelegation is completed?
if in_bank.undelegating() {
debug!(
pubkey = %pubkey,
Expand Down Expand Up @@ -1696,6 +1703,11 @@ where
)
}

/// CHECKPOINT: companion could be any of these:
/// - delegation record (of delegated account)
/// - program data (of program)
/// - eata (of ata)
/// anything else?
fn task_to_fetch_with_companion(
&self,
pubkey: Pubkey,
Expand Down Expand Up @@ -1741,13 +1753,13 @@ where
))),
}
})
.and_then(|(acc, deleg)| {
.and_then(|(acc, companion)| {
Self::resolve_account_with_companion(
&bank,
pubkey,
companion_pubkey,
acc,
deleg,
companion,
)
})
})
Expand Down Expand Up @@ -1787,7 +1799,7 @@ where
}
}
(Found(acc), Found(comp)) => {
// Found the delegation record, we include it so that the caller can
// Found the companion (delegation record or program data) , we include it so that the caller can
// use it to add metadata to the account and use it for decision making
let Some(comp_account) =
comp.account.resolved_account_shared_data(bank)
Expand Down
5 changes: 5 additions & 0 deletions magicblock-chainlink/src/chainlink/fetch_cloner/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ where
} else {
*account_slot
};

// CHECKPOINT: just because the account with pubkey is owned by DLP (owned_by_deleg), it
// must be "delegated" account? How about if it is a DLP internal account?
fetch_with_delegation_record_join_set.spawn(
this.task_to_fetch_with_delegation_record(
*pubkey,
Expand Down Expand Up @@ -357,6 +360,8 @@ where
.insert(delegation_record.owner);
}

// CHECKPOINT: if account.delegated() == false, dooes it not imply this case too
// should be added to `missing_delegation_record` ?
let delegation_actions = if account.delegated() {
delegation_actions.unwrap_or_default()
} else {
Expand Down
Loading