Skip to content

Commit

Permalink
fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Sep 21, 2022
1 parent 8b61327 commit 712e941
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion chain/chain/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use near_primitives::hash::CryptoHash;
use near_primitives::merkle::{merklize, MerklePath};
use near_primitives::receipt::Receipt;
use near_primitives::shard_layout::{ShardLayout, ShardUId};
use near_primitives::sharding::{ChunkHash, ShardChunkHeader};
use near_primitives::state_part::PartId;
use near_primitives::transaction::{ExecutionOutcomeWithId, SignedTransaction};
use near_primitives::types::validator_stake::{ValidatorStake, ValidatorStakeIter};
Expand Down
12 changes: 8 additions & 4 deletions chain/epoch-manager/src/adapter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
use near_chain_primitives::Error;
use near_crypto::Signature;
use near_primitives::{
block_header::{Approval, ApprovalInner, BlockHeader},
errors::EpochError,
hash::CryptoHash,
sharding::{ChunkHash, ShardChunkHeader},
types::{
validator_stake::ValidatorStake, AccountId, ApprovalStake, BlockHeight, EpochId, ShardId,
},
Expand Down Expand Up @@ -239,7 +243,7 @@ impl<T: HasEpochMangerHandle + Send + Sync> EpochManagerAdapter for T {
vrf_value: &near_crypto::vrf::Value,
vrf_proof: &near_crypto::vrf::Proof,
) -> Result<(), Error> {
let epoch_manager = self.epoch_manager.read();
let epoch_manager = self.read();
let validator = epoch_manager.get_block_producer_info(epoch_id, block_height)?;
let public_key = near_crypto::key_conversion::convert_public_key(
validator.public_key().unwrap_as_ed25519(),
Expand Down Expand Up @@ -296,7 +300,7 @@ impl<T: HasEpochMangerHandle + Send + Sync> EpochManagerAdapter for T {
}

fn verify_header_signature(&self, header: &BlockHeader) -> Result<bool, Error> {
let epoch_manager = self.epoch_manager.read();
let epoch_manager = self.read();
let block_producer =
epoch_manager.get_block_producer_info(header.epoch_id(), header.height())?;
match epoch_manager.get_block_info(header.prev_hash()) {
Expand All @@ -319,7 +323,7 @@ impl<T: HasEpochMangerHandle + Send + Sync> EpochManagerAdapter for T {
height_created: BlockHeight,
shard_id: ShardId,
) -> Result<bool, Error> {
let epoch_manager = self.epoch_manager.read();
let epoch_manager = self.read();
let chunk_producer =
epoch_manager.get_chunk_producer_info(epoch_id, height_created, shard_id)?;
let block_info = epoch_manager.get_block_info(last_known_hash)?;
Expand All @@ -337,7 +341,7 @@ impl<T: HasEpochMangerHandle + Send + Sync> EpochManagerAdapter for T {
approvals: &[Option<Signature>],
) -> Result<bool, Error> {
let info = {
let epoch_manager = self.epoch_manager.read();
let epoch_manager = self.read();
epoch_manager.get_all_block_approvers_ordered(prev_block_hash).map_err(Error::from)?
};
if approvals.len() > info.len() {
Expand Down
9 changes: 4 additions & 5 deletions nearcore/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use borsh::ser::BorshSerialize;
use borsh::BorshDeserialize;
use errors::FromStateViewerErrors;
use near_chain::types::{ApplySplitStateResult, ApplyTransactionResult, BlockHeaderInfo};
use near_chain::{BlockHeader, Doomslug, DoomslugThresholdMode, Error, RuntimeAdapter};
use near_chain::{Doomslug, DoomslugThresholdMode, Error, RuntimeAdapter};
use near_chain_configs::{
Genesis, GenesisConfig, ProtocolConfig, DEFAULT_GC_NUM_EPOCHS_TO_KEEP,
MIN_GC_NUM_EPOCHS_TO_KEEP,
};
use near_client_primitives::types::StateSplitApplyingStatus;
use near_crypto::{PublicKey, Signature};
use near_epoch_manager::{EpochManager, EpochManagerAdapter, EpochManagerHandle};
use near_epoch_manager::{EpochManager, EpochManagerHandle};
use near_o11y::log_assert;
use near_pool::types::PoolIterator;
use near_primitives::account::{AccessKey, Account};
Expand All @@ -32,7 +32,6 @@ use near_primitives::sandbox::state_patch::SandboxStatePatch;
use near_primitives::shard_layout::{
account_id_to_shard_id, account_id_to_shard_uid, ShardLayout, ShardUId,
};
use near_primitives::sharding::ChunkHash;
use near_primitives::state_part::PartId;
use near_primitives::state_record::{state_record_to_account_id, StateRecord};
use near_primitives::syncing::{get_num_state_parts, STATE_PART_MEMORY_LIMIT};
Expand Down Expand Up @@ -1779,8 +1778,10 @@ mod test {
use near_primitives::types::validator_stake::ValidatorStake;
use num_rational::Ratio;

use crate::config::{GenesisExt, TESTING_INIT_BALANCE, TESTING_INIT_STAKE};
use near_chain_configs::DEFAULT_GC_NUM_EPOCHS_TO_KEEP;
use near_crypto::{InMemorySigner, KeyType, Signer};
use near_epoch_manager::EpochManagerAdapter;
use near_o11y::testonly::init_test_logger;
use near_primitives::block::Tip;
use near_primitives::challenge::SlashedValidator;
Expand All @@ -1792,8 +1793,6 @@ mod test {
};
use near_store::{NodeStorage, Temperature};

use crate::config::{GenesisExt, TESTING_INIT_BALANCE, TESTING_INIT_STAKE};

use super::*;

use near_primitives::trie_key::TrieKey;
Expand Down

0 comments on commit 712e941

Please sign in to comment.