Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Runtime Epoch Split] (7/n) Split runtime everywhere else #8940

Merged
merged 26 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
70abe87
[Runtime Epoch Split] (7/n) More splitting around Chain.
robin-near Apr 17, 2023
aba3677
[Runtime Epoch Split] (8/n) Split Chain's runtime_adapter field.
robin-near Apr 21, 2023
33bca45
Fix undo-tool
robin-near Apr 21, 2023
f97314f
Fix VM tests which is unstable under cargo fix.
robin-near Apr 21, 2023
cd23a8a
Split runtime in Client and affected code.
robin-near Apr 21, 2023
8f848ed
Split out KeyValueEpochManager from KeyValueRuntime.
robin-near Apr 24, 2023
8e70205
Make NightshadeRuntime no longer implement EpochManager
robin-near Apr 25, 2023
b5d36d5
Fix after rebase.
robin-near Apr 26, 2023
c16f459
Minor fix.
robin-near Apr 26, 2023
e1fa6a6
Rename runtime back to runtime_adapter for client and chain.
robin-near May 1, 2023
4888419
Rename KeyValueEpochManager to MockEpochManager
robin-near May 1, 2023
5810f5d
Merge remote-tracking branch 'origin/master' into epoch9
robin-near May 1, 2023
9ee616a
Fix compilation failures behind features.
robin-near May 1, 2023
c9930a9
Fix formatting.
robin-near May 1, 2023
73e6c76
Lol. More formatting correction.
robin-near May 1, 2023
cea21cc
Fix setup difference introduced by KeyValueRuntime splitting.
robin-near May 3, 2023
7ad64c2
Merge remote-tracking branch 'origin/master' into epoch9
robin-near May 3, 2023
b2f2e14
Fix sanity check.
robin-near May 3, 2023
8a34f87
Fix another small bug after rebasing.
robin-near May 3, 2023
39300b6
Fix more sanity checks. When does this ever end? :(
robin-near May 4, 2023
2ad72bb
Why doesn't clippy just emit all the errors at once?
robin-near May 4, 2023
4afd10e
Merge branch 'master' into epoch9
robin-near May 4, 2023
86cb343
Merge branch 'master' into epoch9
robin-near May 9, 2023
ad6b6eb
Correct new issue.
robin-near May 10, 2023
7116e99
Merge remote-tracking branch 'origin/master' into epoch9
robin-near May 10, 2023
66796cf
Merge branch 'master' into epoch9
robin-near May 11, 2023
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
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions chain/chain/src/blocks_delay_tracker.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use chrono::DateTime;
use near_epoch_manager::EpochManagerAdapter;
use near_primitives::block::{Block, Tip};
use near_primitives::borsh::maybestd::collections::hash_map::Entry;
use near_primitives::hash::CryptoHash;
Expand All @@ -14,7 +15,7 @@ use std::mem;
use std::time::Instant;
use tracing::error;

use crate::{metrics, Chain, ChainStoreAccess, RuntimeWithEpochManagerAdapter};
use crate::{metrics, Chain, ChainStoreAccess};

const BLOCK_DELAY_TRACKING_COUNT: u64 = 50;

Expand Down Expand Up @@ -92,7 +93,7 @@ impl ChunkTrackingStats {
fn to_chunk_processing_info(
&self,
chunk_hash: ChunkHash,
runtime_adapter: &dyn RuntimeWithEpochManagerAdapter,
epoch_manager: &dyn EpochManagerAdapter,
) -> ChunkProcessingInfo {
let status = if self.completed_timestamp.is_some() {
ChunkProcessingStatus::Completed
Expand All @@ -101,10 +102,10 @@ impl ChunkTrackingStats {
} else {
ChunkProcessingStatus::NeedToRequest
};
let created_by = runtime_adapter
let created_by = epoch_manager
.get_epoch_id_from_prev_block(&self.prev_block_hash)
.and_then(|epoch_id| {
runtime_adapter.get_chunk_producer(&epoch_id, self.height_created, self.shard_id)
epoch_manager.get_chunk_producer(&epoch_id, self.height_created, self.shard_id)
})
.ok();
let request_duration = if let Some(requested_timestamp) = self.requested_timestamp {
Expand Down Expand Up @@ -353,17 +354,17 @@ impl BlocksDelayTracker {
block_height: BlockHeight,
block_hash: &CryptoHash,
chain: &Chain,
runtime_adapter: &dyn RuntimeWithEpochManagerAdapter,
epoch_manager: &dyn EpochManagerAdapter,
) -> Option<BlockProcessingInfo> {
self.blocks.get(block_hash).map(|block_stats| {
let chunks_info: Vec<_> = block_stats
.chunks
.iter()
.map(|chunk_hash| {
if let Some(chunk_hash) = chunk_hash {
self.chunks.get(chunk_hash).map(|x| {
x.to_chunk_processing_info(chunk_hash.clone(), runtime_adapter)
})
self.chunks
.get(chunk_hash)
.map(|x| x.to_chunk_processing_info(chunk_hash.clone(), epoch_manager))
} else {
None
}
Expand Down Expand Up @@ -451,7 +452,7 @@ impl Chain {
*height,
hash,
self,
&*self.runtime_adapter,
self.epoch_manager.as_ref(),
)
})
.collect::<Vec<_>>()
Expand All @@ -463,7 +464,8 @@ impl Chain {
.iter()
.flat_map(|(chunk_hash, _)| {
self.blocks_delay_tracker.chunks.get(chunk_hash).map(|chunk_stats| {
chunk_stats.to_chunk_processing_info(chunk_hash.clone(), &*self.runtime_adapter)
chunk_stats
.to_chunk_processing_info(chunk_hash.clone(), self.epoch_manager.as_ref())
})
})
.collect::<Vec<_>>();
Expand Down
Loading
Loading