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
Original file line number Diff line number Diff line change
Expand Up @@ -1144,10 +1144,11 @@ impl ConsensusContext for SequencerConsensusContext {
Some(block_data.compute_accessed_keys(&sync_block.state_diff.clone().into()))
}
Ok(None) => {
panic!(
"The accessed-keys data for synced block {block_number} is expected to be \
ready."
error!(
"Recorder does not yet have accessed-keys data for synced block \
{block_number}."
);
return false;
}
Err(e) => {
error!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2111,11 +2111,12 @@ async fn try_sync_forwards_accessed_keys_from_centralized() {
assert!(context.try_sync(SYNC_HEIGHT).await);
}

// When `fetch_accessed_keys_from_centralized` is enabled, the block's accessed keys are required;
// the data is expected to be ready at sync time, so a missing entry in the recorder is a bug.
// When `fetch_accessed_keys_from_centralized` is enabled, the recorder may not yet have the
// synced block's accessed-keys data (e.g. it lags behind state sync, or is unavailable). This is
// data from a remote, network-reachable service, not a programmer invariant, so `try_sync` must
// fail the attempt gracefully (allowing the caller to retry) instead of panicking the node.
#[tokio::test]
#[should_panic(expected = "The accessed-keys data for synced block 7 is expected to be ready.")]
async fn try_sync_panics_when_recorder_has_no_accessed_keys() {
async fn try_sync_fails_gracefully_when_recorder_has_no_accessed_keys() {
const SYNC_HEIGHT: BlockNumber = BlockNumber(7);

let (mut deps, _network) = create_test_and_network_deps();
Expand All @@ -2140,7 +2141,7 @@ async fn try_sync_panics_when_recorder_has_no_accessed_keys() {
..Default::default()
});

context.try_sync(SYNC_HEIGHT).await;
assert!(!context.try_sync(SYNC_HEIGHT).await);
}

// With the opt-in disabled (the default), `try_sync` must not query the recorder and passes `None`
Expand Down
Loading