Skip to content
Open
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
4 changes: 2 additions & 2 deletions magicblock-chainlink/src/chainlink/fetch_cloner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,15 @@ where
Ok(Err(err)) => {
error!(
pubkey = %pubkey,
error = %err,
error = ?err,
"Failed to fetch delegation record"
);
(None, None)
}
Err(err) => {
error!(
pubkey = %pubkey,
error = %err,
error = ?err,
"Failed to fetch delegation record"
);
(None, None)
Expand Down
8 changes: 4 additions & 4 deletions magicblock-chainlink/src/remote_account_provider/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ pub enum RemoteAccountProviderError {
#[error("Failed to resolve account ({0}) to track slots")]
ClockAccountCouldNotBeResolved(String),

#[error("Failed to resolve accounts to same slot ({0}) to track slots")]
SlotsDidNotMatch(String, Vec<u64>),
#[error("Failed to resolve accounts to same slot ({0}) to track slots hit limit: {2}")]
SlotsDidNotMatch(String, Vec<u64>, String),

#[error("Accounts matched same slot ({0}), but it's less than min required context slot {2} ")]
MatchingSlotsNotSatisfyingMinContextSlot(String, Vec<u64>, u64),
#[error("Accounts matched same slot ({0}), but it's less than min required context slot {2} hit limit: {3}")]
MatchingSlotsNotSatisfyingMinContextSlot(String, Vec<u64>, u64, String),

#[error("LRU capacity must be greater than 0")]
InvalidLruCapacity,
Expand Down
33 changes: 18 additions & 15 deletions magicblock-chainlink/src/remote_account_provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,20 +632,19 @@ impl<T: ChainRpcClient, U: ChainPubsubClient> RemoteAccountProvider<T, U> {
return Ok(remote_accounts);
}

if start.elapsed() > MAX_TOTAL_TIME {
return Err(RemoteAccountProviderError::SlotsDidNotMatch(
format!(
"Timeout after {}s waiting for slots to match",
MAX_TOTAL_TIME.as_secs_f64()
),
vec![],
));
}

retries += 1;
if retries == config.max_retries {
let hit_max_retry_limit = retries == config.max_retries;
if hit_max_retry_limit || start.elapsed() > MAX_TOTAL_TIME {
let remote_accounts =
remote_accounts.into_iter().map(|a| a.slot()).collect();
let limit = if hit_max_retry_limit {
format!("max retries {}", config.max_retries)
} else {
format!(
"max total time of {} seconds",
MAX_TOTAL_TIME.as_secs()
)
};
match slots_match_result {
// SAFETY: Match case is already handled and returns
Match => unreachable!("we would have returned above"),
Expand All @@ -654,15 +653,18 @@ impl<T: ChainRpcClient, U: ChainPubsubClient> RemoteAccountProvider<T, U> {
RemoteAccountProviderError::SlotsDidNotMatch(
pubkeys_str(pubkeys),
remote_accounts,
limit,
),
);
}
MatchButBelowMinContextSlot(slot) => {
return Err(
RemoteAccountProviderError::MatchingSlotsNotSatisfyingMinContextSlot(
pubkeys_str(pubkeys),
remote_accounts,
slot)
pubkeys_str(pubkeys),
remote_accounts,
slot,
limit
)
);
}
}
Expand Down Expand Up @@ -1552,7 +1554,8 @@ mod test {
RemoteAccountProviderError::MatchingSlotsNotSatisfyingMinContextSlot(
_pubkeys,
_slots,
slot
slot,
_
) if slot == CURRENT_SLOT + 1
));
}
Expand Down