From 7476d1aaada70b449155a132470bacc4d91bcccc Mon Sep 17 00:00:00 2001 From: Sarfaraz Nawaz Date: Sat, 21 Mar 2026 19:12:20 +0530 Subject: [PATCH] explore/refactor: explore and make minor improvements --- .../src/chainlink/fetch_cloner/mod.rs | 18 +++++++++++++++--- .../src/chainlink/fetch_cloner/pipeline.rs | 5 +++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs b/magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs index 795ae79f6..296deb9a6 100644 --- a/magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs +++ b/magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs @@ -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(), @@ -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 @@ -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, @@ -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, @@ -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, ) }) }) @@ -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) diff --git a/magicblock-chainlink/src/chainlink/fetch_cloner/pipeline.rs b/magicblock-chainlink/src/chainlink/fetch_cloner/pipeline.rs index 0ac5cb586..b484ddfec 100644 --- a/magicblock-chainlink/src/chainlink/fetch_cloner/pipeline.rs +++ b/magicblock-chainlink/src/chainlink/fetch_cloner/pipeline.rs @@ -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, @@ -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 {