From 712e941789cbf6966eae4a99c60b26053c0e7828 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 21 Sep 2022 12:08:41 +0100 Subject: [PATCH] fix compilation --- chain/chain/src/types.rs | 1 - chain/epoch-manager/src/adapter.rs | 12 ++++++++---- nearcore/src/runtime/mod.rs | 9 ++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/chain/chain/src/types.rs b/chain/chain/src/types.rs index 979e8ccb4ca..538c5e027e2 100644 --- a/chain/chain/src/types.rs +++ b/chain/chain/src/types.rs @@ -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}; diff --git a/chain/epoch-manager/src/adapter.rs b/chain/epoch-manager/src/adapter.rs index 0a2e7d5b7cd..443f241182b 100644 --- a/chain/epoch-manager/src/adapter.rs +++ b/chain/epoch-manager/src/adapter.rs @@ -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, }, @@ -239,7 +243,7 @@ impl 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(), @@ -296,7 +300,7 @@ impl EpochManagerAdapter for T { } fn verify_header_signature(&self, header: &BlockHeader) -> Result { - 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()) { @@ -319,7 +323,7 @@ impl EpochManagerAdapter for T { height_created: BlockHeight, shard_id: ShardId, ) -> Result { - 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)?; @@ -337,7 +341,7 @@ impl EpochManagerAdapter for T { approvals: &[Option], ) -> Result { 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() { diff --git a/nearcore/src/runtime/mod.rs b/nearcore/src/runtime/mod.rs index feb543b1036..2f7a195bdec 100644 --- a/nearcore/src/runtime/mod.rs +++ b/nearcore/src/runtime/mod.rs @@ -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}; @@ -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}; @@ -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; @@ -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;