From 0f2390af914b7b311dbfad5be278d5701b57b570 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Thu, 21 May 2020 08:35:32 -0700 Subject: [PATCH 01/21] Adding nightly test for upgradability: checks that after proper number of epochs active protocol versoins match --- chain/client/src/client_actor.rs | 9 +- core/primitives/src/block.rs | 360 +-------------------- core/primitives/src/block_header.rs | 359 ++++++++++++++++++++ core/primitives/src/lib.rs | 1 + core/primitives/src/views.rs | 4 + nightly/nightly.txt | 1 + pytest/lib/branches.py | 25 +- pytest/lib/utils.py | 15 + pytest/tests/sanity/backward_compatible.py | 5 +- pytest/tests/sanity/upgradable.py | 74 +++++ 10 files changed, 483 insertions(+), 370 deletions(-) create mode 100644 core/primitives/src/block_header.rs create mode 100644 pytest/tests/sanity/upgradable.py diff --git a/chain/client/src/client_actor.rs b/chain/client/src/client_actor.rs index b4669c1341c..879feeb30ea 100644 --- a/chain/client/src/client_actor.rs +++ b/chain/client/src/client_actor.rs @@ -17,9 +17,9 @@ use near_chain::{ byzantine_assert, Block, BlockHeader, ChainGenesis, ChainStoreAccess, Provenance, RuntimeAdapter, }; -use near_chain_configs::ClientConfig; #[cfg(feature = "adversarial")] use near_chain_configs::GenesisConfig; +use near_chain_configs::{ClientConfig, PROTOCOL_VERSION}; use near_crypto::Signature; #[cfg(feature = "metric_recorder")] use near_network::recorder::MetricRecorder; @@ -38,6 +38,8 @@ use near_primitives::validator_signer::ValidatorSigner; use near_primitives::views::ValidatorInfo; #[cfg(feature = "adversarial")] use near_store::ColBlock; +#[cfg(feature = "adversarial")] +use near_store::StoreValidator; use near_telemetry::TelemetryActor; use crate::client::Client; @@ -48,8 +50,6 @@ use crate::types::{ StatusSyncInfo, SyncStatus, }; use crate::StatusResponse; -#[cfg(feature = "adversarial")] -use near_store::StoreValidator; /// Multiplier on `max_block_time` to wait until deciding that chain stalled. const STATUS_WAIT_TIME_MULTIPLIER: u64 = 10; @@ -508,6 +508,9 @@ impl Handler for ClientActor { .collect(); Ok(StatusResponse { version: self.client.config.version.clone(), + // TODO: update this with current one from epoch manager. + protocol_version: PROTOCOL_VERSION, + latest_protocol_version: PROTOCOL_VERSION, chain_id: self.client.config.chain_id.clone(), rpc_addr: self.client.config.rpc_addr.clone(), validators, diff --git a/core/primitives/src/block.rs b/core/primitives/src/block.rs index 97da62f6853..42c04155865 100644 --- a/core/primitives/src/block.rs +++ b/core/primitives/src/block.rs @@ -2,369 +2,21 @@ use std::cmp::max; use borsh::{BorshDeserialize, BorshSerialize}; use chrono::{DateTime, Utc}; +use num_rational::Rational; use serde::Serialize; -use near_crypto::{KeyType, PublicKey, Signature}; +use near_crypto::Signature; +pub use crate::block_header::*; use crate::challenge::{Challenges, ChallengesResult}; use crate::hash::{hash, CryptoHash}; -use crate::merkle::{combine_hash, merklize, verify_path, MerklePath}; +use crate::merkle::{merklize, verify_path, MerklePath}; use crate::sharding::{ ChunkHashHeight, EncodedShardChunk, ReedSolomonWrapper, ShardChunk, ShardChunkHeader, }; -use crate::types::{ - AccountId, Balance, BlockHeight, EpochId, Gas, MerkleHash, NumShards, StateRoot, ValidatorStake, -}; -use crate::utils::{from_timestamp, to_timestamp}; +use crate::types::{Balance, BlockHeight, EpochId, Gas, NumShards, StateRoot}; +use crate::utils::to_timestamp; use crate::validator_signer::{EmptyValidatorSigner, ValidatorSigner}; -use num_rational::Rational; - -#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct BlockHeaderInnerLite { - /// Height of this block since the genesis block (height 0). - pub height: BlockHeight, - /// Epoch start hash of this block's epoch. - /// Used for retrieving validator information - pub epoch_id: EpochId, - pub next_epoch_id: EpochId, - /// Root hash of the state at the previous block. - pub prev_state_root: MerkleHash, - /// Root of the outcomes of transactions and receipts. - pub outcome_root: MerkleHash, - /// Timestamp at which the block was built (number of non-leap-nanoseconds since January 1, 1970 0:00:00 UTC). - pub timestamp: u64, - /// Hash of the next epoch block producers set - pub next_bp_hash: CryptoHash, - /// Merkle root of block hashes up to the current block. - pub block_merkle_root: CryptoHash, -} - -#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct BlockHeaderInnerRest { - /// Root hash of the chunk receipts in the given block. - pub chunk_receipts_root: MerkleHash, - /// Root hash of the chunk headers in the given block. - pub chunk_headers_root: MerkleHash, - /// Root hash of the chunk transactions in the given block. - pub chunk_tx_root: MerkleHash, - /// Number of chunks included into the block. - pub chunks_included: u64, - /// Root hash of the challenges in the given block. - pub challenges_root: MerkleHash, - /// The output of the randomness beacon - pub random_value: CryptoHash, - /// Validator proposals. - pub validator_proposals: Vec, - /// Mask for new chunks included in the block - pub chunk_mask: Vec, - /// Gas price. Same for all chunks - pub gas_price: Balance, - /// Total supply of tokens in the system - pub total_supply: Balance, - /// List of challenges result from previous block. - pub challenges_result: ChallengesResult, - - /// Last block that has full BFT finality - pub last_final_block: CryptoHash, - /// Last block that has doomslug finality - pub last_ds_final_block: CryptoHash, - - /// All the approvals included in this block - pub approvals: Vec>, -} - -impl BlockHeaderInnerLite { - pub fn new( - height: BlockHeight, - epoch_id: EpochId, - next_epoch_id: EpochId, - prev_state_root: MerkleHash, - outcome_root: MerkleHash, - timestamp: u64, - next_bp_hash: CryptoHash, - block_merkle_root: CryptoHash, - ) -> Self { - Self { - height, - epoch_id, - next_epoch_id, - prev_state_root, - outcome_root, - timestamp, - next_bp_hash, - block_merkle_root, - } - } - - pub fn hash(&self) -> CryptoHash { - hash(&self.try_to_vec().expect("Failed to serialize")) - } -} - -impl BlockHeaderInnerRest { - pub fn new( - chunk_receipts_root: MerkleHash, - chunk_headers_root: MerkleHash, - chunk_tx_root: MerkleHash, - chunks_included: u64, - challenges_root: MerkleHash, - random_value: CryptoHash, - validator_proposals: Vec, - chunk_mask: Vec, - gas_price: Balance, - total_supply: Balance, - challenges_result: ChallengesResult, - last_final_block: CryptoHash, - last_ds_final_block: CryptoHash, - approvals: Vec>, - ) -> Self { - Self { - chunk_receipts_root, - chunk_headers_root, - chunk_tx_root, - chunks_included, - challenges_root, - random_value, - validator_proposals, - chunk_mask, - gas_price, - total_supply, - challenges_result, - last_final_block, - last_ds_final_block, - approvals, - } - } - - pub fn hash(&self) -> CryptoHash { - hash(&self.try_to_vec().expect("Failed to serialize")) - } -} - -/// The part of the block approval that is different for endorsements and skips -#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, PartialEq, Eq, Hash)] -pub enum ApprovalInner { - Endorsement(CryptoHash), - Skip(BlockHeight), -} - -/// Block approval by other block producers with a signature -#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, PartialEq, Eq)] -pub struct Approval { - pub inner: ApprovalInner, - pub target_height: BlockHeight, - pub signature: Signature, - pub account_id: AccountId, -} - -/// Block approval by other block producers. -#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, PartialEq, Eq)] -pub struct ApprovalMessage { - pub approval: Approval, - pub target: AccountId, -} - -impl ApprovalInner { - pub fn new( - parent_hash: &CryptoHash, - parent_height: BlockHeight, - target_height: BlockHeight, - ) -> Self { - if target_height == parent_height + 1 { - ApprovalInner::Endorsement(parent_hash.clone()) - } else { - ApprovalInner::Skip(parent_height) - } - } -} - -impl Approval { - pub fn new( - parent_hash: CryptoHash, - parent_height: BlockHeight, - target_height: BlockHeight, - signer: &dyn ValidatorSigner, - ) -> Self { - let inner = ApprovalInner::new(&parent_hash, parent_height, target_height); - let signature = signer.sign_approval(&inner, target_height); - Approval { inner, target_height, signature, account_id: signer.validator_id().clone() } - } - - pub fn get_data_for_sig(inner: &ApprovalInner, target_height: BlockHeight) -> Vec { - [inner.try_to_vec().unwrap().as_ref(), target_height.to_be_bytes().as_ref()].concat() - } -} - -impl ApprovalMessage { - pub fn new(approval: Approval, target: AccountId) -> Self { - ApprovalMessage { approval, target } - } -} - -#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -#[borsh_init(init)] -pub struct BlockHeader { - pub prev_hash: CryptoHash, - - /// Inner part of the block header that gets hashed, split into two parts, one that is sent - /// to light clients, and the rest - pub inner_lite: BlockHeaderInnerLite, - pub inner_rest: BlockHeaderInnerRest, - - /// Signature of the block producer. - pub signature: Signature, - - /// Cached value of hash for this block. - #[borsh_skip] - pub hash: CryptoHash, -} - -impl BlockHeader { - pub fn compute_inner_hash( - inner_lite: &BlockHeaderInnerLite, - inner_rest: &BlockHeaderInnerRest, - ) -> CryptoHash { - let hash_lite = inner_lite.hash(); - let hash_rest = inner_rest.hash(); - combine_hash(hash_lite, hash_rest) - } - - pub fn compute_hash( - prev_hash: CryptoHash, - inner_lite: &BlockHeaderInnerLite, - inner_rest: &BlockHeaderInnerRest, - ) -> CryptoHash { - let hash_inner = BlockHeader::compute_inner_hash(inner_lite, inner_rest); - - return combine_hash(hash_inner, prev_hash); - } - - pub fn init(&mut self) { - self.hash = BlockHeader::compute_hash(self.prev_hash, &self.inner_lite, &self.inner_rest); - } - - pub fn new( - height: BlockHeight, - prev_hash: CryptoHash, - prev_state_root: MerkleHash, - chunk_receipts_root: MerkleHash, - chunk_headers_root: MerkleHash, - chunk_tx_root: MerkleHash, - outcome_root: MerkleHash, - timestamp: u64, - chunks_included: u64, - challenges_root: MerkleHash, - random_value: CryptoHash, - validator_proposals: Vec, - chunk_mask: Vec, - epoch_id: EpochId, - next_epoch_id: EpochId, - gas_price: Balance, - total_supply: Balance, - challenges_result: ChallengesResult, - signer: &dyn ValidatorSigner, - last_final_block: CryptoHash, - last_ds_final_block: CryptoHash, - approvals: Vec>, - next_bp_hash: CryptoHash, - block_merkle_root: CryptoHash, - ) -> Self { - let inner_lite = BlockHeaderInnerLite::new( - height, - epoch_id, - next_epoch_id, - prev_state_root, - outcome_root, - timestamp, - next_bp_hash, - block_merkle_root, - ); - let inner_rest = BlockHeaderInnerRest::new( - chunk_receipts_root, - chunk_headers_root, - chunk_tx_root, - chunks_included, - challenges_root, - random_value, - validator_proposals, - chunk_mask, - gas_price, - total_supply, - challenges_result, - last_final_block, - last_ds_final_block, - approvals, - ); - let (hash, signature) = signer.sign_block_header_parts(prev_hash, &inner_lite, &inner_rest); - Self { prev_hash, inner_lite, inner_rest, signature, hash } - } - - pub fn genesis( - height: BlockHeight, - state_root: MerkleHash, - chunk_receipts_root: MerkleHash, - chunk_headers_root: MerkleHash, - chunk_tx_root: MerkleHash, - chunks_included: u64, - challenges_root: MerkleHash, - timestamp: DateTime, - initial_gas_price: Balance, - initial_total_supply: Balance, - next_bp_hash: CryptoHash, - ) -> Self { - let inner_lite = BlockHeaderInnerLite::new( - height, - EpochId::default(), - EpochId::default(), - state_root, - CryptoHash::default(), - to_timestamp(timestamp), - next_bp_hash, - CryptoHash::default(), - ); - let inner_rest = BlockHeaderInnerRest::new( - chunk_receipts_root, - chunk_headers_root, - chunk_tx_root, - chunks_included, - challenges_root, - CryptoHash::default(), - vec![], - vec![], - initial_gas_price, - initial_total_supply, - vec![], - CryptoHash::default(), - CryptoHash::default(), - vec![], - ); - let hash = BlockHeader::compute_hash(CryptoHash::default(), &inner_lite, &inner_rest); - Self { - prev_hash: CryptoHash::default(), - inner_lite, - inner_rest, - signature: Signature::empty(KeyType::ED25519), - hash, - } - } - - pub fn hash(&self) -> CryptoHash { - self.hash - } - - /// Verifies that given public key produced the block. - pub fn verify_block_producer(&self, public_key: &PublicKey) -> bool { - self.signature.verify(self.hash.as_ref(), public_key) - } - - pub fn timestamp(&self) -> DateTime { - from_timestamp(self.inner_lite.timestamp) - } - - pub fn num_approvals(&self) -> u64 { - self.inner_rest.approvals.iter().filter(|x| x.is_some()).count() as u64 - } -} #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] pub struct Block { diff --git a/core/primitives/src/block_header.rs b/core/primitives/src/block_header.rs new file mode 100644 index 00000000000..567f96b2964 --- /dev/null +++ b/core/primitives/src/block_header.rs @@ -0,0 +1,359 @@ +use borsh::{BorshDeserialize, BorshSerialize}; +use chrono::{DateTime, Utc}; +use serde::Serialize; + +use near_crypto::{KeyType, PublicKey, Signature}; + +use crate::challenge::ChallengesResult; +use crate::hash::{hash, CryptoHash}; +use crate::merkle::combine_hash; +use crate::types::{AccountId, Balance, BlockHeight, EpochId, MerkleHash, ValidatorStake}; +use crate::utils::{from_timestamp, to_timestamp}; +use crate::validator_signer::ValidatorSigner; + +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +pub struct BlockHeaderInnerLite { + /// Height of this block since the genesis block (height 0). + pub height: BlockHeight, + /// Epoch start hash of this block's epoch. + /// Used for retrieving validator information + pub epoch_id: EpochId, + pub next_epoch_id: EpochId, + /// Root hash of the state at the previous block. + pub prev_state_root: MerkleHash, + /// Root of the outcomes of transactions and receipts. + pub outcome_root: MerkleHash, + /// Timestamp at which the block was built (number of non-leap-nanoseconds since January 1, 1970 0:00:00 UTC). + pub timestamp: u64, + /// Hash of the next epoch block producers set + pub next_bp_hash: CryptoHash, + /// Merkle root of block hashes up to the current block. + pub block_merkle_root: CryptoHash, +} + +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +pub struct BlockHeaderInnerRest { + /// Root hash of the chunk receipts in the given block. + pub chunk_receipts_root: MerkleHash, + /// Root hash of the chunk headers in the given block. + pub chunk_headers_root: MerkleHash, + /// Root hash of the chunk transactions in the given block. + pub chunk_tx_root: MerkleHash, + /// Number of chunks included into the block. + pub chunks_included: u64, + /// Root hash of the challenges in the given block. + pub challenges_root: MerkleHash, + /// The output of the randomness beacon + pub random_value: CryptoHash, + /// Validator proposals. + pub validator_proposals: Vec, + /// Mask for new chunks included in the block + pub chunk_mask: Vec, + /// Gas price. Same for all chunks + pub gas_price: Balance, + /// Total supply of tokens in the system + pub total_supply: Balance, + /// List of challenges result from previous block. + pub challenges_result: ChallengesResult, + + /// Last block that has full BFT finality + pub last_final_block: CryptoHash, + /// Last block that has doomslug finality + pub last_ds_final_block: CryptoHash, + + /// All the approvals included in this block + pub approvals: Vec>, +} + +impl BlockHeaderInnerLite { + pub fn new( + height: BlockHeight, + epoch_id: EpochId, + next_epoch_id: EpochId, + prev_state_root: MerkleHash, + outcome_root: MerkleHash, + timestamp: u64, + next_bp_hash: CryptoHash, + block_merkle_root: CryptoHash, + ) -> Self { + Self { + height, + epoch_id, + next_epoch_id, + prev_state_root, + outcome_root, + timestamp, + next_bp_hash, + block_merkle_root, + } + } + + pub fn hash(&self) -> CryptoHash { + hash(&self.try_to_vec().expect("Failed to serialize")) + } +} + +impl BlockHeaderInnerRest { + pub fn new( + chunk_receipts_root: MerkleHash, + chunk_headers_root: MerkleHash, + chunk_tx_root: MerkleHash, + chunks_included: u64, + challenges_root: MerkleHash, + random_value: CryptoHash, + validator_proposals: Vec, + chunk_mask: Vec, + gas_price: Balance, + total_supply: Balance, + challenges_result: ChallengesResult, + last_final_block: CryptoHash, + last_ds_final_block: CryptoHash, + approvals: Vec>, + ) -> Self { + Self { + chunk_receipts_root, + chunk_headers_root, + chunk_tx_root, + chunks_included, + challenges_root, + random_value, + validator_proposals, + chunk_mask, + gas_price, + total_supply, + challenges_result, + last_final_block, + last_ds_final_block, + approvals, + } + } + + pub fn hash(&self) -> CryptoHash { + hash(&self.try_to_vec().expect("Failed to serialize")) + } +} + +/// The part of the block approval that is different for endorsements and skips +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, PartialEq, Eq, Hash)] +pub enum ApprovalInner { + Endorsement(CryptoHash), + Skip(BlockHeight), +} + +/// Block approval by other block producers with a signature +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, PartialEq, Eq)] +pub struct Approval { + pub inner: ApprovalInner, + pub target_height: BlockHeight, + pub signature: Signature, + pub account_id: AccountId, +} + +/// Block approval by other block producers. +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, PartialEq, Eq)] +pub struct ApprovalMessage { + pub approval: Approval, + pub target: AccountId, +} + +impl ApprovalInner { + pub fn new( + parent_hash: &CryptoHash, + parent_height: BlockHeight, + target_height: BlockHeight, + ) -> Self { + if target_height == parent_height + 1 { + ApprovalInner::Endorsement(parent_hash.clone()) + } else { + ApprovalInner::Skip(parent_height) + } + } +} + +impl Approval { + pub fn new( + parent_hash: CryptoHash, + parent_height: BlockHeight, + target_height: BlockHeight, + signer: &dyn ValidatorSigner, + ) -> Self { + let inner = ApprovalInner::new(&parent_hash, parent_height, target_height); + let signature = signer.sign_approval(&inner, target_height); + Approval { inner, target_height, signature, account_id: signer.validator_id().clone() } + } + + pub fn get_data_for_sig(inner: &ApprovalInner, target_height: BlockHeight) -> Vec { + [inner.try_to_vec().unwrap().as_ref(), target_height.to_be_bytes().as_ref()].concat() + } +} + +impl ApprovalMessage { + pub fn new(approval: Approval, target: AccountId) -> Self { + ApprovalMessage { approval, target } + } +} + +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +#[borsh_init(init)] +pub struct BlockHeader { + pub prev_hash: CryptoHash, + + /// Inner part of the block header that gets hashed, split into two parts, one that is sent + /// to light clients, and the rest + pub inner_lite: BlockHeaderInnerLite, + pub inner_rest: BlockHeaderInnerRest, + + /// Signature of the block producer. + pub signature: Signature, + + /// Cached value of hash for this block. + #[borsh_skip] + pub hash: CryptoHash, +} + +impl BlockHeader { + pub fn compute_inner_hash( + inner_lite: &BlockHeaderInnerLite, + inner_rest: &BlockHeaderInnerRest, + ) -> CryptoHash { + let hash_lite = inner_lite.hash(); + let hash_rest = inner_rest.hash(); + combine_hash(hash_lite, hash_rest) + } + + pub fn compute_hash( + prev_hash: CryptoHash, + inner_lite: &BlockHeaderInnerLite, + inner_rest: &BlockHeaderInnerRest, + ) -> CryptoHash { + let hash_inner = BlockHeader::compute_inner_hash(inner_lite, inner_rest); + + return combine_hash(hash_inner, prev_hash); + } + + pub fn init(&mut self) { + self.hash = BlockHeader::compute_hash(self.prev_hash, &self.inner_lite, &self.inner_rest); + } + + pub fn new( + height: BlockHeight, + prev_hash: CryptoHash, + prev_state_root: MerkleHash, + chunk_receipts_root: MerkleHash, + chunk_headers_root: MerkleHash, + chunk_tx_root: MerkleHash, + outcome_root: MerkleHash, + timestamp: u64, + chunks_included: u64, + challenges_root: MerkleHash, + random_value: CryptoHash, + validator_proposals: Vec, + chunk_mask: Vec, + epoch_id: EpochId, + next_epoch_id: EpochId, + gas_price: Balance, + total_supply: Balance, + challenges_result: ChallengesResult, + signer: &dyn ValidatorSigner, + last_final_block: CryptoHash, + last_ds_final_block: CryptoHash, + approvals: Vec>, + next_bp_hash: CryptoHash, + block_merkle_root: CryptoHash, + ) -> Self { + let inner_lite = BlockHeaderInnerLite::new( + height, + epoch_id, + next_epoch_id, + prev_state_root, + outcome_root, + timestamp, + next_bp_hash, + block_merkle_root, + ); + let inner_rest = BlockHeaderInnerRest::new( + chunk_receipts_root, + chunk_headers_root, + chunk_tx_root, + chunks_included, + challenges_root, + random_value, + validator_proposals, + chunk_mask, + gas_price, + total_supply, + challenges_result, + last_final_block, + last_ds_final_block, + approvals, + ); + let (hash, signature) = signer.sign_block_header_parts(prev_hash, &inner_lite, &inner_rest); + Self { prev_hash, inner_lite, inner_rest, signature, hash } + } + + pub fn genesis( + height: BlockHeight, + state_root: MerkleHash, + chunk_receipts_root: MerkleHash, + chunk_headers_root: MerkleHash, + chunk_tx_root: MerkleHash, + chunks_included: u64, + challenges_root: MerkleHash, + timestamp: DateTime, + initial_gas_price: Balance, + initial_total_supply: Balance, + next_bp_hash: CryptoHash, + ) -> Self { + let inner_lite = BlockHeaderInnerLite::new( + height, + EpochId::default(), + EpochId::default(), + state_root, + CryptoHash::default(), + to_timestamp(timestamp), + next_bp_hash, + CryptoHash::default(), + ); + let inner_rest = BlockHeaderInnerRest::new( + chunk_receipts_root, + chunk_headers_root, + chunk_tx_root, + chunks_included, + challenges_root, + CryptoHash::default(), + vec![], + vec![], + initial_gas_price, + initial_total_supply, + vec![], + CryptoHash::default(), + CryptoHash::default(), + vec![], + ); + let hash = BlockHeader::compute_hash(CryptoHash::default(), &inner_lite, &inner_rest); + Self { + prev_hash: CryptoHash::default(), + inner_lite, + inner_rest, + signature: Signature::empty(KeyType::ED25519), + hash, + } + } + + pub fn hash(&self) -> CryptoHash { + self.hash + } + + /// Verifies that given public key produced the block. + pub fn verify_block_producer(&self, public_key: &PublicKey) -> bool { + self.signature.verify(self.hash.as_ref(), public_key) + } + + pub fn timestamp(&self) -> DateTime { + from_timestamp(self.inner_lite.timestamp) + } + + pub fn num_approvals(&self) -> u64 { + self.inner_rest.approvals.iter().filter(|x| x.is_some()).count() as u64 + } +} diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index 338df9e82ef..64a6f14d00a 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -7,6 +7,7 @@ static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; pub mod account; pub mod block; +pub mod block_header; pub mod challenge; pub mod contract; pub mod errors; diff --git a/core/primitives/src/views.rs b/core/primitives/src/views.rs index 3eeb537d480..3d770e29ec6 100644 --- a/core/primitives/src/views.rs +++ b/core/primitives/src/views.rs @@ -254,6 +254,10 @@ pub struct StatusResponse { pub version: Version, /// Unique chain id. pub chain_id: String, + /// Currently active protocol version. + pub protocol_version: u32, + /// Latest protocol version that this client supports. + pub latest_protocol_version: u32, /// Address for RPC server. pub rpc_addr: String, /// Current epoch validators. diff --git a/nightly/nightly.txt b/nightly/nightly.txt index 07fb9a5dcb1..740f32f81d5 100644 --- a/nightly/nightly.txt +++ b/nightly/nightly.txt @@ -32,6 +32,7 @@ pytest --timeout=120 sanity/garbage_collection1.py pytest --timeout=300 sanity/gc_after_sync.py pytest --timeout=300 sanity/gc_sync_after_sync.py pytest --timeout=300 sanity/gc_sync_after_sync.py swap_nodes +pytest sanity/upgradable.py # python tests for smart contract deployment and invocation pytest contracts/deploy_call_smart_contract.py diff --git a/pytest/lib/branches.py b/pytest/lib/branches.py index 2d8341eb872..c8fc5bed814 100644 --- a/pytest/lib/branches.py +++ b/pytest/lib/branches.py @@ -29,7 +29,7 @@ def escaped(branch): def compile_current(): - """ Compile current branch """ + """Compile current branch.""" branch = current_branch() try: # Accommodate rename from near to neard @@ -44,14 +44,16 @@ def compile_current(): subprocess.check_output(['git', 'checkout', '../Cargo.lock']) -def download_binary(branch): - url = f'https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/Linux/{branch}/near' +def download_binary(uname, branch): + """Download binary for given platform and branch.""" + url = f'https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/{uname}/{branch}/near' + print(f'Downloading near & state-viewer for {branch}@{uname}') subprocess.check_output([ 'curl', '--proto', '=https', '--tlsv1.2', '-sSfL', url, '-o', f'../target/debug/near-{branch}' ]) subprocess.check_output(['chmod', '+x', f'../target/debug/near-{branch}']) - url = f'https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/Linux/{branch}/state-viewer' + url = f'https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/{uname}/{branch}/state-viewer' subprocess.check_output([ 'curl', '--proto', '=https', '--tlsv1.2', '-sSfL', url, '-o', f'../target/debug/state-viewer-{branch}' @@ -61,11 +63,12 @@ def download_binary(branch): def prepare_ab_test(other_branch): - compile_current() - if os.environ.get('BUILDKITE') and other_branch in [ - 'master', 'beta', 'stable' - ]: - download_binary(other_branch) - else: - compile_binary(other_branch) + # Use NEAR_AB_BINARY_EXISTS to avoid rebuild / re-download when testing locally. + if not os.environ.get('NEAR_AB_BINARY_EXISTS'): + compile_current() + uname = os.uname()[0] + if other_branch in ['master', 'beta', 'stable'] and uname in ['Linux', 'Darwin']: + download_binary(uname, other_branch) + else: + compile_binary(other_branch) return '../target/debug/', [other_branch, escaped(current_branch())] diff --git a/pytest/lib/utils.py b/pytest/lib/utils.py index c1d9c6cb1aa..f816e3b9c7d 100644 --- a/pytest/lib/utils.py +++ b/pytest/lib/utils.py @@ -7,6 +7,7 @@ import os import tempfile import json +import time from pprint import pprint @@ -268,3 +269,17 @@ def collect_gcloud_config(num_nodes): with open(outfile, 'w+') as f: json.dump(res, f) os.environ[CONFIG_ENV_VAR] = outfile + + +def wait_for_blocks_or_timeout(node, num_blocks, timeout, callback=None): + status = node.get_status() + start_height = status['sync_info']['latest_block_height'] + max_height = 0 + started = time.time() + while max_height < start_height + num_blocks: + assert time.time() - started < timeout + status = node.get_status() + max_height = status['sync_info']['latest_block_height'] + if callback is not None: + if callback(): + break diff --git a/pytest/tests/sanity/backward_compatible.py b/pytest/tests/sanity/backward_compatible.py index a717d73ac8f..b7175087294 100755 --- a/pytest/tests/sanity/backward_compatible.py +++ b/pytest/tests/sanity/backward_compatible.py @@ -22,8 +22,9 @@ def main(): shutil.rmtree(node_root) subprocess.check_output('mkdir -p /tmp/near', shell=True) - near_root, (stable_branch, - current_branch) = branches.prepare_ab_test("beta") + # near_root, (stable_branch, + # current_branch) = branches.prepare_ab_test("beta") + (near_root, (stable_branch, current_branch)) = ('../target/debug', ('beta', 'upgradability')) # Setup local network. subprocess.call([ diff --git a/pytest/tests/sanity/upgradable.py b/pytest/tests/sanity/upgradable.py new file mode 100644 index 00000000000..6c696e04b33 --- /dev/null +++ b/pytest/tests/sanity/upgradable.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +""" +First run network with 3 `stable` nodes and 1 `new` node. +Then start switching `stable` nodes one by one with new nodes. +At the end run for 3 epochs and observe that current protocol version of the network matches `new` nodes. +""" + +import os +import subprocess +import shutil +import sys + +sys.path.append('lib') + +import branches +import cluster +from utils import wait_for_blocks_or_timeout + + +def main(): + node_root = "/tmp/near/upgradable" + if os.path.exists(node_root): + shutil.rmtree(node_root) + subprocess.check_output('mkdir -p /tmp/near', shell=True) + + near_root, (stable_branch, + current_branch) = branches.prepare_ab_test("beta") + + # Setup local network. + print([ + "%snear-%s" % (near_root, stable_branch), + "--home=%s" % node_root, "testnet", "--v", "4", "--prefix", "test" + ]) + subprocess.call([ + "%snear-%s" % (near_root, stable_branch), + "--home=%s" % node_root, "testnet", "--v", "4", "--prefix", "test" + ]) + genesis_config_changes = [("epoch_length", 10)] + node_dirs = [os.path.join(node_root, 'test%d' % i) for i in range(4)] + for i, node_dir in enumerate(node_dirs): + cluster.apply_genesis_changes(node_dir, genesis_config_changes) + + # Start 3 stable nodes and one current node. + config = { + "local": True, + 'near_root': near_root, + 'binary_name': "near-%s" % stable_branch + } + nodes = [cluster.spin_up_node( + config, near_root, node_dirs[0], 0, None, None)] + for i in range(1, 3): + nodes.append(cluster.spin_up_node( + config, near_root, node_dirs[i], i, nodes[0].node_key.pk, nodes[0].addr())) + config["binary_name"] = "near-%s" % current_branch + nodes.append(cluster.spin_up_node( + config, near_root, node_dirs[3], 3, nodes[0].node_key.pk, nodes[0].addr())) + + wait_for_blocks_or_timeout(nodes[0], 20, 120) + + # Restart stable nodes into new version. + for i in range(3): + nodes[i].kill() + nodes[i].start(nodes[0].node_key.pk, nodes[0].addr()) + + wait_for_blocks_or_timeout(nodes[3], 30, 120) + status = nodes[0].get_status() + protocol_version = status.get("protocol_version", 14) + latest_protocol_version = status["latest_protocol_version"] + assert protocol_version == latest_protocol_version,\ + "Latest protocol version %d should match active protocol version %d" % (latest_protocol_version, protocol_version) + + +if __name__ == "__main__": + main() From 913bc51521efbcbd617771a3064b2e926d4817d3 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Thu, 21 May 2020 13:00:25 -0700 Subject: [PATCH 02/21] Pipe protocol version via epoch manager/runtime --- Cargo.lock | 1 + chain/chain/src/chain.rs | 21 +++++++++++++++------ chain/chain/src/test_utils.rs | 7 ++++++- chain/chain/src/types.rs | 2 ++ chain/client/src/test_utils.rs | 3 ++- chain/epoch_manager/Cargo.toml | 1 + chain/epoch_manager/src/lib.rs | 22 ++++++++++++++++++++++ chain/epoch_manager/src/proposals.rs | 1 + chain/epoch_manager/src/test_utils.rs | 8 ++++++-- chain/epoch_manager/src/types.rs | 9 ++++++++- chain/network/tests/runner/mod.rs | 3 ++- core/chain-configs/src/genesis_config.rs | 4 ++-- core/chain-configs/src/lib.rs | 4 +++- genesis-tools/genesis-populate/src/lib.rs | 1 + neard/src/runtime.rs | 11 +++++++++-- neard/src/shard_tracker.rs | 12 +++++++++++- pytest/tests/sanity/upgradable.py | 8 +++++--- test-utils/state-viewer/src/main.rs | 3 +++ 18 files changed, 100 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 67efe3cba66..634da5c7d7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2189,6 +2189,7 @@ dependencies = [ "cached", "log", "near-chain", + "near-chain-configs", "near-crypto", "near-primitives", "near-store", diff --git a/chain/chain/src/chain.rs b/chain/chain/src/chain.rs index 31313e2351a..b4c3e7ed1ba 100644 --- a/chain/chain/src/chain.rs +++ b/chain/chain/src/chain.rs @@ -1,5 +1,6 @@ use std::cmp::min; use std::collections::{HashMap, HashSet}; +use std::mem; use std::sync::Arc; use std::time::{Duration as TimeDuration, Instant}; @@ -7,8 +8,12 @@ use borsh::BorshSerialize; use chrono::prelude::{DateTime, Utc}; use chrono::Duration; use log::{debug, error, info}; +use num_rational::Rational; +use rand::rngs::StdRng; +use rand::seq::SliceRandom; +use rand::SeedableRng; -use near_chain_configs::GenesisConfig; +use near_chain_configs::{GenesisConfig, ProtocolVersion, PROTOCOL_VERSION}; use near_primitives::block::genesis_chunks; use near_primitives::challenge::{ BlockDoubleSign, Challenge, ChallengeBody, ChallengesResult, ChunkProofs, ChunkState, @@ -48,11 +53,6 @@ use crate::validate::{ }; use crate::{byzantine_assert, create_light_client_block_view, Doomslug}; use crate::{metrics, DoomslugThresholdMode}; -use num_rational::Rational; -use rand::rngs::StdRng; -use rand::seq::SliceRandom; -use rand::SeedableRng; -use std::mem; /// Maximum number of orphans chain can store. pub const MAX_ORPHAN_SIZE: usize = 1024; @@ -187,6 +187,7 @@ pub struct ChainGenesis { pub gas_price_adjustment_rate: Rational, pub transaction_validity_period: NumBlocks, pub epoch_length: BlockHeightDelta, + pub protocol_version: ProtocolVersion, } impl ChainGenesis { @@ -200,6 +201,7 @@ impl ChainGenesis { gas_price_adjustment_rate: Rational, transaction_validity_period: NumBlocks, epoch_length: BlockHeightDelta, + protocol_version: ProtocolVersion, ) -> Self { Self { time, @@ -211,6 +213,7 @@ impl ChainGenesis { gas_price_adjustment_rate, transaction_validity_period, epoch_length, + protocol_version, } } } @@ -231,6 +234,7 @@ where genesis_config.gas_price_adjustment_rate, genesis_config.transaction_validity_period, genesis_config.epoch_length, + genesis_config.protocol_version, ) } } @@ -321,6 +325,7 @@ impl Chain { vec![], vec![], chain_genesis.total_supply, + chain_genesis.protocol_version, )?; store_update.save_block_header(genesis.header.clone())?; store_update.save_block(genesis.clone()); @@ -812,6 +817,8 @@ impl Chain { vec![], header.inner_rest.chunk_mask.clone(), header.inner_rest.total_supply, + // TODO: header.inner_rest.latest_protocol_version, + PROTOCOL_VERSION, )?; } } @@ -2762,6 +2769,8 @@ impl<'a> ChainUpdate<'a> { block.header.inner_rest.challenges_result.clone(), block.header.inner_rest.chunk_mask.clone(), block.header.inner_rest.total_supply, + // TODO: !!! + PROTOCOL_VERSION, )?; // Add validated block to the db, even if it's not the canonical fork. diff --git a/chain/chain/src/test_utils.rs b/chain/chain/src/test_utils.rs index 0375d8d0b17..865332cd029 100644 --- a/chain/chain/src/test_utils.rs +++ b/chain/chain/src/test_utils.rs @@ -6,8 +6,10 @@ use std::sync::{Arc, RwLock}; use borsh::{BorshDeserialize, BorshSerialize}; use chrono::Utc; use log::debug; +use num_rational::Rational; use serde::Serialize; +use near_chain_configs::{ProtocolVersion, PROTOCOL_VERSION}; use near_crypto::{KeyType, PublicKey, SecretKey, Signature}; use near_pool::types::PoolIterator; use near_primitives::account::{AccessKey, Account}; @@ -41,7 +43,6 @@ use crate::error::{Error, ErrorKind}; use crate::store::ChainStoreAccess; use crate::types::ApplyTransactionResult; use crate::{BlockHeader, DoomslugThresholdMode, RuntimeAdapter}; -use num_rational::Rational; #[derive( BorshSerialize, BorshDeserialize, Serialize, Hash, PartialEq, Eq, Ord, PartialOrd, Clone, Debug, @@ -518,6 +519,7 @@ impl RuntimeAdapter for KeyValueRuntime { _slashed_validators: Vec, _validator_mask: Vec, _total_supply: Balance, + _protocol_version: ProtocolVersion, ) -> Result<(), Error> { Ok(()) } @@ -982,6 +984,7 @@ pub fn setup_with_tx_validity_period( Rational::from_integer(0), tx_validity_period, 10, + PROTOCOL_VERSION, ), DoomslugThresholdMode::NoApprovals, ) @@ -1021,6 +1024,7 @@ pub fn setup_with_validators( Rational::from_integer(0), tx_validity_period, epoch_length, + PROTOCOL_VERSION, ), DoomslugThresholdMode::NoApprovals, ) @@ -1138,6 +1142,7 @@ impl ChainGenesis { gas_price_adjustment_rate: Rational::from_integer(0), transaction_validity_period: 100, epoch_length: 5, + protocol_version: PROTOCOL_VERSION, } } } diff --git a/chain/chain/src/types.rs b/chain/chain/src/types.rs index 059d9a22831..b178f3636e4 100644 --- a/chain/chain/src/types.rs +++ b/chain/chain/src/types.rs @@ -5,6 +5,7 @@ use std::sync::Arc; use borsh::{BorshDeserialize, BorshSerialize}; use serde::Serialize; +use near_chain_configs::ProtocolVersion; use near_crypto::Signature; use near_pool::types::PoolIterator; pub use near_primitives::block::{Block, BlockHeader}; @@ -318,6 +319,7 @@ pub trait RuntimeAdapter: Send + Sync { slashed_validators: Vec, validator_mask: Vec, total_supply: Balance, + protocol_version: ProtocolVersion, ) -> Result<(), Error>; /// Apply transactions to given state root and return store update and new state root. diff --git a/chain/client/src/test_utils.rs b/chain/client/src/test_utils.rs index 88e9970830e..004e11e2cd2 100644 --- a/chain/client/src/test_utils.rs +++ b/chain/client/src/test_utils.rs @@ -11,7 +11,7 @@ use rand::{thread_rng, Rng}; use near_chain::test_utils::KeyValueRuntime; use near_chain::{Chain, ChainGenesis, DoomslugThresholdMode, Provenance, RuntimeAdapter}; -use near_chain_configs::ClientConfig; +use near_chain_configs::{ClientConfig, PROTOCOL_VERSION}; use near_crypto::{InMemorySigner, KeyType, PublicKey}; #[cfg(feature = "metric_recorder")] use near_network::recorder::MetricRecorder; @@ -77,6 +77,7 @@ pub fn setup( Rational::from_integer(0), transaction_validity_period, epoch_length, + PROTOCOL_VERSION, ); let doomslug_threshold_mode = if enable_doomslug { DoomslugThresholdMode::TwoThirds diff --git a/chain/epoch_manager/Cargo.toml b/chain/epoch_manager/Cargo.toml index 0fab11b3d04..73afbdb8810 100644 --- a/chain/epoch_manager/Cargo.toml +++ b/chain/epoch_manager/Cargo.toml @@ -17,6 +17,7 @@ serde_json = "1" primitive-types = { version = "0.7", default-features = false } num-rational = "0.2.4" +near-chain-configs = { path = "../../core/chain-configs" } near-crypto = { path = "../../core/crypto" } near-primitives = { path = "../../core/primitives" } near-chain = { path = "../chain" } diff --git a/chain/epoch_manager/src/lib.rs b/chain/epoch_manager/src/lib.rs index 6a6a2573e94..599fd442ff9 100644 --- a/chain/epoch_manager/src/lib.rs +++ b/chain/epoch_manager/src/lib.rs @@ -1057,6 +1057,7 @@ mod tests { use num_rational::Rational; + use near_chain_configs::PROTOCOL_VERSION; use near_primitives::challenge::SlashedValidator; use near_primitives::hash::hash; use near_primitives::types::ValidatorKickoutReason::NotEnoughBlocks; @@ -1449,6 +1450,7 @@ mod tests { vec![], vec![SlashedValidator::new("test1".to_string(), false)], DEFAULT_TOTAL_SUPPLY, + PROTOCOL_VERSION, ), [0; 32], ) @@ -1535,6 +1537,7 @@ mod tests { SlashedValidator::new("test1".to_string(), false), ], DEFAULT_TOTAL_SUPPLY, + PROTOCOL_VERSION, ), [0; 32], ) @@ -1561,6 +1564,7 @@ mod tests { vec![], vec![SlashedValidator::new("test1".to_string(), true)], DEFAULT_TOTAL_SUPPLY, + PROTOCOL_VERSION, ), [0; 32], ) @@ -1620,6 +1624,7 @@ mod tests { vec![], vec![SlashedValidator::new("test1".to_string(), true)], DEFAULT_TOTAL_SUPPLY, + PROTOCOL_VERSION, ), [0; 32], ) @@ -1647,6 +1652,7 @@ mod tests { vec![], vec![SlashedValidator::new("test1".to_string(), true)], DEFAULT_TOTAL_SUPPLY, + PROTOCOL_VERSION, ), [0; 32], ) @@ -1731,6 +1737,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -1751,6 +1758,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -1771,6 +1779,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -1855,6 +1864,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -1875,6 +1885,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -1895,6 +1906,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -1998,6 +2010,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -2018,6 +2031,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -2038,6 +2052,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -2156,6 +2171,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -2176,6 +2192,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -2196,6 +2213,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -2259,6 +2277,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -2416,6 +2435,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -2435,6 +2455,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) @@ -2454,6 +2475,7 @@ mod tests { block_tracker: Default::default(), shard_tracker: Default::default(), all_proposals: vec![], + latest_protocol_version: PROTOCOL_VERSION, }, rng_seed, ) diff --git a/chain/epoch_manager/src/proposals.rs b/chain/epoch_manager/src/proposals.rs index db20cf884b0..a195e8e431c 100644 --- a/chain/epoch_manager/src/proposals.rs +++ b/chain/epoch_manager/src/proposals.rs @@ -200,6 +200,7 @@ pub fn proposals_to_epoch_info( validator_kickout, fishermen_to_index, minted_amount, + protocol_version: epoch_info.protocol_version, }) } diff --git a/chain/epoch_manager/src/test_utils.rs b/chain/epoch_manager/src/test_utils.rs index 0b935520964..cb8b0ff6229 100644 --- a/chain/epoch_manager/src/test_utils.rs +++ b/chain/epoch_manager/src/test_utils.rs @@ -1,6 +1,10 @@ use std::collections::{BTreeMap, HashMap}; +use num_rational::Rational; + +use near_chain_configs::PROTOCOL_VERSION; use near_crypto::{KeyType, SecretKey}; +use near_primitives::challenge::SlashedValidator; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::types::{ AccountId, Balance, BlockHeight, BlockHeightDelta, EpochHeight, NumSeats, NumShards, @@ -12,8 +16,6 @@ use near_store::test_utils::create_test_store; use crate::types::{EpochConfig, EpochInfo, ValidatorWeight}; use crate::RewardCalculator; use crate::{BlockInfo, EpochManager}; -use near_primitives::challenge::SlashedValidator; -use num_rational::Rational; pub const DEFAULT_GAS_PRICE: u128 = 100; pub const DEFAULT_TOTAL_SUPPLY: u128 = 1_000_000_000_000; @@ -77,6 +79,7 @@ pub fn epoch_info( validator_reward, validator_kickout, minted_amount, + protocol_version: PROTOCOL_VERSION, } } @@ -201,6 +204,7 @@ pub fn record_block_with_slashes( vec![], slashed, DEFAULT_TOTAL_SUPPLY, + PROTOCOL_VERSION, ), [0; 32], ) diff --git a/chain/epoch_manager/src/types.rs b/chain/epoch_manager/src/types.rs index bd7803ea9e2..924cef36c89 100644 --- a/chain/epoch_manager/src/types.rs +++ b/chain/epoch_manager/src/types.rs @@ -5,6 +5,7 @@ use borsh::{BorshDeserialize, BorshSerialize}; use num_rational::Rational; use serde::Serialize; +use near_chain_configs::ProtocolVersion; use near_primitives::challenge::SlashedValidator; use near_primitives::hash::CryptoHash; use near_primitives::serialize::to_base; @@ -75,6 +76,8 @@ pub struct EpochInfo { pub validator_kickout: HashMap, /// Total minted tokens in the epoch. pub minted_amount: Balance, + /// Current protocol version during this epoch. + pub protocol_version: ProtocolVersion, } /// Information per each block. @@ -87,7 +90,7 @@ pub struct BlockInfo { pub epoch_id: EpochId, pub proposals: Vec, pub chunk_mask: Vec, - /// Validators slashed since the start of epoch or in previous epoch + /// Validators slashed since the start of epoch or in previous epoch. pub slashed: HashMap, /// Total supply at this block. pub total_supply: Balance, @@ -97,6 +100,8 @@ pub struct BlockInfo { pub shard_tracker: HashMap>, /// All proposals in this epoch up to this block. pub all_proposals: Vec, + /// Latest protocol version this validator observes. + pub latest_protocol_version: ProtocolVersion, } impl BlockInfo { @@ -108,6 +113,7 @@ impl BlockInfo { validator_mask: Vec, slashed: Vec, total_supply: Balance, + latest_protocol_version: ProtocolVersion, ) -> Self { Self { height, @@ -130,6 +136,7 @@ impl BlockInfo { block_tracker: HashMap::default(), shard_tracker: HashMap::default(), all_proposals: vec![], + latest_protocol_version, } } diff --git a/chain/network/tests/runner/mod.rs b/chain/network/tests/runner/mod.rs index b202081da97..8d4c0b1ebdb 100644 --- a/chain/network/tests/runner/mod.rs +++ b/chain/network/tests/runner/mod.rs @@ -10,7 +10,7 @@ use futures::{future, FutureExt, TryFutureExt}; use near_chain::test_utils::KeyValueRuntime; use near_chain::ChainGenesis; -use near_chain_configs::ClientConfig; +use near_chain_configs::{ClientConfig, PROTOCOL_VERSION}; use near_client::{ClientActor, ViewClientActor}; use near_crypto::KeyType; use near_logger_utils::init_test_logger; @@ -68,6 +68,7 @@ pub fn setup_network_node( Rational::from_integer(0), 1000, 5, + PROTOCOL_VERSION, ); let peer_manager = PeerManagerActor::create(move |ctx| { diff --git a/core/chain-configs/src/genesis_config.rs b/core/chain-configs/src/genesis_config.rs index 2a479e5f5bf..f7b82bd7d5a 100644 --- a/core/chain-configs/src/genesis_config.rs +++ b/core/chain-configs/src/genesis_config.rs @@ -19,7 +19,7 @@ use near_primitives::types::{ }; use near_runtime_configs::RuntimeConfig; -use crate::PROTOCOL_VERSION; +use crate::{ProtocolVersion, PROTOCOL_VERSION}; pub const CONFIG_VERSION: u32 = 1; @@ -38,7 +38,7 @@ pub struct GenesisConfig { /// It's not a major protocol version, but used for automatic config migrations using scripts. pub config_version: u32, /// Protocol version that this genesis works with. - pub protocol_version: u32, + pub protocol_version: ProtocolVersion, /// Official time of blockchain start. #[default(Utc::now())] pub genesis_time: DateTime, diff --git a/core/chain-configs/src/lib.rs b/core/chain-configs/src/lib.rs index cf8162e2a42..fe81602b032 100644 --- a/core/chain-configs/src/lib.rs +++ b/core/chain-configs/src/lib.rs @@ -6,5 +6,7 @@ pub use genesis_config::{ Genesis, GenesisConfig, GenesisRecords, CONFIG_VERSION as GENESIS_CONFIG_VERSION, }; +pub type ProtocolVersion = u32; + /// Current latest version of the protocol -pub const PROTOCOL_VERSION: u32 = 14; +pub const PROTOCOL_VERSION: ProtocolVersion = 15; diff --git a/genesis-tools/genesis-populate/src/lib.rs b/genesis-tools/genesis-populate/src/lib.rs index fb6921a75c3..7693ba8bca2 100644 --- a/genesis-tools/genesis-populate/src/lib.rs +++ b/genesis-tools/genesis-populate/src/lib.rs @@ -210,6 +210,7 @@ impl GenesisBuilder { vec![], vec![], self.genesis.config.total_supply.clone(), + self.genesis.config.protocol_version, ) .unwrap(); store_update diff --git a/neard/src/runtime.rs b/neard/src/runtime.rs index ed4b9240587..d72cb4aa6df 100644 --- a/neard/src/runtime.rs +++ b/neard/src/runtime.rs @@ -10,11 +10,10 @@ use borsh::ser::BorshSerialize; use borsh::BorshDeserialize; use log::{debug, error, warn}; -use crate::shard_tracker::{account_id_to_shard_id, ShardTracker}; use near_chain::chain::NUM_EPOCHS_TO_KEEP_STORE_DATA; use near_chain::types::ApplyTransactionResult; use near_chain::{BlockHeader, Error, ErrorKind, RuntimeAdapter}; -use near_chain_configs::Genesis; +use near_chain_configs::{Genesis, ProtocolVersion}; use near_crypto::{PublicKey, Signature}; use near_epoch_manager::{BlockInfo, EpochConfig, EpochError, EpochManager, RewardCalculator}; use near_pool::types::PoolIterator; @@ -44,6 +43,8 @@ use node_runtime::adapter::ViewRuntimeAdapter; use node_runtime::state_viewer::TrieViewer; use node_runtime::{verify_and_charge_transaction, ApplyState, Runtime, ValidatorAccountsUpdate}; +use crate::shard_tracker::{account_id_to_shard_id, ShardTracker}; + const POISONED_LOCK_ERR: &str = "The lock was poisoned."; const STATE_DUMP_FILE: &str = "state_dump"; const GENESIS_ROOTS_FILE: &str = "genesis_roots"; @@ -839,6 +840,7 @@ impl RuntimeAdapter for NightshadeRuntime { slashed_validators: Vec, chunk_mask: Vec, total_supply: Balance, + protocol_version: ProtocolVersion, ) -> Result<(), Error> { // Check that genesis block doesn't have any proposals. assert!(height > 0 || (proposals.is_empty() && slashed_validators.is_empty())); @@ -853,6 +855,7 @@ impl RuntimeAdapter for NightshadeRuntime { chunk_mask, slashed_validators, total_supply, + protocol_version, ); let rng_seed = (rng_seed.0).0; // TODO: don't commit here, instead contribute to upstream store update. @@ -1370,6 +1373,7 @@ mod test { genesis.config.max_inflation_rate = Rational::from_integer(0); } let genesis_total_supply = genesis.config.total_supply; + let genesis_protocol_version = genesis.config.protocol_version; let runtime = NightshadeRuntime::new( dir.path(), store, @@ -1391,6 +1395,7 @@ mod test { vec![], vec![], genesis_total_supply, + genesis_protocol_version, ) .unwrap(); Self { @@ -1457,6 +1462,7 @@ mod test { challenges_result, chunk_mask, self.runtime.genesis.config.total_supply, + self.runtime.genesis.config.protocol_version, ) .unwrap(); self.last_receipts = new_receipts; @@ -1870,6 +1876,7 @@ mod test { vec![], vec![true], new_env.runtime.genesis.config.total_supply, + new_env.runtime.genesis.config.protocol_version, ) .unwrap(); new_env.head.height = i; diff --git a/neard/src/shard_tracker.rs b/neard/src/shard_tracker.rs index 2a6544477d3..8a728a2368c 100644 --- a/neard/src/shard_tracker.rs +++ b/neard/src/shard_tracker.rs @@ -236,6 +236,7 @@ mod tests { use near_store::test_utils::create_test_store; use super::{account_id_to_shard_id, ShardTracker, POISONED_LOCK_ERR}; + use near_chain_configs::PROTOCOL_VERSION; use num_rational::Rational; const DEFAULT_TOTAL_SUPPLY: u128 = 1_000_000_000_000; @@ -288,7 +289,16 @@ mod tests { epoch_manager .record_block_info( &cur_h, - BlockInfo::new(height, 0, prev_h, proposals, vec![], vec![], DEFAULT_TOTAL_SUPPLY), + BlockInfo::new( + height, + 0, + prev_h, + proposals, + vec![], + vec![], + DEFAULT_TOTAL_SUPPLY, + PROTOCOL_VERSION, + ), [0; 32], ) .unwrap() diff --git a/pytest/tests/sanity/upgradable.py b/pytest/tests/sanity/upgradable.py index 6c696e04b33..4f6e7e0a51b 100644 --- a/pytest/tests/sanity/upgradable.py +++ b/pytest/tests/sanity/upgradable.py @@ -60,12 +60,14 @@ def main(): # Restart stable nodes into new version. for i in range(3): nodes[i].kill() + nodes[i].binary_name = config['binary_name'] nodes[i].start(nodes[0].node_key.pk, nodes[0].addr()) wait_for_blocks_or_timeout(nodes[3], 30, 120) - status = nodes[0].get_status() - protocol_version = status.get("protocol_version", 14) - latest_protocol_version = status["latest_protocol_version"] + status0 = nodes[0].get_status() + status3 = nodes[3].get_status() + protocol_version = status0.get("protocol_version", 14) + latest_protocol_version = status3["latest_protocol_version"] assert protocol_version == latest_protocol_version,\ "Latest protocol version %d should match active protocol version %d" % (latest_protocol_version, protocol_version) diff --git a/test-utils/state-viewer/src/main.rs b/test-utils/state-viewer/src/main.rs index dc77a077ef5..653155a8427 100644 --- a/test-utils/state-viewer/src/main.rs +++ b/test-utils/state-viewer/src/main.rs @@ -6,6 +6,7 @@ use ansi_term::Color::Red; use clap::{App, Arg, SubCommand}; use near_chain::{ChainStore, ChainStoreAccess, RuntimeAdapter}; +use near_chain_configs::PROTOCOL_VERSION; use near_logger_utils::init_integration_logger; use near_network::peer_store::PeerStore; use near_primitives::block::BlockHeader; @@ -181,6 +182,8 @@ fn replay_chain( vec![], header.inner_rest.chunk_mask, header.inner_rest.total_supply, + // TODO: !!! + PROTOCOL_VERSION, ) .unwrap(); } From 09d5fcbada8eeb3e97ca6a2f597678b0c8f7e1a1 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Fri, 22 May 2020 06:06:45 -0700 Subject: [PATCH 03/21] Working on weaving upgradable block headers --- chain/chain/src/chain.rs | 66 ++- chain/chain/src/test_utils.rs | 20 +- chain/chain/src/types.rs | 49 ++- core/chain-configs/src/genesis_config.rs | 3 +- core/chain-configs/src/lib.rs | 5 - core/primitives/benches/serialization.rs | 2 + core/primitives/src/block.rs | 62 ++- core/primitives/src/block_header.rs | 520 +++++++++++++++++------ core/primitives/src/lib.rs | 1 + core/primitives/src/protocol_version.rs | 10 + core/primitives/src/test_utils.rs | 16 +- core/primitives/src/validator_signer.rs | 10 +- core/primitives/src/views.rs | 143 ++++--- core/store/src/validate.rs | 11 +- neard/src/runtime.rs | 34 +- 15 files changed, 606 insertions(+), 346 deletions(-) create mode 100644 core/primitives/src/protocol_version.rs diff --git a/chain/chain/src/chain.rs b/chain/chain/src/chain.rs index b4c3e7ed1ba..82777ff3e70 100644 --- a/chain/chain/src/chain.rs +++ b/chain/chain/src/chain.rs @@ -13,7 +13,7 @@ use rand::rngs::StdRng; use rand::seq::SliceRandom; use rand::SeedableRng; -use near_chain_configs::{GenesisConfig, ProtocolVersion, PROTOCOL_VERSION}; +use near_chain_configs::GenesisConfig; use near_primitives::block::genesis_chunks; use near_primitives::challenge::{ BlockDoubleSign, Challenge, ChallengeBody, ChallengesResult, ChunkProofs, ChunkState, @@ -21,6 +21,7 @@ use near_primitives::challenge::{ }; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::merkle::{merklize, verify_path}; +use near_primitives::protocol_version::{ProtocolVersion, PROTOCOL_VERSION}; use near_primitives::receipt::Receipt; use near_primitives::sharding::{ ChunkHash, ChunkHashHeight, ReceiptProof, ShardChunk, ShardChunkHeader, ShardProof, @@ -43,9 +44,9 @@ use crate::store::{ ChainStore, ChainStoreAccess, ChainStoreUpdate, GCMode, ShardInfo, StateSyncInfo, }; use crate::types::{ - AcceptedBlock, ApplyTransactionResult, Block, BlockHeader, BlockStatus, BlockSyncResponse, - Provenance, ReceiptList, ReceiptProofResponse, ReceiptResponse, RootProof, RuntimeAdapter, - ShardStateSyncResponseHeader, StatePartKey, Tip, + AcceptedBlock, ApplyTransactionResult, Block, BlockHeader, BlockHeaderInfo, BlockStatus, + BlockSyncResponse, Provenance, ReceiptList, ReceiptProofResponse, ReceiptResponse, RootProof, + RuntimeAdapter, ShardStateSyncResponseHeader, StatePartKey, Tip, }; use crate::validate::{ validate_challenge, validate_chunk_proofs, validate_chunk_with_chunk_extra, @@ -119,12 +120,12 @@ impl OrphanBlockPool { fn add(&mut self, orphan: Orphan) { let height_hashes = - self.height_idx.entry(orphan.block.header.inner_lite.height).or_insert_with(|| vec![]); - height_hashes.push(orphan.block.hash()); + self.height_idx.entry(orphan.block.header.height()).or_insert_with(|| vec![]); + height_hashes.push(*orphan.block.hash()); let prev_hash_entries = - self.prev_hash_idx.entry(orphan.block.header.prev_hash).or_insert_with(|| vec![]); - prev_hash_entries.push(orphan.block.hash()); - self.orphans.insert(orphan.block.hash(), orphan); + self.prev_hash_idx.entry(*orphan.block.header.prev_hash()).or_insert_with(|| vec![]); + prev_hash_entries.push(*orphan.block.hash()); + self.orphans.insert(*orphan.block.hash(), orphan); if self.orphans.len() > MAX_ORPHAN_SIZE { let old_len = self.orphans.len(); @@ -288,7 +289,7 @@ impl Chain { // Check that genesis in the store is the same as genesis given in the config. let genesis_hash = store_update.get_block_hash_by_height(chain_genesis.height)?; - if genesis_hash != genesis.hash() { + if &genesis_hash != genesis.hash() { return Err(ErrorKind::Other(format!( "Genesis mismatch between storage and config: {:?} vs {:?}", genesis_hash, @@ -314,19 +315,11 @@ impl Chain { for chunk in genesis_chunks { store_update.save_chunk(&chunk.chunk_hash, chunk.clone()); } - runtime_adapter.add_validator_proposals( - CryptoHash::default(), - genesis.hash(), - genesis.header.inner_rest.random_value, - genesis.header.inner_lite.height, + runtime_adapter.add_validator_proposals(BlockHeaderInfo::new( + &genesis.header, // genesis height is considered final chain_genesis.height, - vec![], - vec![], - vec![], - chain_genesis.total_supply, - chain_genesis.protocol_version, - )?; + ))?; store_update.save_block_header(genesis.header.clone())?; store_update.save_block(genesis.clone()); store_update.save_block_extra( @@ -424,15 +417,15 @@ impl Chain { chain_store: &mut dyn ChainStoreAccess, ) -> Result { let final_block_header = { - let ret = chain_store.get_block_header(&header.inner_rest.last_final_block)?.clone(); - let two_ahead = chain_store.get_header_by_height(ret.inner_lite.height + 2)?; - if two_ahead.inner_lite.epoch_id != ret.inner_lite.epoch_id { - let one_ahead = chain_store.get_header_by_height(ret.inner_lite.height + 1)?; - if one_ahead.inner_lite.epoch_id != ret.inner_lite.epoch_id { - let new_final_hash = ret.inner_rest.last_final_block.clone(); + let ret = chain_store.get_block_header(header.last_final_block())?.clone(); + let two_ahead = chain_store.get_header_by_height(ret.height() + 2)?; + if two_ahead.epoch_id() != ret.epoch_id() { + let one_ahead = chain_store.get_header_by_height(ret.height() + 1)?; + if one_ahead.inner_lite.epoch_id != ret.epoch_id() { + let new_final_hash = ret.last_final_block().clone(); chain_store.get_block_header(&new_final_hash)?.clone() } else { - let new_final_hash = one_ahead.inner_rest.last_final_block.clone(); + let new_final_hash = one_ahead.last_final_block().clone(); chain_store.get_block_header(&new_final_hash)?.clone() } } else { @@ -807,19 +800,10 @@ impl Chain { chain_update.commit()?; // Add validator proposals for given header. - self.runtime_adapter.add_validator_proposals( - header.prev_hash, - header.hash(), - header.inner_rest.random_value, - header.inner_lite.height, - self.store.get_block_height(&header.inner_rest.last_final_block)?, - header.inner_rest.validator_proposals.clone(), - vec![], - header.inner_rest.chunk_mask.clone(), - header.inner_rest.total_supply, - // TODO: header.inner_rest.latest_protocol_version, - PROTOCOL_VERSION, - )?; + self.runtime_adapter.add_validator_proposals(BlockHeaderInfo::new( + &header, + self.store.get_block_height(&header.last_final_block())?, + ))?; } } diff --git a/chain/chain/src/test_utils.rs b/chain/chain/src/test_utils.rs index 865332cd029..b9bc8d1103f 100644 --- a/chain/chain/src/test_utils.rs +++ b/chain/chain/src/test_utils.rs @@ -9,13 +9,13 @@ use log::debug; use num_rational::Rational; use serde::Serialize; -use near_chain_configs::{ProtocolVersion, PROTOCOL_VERSION}; use near_crypto::{KeyType, PublicKey, SecretKey, Signature}; use near_pool::types::PoolIterator; use near_primitives::account::{AccessKey, Account}; -use near_primitives::challenge::{ChallengesResult, SlashedValidator}; +use near_primitives::challenge::ChallengesResult; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::receipt::{ActionReceipt, Receipt, ReceiptEnum}; use near_primitives::serialize::to_base; use near_primitives::sharding::ShardChunkHeader; @@ -41,7 +41,7 @@ use near_store::{ use crate::chain::{Chain, ChainGenesis, NUM_EPOCHS_TO_KEEP_STORE_DATA}; use crate::error::{Error, ErrorKind}; use crate::store::ChainStoreAccess; -use crate::types::ApplyTransactionResult; +use crate::types::{ApplyTransactionResult, BlockHeaderInfo}; use crate::{BlockHeader, DoomslugThresholdMode, RuntimeAdapter}; #[derive( @@ -508,19 +508,7 @@ impl RuntimeAdapter for KeyValueRuntime { Ok(res) } - fn add_validator_proposals( - &self, - _parent_hash: CryptoHash, - _current_hash: CryptoHash, - _rng_seed: CryptoHash, - _height: BlockHeight, - _last_finalized_height: BlockHeight, - _proposals: Vec, - _slashed_validators: Vec, - _validator_mask: Vec, - _total_supply: Balance, - _protocol_version: ProtocolVersion, - ) -> Result<(), Error> { + fn add_validator_proposals(&self, _block_header_info: BlockHeaderInfo) -> Result<(), Error> { Ok(()) } diff --git a/chain/chain/src/types.rs b/chain/chain/src/types.rs index b178f3636e4..c6638166e6e 100644 --- a/chain/chain/src/types.rs +++ b/chain/chain/src/types.rs @@ -5,7 +5,6 @@ use std::sync::Arc; use borsh::{BorshDeserialize, BorshSerialize}; use serde::Serialize; -use near_chain_configs::ProtocolVersion; use near_crypto::Signature; use near_pool::types::PoolIterator; pub use near_primitives::block::{Block, BlockHeader}; @@ -13,6 +12,7 @@ use near_primitives::challenge::{ChallengesResult, SlashedValidator}; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::merkle::{merklize, MerklePath}; +use near_primitives::protocol_version::ProtocolVersion; use near_primitives::receipt::Receipt; use near_primitives::sharding::{ReceiptProof, ShardChunk, ShardChunkHeader}; use near_primitives::transaction::{ExecutionOutcomeWithId, SignedTransaction}; @@ -104,6 +104,39 @@ impl ApplyTransactionResult { } } +/// Compressed information about block. +/// Useful for epoch manager. +#[derive(Default, BorshSerialize, BorshDeserialize, Serialize, Clone, Debug)] +pub struct BlockHeaderInfo { + pub hash: CryptoHash, + pub prev_hash: CryptoHash, + pub height: BlockHeight, + pub random_value: CryptoHash, + pub last_finalized_height: BlockHeight, + pub proposals: Vec, + pub slashed_validators: Vec, + pub chunk_mask: Vec, + pub total_supply: Balance, + pub latest_protocol_version: ProtocolVersion, +} + +impl BlockHeaderInfo { + pub fn new(header: &BlockHeader, last_finalized_height: u64) -> Self { + Self { + hash: *header.hash(), + prev_hash: *header.prev_hash(), + height: header.height(), + random_value: *header.random_value(), + last_finalized_height, + proposals: header.validator_proposals().to_vec(), + slashed_validators: vec![], + chunk_mask: header.chunk_mask().to_vec(), + total_supply: header.total_supply(), + latest_protocol_version: header.latest_protocol_version(), + } + } +} + /// Bridge between the chain and the runtime. /// Main function is to update state given transactions. /// Additionally handles validators. @@ -308,19 +341,7 @@ pub trait RuntimeAdapter: Send + Sync { fn get_epoch_minted_amount(&self, epoch_id: &EpochId) -> Result; /// Add proposals for validators. - fn add_validator_proposals( - &self, - parent_hash: CryptoHash, - current_hash: CryptoHash, - rng_seed: CryptoHash, - height: BlockHeight, - last_finalized_height: BlockHeight, - proposals: Vec, - slashed_validators: Vec, - validator_mask: Vec, - total_supply: Balance, - protocol_version: ProtocolVersion, - ) -> Result<(), Error>; + fn add_validator_proposals(&self, block_header_info: BlockHeaderInfo) -> Result<(), Error>; /// Apply transactions to given state root and return store update and new state root. /// Also returns transaction result for each transaction and new receipts. diff --git a/core/chain-configs/src/genesis_config.rs b/core/chain-configs/src/genesis_config.rs index f7b82bd7d5a..d6274a25a57 100644 --- a/core/chain-configs/src/genesis_config.rs +++ b/core/chain-configs/src/genesis_config.rs @@ -12,6 +12,7 @@ use num_rational::Rational; use serde::{Deserialize, Serialize}; use smart_default::SmartDefault; +use near_primitives::protocol_version::{ProtocolVersion, PROTOCOL_VERSION}; use near_primitives::serialize::{u128_dec_format, u128_dec_format_compatible}; use near_primitives::state_record::StateRecord; use near_primitives::types::{ @@ -19,8 +20,6 @@ use near_primitives::types::{ }; use near_runtime_configs::RuntimeConfig; -use crate::{ProtocolVersion, PROTOCOL_VERSION}; - pub const CONFIG_VERSION: u32 = 1; fn default_online_min_threshold() -> Rational { diff --git a/core/chain-configs/src/lib.rs b/core/chain-configs/src/lib.rs index fe81602b032..f6bd1c002e9 100644 --- a/core/chain-configs/src/lib.rs +++ b/core/chain-configs/src/lib.rs @@ -5,8 +5,3 @@ pub use client_config::ClientConfig; pub use genesis_config::{ Genesis, GenesisConfig, GenesisRecords, CONFIG_VERSION as GENESIS_CONFIG_VERSION, }; - -pub type ProtocolVersion = u32; - -/// Current latest version of the protocol -pub const PROTOCOL_VERSION: ProtocolVersion = 15; diff --git a/core/primitives/benches/serialization.rs b/core/primitives/benches/serialization.rs index d5f9487ab92..bf7e644e70b 100644 --- a/core/primitives/benches/serialization.rs +++ b/core/primitives/benches/serialization.rs @@ -9,6 +9,7 @@ use near_crypto::{KeyType, PublicKey, Signature}; use near_primitives::account::Account; use near_primitives::block::{genesis_chunks, Block}; use near_primitives::hash::CryptoHash; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::test_utils::account_new; use near_primitives::transaction::{Action, SignedTransaction, Transaction, TransferAction}; use near_primitives::types::{EpochId, StateRoot}; @@ -45,6 +46,7 @@ fn create_block() -> Block { ); let signer = InMemoryValidatorSigner::from_random("".to_string(), KeyType::ED25519); Block::produce( + PROTOCOL_VERSION, &genesis.header, 10, vec![genesis.chunks[0].clone()], diff --git a/core/primitives/src/block.rs b/core/primitives/src/block.rs index 42c04155865..9ade204594b 100644 --- a/core/primitives/src/block.rs +++ b/core/primitives/src/block.rs @@ -11,6 +11,7 @@ pub use crate::block_header::*; use crate::challenge::{Challenges, ChallengesResult}; use crate::hash::{hash, CryptoHash}; use crate::merkle::{merklize, verify_path, MerklePath}; +use crate::protocol_version::ProtocolVersion; use crate::sharding::{ ChunkHashHeight, EncodedShardChunk, ReedSolomonWrapper, ShardChunk, ShardChunkHeader, }; @@ -100,6 +101,7 @@ impl Block { /// Produces new block from header of previous block, current state root and set of transactions. pub fn produce( + protocol_version: ProtocolVersion, prev: &BlockHeader, height: BlockHeight, chunks: Vec, @@ -134,42 +136,36 @@ impl Block { } } let new_gas_price = Self::compute_new_gas_price( - prev.inner_rest.gas_price, + prev.gas_price(), gas_used, gas_limit, gas_price_adjustment_rate, ); let new_gas_price = std::cmp::max(new_gas_price, min_gas_price); - let new_total_supply = - prev.inner_rest.total_supply + minted_amount.unwrap_or(0) - balance_burnt; + let new_total_supply = prev.total_supply() + minted_amount.unwrap_or(0) - balance_burnt; let now = to_timestamp(Utc::now()); - let time = - if now <= prev.inner_lite.timestamp { prev.inner_lite.timestamp + 1 } else { now }; + let time = if now <= prev.raw_timestamp() { prev.raw_timestamp() + 1 } else { now }; - let (vrf_value, vrf_proof) = - signer.compute_vrf_with_proof(prev.inner_rest.random_value.as_ref()); + let (vrf_value, vrf_proof) = signer.compute_vrf_with_proof(prev.random_value().as_ref()); let random_value = hash(vrf_value.0.as_ref()); - let last_ds_final_block = if height == prev.inner_lite.height + 1 { - prev.hash() - } else { - prev.inner_rest.last_ds_final_block - }; + let last_ds_final_block = + if height == prev.height() + 1 { prev.hash() } else { prev.last_ds_final_block() }; - let last_final_block = if height == prev.inner_lite.height + 1 - && prev.inner_rest.last_ds_final_block == prev.prev_hash - { - prev.prev_hash - } else { - prev.inner_rest.last_final_block - }; + let last_final_block = + if height == prev.height() + 1 && prev.last_ds_final_block() == prev.prev_hash() { + prev.prev_hash() + } else { + prev.last_final_block() + }; Block { header: BlockHeader::new( + protocol_version, height, - prev.hash(), + prev.hash().clone(), Block::compute_state_root(&chunks), Block::compute_chunk_receipts_root(&chunks), Block::compute_chunk_headers_root(&chunks).0, @@ -187,8 +183,8 @@ impl Block { new_total_supply, challenges_result, signer, - last_final_block, - last_ds_final_block, + last_final_block.clone(), + last_ds_final_block.clone(), approvals, next_bp_hash, block_merkle_root, @@ -207,15 +203,15 @@ impl Block { min_gas_price: Balance, gas_price_adjustment_rate: Rational, ) -> bool { - let gas_used = Self::compute_gas_used(&self.chunks, self.header.inner_lite.height); - let gas_limit = Self::compute_gas_limit(&self.chunks, self.header.inner_lite.height); + let gas_used = Self::compute_gas_used(&self.chunks, self.header.height()); + let gas_limit = Self::compute_gas_limit(&self.chunks, self.header.height()); let expected_price = Self::compute_new_gas_price( prev_gas_price, gas_used, gas_limit, gas_price_adjustment_rate, ); - self.header.inner_rest.gas_price == max(expected_price, min_gas_price) + self.header.gas_price() == max(expected_price, min_gas_price) } pub fn compute_new_gas_price( @@ -313,45 +309,45 @@ impl Block { ) } - pub fn hash(&self) -> CryptoHash { + pub fn hash(&self) -> &CryptoHash { self.header.hash() } pub fn check_validity(&self) -> bool { // Check that state root stored in the header matches the state root of the chunks let state_root = Block::compute_state_root(&self.chunks); - if self.header.inner_lite.prev_state_root != state_root { + if self.header.prev_state_root() != &state_root { return false; } // Check that chunk receipts root stored in the header matches the state root of the chunks let chunk_receipts_root = Block::compute_chunk_receipts_root(&self.chunks); - if self.header.inner_rest.chunk_receipts_root != chunk_receipts_root { + if self.header.chunk_receipts_root() != &chunk_receipts_root { return false; } // Check that chunk headers root stored in the header matches the chunk headers root of the chunks let chunk_headers_root = Block::compute_chunk_headers_root(&self.chunks).0; - if self.header.inner_rest.chunk_headers_root != chunk_headers_root { + if self.header.chunk_headers_root() != &chunk_headers_root { return false; } // Check that chunk tx root stored in the header matches the tx root of the chunks let chunk_tx_root = Block::compute_chunk_tx_root(&self.chunks); - if self.header.inner_rest.chunk_tx_root != chunk_tx_root { + if self.header.chunk_tx_root() != &chunk_tx_root { return false; } // Check that chunk included root stored in the header matches the chunk included root of the chunks let chunks_included_root = - Block::compute_chunks_included(&self.chunks, self.header.inner_lite.height); - if self.header.inner_rest.chunks_included != chunks_included_root { + Block::compute_chunks_included(&self.chunks, self.header.height()); + if self.header.chunks_included() != chunks_included_root { return false; } // Check that challenges root stored in the header matches the challenges root of the challenges let challenges_root = Block::compute_challenges_root(&self.challenges); - if self.header.inner_rest.challenges_root != challenges_root { + if self.header.challenges_root() != &challenges_root { return false; } diff --git a/core/primitives/src/block_header.rs b/core/primitives/src/block_header.rs index 567f96b2964..bf3b6b5fac8 100644 --- a/core/primitives/src/block_header.rs +++ b/core/primitives/src/block_header.rs @@ -7,6 +7,7 @@ use near_crypto::{KeyType, PublicKey, Signature}; use crate::challenge::ChallengesResult; use crate::hash::{hash, CryptoHash}; use crate::merkle::combine_hash; +use crate::protocol_version::{ProtocolVersion, PROTOCOL_VERSION, PROTOCOL_VERSION_V14}; use crate::types::{AccountId, Balance, BlockHeight, EpochId, MerkleHash, ValidatorStake}; use crate::utils::{from_timestamp, to_timestamp}; use crate::validator_signer::ValidatorSigner; @@ -32,7 +33,7 @@ pub struct BlockHeaderInnerLite { } #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct BlockHeaderInnerRest { +pub struct BlockHeaderInnerRestV1 { /// Root hash of the chunk receipts in the given block. pub chunk_receipts_root: MerkleHash, /// Root hash of the chunk headers in the given block. @@ -65,72 +66,41 @@ pub struct BlockHeaderInnerRest { pub approvals: Vec>, } -impl BlockHeaderInnerLite { - pub fn new( - height: BlockHeight, - epoch_id: EpochId, - next_epoch_id: EpochId, - prev_state_root: MerkleHash, - outcome_root: MerkleHash, - timestamp: u64, - next_bp_hash: CryptoHash, - block_merkle_root: CryptoHash, - ) -> Self { - Self { - height, - epoch_id, - next_epoch_id, - prev_state_root, - outcome_root, - timestamp, - next_bp_hash, - block_merkle_root, - } - } +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +pub struct BlockHeaderInnerRestV2 { + /// Root hash of the chunk receipts in the given block. + pub chunk_receipts_root: MerkleHash, + /// Root hash of the chunk headers in the given block. + pub chunk_headers_root: MerkleHash, + /// Root hash of the chunk transactions in the given block. + pub chunk_tx_root: MerkleHash, + /// Number of chunks included into the block. + pub chunks_included: u64, + /// Root hash of the challenges in the given block. + pub challenges_root: MerkleHash, + /// The output of the randomness beacon + pub random_value: CryptoHash, + /// Validator proposals. + pub validator_proposals: Vec, + /// Mask for new chunks included in the block + pub chunk_mask: Vec, + /// Gas price. Same for all chunks + pub gas_price: Balance, + /// Total supply of tokens in the system + pub total_supply: Balance, + /// List of challenges result from previous block. + pub challenges_result: ChallengesResult, - pub fn hash(&self) -> CryptoHash { - hash(&self.try_to_vec().expect("Failed to serialize")) - } -} + /// Last block that has full BFT finality + pub last_final_block: CryptoHash, + /// Last block that has doomslug finality + pub last_ds_final_block: CryptoHash, -impl BlockHeaderInnerRest { - pub fn new( - chunk_receipts_root: MerkleHash, - chunk_headers_root: MerkleHash, - chunk_tx_root: MerkleHash, - chunks_included: u64, - challenges_root: MerkleHash, - random_value: CryptoHash, - validator_proposals: Vec, - chunk_mask: Vec, - gas_price: Balance, - total_supply: Balance, - challenges_result: ChallengesResult, - last_final_block: CryptoHash, - last_ds_final_block: CryptoHash, - approvals: Vec>, - ) -> Self { - Self { - chunk_receipts_root, - chunk_headers_root, - chunk_tx_root, - chunks_included, - challenges_root, - random_value, - validator_proposals, - chunk_mask, - gas_price, - total_supply, - challenges_result, - last_final_block, - last_ds_final_block, - approvals, - } - } + /// All the approvals included in this block + pub approvals: Vec>, - pub fn hash(&self) -> CryptoHash { - hash(&self.try_to_vec().expect("Failed to serialize")) - } + /// Latest protocol version that this block producer has. + pub latest_protocol_version: ProtocolVersion, } /// The part of the block approval that is different for endorsements and skips @@ -194,14 +164,30 @@ impl ApprovalMessage { } #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -#[borsh_init(init)] -pub struct BlockHeader { +pub struct BlockHeaderV1 { + pub prev_hash: CryptoHash, + + /// Inner part of the block header that gets hashed, split into two parts, one that is sent + /// to light clients, and the rest + pub inner_lite: BlockHeaderInnerLite, + pub inner_rest: BlockHeaderInnerRestV1, + + /// Signature of the block producer. + pub signature: Signature, + + /// Cached value of hash for this block. + #[borsh_skip] + pub hash: CryptoHash, +} + +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +pub struct BlockHeaderV2 { pub prev_hash: CryptoHash, /// Inner part of the block header that gets hashed, split into two parts, one that is sent /// to light clients, and the rest pub inner_lite: BlockHeaderInnerLite, - pub inner_rest: BlockHeaderInnerRest, + pub inner_rest: BlockHeaderInnerRestV2, /// Signature of the block producer. pub signature: Signature, @@ -211,20 +197,26 @@ pub struct BlockHeader { pub hash: CryptoHash, } +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +#[borsh_init(init)] +pub enum BlockHeader { + BlockHeaderV1(BlockHeaderV1), + /// Added `latest_protocol_version` to `BlockHeaderInnerRest`. + BlockHeaderV2(BlockHeaderV2), +} + impl BlockHeader { - pub fn compute_inner_hash( - inner_lite: &BlockHeaderInnerLite, - inner_rest: &BlockHeaderInnerRest, - ) -> CryptoHash { - let hash_lite = inner_lite.hash(); - let hash_rest = inner_rest.hash(); + pub fn compute_inner_hash(inner_lite: &T, inner_rest: &[u8]) -> CryptoHash { + let hash_lite = hash(&inner_lite.try_to_vec().expect("Failed to serialize")); + let hash_rest = hash(inner_rest); combine_hash(hash_lite, hash_rest) } + // &inner_rest.try_to_vec().expect("Failed to serialize") - pub fn compute_hash( + pub fn compute_hash( prev_hash: CryptoHash, - inner_lite: &BlockHeaderInnerLite, - inner_rest: &BlockHeaderInnerRest, + inner_lite: &T, + inner_rest: &[u8], ) -> CryptoHash { let hash_inner = BlockHeader::compute_inner_hash(inner_lite, inner_rest); @@ -232,10 +224,26 @@ impl BlockHeader { } pub fn init(&mut self) { - self.hash = BlockHeader::compute_hash(self.prev_hash, &self.inner_lite, &self.inner_rest); + match self { + BlockHeader::BlockHeaderV1(header) => { + header.hash = BlockHeader::compute_hash( + header.prev_hash, + &header.inner_lite, + &header.inner_rest.try_to_vec().expect("Failed to serialize"), + ) + } + BlockHeader::BlockHeaderV2(header) => { + header.hash = BlockHeader::compute_hash( + header.prev_hash, + &header.inner_lite, + &header.inner_rest.try_to_vec().expect("Failed to serialize"), + ) + } + } } pub fn new( + protocol_version: ProtocolVersion, height: BlockHeight, prev_hash: CryptoHash, prev_state_root: MerkleHash, @@ -261,7 +269,7 @@ impl BlockHeader { next_bp_hash: CryptoHash, block_merkle_root: CryptoHash, ) -> Self { - let inner_lite = BlockHeaderInnerLite::new( + let inner_lite = BlockHeaderInnerLite { height, epoch_id, next_epoch_id, @@ -270,25 +278,70 @@ impl BlockHeader { timestamp, next_bp_hash, block_merkle_root, - ); - let inner_rest = BlockHeaderInnerRest::new( - chunk_receipts_root, - chunk_headers_root, - chunk_tx_root, - chunks_included, - challenges_root, - random_value, - validator_proposals, - chunk_mask, - gas_price, - total_supply, - challenges_result, - last_final_block, - last_ds_final_block, - approvals, - ); - let (hash, signature) = signer.sign_block_header_parts(prev_hash, &inner_lite, &inner_rest); - Self { prev_hash, inner_lite, inner_rest, signature, hash } + }; + match protocol_version { + PROTOCOL_VERSION_V14 => { + let inner_rest = BlockHeaderInnerRestV1 { + chunk_receipts_root, + chunk_headers_root, + chunk_tx_root, + chunks_included, + challenges_root, + random_value, + validator_proposals, + chunk_mask, + gas_price, + total_supply, + challenges_result, + last_final_block, + last_ds_final_block, + approvals, + }; + let (hash, signature) = signer.sign_block_header_parts( + prev_hash, + &inner_lite, + &inner_rest.try_to_vec().expect("Failed to serialize"), + ); + Self::BlockHeaderV1(BlockHeaderV1 { + prev_hash, + inner_lite, + inner_rest, + signature, + hash, + }) + } + _ => { + let inner_rest = BlockHeaderInnerRestV2 { + chunk_receipts_root, + chunk_headers_root, + chunk_tx_root, + chunks_included, + challenges_root, + random_value, + validator_proposals, + chunk_mask, + gas_price, + total_supply, + challenges_result, + last_final_block, + last_ds_final_block, + approvals, + latest_protocol_version: PROTOCOL_VERSION, + }; + let (hash, signature) = signer.sign_block_header_parts( + prev_hash, + &inner_lite, + &inner_rest.try_to_vec().expect("Failed to serialize"), + ); + Self::BlockHeaderV2(BlockHeaderV2 { + prev_hash, + inner_lite, + inner_rest, + signature, + hash, + }) + } + } } pub fn genesis( @@ -304,56 +357,281 @@ impl BlockHeader { initial_total_supply: Balance, next_bp_hash: CryptoHash, ) -> Self { - let inner_lite = BlockHeaderInnerLite::new( + let inner_lite = BlockHeaderInnerLite { height, - EpochId::default(), - EpochId::default(), - state_root, - CryptoHash::default(), - to_timestamp(timestamp), + epoch_id: EpochId::default(), + next_epoch_id: EpochId::default(), + prev_state_root: state_root, + outcome_root: CryptoHash::default(), + timestamp: to_timestamp(timestamp), next_bp_hash, - CryptoHash::default(), - ); - let inner_rest = BlockHeaderInnerRest::new( + block_merkle_root: CryptoHash::default(), + }; + let inner_rest = BlockHeaderInnerRestV1 { chunk_receipts_root, chunk_headers_root, chunk_tx_root, chunks_included, challenges_root, + random_value: CryptoHash::default(), + validator_proposals: vec![], + chunk_mask: vec![], + gas_price: initial_gas_price, + total_supply: initial_total_supply, + challenges_result: vec![], + last_final_block: CryptoHash::default(), + last_ds_final_block: CryptoHash::default(), + approvals: vec![], + }; + let hash = BlockHeader::compute_hash( CryptoHash::default(), - vec![], - vec![], - initial_gas_price, - initial_total_supply, - vec![], - CryptoHash::default(), - CryptoHash::default(), - vec![], + &inner_lite, + &inner_rest.try_to_vec().expect("Failed to serialize"), ); - let hash = BlockHeader::compute_hash(CryptoHash::default(), &inner_lite, &inner_rest); - Self { + // Genesis always has v1 of BlockHeader. + Self::BlockHeaderV1(BlockHeaderV1 { prev_hash: CryptoHash::default(), inner_lite, inner_rest, signature: Signature::empty(KeyType::ED25519), hash, + }) + } + + pub fn hash(&self) -> &CryptoHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.hash, + BlockHeader::BlockHeaderV2(header) => &header.hash, + } + } + + pub fn prev_hash(&self) -> &CryptoHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.prev_hash, + BlockHeader::BlockHeaderV2(header) => &header.prev_hash, + } + } + + pub fn signature(&self) -> &Signature { + match self { + BlockHeader::BlockHeaderV1(header) => &header.signature, + BlockHeader::BlockHeaderV2(header) => &header.signature, + } + } + + pub fn height(&self) -> BlockHeight { + match self { + BlockHeader::BlockHeaderV1(header) => header.inner_lite.height, + BlockHeader::BlockHeaderV2(header) => header.inner_lite.height, + } + } + + pub fn epoch_id(&self) -> &EpochId { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_lite.epoch_id, + BlockHeader::BlockHeaderV2(header) => &header.inner_lite.epoch_id, + } + } + + pub fn next_epoch_id(&self) -> &EpochId { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_lite.next_epoch_id, + BlockHeader::BlockHeaderV2(header) => &header.inner_lite.next_epoch_id, + } + } + + pub fn prev_state_root(&self) -> &MerkleHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_lite.prev_state_root, + BlockHeader::BlockHeaderV2(header) => &header.inner_lite.prev_state_root, + } + } + + pub fn chunk_receipts_root(&self) -> &MerkleHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.chunk_receipts_root, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.chunk_receipts_root, + } + } + + pub fn chunk_headers_root(&self) -> &MerkleHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.chunk_headers_root, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.chunk_headers_root, + } + } + + pub fn chunk_tx_root(&self) -> &MerkleHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.chunk_tx_root, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.chunk_tx_root, + } + } + + pub fn chunks_included(&self) -> u64 { + match self { + BlockHeader::BlockHeaderV1(header) => header.inner_rest.chunks_included, + BlockHeader::BlockHeaderV2(header) => header.inner_rest.chunks_included, + } + } + + pub fn challenges_root(&self) -> &MerkleHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.challenges_root, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.challenges_root, + } + } + + pub fn outcome_root(&self) -> &MerkleHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_lite.outcome_root, + BlockHeader::BlockHeaderV2(header) => &header.inner_lite.outcome_root, + } + } + + pub fn raw_timestamp(&self) -> u64 { + match self { + BlockHeader::BlockHeaderV1(header) => header.inner_lite.timestamp, + BlockHeader::BlockHeaderV2(header) => header.inner_lite.timestamp, + } + } + + pub fn validator_proposals(&self) -> &[ValidatorStake] { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.validator_proposals, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.validator_proposals, + } + } + + pub fn chunk_mask(&self) -> &[bool] { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.chunk_mask, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.chunk_mask, + } + } + + pub fn gas_price(&self) -> Balance { + match self { + BlockHeader::BlockHeaderV1(header) => header.inner_rest.gas_price, + BlockHeader::BlockHeaderV2(header) => header.inner_rest.gas_price, + } + } + + pub fn total_supply(&self) -> Balance { + match self { + BlockHeader::BlockHeaderV1(header) => header.inner_rest.total_supply, + BlockHeader::BlockHeaderV2(header) => header.inner_rest.total_supply, + } + } + + pub fn random_value(&self) -> &CryptoHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.random_value, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.random_value, + } + } + + pub fn last_final_block(&self) -> &CryptoHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.last_final_block, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.last_final_block, + } + } + + pub fn last_ds_final_block(&self) -> &CryptoHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.last_ds_final_block, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.last_ds_final_block, + } + } + + pub fn challenges_result(&self) -> &ChallengesResult { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.challenges_result, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.challenges_result, + } + } + + pub fn next_bp_hash(&self) -> &CryptoHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_lite.next_bp_hash, + BlockHeader::BlockHeaderV2(header) => &header.inner_lite.next_bp_hash, + } + } + + pub fn block_merkle_root(&self) -> &CryptoHash { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_lite.block_merkle_root, + BlockHeader::BlockHeaderV2(header) => &header.inner_lite.block_merkle_root, } } - pub fn hash(&self) -> CryptoHash { - self.hash + pub fn approvals(&self) -> &[Option] { + match self { + BlockHeader::BlockHeaderV1(header) => &header.inner_rest.approvals, + BlockHeader::BlockHeaderV2(header) => &header.inner_rest.approvals, + } } /// Verifies that given public key produced the block. pub fn verify_block_producer(&self, public_key: &PublicKey) -> bool { - self.signature.verify(self.hash.as_ref(), public_key) + self.signature().verify(self.hash().as_ref(), public_key) } pub fn timestamp(&self) -> DateTime { - from_timestamp(self.inner_lite.timestamp) + from_timestamp(self.raw_timestamp()) } pub fn num_approvals(&self) -> u64 { - self.inner_rest.approvals.iter().filter(|x| x.is_some()).count() as u64 + self.approvals().iter().filter(|x| x.is_some()).count() as u64 + } + + pub fn latest_protocol_version(&self) -> u32 { + match self { + BlockHeader::BlockHeaderV1(_header) => PROTOCOL_VERSION_V14, + BlockHeader::BlockHeaderV2(header) => header.inner_rest.latest_protocol_version, + } + } +} + +//impl BorshSerialize for BlockHeader { +// +//} + +//impl BorshDeserialize for BlockHeader {} + +#[cfg(test)] +mod tests { + // use borsh::ser::BorshSerialize; + // + // use crate::block::Block; + use crate::serialize::from_base; + + use super::*; + + #[test] + fn test_block_header_v1_deserialize() { + // This is serialized BlockHeader converting from v1 which doesn't have version number. + // let chunks = vec![]; + // let challenges = vec![]; + // let block_header_v1 = BlockHeader::genesis( + // 0, + // Block::compute_state_root(&chunks), + // Block::compute_chunk_receipts_root(&chunks), + // Block::compute_chunk_headers_root(&chunks).0, + // Block::compute_chunk_tx_root(&chunks), + // Block::compute_chunks_included(&chunks, 0), + // Block::compute_challenges_root(&challenges), + // Utc::now(), + // 100, + // 1_000_000, + // CryptoHash::default(), + // ); + let block_header_v1_enc = "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111119g3LQYu8NYhqU9RHSeqTwaGjiCojJtbKmHraACCNtFbduZbaV2QUaM1fBMVuoXXoXZxnC5Qicu74eS3rRY7DNWGycYjQknptSjzT4H1RXubmP7g3wg5DXC6jrG2K5zBmn8AFPHviziwHK1DsHWct58EXmKX1WjMR7mvahinN5DMAqd1vRN8o45uQP6HunhgnuC22Jo1uT6E1TyBjgyMLPnxq2SZ4jWvSn6d5H4u4qwgQ5RBJR1sP53gVptwrF6vvtCSpe6jNM6JfC6R9VgG5UeW91wua2Mo8cgzfF5SZ7hgLHkmkVqZqx6Pt98C44JTWHAvzrFpZ3xUeSBxKXeqE3zs8koVfz2hYyCASsx5xXwtVEJsARgmjBojJ8s8v2P3sETiF1rTTRVkth9TF7tcc4TSW8JCzhpgDiu2vVLaUkc8452h9Yrn2Ruh9GmWbZT3anrPrHr8GEGaLmNiAN4pF6eUjDxqf44y95eKrz7dPWcYj3gsdKcTgQB98xt6NhPbSE33az6DkrqgZDqapWQBWcPkrXqUstWkLBPVypgjpJPSkdeJvVDP8WwfM"; + // assert_eq!(to_base(block_header_v1.try_to_vec().unwrap()), block_header_v1_enc); + let _block_header_v1 = + BlockHeaderV1::try_from_slice(&from_base(block_header_v1_enc).unwrap()) + .expect("Failed to deserialize old block header"); + // assert_eq!(block_header_v1.latest_protocol_version(), PROTOCOL_VERSION_V14); } } diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index 64a6f14d00a..657bb26f2f3 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -15,6 +15,7 @@ pub mod hash; pub mod logging; pub mod merkle; pub mod network; +pub mod protocol_version; pub mod receipt; pub mod rpc; pub mod serialize; diff --git a/core/primitives/src/protocol_version.rs b/core/primitives/src/protocol_version.rs new file mode 100644 index 00000000000..83cac05e51c --- /dev/null +++ b/core/primitives/src/protocol_version.rs @@ -0,0 +1,10 @@ +/// Protocol version type. +pub type ProtocolVersion = u32; + +/// First protocol version backward compatibility started. +/// Changes 14 -> 15: +/// - Added `latest_protocol_version` into `BlockHeaderInnerRest`. +pub const PROTOCOL_VERSION_V14: ProtocolVersion = 14; + +/// Current latest version of the protocol. +pub const PROTOCOL_VERSION: ProtocolVersion = 15; diff --git a/core/primitives/src/test_utils.rs b/core/primitives/src/test_utils.rs index ebd006d902a..21f4bbd407c 100644 --- a/core/primitives/src/test_utils.rs +++ b/core/primitives/src/test_utils.rs @@ -4,6 +4,7 @@ use crate::account::{AccessKey, AccessKeyPermission, Account}; use crate::block::Block; use crate::hash::CryptoHash; use crate::merkle::PartialMerkleTree; +use crate::protocol_version::PROTOCOL_VERSION; use crate::transaction::{ Action, AddKeyAction, CreateAccountAction, DeleteAccountAction, DeleteKeyAction, DeployContractAction, FunctionCallAction, SignedTransaction, StakeAction, Transaction, @@ -248,7 +249,7 @@ impl Block { signer: &dyn ValidatorSigner, block_merkle_tree: &mut PartialMerkleTree, ) -> Self { - block_merkle_tree.insert(prev.hash()); + block_merkle_tree.insert(*prev.hash()); Self::empty_with_approvals( prev, height, @@ -283,13 +284,13 @@ impl Block { Self::empty_with_epoch( prev, height, - prev.header.inner_lite.epoch_id.clone(), - if prev.header.prev_hash == CryptoHash::default() { - EpochId(prev.hash()) + prev.header.epoch_id().clone(), + if prev.header.prev_hash() == &CryptoHash::default() { + EpochId(*prev.hash()) } else { - prev.header.inner_lite.next_epoch_id.clone() + prev.header.next_epoch_id().clone() }, - prev.header.inner_lite.next_bp_hash, + *prev.header.next_bp_hash(), signer, block_merkle_tree, ) @@ -302,7 +303,7 @@ impl Block { ) -> Self { Self::empty_with_height_and_block_merkle_tree( prev, - prev.header.inner_lite.height + 1, + prev.header.height() + 1, signer, block_merkle_tree, ) @@ -325,6 +326,7 @@ impl Block { block_merkle_root: CryptoHash, ) -> Self { Block::produce( + PROTOCOL_VERSION, &prev.header, height, prev.chunks.clone(), diff --git a/core/primitives/src/validator_signer.rs b/core/primitives/src/validator_signer.rs index 96157bd9019..709056afc8f 100644 --- a/core/primitives/src/validator_signer.rs +++ b/core/primitives/src/validator_signer.rs @@ -5,9 +5,7 @@ use borsh::BorshSerialize; use near_crypto::{InMemorySigner, KeyType, PublicKey, Signature, Signer}; -use crate::block::{ - Approval, ApprovalInner, BlockHeader, BlockHeaderInnerLite, BlockHeaderInnerRest, -}; +use crate::block::{Approval, ApprovalInner, BlockHeader, BlockHeaderInnerLite}; use crate::challenge::ChallengeBody; use crate::hash::{hash, CryptoHash}; use crate::network::{AnnounceAccount, PeerId}; @@ -31,7 +29,7 @@ pub trait ValidatorSigner: Sync + Send { &self, prev_hash: CryptoHash, inner_lite: &BlockHeaderInnerLite, - inner_rest: &BlockHeaderInnerRest, + inner_rest: &[u8], ) -> (CryptoHash, Signature); /// Signs given inner of the chunk header. @@ -87,7 +85,7 @@ impl ValidatorSigner for EmptyValidatorSigner { &self, prev_hash: CryptoHash, inner_lite: &BlockHeaderInnerLite, - inner_rest: &BlockHeaderInnerRest, + inner_rest: &[u8], ) -> (CryptoHash, Signature) { let hash = BlockHeader::compute_hash(prev_hash, inner_lite, inner_rest); (hash, Signature::default()) @@ -183,7 +181,7 @@ impl ValidatorSigner for InMemoryValidatorSigner { &self, prev_hash: CryptoHash, inner_lite: &BlockHeaderInnerLite, - inner_rest: &BlockHeaderInnerRest, + inner_rest: &[u8], ) -> (CryptoHash, Signature) { let hash = BlockHeader::compute_hash(prev_hash, inner_lite, inner_rest); (hash, self.signer.sign(hash.as_ref())) diff --git a/core/primitives/src/views.rs b/core/primitives/src/views.rs index 3d770e29ec6..04737f9969b 100644 --- a/core/primitives/src/views.rs +++ b/core/primitives/src/views.rs @@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize}; use near_crypto::{PublicKey, Signature}; use crate::account::{AccessKey, AccessKeyPermission, Account, FunctionCallPermission}; -use crate::block::{Block, BlockHeader, BlockHeaderInnerLite, BlockHeaderInnerRest}; +use crate::block::{Block, BlockHeader}; use crate::challenge::{Challenge, ChallengesResult}; use crate::errors::TxExecutionError; use crate::hash::{hash, CryptoHash}; @@ -34,8 +34,8 @@ use crate::transaction::{ FunctionCallAction, SignedTransaction, StakeAction, TransferAction, }; use crate::types::{ - AccountId, AccountWithPublicKey, Balance, BlockHeight, EpochId, FunctionArgs, Gas, Nonce, - NumBlocks, ShardId, StateChangeCause, StateChangeKind, StateChangeValue, StateChangeWithCause, + AccountId, AccountWithPublicKey, Balance, BlockHeight, FunctionArgs, Gas, Nonce, NumBlocks, + ShardId, StateChangeCause, StateChangeKind, StateChangeValue, StateChangeWithCause, StateChangesRequest, StateRoot, StorageUsage, StoreKey, StoreValue, ValidatorKickoutReason, ValidatorStake, Version, }; @@ -350,83 +350,82 @@ pub struct BlockHeaderView { impl From for BlockHeaderView { fn from(header: BlockHeader) -> Self { Self { - height: header.inner_lite.height, - epoch_id: header.inner_lite.epoch_id.0, - next_epoch_id: header.inner_lite.next_epoch_id.0, - hash: header.hash, - prev_hash: header.prev_hash, - prev_state_root: header.inner_lite.prev_state_root, - chunk_receipts_root: header.inner_rest.chunk_receipts_root, - chunk_headers_root: header.inner_rest.chunk_headers_root, - chunk_tx_root: header.inner_rest.chunk_tx_root, - chunks_included: header.inner_rest.chunks_included, - challenges_root: header.inner_rest.challenges_root, - outcome_root: header.inner_lite.outcome_root, - timestamp: header.inner_lite.timestamp, - random_value: header.inner_rest.random_value, + height: header.height(), + epoch_id: header.epoch_id().0, + next_epoch_id: header.next_epoch_id().0, + hash: header.hash().clone(), + prev_hash: header.prev_hash().clone(), + prev_state_root: header.prev_state_root().clone(), + chunk_receipts_root: header.chunk_receipts_root().clone(), + chunk_headers_root: header.chunk_headers_root().clone(), + chunk_tx_root: header.chunk_tx_root().clone(), + chunks_included: header.chunks_included(), + challenges_root: header.challenges_root().clone(), + outcome_root: header.outcome_root().clone(), + timestamp: header.raw_timestamp(), + random_value: header.random_value().clone(), validator_proposals: header - .inner_rest - .validator_proposals - .into_iter() - .map(|v| v.into()) + .validator_proposals() + .iter() + .map(|v| v.clone().into()) .collect(), - chunk_mask: header.inner_rest.chunk_mask, - gas_price: header.inner_rest.gas_price, + chunk_mask: header.chunk_mask().to_vec(), + gas_price: header.gas_price(), rent_paid: 0, validator_reward: 0, - total_supply: header.inner_rest.total_supply, - challenges_result: header.inner_rest.challenges_result, - last_final_block: header.inner_rest.last_final_block, - last_ds_final_block: header.inner_rest.last_ds_final_block, - next_bp_hash: header.inner_lite.next_bp_hash, - block_merkle_root: header.inner_lite.block_merkle_root, - approvals: header.inner_rest.approvals.clone(), - signature: header.signature, + total_supply: header.total_supply(), + challenges_result: header.challenges_result().clone(), + last_final_block: header.last_final_block().clone(), + last_ds_final_block: header.last_ds_final_block().clone(), + next_bp_hash: header.next_bp_hash().clone(), + block_merkle_root: header.block_merkle_root().clone(), + approvals: header.approvals().to_vec(), + signature: header.signature().clone(), } } } -impl From for BlockHeader { - fn from(view: BlockHeaderView) -> Self { - let mut header = Self { - prev_hash: view.prev_hash, - inner_lite: BlockHeaderInnerLite { - height: view.height, - epoch_id: EpochId(view.epoch_id), - next_epoch_id: EpochId(view.next_epoch_id), - prev_state_root: view.prev_state_root, - outcome_root: view.outcome_root, - timestamp: view.timestamp, - next_bp_hash: view.next_bp_hash, - block_merkle_root: view.block_merkle_root, - }, - inner_rest: BlockHeaderInnerRest { - chunk_receipts_root: view.chunk_receipts_root, - chunk_headers_root: view.chunk_headers_root, - chunk_tx_root: view.chunk_tx_root, - chunks_included: view.chunks_included, - challenges_root: view.challenges_root, - random_value: view.random_value, - validator_proposals: view - .validator_proposals - .into_iter() - .map(|v| v.into()) - .collect(), - chunk_mask: view.chunk_mask, - gas_price: view.gas_price, - total_supply: view.total_supply, - challenges_result: view.challenges_result, - last_final_block: view.last_final_block, - last_ds_final_block: view.last_ds_final_block, - approvals: view.approvals.clone(), - }, - signature: view.signature, - hash: CryptoHash::default(), - }; - header.init(); - header - } -} +//impl From for BlockHeader { +// fn from(view: BlockHeaderView) -> Self { +// let mut header = Self { +// prev_hash: view.prev_hash, +// inner_lite: BlockHeaderInnerLite { +// height: view.height, +// epoch_id: EpochId(view.epoch_id), +// next_epoch_id: EpochId(view.next_epoch_id), +// prev_state_root: view.prev_state_root, +// outcome_root: view.outcome_root, +// timestamp: view.timestamp, +// next_bp_hash: view.next_bp_hash, +// block_merkle_root: view.block_merkle_root, +// }, +// inner_rest: BlockHeaderInnerRestV2 { +// chunk_receipts_root: view.chunk_receipts_root, +// chunk_headers_root: view.chunk_headers_root, +// chunk_tx_root: view.chunk_tx_root, +// chunks_included: view.chunks_included, +// challenges_root: view.challenges_root, +// random_value: view.random_value, +// validator_proposals: view +// .validator_proposals +// .into_iter() +// .map(|v| v.into()) +// .collect(), +// chunk_mask: view.chunk_mask, +// gas_price: view.gas_price, +// total_supply: view.total_supply, +// challenges_result: view.challenges_result, +// last_final_block: view.last_final_block, +// last_ds_final_block: view.last_ds_final_block, +// approvals: view.approvals.clone(), +// }, +// signature: view.signature, +// hash: CryptoHash::default(), +// }; +// header.init(); +// header +// } +//} #[derive(Serialize, Debug, Clone, BorshDeserialize, BorshSerialize)] pub struct BlockHeaderInnerLiteView { diff --git a/core/store/src/validate.rs b/core/store/src/validate.rs index 967e34b5e00..10dfb6755a1 100644 --- a/core/store/src/validate.rs +++ b/core/store/src/validate.rs @@ -57,7 +57,7 @@ fn block_header_validity( let block_hash = CryptoHash::try_from(key.as_ref()).unwrap(); match BlockHeader::try_from_slice(value) { Ok(header) => { - if header.hash() != block_hash { + if header.hash() != &block_hash { err!(format!("Invalid Block Header hash stored, {:?}", block_hash)) } else { Ok(()) @@ -76,7 +76,7 @@ fn block_hash_validity( let block_hash = CryptoHash::try_from(key.as_ref()).unwrap(); match Block::try_from_slice(value) { Ok(block) => { - if block.hash() != block_hash { + if block.hash() != &block_hash { err!(format!("Invalid Block hash stored, {:?}", block_hash)) } else { Ok(()) @@ -169,12 +169,11 @@ fn block_height_cmp_tail( }; match Block::try_from_slice(value) { Ok(block) => { - if block.header.inner_lite.height < tail - && block.header.inner_lite.height != config.genesis_height - { + if block.header.height() < tail && block.header.height() != config.genesis_height { err!(format!( "Invalid block height stored: {:?}, tail: {:?}", - block.header.inner_lite.height, tail + block.header.height(), + tail )) } else { Ok(()) diff --git a/neard/src/runtime.rs b/neard/src/runtime.rs index d72cb4aa6df..37b8d004d06 100644 --- a/neard/src/runtime.rs +++ b/neard/src/runtime.rs @@ -11,7 +11,7 @@ use borsh::BorshDeserialize; use log::{debug, error, warn}; use near_chain::chain::NUM_EPOCHS_TO_KEEP_STORE_DATA; -use near_chain::types::ApplyTransactionResult; +use near_chain::types::{ApplyTransactionResult, BlockHeaderInfo}; use near_chain::{BlockHeader, Error, ErrorKind, RuntimeAdapter}; use near_chain_configs::{Genesis, ProtocolVersion}; use near_crypto::{PublicKey, Signature}; @@ -829,35 +829,23 @@ impl RuntimeAdapter for NightshadeRuntime { Ok(epoch_manager.get_epoch_info(epoch_id)?.minted_amount) } - fn add_validator_proposals( - &self, - parent_hash: CryptoHash, - current_hash: CryptoHash, - rng_seed: CryptoHash, - height: BlockHeight, - last_finalized_height: BlockHeight, - proposals: Vec, - slashed_validators: Vec, - chunk_mask: Vec, - total_supply: Balance, - protocol_version: ProtocolVersion, - ) -> Result<(), Error> { + fn add_validator_proposals(&self, block_header_info: BlockHeaderInfo) -> Result<(), Error> { // Check that genesis block doesn't have any proposals. assert!(height > 0 || (proposals.is_empty() && slashed_validators.is_empty())); debug!(target: "runtime", "add validator proposals at block height {} {:?}", height, proposals); // Deal with validator proposals and epoch finishing. let mut epoch_manager = self.epoch_manager.write().expect(POISONED_LOCK_ERR); let block_info = BlockInfo::new( - height, - last_finalized_height, - parent_hash, - proposals, - chunk_mask, - slashed_validators, - total_supply, - protocol_version, + block_header_info.height, + block_header_info.last_finalized_height, + block_header_info.parent_hash, + block_header_info.proposals, + block_header_info.chunk_mask, + block_header_info.slashed_validators, + block_header_info.total_supply, + block_header_info.protocol_version, ); - let rng_seed = (rng_seed.0).0; + let rng_seed = (block_header_info.rng_seed.0).0; // TODO: don't commit here, instead contribute to upstream store update. epoch_manager .record_block_info(¤t_hash, block_info, rng_seed)? From f620245eab0dc71fbc2748300beeb7461b3f7e16 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Fri, 22 May 2020 15:34:24 -0700 Subject: [PATCH 04/21] Make updatable BlockHeader compile. --- Cargo.lock | 1 - chain/chain/src/chain.rs | 364 +++++++++--------- chain/chain/src/doomslug.rs | 2 +- chain/chain/src/lightclient.rs | 29 +- chain/chain/src/store.rs | 145 ++++--- chain/chain/src/test_utils.rs | 54 ++- chain/chain/src/types.rs | 18 +- chain/chain/src/validate.rs | 42 +- chain/chain/tests/challenges.rs | 24 +- chain/chain/tests/gc.rs | 15 +- chain/chain/tests/simple_chain.rs | 76 ++-- chain/chain/tests/sync_chain.rs | 2 +- chain/chunks/src/lib.rs | 4 +- chain/client/src/client.rs | 63 +-- chain/client/src/client_actor.rs | 46 +-- chain/client/src/sync.rs | 54 +-- chain/client/src/test_utils.rs | 19 +- chain/client/src/view_client.rs | 39 +- chain/client/tests/bug_repros.rs | 14 +- chain/client/tests/catching_up.rs | 97 ++--- chain/client/tests/challenges.rs | 70 ++-- chain/client/tests/chunks_management.rs | 38 +- chain/client/tests/consensus.rs | 37 +- chain/client/tests/cross_shard_tx.rs | 2 +- chain/client/tests/process_blocks.rs | 102 ++--- chain/client/tests/query_client.rs | 17 +- chain/epoch_manager/Cargo.toml | 1 - chain/epoch_manager/src/lib.rs | 2 +- chain/epoch_manager/src/test_utils.rs | 2 +- chain/epoch_manager/src/types.rs | 2 +- chain/jsonrpc/tests/rpc_query.rs | 2 +- chain/network/src/peer.rs | 17 +- chain/network/src/recorder.rs | 2 +- chain/network/src/types.rs | 2 +- chain/network/tests/runner/mod.rs | 3 +- core/primitives/src/block_header.rs | 60 +-- core/primitives/src/test_utils.rs | 21 + core/primitives/src/validator_signer.rs | 8 +- core/primitives/src/views.rs | 91 ++--- .../src/csv_to_json_configs.rs | 3 +- genesis-tools/genesis-populate/src/lib.rs | 16 +- neard/src/config.rs | 5 +- neard/src/runtime.rs | 103 ++--- neard/src/shard_tracker.rs | 2 +- neard/tests/economics.rs | 15 +- neard/tests/rpc_nodes.rs | 8 +- neard/tests/sync_nodes.rs | 26 +- test-utils/state-viewer/src/main.rs | 53 +-- test-utils/state-viewer/src/state_dump.rs | 18 +- test-utils/testlib/src/lib.rs | 4 +- 50 files changed, 883 insertions(+), 957 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 634da5c7d7e..67efe3cba66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2189,7 +2189,6 @@ dependencies = [ "cached", "log", "near-chain", - "near-chain-configs", "near-crypto", "near-primitives", "near-store", diff --git a/chain/chain/src/chain.rs b/chain/chain/src/chain.rs index 82777ff3e70..283879f05c2 100644 --- a/chain/chain/src/chain.rs +++ b/chain/chain/src/chain.rs @@ -21,7 +21,7 @@ use near_primitives::challenge::{ }; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::merkle::{merklize, verify_path}; -use near_primitives::protocol_version::{ProtocolVersion, PROTOCOL_VERSION}; +use near_primitives::protocol_version::ProtocolVersion; use near_primitives::receipt::Receipt; use near_primitives::sharding::{ ChunkHash, ChunkHashHeight, ReceiptProof, ShardChunk, ShardChunkHeader, ShardProof, @@ -421,7 +421,7 @@ impl Chain { let two_ahead = chain_store.get_header_by_height(ret.height() + 2)?; if two_ahead.epoch_id() != ret.epoch_id() { let one_ahead = chain_store.get_header_by_height(ret.height() + 1)?; - if one_ahead.inner_lite.epoch_id != ret.epoch_id() { + if one_ahead.epoch_id() != ret.epoch_id() { let new_final_hash = ret.last_final_block().clone(); chain_store.get_block_header(&new_final_hash)?.clone() } else { @@ -434,8 +434,8 @@ impl Chain { }; let next_block_producers = get_epoch_block_producers_view( - &final_block_header.inner_lite.next_epoch_id, - &header.prev_hash, + &final_block_header.next_epoch_id(), + header.prev_hash(), runtime_adapter, )?; @@ -578,7 +578,7 @@ impl Chain { let blocks_current_height = blocks_current_height.values().flatten().cloned().collect::>(); if let Some(block_hash) = blocks_current_height.first() { - let prev_hash = chain_store_update.get_block_header(block_hash)?.prev_hash; + let prev_hash = *chain_store_update.get_block_header(block_hash)?.prev_hash(); let prev_block_refcount = *chain_store_update.get_block_refcount(&prev_hash)?; if prev_block_refcount > 1 { // Block of `prev_hash` starts a Fork, stopping @@ -619,7 +619,7 @@ impl Chain { let mut chain_store_update = self.store.store_update(); if *chain_store_update.get_block_refcount(¤t_hash)? == 0 { let prev_hash = - chain_store_update.get_block_header(¤t_hash)?.prev_hash; + *chain_store_update.get_block_header(¤t_hash)?.prev_hash(); // It's safe to call `clear_block_data` for prev data because it clears fork only here chain_store_update @@ -696,7 +696,7 @@ impl Chain { F2: Copy + FnMut(Vec) -> (), F3: Copy + FnMut(ChallengeBody) -> (), { - let block_hash = block.hash(); + let block_hash = *block.hash(); let timer = near_metrics::start_timer(&metrics::BLOCK_PROCESSING_TIME); let res = self.process_block_single( me, @@ -760,10 +760,10 @@ impl Chain { F: Copy + FnMut(ChallengeBody) -> (), { // Sort headers by heights if they are out of order. - headers.sort_by(|left, right| left.inner_lite.height.cmp(&right.inner_lite.height)); + headers.sort_by(|left, right| left.height().cmp(&right.height())); if let Some(header) = headers.first() { - debug!(target: "chain", "Sync block headers: {} headers from {} at {}", headers.len(), header.hash(), header.inner_lite.height); + debug!(target: "chain", "Sync block headers: {} headers from {} at {}", headers.len(), header.hash(), header.height()); } else { return Ok(()); }; @@ -847,18 +847,18 @@ impl Chain { let mut oldest_height = header_head.height; let mut current = self.get_block_header(&header_head.last_block_hash).map(|h| h.clone()); while let Ok(header) = current { - if header.inner_lite.height <= block_head.height { + if header.height() <= block_head.height { if self.is_on_current_chain(&header).is_ok() { break; } } - oldest_height = header.inner_lite.height; - hashes.push(header.hash()); + oldest_height = header.height(); + hashes.push(*header.hash()); current = self.get_previous_header(&header).map(|h| h.clone()); } let next_epoch_id = - self.get_block_header(&block_head.last_block_hash)?.inner_lite.next_epoch_id.clone(); + self.get_block_header(&block_head.last_block_hash)?.next_epoch_id().clone(); // Don't run State Sync if header head is not more than one epoch ahead. if block_head.epoch_id != header_head.epoch_id && next_epoch_id != header_head.epoch_id { @@ -877,7 +877,7 @@ impl Chain { /// Returns if given block header is on the current chain. fn is_on_current_chain(&mut self, header: &BlockHeader) -> Result<(), Error> { - let chain_header = self.get_header_by_height(header.inner_lite.height)?; + let chain_header = self.get_header_by_height(header.height())?; if chain_header.hash() == header.hash() { Ok(()) } else { @@ -889,7 +889,7 @@ impl Chain { pub fn find_common_header(&mut self, hashes: &[CryptoHash]) -> Option { for hash in hashes { if let Ok(header) = self.get_block_header(&hash).map(|h| h.clone()) { - if let Ok(header_at_height) = self.get_header_by_height(header.inner_lite.height) { + if let Ok(header_at_height) = self.get_header_by_height(header.height()) { if header.hash() == header_at_height.hash() { return Some(header); } @@ -924,7 +924,7 @@ impl Chain { pub fn reset_data_pre_state_sync(&mut self, sync_hash: CryptoHash) -> Result<(), Error> { // Get header we were syncing into. let header = self.get_block_header(&sync_hash)?; - let hash = header.prev_hash; + let hash = *header.prev_hash(); let prev_header = self.get_block_header(&hash)?; let tip = Tip::from_header(prev_header); @@ -969,7 +969,7 @@ impl Chain { { // Get header we were syncing into. let header = self.get_block_header(&sync_hash)?; - let hash = header.prev_hash; + let hash = *header.prev_hash(); let prev_header = self.get_block_header(&hash)?; let tip = Tip::from_header(prev_header); // Update related heads now. @@ -989,14 +989,14 @@ impl Chain { me: &Option, block: &Block, ) -> Result<(), Error> { - let prev_hash = block.header.prev_hash; + let prev_hash = *block.header.prev_hash(); let shards_to_dl = self.get_shards_to_dl_state(me, &prev_hash); let prev_block = self.get_block(&prev_hash)?; debug!(target: "chain", "Downloading state for {:?}, I'm {:?}", shards_to_dl, me); let state_dl_info = StateSyncInfo { - epoch_tail_hash: block.header.hash(), + epoch_tail_hash: *block.header.hash(), shards: shards_to_dl .iter() .map(|shard_id| { @@ -1077,8 +1077,7 @@ impl Chain { // Sum validator balances in full NEARs (divided by 10**24) let sum = block .header - .inner_rest - .validator_proposals + .validator_proposals() .iter() .map(|validator_stake| (validator_stake.stake / NEAR_BASE) as i64) .sum::(); @@ -1087,7 +1086,7 @@ impl Chain { let status = self.determine_status(head.clone(), prev_head); // Notify other parts of the system of the update. - block_accepted(AcceptedBlock { hash: block.hash(), status, provenance }); + block_accepted(AcceptedBlock { hash: *block.hash(), status, provenance }); Ok(head) } @@ -1095,8 +1094,8 @@ impl Chain { ErrorKind::Orphan => { let tail_height = self.store.tail()?; // we only add blocks that couldn't have been gc'ed to the orphan pool. - if block.header.inner_lite.height >= tail_height { - let block_hash = block.hash(); + if block.header.height() >= tail_height { + let block_hash = *block.hash(); let orphan = Orphan { block, provenance, added: Instant::now() }; self.orphans.add(orphan); @@ -1116,7 +1115,7 @@ impl Chain { Err(e) } ErrorKind::ChunksMissing(missing_chunks) => { - let block_hash = block.hash(); + let block_hash = *block.hash(); block_misses_chunks(missing_chunks.clone()); let orphan = Orphan { block, provenance, added: Instant::now() }; @@ -1132,7 +1131,7 @@ impl Chain { ErrorKind::EpochOutOfBounds => { // Possibly block arrived before we finished processing all of the blocks for epoch before last. // Or someone is attacking with invalid chain. - debug!(target: "chain", "Received block {}/{} ignored, as epoch is unknown", block.header.inner_lite.height, block.hash()); + debug!(target: "chain", "Received block {}/{} ignored, as epoch is unknown", block.header.height(), block.hash()); Err(e) } ErrorKind::Unfit(ref msg) => { @@ -1140,7 +1139,7 @@ impl Chain { target: "chain", "Block {} at {} is unfit at this time: {}", block.hash(), - block.header.inner_lite.height, + block.header.height(), msg ); Err(ErrorKind::Unfit(msg.clone()).into()) @@ -1198,7 +1197,7 @@ impl Chain { let mut new_blocks_accepted = vec![]; if let Some(orphans) = self.blocks_with_missing_chunks.remove_by_prev_hash(prev_hash) { for orphan in orphans.into_iter() { - let block_hash = orphan.block.header.hash(); + let block_hash = *orphan.block.header.hash(); let res = self.process_block_single( me, orphan.block, @@ -1255,7 +1254,7 @@ impl Chain { if let Some(orphans) = self.orphans.remove_by_prev_hash(queue[queue_idx]) { debug!(target: "chain", "Check orphans: found {} orphans", orphans.len()); for orphan in orphans.into_iter() { - let block_hash = orphan.block.hash(); + let block_hash = *orphan.block.hash(); let timer = near_metrics::start_timer(&metrics::BLOCK_PROCESSING_TIME); let res = self.process_block_single( me, @@ -1317,15 +1316,15 @@ impl Chain { let sync_block = self.get_block(&sync_hash).expect("block has already been checked for existence"); let sync_block_header = sync_block.header.clone(); - let sync_block_epoch_id = sync_block.header.inner_lite.epoch_id.clone(); + let sync_block_epoch_id = sync_block.header.epoch_id().clone(); if shard_id as usize >= sync_block.chunks.len() { return Err(ErrorKind::InvalidStateRequest("ShardId out of bounds".into()).into()); } // The chunk was applied at height `chunk_header.height_included`. // Getting the `current` state. - let sync_prev_block = self.get_block(&sync_block_header.prev_hash)?; - if sync_block_epoch_id == sync_prev_block.header.inner_lite.epoch_id { + let sync_prev_block = self.get_block(sync_block_header.prev_hash())?; + if &sync_block_epoch_id == sync_prev_block.header.epoch_id() { return Err(ErrorKind::InvalidStateRequest( "sync_hash is not the first hash of the epoch".into(), ) @@ -1345,7 +1344,7 @@ impl Chain { }) .collect::>(), ); - assert_eq!(chunk_headers_root, sync_prev_block.header.inner_rest.chunk_headers_root); + assert_eq!(&chunk_headers_root, sync_prev_block.header.chunk_headers_root()); let chunk = self.get_chunk_clone_from_header(&chunk_header)?; let chunk_proof = chunk_proofs[shard_id as usize].clone(); @@ -1354,7 +1353,7 @@ impl Chain { // Collecting the `prev` state. let (prev_chunk_header, prev_chunk_proof, prev_chunk_height_included) = match self - .get_block(&block_header.prev_hash) + .get_block(block_header.prev_hash()) { Ok(prev_block) => { if shard_id as usize >= prev_block.chunks.len() { @@ -1372,10 +1371,7 @@ impl Chain { }) .collect::>(), ); - assert_eq!( - prev_chunk_headers_root, - prev_block.header.inner_rest.chunk_headers_root - ); + assert_eq!(&prev_chunk_headers_root, prev_block.header.chunk_headers_root()); let prev_chunk_proof = prev_chunk_proofs[shard_id as usize].clone(); let prev_chunk_height_included = prev_chunk_header.height_included; @@ -1384,7 +1380,7 @@ impl Chain { } Err(e) => match e.kind() { ErrorKind::DBNotFoundErr(_) => { - if block_header.prev_hash == CryptoHash::default() { + if block_header.prev_hash() == &CryptoHash::default() { (None, None, 0) } else { return Err(e); @@ -1413,7 +1409,7 @@ impl Chain { ); let mut root_proofs_cur = vec![]; - assert_eq!(receipt_proofs.len(), block_header.inner_rest.chunks_included as usize); + assert_eq!(receipt_proofs.len(), block_header.chunks_included() as usize); for receipt_proof in receipt_proofs { let ReceiptProof(receipts, shard_proof) = receipt_proof; let ShardProof { from_shard_id, to_shard_id: _, proof } = shard_proof; @@ -1425,7 +1421,7 @@ impl Chain { .push(RootProof(root_proof, block_receipts_proofs[from_shard_id].clone())); // Make sure we send something reasonable. - assert_eq!(block_header.inner_rest.chunk_receipts_root, block_receipts_root); + assert_eq!(block_header.chunk_receipts_root(), &block_receipts_root); assert!(verify_path(root_proof, &proof, &receipts_hash)); assert!(verify_path( block_receipts_root, @@ -1467,12 +1463,12 @@ impl Chain { let sync_block = self.get_block(&sync_hash).expect("block has already been checked for existence"); let sync_block_header = sync_block.header.clone(); - let sync_block_epoch_id = sync_block.header.inner_lite.epoch_id.clone(); + let sync_block_epoch_id = sync_block.header.epoch_id().clone(); if shard_id as usize >= sync_block.chunks.len() { return Err(ErrorKind::InvalidStateRequest("shard_id out of bounds".into()).into()); } - let sync_prev_block = self.get_block(&sync_block_header.prev_hash)?; - if sync_block_epoch_id == sync_prev_block.header.inner_lite.epoch_id { + let sync_prev_block = self.get_block(sync_block_header.prev_hash())?; + if &sync_block_epoch_id == sync_prev_block.header.epoch_id() { return Err(ErrorKind::InvalidStateRequest( "sync_hash is not the first hash of the epoch".into(), ) @@ -1526,9 +1522,9 @@ impl Chain { // 3. Checking that chunks `chunk` and `prev_chunk` are included in appropriate blocks // 3a. Checking that chunk `chunk` is included into block at last height before sync_hash // 3aa. Also checking chunk.height_included - let sync_prev_block_header = self.get_block_header(&sync_block_header.prev_hash)?.clone(); + let sync_prev_block_header = self.get_block_header(sync_block_header.prev_hash())?.clone(); if !verify_path( - sync_prev_block_header.inner_rest.chunk_headers_root, + *sync_prev_block_header.chunk_headers_root(), &chunk_proof, &ChunkHashHeight(chunk.chunk_hash.clone(), chunk.header.height_included), ) { @@ -1550,9 +1546,9 @@ impl Chain { match (prev_chunk_header, prev_chunk_proof) { (Some(prev_chunk_header), Some(prev_chunk_proof)) => { let prev_block_header = - self.get_block_header(&block_header.prev_hash)?.clone(); + self.get_block_header(block_header.prev_hash())?.clone(); if !verify_path( - prev_block_header.inner_rest.chunk_headers_root, + *prev_block_header.chunk_headers_root(), &prev_chunk_proof, &ChunkHashHeight(prev_chunk_header.hash.clone(), prev_chunk_height_included), ) { @@ -1593,12 +1589,12 @@ impl Chain { .into()); } let header = self.get_block_header(&hash_to_compare)?; - hash_to_compare = header.prev_hash; + hash_to_compare = *header.prev_hash(); let block_header = self.get_block_header(&block_hash)?; // 4c. Checking len of receipt_proofs for current block if receipt_proofs.len() != root_proofs[i].len() - || receipt_proofs.len() != block_header.inner_rest.chunks_included as usize + || receipt_proofs.len() != block_header.chunks_included() as usize { byzantine_assert!(false); return Err( @@ -1635,7 +1631,7 @@ impl Chain { ); } // 4f. Proving the outgoing_receipts_root matches that in the block - if !verify_path(block_header.inner_rest.chunk_receipts_root, block_proof, root) { + if !verify_path(*block_header.chunk_receipts_root(), block_proof, root) { byzantine_assert!(false); return Err( ErrorKind::Other("set_shard_state failed: invalid proofs".into()).into() @@ -1645,7 +1641,7 @@ impl Chain { } // 4g. Checking that there are no more heights to get incoming_receipts let header = self.get_block_header(&hash_to_compare)?; - if header.inner_lite.height != prev_chunk_height_included { + if header.height() != prev_chunk_height_included { byzantine_assert!(false); return Err(ErrorKind::Other( "set_shard_state failed: invalid incoming receipts".into(), @@ -1805,7 +1801,7 @@ impl Chain { // Apply the epoch start block separately, since it doesn't follow the pattern let block = self.store.get_block(&epoch_first_block)?.clone(); - let prev_block = self.store.get_block(&block.header.prev_hash)?.clone(); + let prev_block = self.store.get_block(block.header.prev_hash())?.clone(); let mut chain_update = ChainUpdate::new( &mut self.store, @@ -1819,9 +1815,9 @@ impl Chain { chain_update.apply_chunks(me, &block, &prev_block, ApplyChunksMode::NextEpoch)?; chain_update.commit()?; - affected_blocks.insert(block.header.hash()); + affected_blocks.insert(*block.header.hash()); - let first_epoch = block.header.inner_lite.epoch_id.clone(); + let first_epoch = block.header.epoch_id().clone(); let mut queue = vec![*epoch_first_block]; let mut cur = 0; @@ -1852,7 +1848,7 @@ impl Chain { chain_update.commit()?; - affected_blocks.insert(block.header.hash()); + affected_blocks.insert(*block.header.hash()); queue.push(next_block_hash); } if saw_one { @@ -1871,7 +1867,7 @@ impl Chain { // `epoch_first_block` we should only remove the pair with hash = epoch_first_block, while // for all the blocks in the queue we can remove all the pairs that have them as `prev_hash` // since we processed all the blocks built on top of them above during the BFS - chain_store_update.remove_block_to_catchup(block.header.prev_hash, *epoch_first_block); + chain_store_update.remove_block_to_catchup(*block.header.prev_hash(), *epoch_first_block); for block_hash in queue { debug!(target: "chain", "Catching up: removing prev={:?} from the queue. I'm {:?}", block_hash, me); @@ -2222,9 +2218,9 @@ impl<'a> ChainUpdate<'a> { where F: FnMut(ChallengeBody) -> (), { - debug!(target: "chain", "Process block header: {} at {}", header.hash(), header.inner_lite.height); + debug!(target: "chain", "Process block header: {} at {}", header.hash(), header.height()); - self.check_known(&header.hash)?; + self.check_known(header.hash())?; self.validate_header(header, &Provenance::NONE, on_challenge)?; Ok(()) } @@ -2272,7 +2268,7 @@ impl<'a> ChainUpdate<'a> { return Ok(()); } let mut missing = vec![]; - let height = block.header.inner_lite.height; + let height = block.header.height(); for (shard_id, chunk_header) in block.chunks.iter().enumerate() { // Check if any chunks are invalid in this block. if let Some(encoded_chunk) = @@ -2322,10 +2318,10 @@ impl<'a> ChainUpdate<'a> { me: &Option, block: &Block, ) -> Result<(), Error> { - if !self.care_about_any_shard_or_part(me, block.header.prev_hash)? { + if !self.care_about_any_shard_or_part(me, *block.header.prev_hash())? { return Ok(()); } - let height = block.header.inner_lite.height; + let height = block.header.height(); let mut receipt_proofs_by_shard_id = HashMap::new(); for chunk_header in block.chunks.iter() { @@ -2371,15 +2367,15 @@ impl<'a> ChainUpdate<'a> { let receipt_proof_response: Vec = self.chain_store_update.get_incoming_receipts_for_shard( chunk_header.inner.shard_id, - prev_block.hash(), + *prev_block.hash(), prev_chunk_header.height_included, )?; let receipts = collect_receipts_from_response(&receipt_proof_response); let challenges_result = self.verify_challenges( &block.challenges, - &block.header.inner_lite.epoch_id, - &block.header.prev_hash, + &block.header.epoch_id(), + &block.header.prev_hash(), Some(&block.hash()), )?; let apply_result = self @@ -2388,13 +2384,13 @@ impl<'a> ChainUpdate<'a> { chunk_header.inner.shard_id, &prev_chunk.header.inner.prev_state_root, prev_chunk.header.height_included, - prev_block.header.inner_lite.timestamp, + prev_block.header.raw_timestamp(), &prev_chunk.header.inner.prev_block_hash, &prev_block.hash(), &receipts, &prev_chunk.transactions, &prev_chunk.header.inner.validator_proposals, - prev_block.header.inner_rest.gas_price, + prev_block.header.gas_price(), prev_chunk.header.inner.gas_limit, &challenges_result, true, @@ -2421,8 +2417,8 @@ impl<'a> ChainUpdate<'a> { ) -> Result<(), Error> { let challenges_result = self.verify_challenges( &block.challenges, - &block.header.inner_lite.epoch_id, - &block.header.prev_hash, + &block.header.epoch_id(), + &block.header.prev_hash(), Some(&block.hash()), )?; self.chain_store_update.save_block_extra(&block.hash(), BlockExtra { challenges_result }); @@ -2434,30 +2430,30 @@ impl<'a> ChainUpdate<'a> { let care_about_shard = match mode { ApplyChunksMode::ThisEpoch => self.runtime_adapter.cares_about_shard( me.as_ref(), - &block.header.prev_hash, + &block.header.prev_hash(), shard_id, true, ), ApplyChunksMode::NextEpoch => { self.runtime_adapter.will_care_about_shard( me.as_ref(), - &block.header.prev_hash, + &block.header.prev_hash(), shard_id, true, ) && !self.runtime_adapter.cares_about_shard( me.as_ref(), - &block.header.prev_hash, + &block.header.prev_hash(), shard_id, true, ) } }; if care_about_shard { - if chunk_header.height_included == block.header.inner_lite.height { + if chunk_header.height_included == block.header.height() { // Validate state root. let prev_chunk_extra = self .chain_store_update - .get_chunk_extra(&block.header.prev_hash, shard_id)? + .get_chunk_extra(&block.header.prev_hash(), shard_id)? .clone(); // Validate that all next chunk information matches previous chunk extra. @@ -2466,7 +2462,7 @@ impl<'a> ChainUpdate<'a> { // because we're asking prev_chunk_header for already committed block self.chain_store_update.get_chain_store(), &*self.runtime_adapter, - &block.header.prev_hash, + &block.header.prev_hash(), &prev_chunk_extra, prev_chunk_header, chunk_header, @@ -2485,7 +2481,7 @@ impl<'a> ChainUpdate<'a> { let receipt_proof_response: Vec = self.chain_store_update.get_incoming_receipts_for_shard( shard_id, - block.hash(), + *block.hash(), prev_chunk_header.height_included, )?; let receipts = collect_receipts_from_response(&receipt_proof_response); @@ -2514,15 +2510,15 @@ impl<'a> ChainUpdate<'a> { shard_id, &chunk.header.inner.prev_state_root, chunk_header.height_included, - block.header.inner_lite.timestamp, + block.header.raw_timestamp(), &chunk_header.inner.prev_block_hash, &block.hash(), &receipts, &chunk.transactions, &chunk.header.inner.validator_proposals, - prev_block.header.inner_rest.gas_price, + prev_block.header.gas_price(), chunk.header.inner.gas_limit, - &block.header.inner_rest.challenges_result, + &block.header.challenges_result(), ) .map_err(|e| ErrorKind::Other(e.to_string()))?; @@ -2578,16 +2574,16 @@ impl<'a> ChainUpdate<'a> { .apply_transactions( shard_id, &new_extra.state_root, - block.header.inner_lite.height, - block.header.inner_lite.timestamp, + block.header.height(), + block.header.raw_timestamp(), &prev_block.hash(), &block.hash(), &[], &[], &new_extra.validator_proposals, - block.header.inner_rest.gas_price, + block.header.gas_price(), new_extra.gas_limit, - &block.header.inner_rest.challenges_result, + &block.header.challenges_result(), ) .map_err(|e| ErrorKind::Other(e.to_string()))?; @@ -2615,28 +2611,28 @@ impl<'a> ChainUpdate<'a> { where F: FnMut(ChallengeBody) -> (), { - debug!(target: "chain", "Process block {} at {}, approvals: {}, me: {:?}", block.hash(), block.header.inner_lite.height, block.header.num_approvals(), me); + debug!(target: "chain", "Process block {} at {}, approvals: {}, me: {:?}", block.hash(), block.header.height(), block.header.num_approvals(), me); // Check if we have already processed this block previously. - self.check_known(&block.header.hash)?; + self.check_known(block.header.hash())?; // Delay hitting the db for current chain head until we know this block is not already known. let head = self.chain_store_update.head()?; - let is_next = block.header.prev_hash == head.last_block_hash; + let is_next = block.header.prev_hash() == &head.last_block_hash; // Check that we know the epoch of the block before we try to get the header // (so that a block from unknown epoch doesn't get marked as an orphan) - if !self.runtime_adapter.epoch_exists(&block.header.inner_lite.epoch_id) { + if !self.runtime_adapter.epoch_exists(&block.header.epoch_id()) { return Err(ErrorKind::EpochOutOfBounds.into()); } // First real I/O expense. let prev = self.get_previous_header(&block.header)?; - let prev_hash = prev.hash(); - let prev_prev_hash = prev.prev_hash; - let prev_gas_price = prev.inner_rest.gas_price; - let prev_epoch_id = prev.inner_lite.epoch_id.clone(); - let prev_random_value = prev.inner_rest.random_value; + let prev_hash = *prev.hash(); + let prev_prev_hash = *prev.prev_hash(); + let prev_gas_price = prev.gas_price(); + let prev_epoch_id = prev.epoch_id().clone(); + let prev_random_value = *prev.random_value(); // Block is an orphan if we do not know about the previous full block. if !is_next && !self.chain_store_update.block_exists(&prev_hash)? { @@ -2645,7 +2641,7 @@ impl<'a> ChainUpdate<'a> { // A heuristic to prevent block height to jump too fast towards BlockHeight::max and cause // overflow-related problems - if block.header.inner_lite.height > head.height + self.epoch_length * 20 { + if block.header.height() > head.height + self.epoch_length * 20 { return Err(ErrorKind::InvalidBlockHeight.into()); } @@ -2671,14 +2667,14 @@ impl<'a> ChainUpdate<'a> { self.process_header_for_block(&block.header, provenance, on_challenge)?; self.runtime_adapter.verify_block_vrf( - &block.header.inner_lite.epoch_id, - block.header.inner_lite.height, + &block.header.epoch_id(), + block.header.height(), &prev_random_value, block.vrf_value, block.vrf_proof, )?; - if block.header.inner_rest.random_value != hash(block.vrf_value.0.as_ref()) { + if block.header.random_value() != &hash(block.vrf_value.0.as_ref()) { return Err(ErrorKind::InvalidRandomnessBeaconOutput.into()); } @@ -2703,8 +2699,8 @@ impl<'a> ChainUpdate<'a> { // Do basic validation of chunks before applying the transactions for (chunk_header, prev_chunk_header) in block.chunks.iter().zip(prev_block.chunks.iter()) { - if chunk_header.height_included == block.header.inner_lite.height { - if chunk_header.inner.prev_block_hash != block.header.prev_hash { + if chunk_header.height_included == block.header.height() { + if &chunk_header.inner.prev_block_hash != block.header.prev_hash() { return Err(ErrorKind::InvalidChunk.into()); } } else { @@ -2722,48 +2718,37 @@ impl<'a> ChainUpdate<'a> { if is_caught_up { self.apply_chunks(me, block, &prev_block, ApplyChunksMode::NextEpoch)?; } else { - self.chain_store_update.add_block_to_catchup(prev_hash, block.hash()); + self.chain_store_update.add_block_to_catchup(prev_hash, *block.hash()); } // Verify that proposals from chunks match block header proposals. let mut all_chunk_proposals = vec![]; for chunk in block.chunks.iter() { - if block.header.inner_lite.height == chunk.height_included { + if block.header.height() == chunk.height_included { all_chunk_proposals.extend(chunk.inner.validator_proposals.clone()); } } - if all_chunk_proposals != block.header.inner_rest.validator_proposals { + if all_chunk_proposals.as_slice() != block.header.validator_proposals() { return Err(ErrorKind::InvalidValidatorProposals.into()); } // If block checks out, record validator proposals for given block. - let last_final_block = &block.header.inner_rest.last_final_block; + let last_final_block = block.header.last_final_block(); let last_finalized_height = if last_final_block == &CryptoHash::default() { self.chain_store_update.get_genesis_height() } else { - self.chain_store_update.get_block_header(last_final_block)?.inner_lite.height + self.chain_store_update.get_block_header(last_final_block)?.height() }; - self.runtime_adapter.add_validator_proposals( - block.header.prev_hash, - block.hash(), - block.header.inner_rest.random_value, - block.header.inner_lite.height, - last_finalized_height, - block.header.inner_rest.validator_proposals.clone(), - block.header.inner_rest.challenges_result.clone(), - block.header.inner_rest.chunk_mask.clone(), - block.header.inner_rest.total_supply, - // TODO: !!! - PROTOCOL_VERSION, - )?; + self.runtime_adapter + .add_validator_proposals(BlockHeaderInfo::new(&block.header, last_finalized_height))?; // Add validated block to the db, even if it's not the canonical fork. self.chain_store_update.save_block(block.clone()); - self.chain_store_update.inc_block_refcount(&block.header.prev_hash)?; + self.chain_store_update.inc_block_refcount(block.header.prev_hash())?; for (shard_id, chunk_headers) in block.chunks.iter().enumerate() { - if chunk_headers.height_included == block.header.inner_lite.height { + if chunk_headers.height_included == block.header.height() { self.chain_store_update - .save_block_hash_with_new_chunk(block.hash(), shard_id as ShardId); + .save_block_hash_with_new_chunk(*block.hash(), shard_id as ShardId); } } @@ -2780,9 +2765,9 @@ impl<'a> ChainUpdate<'a> { // Presently the epoch boundary is defined by the height, and the fork choice rule // is also just height, so the very first block to cross the epoch end is guaranteed // to be the head of the chain, and result in the light client block produced. - if block.header.inner_lite.epoch_id != prev_epoch_id { + if block.header.epoch_id() != &prev_epoch_id { let prev = self.get_previous_header(&block.header)?.clone(); - if prev.inner_rest.last_final_block != CryptoHash::default() { + if prev.last_final_block() != &CryptoHash::default() { let light_client_block = self.create_light_client_block(&prev)?; self.chain_store_update .save_epoch_light_client_block(&prev_epoch_id.0, light_client_block); @@ -2798,7 +2783,7 @@ impl<'a> ChainUpdate<'a> { header: &BlockHeader, ) -> Result { // First update the last next_block, since it might not be set yet - self.chain_store_update.save_next_block_hash(&header.prev_hash, header.hash()); + self.chain_store_update.save_next_block_hash(header.prev_hash(), *header.hash()); Chain::create_light_client_block( header, @@ -2861,13 +2846,13 @@ impl<'a> ChainUpdate<'a> { // If we do - send out double sign challenge and keep going as double signed blocks are valid blocks. if let Ok(epoch_id_to_blocks) = self .chain_store_update - .get_all_block_hashes_by_height(header.inner_lite.height) + .get_all_block_hashes_by_height(header.height()) .map(Clone::clone) { // Check if there is already known block of the same height that has the same epoch id - if let Some(block_hashes) = epoch_id_to_blocks.get(&header.inner_lite.epoch_id) { + if let Some(block_hashes) = epoch_id_to_blocks.get(&header.epoch_id()) { // This should be guaranteed but it doesn't hurt to check again - if !block_hashes.contains(&header.hash) { + if !block_hashes.contains(header.hash()) { let other_header = self .chain_store_update .get_block_header(block_hashes.iter().next().unwrap())?; @@ -2883,42 +2868,42 @@ impl<'a> ChainUpdate<'a> { let prev_header = self.get_previous_header(header)?.clone(); // Check that epoch_id in the header does match epoch given previous header (only if previous header is present). - if self.runtime_adapter.get_epoch_id_from_prev_block(&header.prev_hash).unwrap() - != header.inner_lite.epoch_id + if &self.runtime_adapter.get_epoch_id_from_prev_block(header.prev_hash()).unwrap() + != header.epoch_id() { return Err(ErrorKind::InvalidEpochHash.into()); } // Check that epoch_id in the header does match epoch given previous header (only if previous header is present). - if self.runtime_adapter.get_next_epoch_id_from_prev_block(&header.prev_hash).unwrap() - != header.inner_lite.next_epoch_id + if &self.runtime_adapter.get_next_epoch_id_from_prev_block(header.prev_hash()).unwrap() + != header.next_epoch_id() { return Err(ErrorKind::InvalidEpochHash.into()); } - if header.inner_lite.epoch_id == prev_header.inner_lite.epoch_id { - if header.inner_lite.next_bp_hash != prev_header.inner_lite.next_bp_hash { + if header.epoch_id() == prev_header.epoch_id() { + if header.next_bp_hash() != prev_header.next_bp_hash() { return Err(ErrorKind::InvalidNextBPHash.into()); } } else { - if header.inner_lite.next_bp_hash - != Chain::compute_bp_hash( + if header.next_bp_hash() + != &Chain::compute_bp_hash( &*self.runtime_adapter, - header.inner_lite.next_epoch_id.clone(), - &header.prev_hash, + header.next_epoch_id().clone(), + &header.prev_hash(), )? { return Err(ErrorKind::InvalidNextBPHash.into()); } } - if header.inner_rest.chunk_mask.len() as u64 != self.runtime_adapter.num_shards() { + if header.chunk_mask().len() as u64 != self.runtime_adapter.num_shards() { return Err(ErrorKind::InvalidChunkMask.into()); } // Prevent time warp attacks and some timestamp manipulations by forcing strict // time progression. - if header.inner_lite.timestamp <= prev_header.inner_lite.timestamp { + if header.raw_timestamp() <= prev_header.raw_timestamp() { return Err(ErrorKind::InvalidBlockPastTime( prev_header.timestamp(), header.timestamp(), @@ -2930,10 +2915,10 @@ impl<'a> ChainUpdate<'a> { if *provenance != Provenance::PRODUCED { // first verify aggregated signature if !self.runtime_adapter.verify_approval( - &prev_header.hash, - prev_header.inner_lite.height, - header.inner_lite.height, - &header.inner_rest.approvals, + prev_header.hash(), + prev_header.height(), + header.height(), + &header.approvals(), )? { return Err(ErrorKind::InvalidApprovals.into()); }; @@ -2942,44 +2927,42 @@ impl<'a> ChainUpdate<'a> { let stakes = self .runtime_adapter - .get_epoch_block_approvers_ordered(&header.prev_hash)? + .get_epoch_block_approvers_ordered(header.prev_hash())? .iter() .map(|x| (x.stake_this_epoch, x.stake_next_epoch)) .collect(); if !Doomslug::can_approved_block_be_produced( self.doomslug_threshold_mode, - &header.inner_rest.approvals, + header.approvals(), &stakes, ) { return Err(ErrorKind::NotEnoughApprovals.into()); } - let expected_last_ds_final_block = - if prev_header.inner_lite.height + 1 == header.inner_lite.height { - prev_header.hash - } else { - prev_header.inner_rest.last_ds_final_block - }; + let expected_last_ds_final_block = if prev_header.height() + 1 == header.height() { + prev_header.hash() + } else { + prev_header.last_ds_final_block() + }; - let expected_last_final_block = if prev_header.inner_lite.height + 1 - == header.inner_lite.height - && prev_header.inner_rest.last_ds_final_block == prev_header.prev_hash + let expected_last_final_block = if prev_header.height() + 1 == header.height() + && prev_header.last_ds_final_block() == prev_header.prev_hash() { - prev_header.prev_hash + prev_header.prev_hash() } else { - prev_header.inner_rest.last_final_block + prev_header.last_final_block() }; - if header.inner_rest.last_ds_final_block != expected_last_ds_final_block - || header.inner_rest.last_final_block != expected_last_final_block + if header.last_ds_final_block() != expected_last_ds_final_block + || header.last_final_block() != expected_last_final_block { return Err(ErrorKind::InvalidFinalityInfo.into()); } let mut block_merkle_tree = - self.chain_store_update.get_block_merkle_tree(&header.prev_hash)?.clone(); - block_merkle_tree.insert(header.prev_hash); - if block_merkle_tree.root() != header.inner_lite.block_merkle_root { + self.chain_store_update.get_block_merkle_tree(header.prev_hash())?.clone(); + block_merkle_tree.insert(*header.prev_hash()); + if &block_merkle_tree.root() != header.block_merkle_root() { return Err(ErrorKind::InvalidBlockMerkleRoot.into()); } } @@ -2993,7 +2976,7 @@ impl<'a> ChainUpdate<'a> { header: &BlockHeader, ) -> Result, Error> { let header_head = self.chain_store_update.header_head()?; - if header.inner_lite.height > header_head.height { + if header.height() > header_head.height { let tip = Tip::from_header(header); self.chain_store_update.save_header_head_if_not_challenged(&tip)?; debug!(target: "chain", "Header head updated to {} at {}", tip.last_block_hash, tip.height); @@ -3010,7 +2993,7 @@ impl<'a> ChainUpdate<'a> { // if we made a fork with higher height than the head (which should also be true // when extending the head), update it let head = self.chain_store_update.head()?; - if block.header.inner_lite.height > head.height { + if block.header.height() > head.height { let tip = Tip::from_header(&block.header); self.chain_store_update.save_body_head(&tip)?; @@ -3049,16 +3032,14 @@ impl<'a> ChainUpdate<'a> { }, }; - let cur_block_at_same_height = match self - .chain_store_update - .get_block_hash_by_height(block_header.inner_lite.height) - { - Ok(bh) => Some(bh), - Err(e) => match e.kind() { - ErrorKind::DBNotFoundErr(_) => None, - _ => return Err(e), - }, - }; + let cur_block_at_same_height = + match self.chain_store_update.get_block_hash_by_height(block_header.height()) { + Ok(bh) => Some(bh), + Err(e) => match e.kind() { + ErrorKind::DBNotFoundErr(_) => None, + _ => return Err(e), + }, + }; self.chain_store_update.save_challenged_block(*block_hash); @@ -3070,11 +3051,11 @@ impl<'a> ChainUpdate<'a> { // and even if there's such chain available, the very next block built on it will // bring this node's head to that chain. let prev_header = - self.chain_store_update.get_block_header(&block_header.prev_hash)?.clone(); - let prev_height = prev_header.inner_lite.height; + self.chain_store_update.get_block_header(block_header.prev_hash())?.clone(); + let prev_height = prev_header.height(); let new_head_header = if let Some(hash) = challenger_hash { let challenger_header = self.chain_store_update.get_block_header(hash)?; - if challenger_header.inner_lite.height > prev_height { + if challenger_header.height() > prev_height { challenger_header } else { &prev_header @@ -3093,12 +3074,12 @@ impl<'a> ChainUpdate<'a> { /// Check if header is recent or in the store fn check_header_known(&mut self, header: &BlockHeader) -> Result<(), Error> { let header_head = self.chain_store_update.header_head()?; - if header.hash() == header_head.last_block_hash - || header.hash() == header_head.prev_block_hash + if header.hash() == &header_head.last_block_hash + || header.hash() == &header_head.prev_block_hash { return Err(ErrorKind::Unfit("header already known".to_string()).into()); } - self.check_known_store(&header.hash) + self.check_known_store(header.hash()) } /// Quick in-memory check for fast-reject any block handled recently. @@ -3170,7 +3151,7 @@ impl<'a> ChainUpdate<'a> { for incoming_receipt_proof in incoming_receipts_proofs.iter() { let ReceiptProofResponse(hash, _) = incoming_receipt_proof; let block_header = self.chain_store_update.get_block_header(&hash)?; - if block_header.inner_lite.height <= chunk.header.height_included { + if block_header.height() <= chunk.header.height_included { receipt_proof_response.push(incoming_receipt_proof.clone()); } } @@ -3181,15 +3162,15 @@ impl<'a> ChainUpdate<'a> { shard_id, &chunk.header.inner.prev_state_root, chunk.header.height_included, - block_header.inner_lite.timestamp, + block_header.raw_timestamp(), &chunk.header.inner.prev_block_hash, - &block_header.hash, + block_header.hash(), &receipts, &chunk.transactions, &chunk.header.inner.validator_proposals, - block_header.inner_rest.gas_price, + block_header.gas_price(), chunk.header.inner.gas_limit, - &block_header.inner_rest.challenges_result, + &block_header.challenges_result(), )?; let (outcome_root, outcome_proofs) = @@ -3206,7 +3187,7 @@ impl<'a> ChainUpdate<'a> { gas_limit, apply_result.total_balance_burnt, ); - self.chain_store_update.save_chunk_extra(&block_header.hash, shard_id, chunk_extra); + self.chain_store_update.save_chunk_extra(block_header.hash(), shard_id, chunk_extra); // Saving outgoing receipts. let mut outgoing_receipts = vec![]; @@ -3220,7 +3201,7 @@ impl<'a> ChainUpdate<'a> { ); // Saving transaction results. self.chain_store_update.save_outcomes_with_proofs( - &block_header.hash, + block_header.hash(), apply_result.outcomes, outcome_proofs, ); @@ -3248,12 +3229,12 @@ impl<'a> ChainUpdate<'a> { return Ok(true); } let block_header = block_header_result?.clone(); - if block_header.hash == sync_hash { + if block_header.hash() == &sync_hash { // Don't continue return Ok(false); } let prev_block_header = - self.chain_store_update.get_block_header(&block_header.prev_hash)?.clone(); + self.chain_store_update.get_block_header(&block_header.prev_hash())?.clone(); let mut chunk_extra = self.chain_store_update.get_chunk_extra(&prev_block_header.hash(), shard_id)?.clone(); @@ -3261,16 +3242,16 @@ impl<'a> ChainUpdate<'a> { let apply_result = self.runtime_adapter.apply_transactions( shard_id, &chunk_extra.state_root, - block_header.inner_lite.height, - block_header.inner_lite.timestamp, + block_header.height(), + block_header.raw_timestamp(), &prev_block_header.hash(), &block_header.hash(), &[], &[], &chunk_extra.validator_proposals, - block_header.inner_rest.gas_price, + block_header.gas_price(), chunk_extra.gas_limit, - &block_header.inner_rest.challenges_result, + &block_header.challenges_result(), )?; self.chain_store_update.save_trie_changes(apply_result.trie_changes); @@ -3347,7 +3328,8 @@ pub fn check_refcount_map(chain: &mut Chain) -> Result<(), Error> { _ => vec![], }; for block_hash in blocks_current_height.iter() { - if let Ok(prev_hash) = chain.get_block(&block_hash).map(|block| block.header.prev_hash) + if let Ok(prev_hash) = + chain.get_block(&block_hash).map(|block| *block.header.prev_hash()) { *block_refcounts.entry(prev_hash).or_insert(0) += 1; } diff --git a/chain/chain/src/doomslug.rs b/chain/chain/src/doomslug.rs index 78f4749399d..139bd0fb412 100644 --- a/chain/chain/src/doomslug.rs +++ b/chain/chain/src/doomslug.rs @@ -416,7 +416,7 @@ impl Doomslug { /// * `stakes` - the vector of validator stakes in the current epoch pub fn can_approved_block_be_produced( mode: DoomslugThresholdMode, - approvals: &Vec>, + approvals: &[Option], stakes: &Vec<(Balance, Balance)>, ) -> bool { if mode == DoomslugThresholdMode::NoApprovals { diff --git a/chain/chain/src/lightclient.rs b/chain/chain/src/lightclient.rs index 1493858eb42..12a52dc933c 100644 --- a/chain/chain/src/lightclient.rs +++ b/chain/chain/src/lightclient.rs @@ -1,5 +1,5 @@ use near_primitives::block::BlockHeader; -use near_primitives::hash::CryptoHash; +use near_primitives::hash::{hash, CryptoHash}; use near_primitives::types::EpochId; use near_primitives::views::{BlockHeaderInnerLiteView, LightClientBlockView, ValidatorStakeView}; @@ -36,32 +36,31 @@ pub fn create_light_client_block_view( chain_store: &mut dyn ChainStoreAccess, next_block_producers: Option>, ) -> Result { - let inner_lite = block_header.inner_lite.clone(); let inner_lite_view = BlockHeaderInnerLiteView { - height: inner_lite.height, - epoch_id: inner_lite.epoch_id.0, - next_epoch_id: inner_lite.next_epoch_id.0, - prev_state_root: inner_lite.prev_state_root, - outcome_root: inner_lite.outcome_root, - timestamp: inner_lite.timestamp, - next_bp_hash: inner_lite.next_bp_hash, - block_merkle_root: inner_lite.block_merkle_root, + height: block_header.height(), + epoch_id: block_header.epoch_id().0, + next_epoch_id: block_header.next_epoch_id().0, + prev_state_root: *block_header.prev_state_root(), + outcome_root: *block_header.outcome_root(), + timestamp: block_header.raw_timestamp(), + next_bp_hash: *block_header.next_bp_hash(), + block_merkle_root: *block_header.block_merkle_root(), }; - let inner_rest_hash = block_header.inner_rest.hash(); + let inner_rest_hash = hash(&block_header.inner_rest_bytes()); let next_block_hash = chain_store.get_next_block_hash(&block_header.hash())?.clone(); let next_block_header = chain_store.get_block_header(&next_block_hash)?; let next_block_inner_hash = BlockHeader::compute_inner_hash( - &next_block_header.inner_lite, - &next_block_header.inner_rest, + &next_block_header.inner_lite_bytes(), + &next_block_header.inner_rest_bytes(), ); let after_next_block_hash = chain_store.get_next_block_hash(&next_block_hash)?.clone(); let after_next_block_header = chain_store.get_block_header(&after_next_block_hash)?; - let approvals_after_next = after_next_block_header.inner_rest.approvals.clone(); + let approvals_after_next = after_next_block_header.approvals().to_vec(); Ok(LightClientBlockView { - prev_block_hash: block_header.prev_hash, + prev_block_hash: *block_header.prev_hash(), next_block_inner_hash, inner_lite: inner_lite_view, inner_rest_hash, diff --git a/chain/chain/src/store.rs b/chain/chain/src/store.rs index 2980c02cac0..aa49ed2578e 100644 --- a/chain/chain/src/store.rs +++ b/chain/chain/src/store.rs @@ -174,11 +174,11 @@ pub trait ChainStoreAccess { ) -> Result<&BlockHeader, Error> { let mut header = self.get_block_header(sync_hash)?; let mut hash = sync_hash.clone(); - while header.inner_lite.height > height { - hash = header.prev_hash; + while header.height() > height { + hash = *header.prev_hash(); header = self.get_block_header(&hash)?; } - if header.inner_lite.height < height { + if header.height() < height { return Err(ErrorKind::InvalidBlockHeight.into()); } self.get_block_header(&hash) @@ -381,7 +381,7 @@ impl ChainStore { loop { let block_header = self.get_block_header(&receipts_block_hash)?; - if block_header.inner_lite.height == last_included_height { + if block_header.height() == last_included_height { let receipts = if let Ok(cur_receipts) = self.get_outgoing_receipts(&receipts_block_hash, shard_id) { @@ -391,7 +391,7 @@ impl ChainStore { }; return Ok(ReceiptResponse(receipts_block_hash, receipts)); } else { - receipts_block_hash = block_header.prev_hash; + receipts_block_hash = *block_header.prev_hash(); } } } @@ -406,16 +406,13 @@ impl ChainStore { ) -> Result<(), InvalidTxError> { // if both are on the canonical chain, comparing height is sufficient // we special case this because it is expected that this scenario will happen in most cases. - let base_height = self - .get_block_header(base_block_hash) - .map_err(|_| InvalidTxError::Expired)? - .inner_lite - .height; - let prev_height = prev_block_header.inner_lite.height; + let base_height = + self.get_block_header(base_block_hash).map_err(|_| InvalidTxError::Expired)?.height(); + let prev_height = prev_block_header.height(); if let Ok(base_block_hash_by_height) = self.get_block_hash_by_height(base_height) { if &base_block_hash_by_height == base_block_hash { if let Ok(prev_hash) = self.get_block_hash_by_height(prev_height) { - if prev_hash == prev_block_header.hash { + if &prev_hash == prev_block_header.hash() { if prev_height <= base_height + validity_period { return Ok(()); } else { @@ -430,7 +427,7 @@ impl ChainStore { // whether the base block is the same as the one with that height on the canonical fork. // Otherwise we walk back the chain to check whether base block is on the same chain. let last_final_height = self - .get_block_height(&prev_block_header.inner_rest.last_final_block) + .get_block_height(&prev_block_header.last_final_block()) .map_err(|_| InvalidTxError::InvalidChain)?; if prev_height > base_height + validity_period { @@ -450,9 +447,9 @@ impl ChainStore { } } else { let header = self - .get_header_on_chain_by_height(&prev_block_header.hash, base_height) + .get_header_on_chain_by_height(prev_block_header.hash(), base_height) .map_err(|_| InvalidTxError::InvalidChain)?; - if &header.hash == base_block_hash { + if header.hash() == base_block_hash { Ok(()) } else { Err(InvalidTxError::InvalidChain) @@ -464,7 +461,7 @@ impl ChainStore { if hash == &CryptoHash::default() { Ok(self.genesis_height) } else { - Ok(self.get_block_header(hash)?.inner_lite.height) + Ok(self.get_block_header(hash)?.height()) } } } @@ -533,7 +530,7 @@ impl ChainStoreAccess for ChainStore { debug_assert!( false, "If the block was not found, the block header may either \ - exist or not found as well, instead the error was returned {:?}", + exist or not found as well, instead the error was returned {:?}", header_error ); debug!( @@ -580,7 +577,7 @@ impl ChainStoreAccess for ChainStore { /// Get previous header. fn get_previous_header(&mut self, header: &BlockHeader) -> Result<&BlockHeader, Error> { - self.get_block_header(&header.prev_hash) + self.get_block_header(header.prev_hash()) } /// Information from applying block. @@ -1093,15 +1090,15 @@ impl<'a> ChainStoreUpdate<'a> { loop { let header = self.get_block_header(&block_hash)?; - if header.inner_lite.height < last_chunk_height_included { + if header.height() < last_chunk_height_included { panic!("get_incoming_receipts_for_shard failed"); } - if header.inner_lite.height == last_chunk_height_included { + if header.height() == last_chunk_height_included { break; } - let prev_hash = header.prev_hash; + let prev_hash = *header.prev_hash(); if let Ok(receipt_proofs) = self.get_incoming_receipts(&block_hash, shard_id) { ret.push(ReceiptProofResponse(block_hash, receipt_proofs.clone())); @@ -1196,7 +1193,7 @@ impl<'a> ChainStoreAccess for ChainStoreUpdate<'a> { /// Get previous header. fn get_previous_header(&mut self, header: &BlockHeader) -> Result<&BlockHeader, Error> { - self.get_block_header(&header.prev_hash) + self.get_block_header(header.prev_hash()) } fn get_block_extra(&mut self, block_hash: &CryptoHash) -> Result<&BlockExtra, Error> { @@ -1492,7 +1489,7 @@ impl<'a> ChainStoreUpdate<'a> { loop { let header = self.get_block_header(&prev_hash)?; let (header_height, header_hash, header_prev_hash) = - (header.inner_lite.height, header.hash(), header.prev_hash); + (header.height(), *header.hash(), *header.prev_hash()); // Clean up block indices between blocks. for height in (header_height + 1)..prev_height { self.chain_store_cache_update.height_to_hashes.insert(height, None); @@ -1577,7 +1574,7 @@ impl<'a> ChainStoreUpdate<'a> { /// Save block. pub fn save_block(&mut self, block: Block) { - self.chain_store_cache_update.blocks.insert(block.hash(), block); + self.chain_store_cache_update.blocks.insert(*block.hash(), block); } /// Save post applying block extra info. @@ -1616,20 +1613,20 @@ impl<'a> ChainStoreUpdate<'a> { } fn update_and_save_block_merkle_tree(&mut self, header: &BlockHeader) -> Result<(), Error> { - let prev_hash = header.prev_hash; + let prev_hash = *header.prev_hash(); if prev_hash == CryptoHash::default() { - self.save_block_merkle_tree(header.hash(), PartialMerkleTree::default()); + self.save_block_merkle_tree(*header.hash(), PartialMerkleTree::default()); } else { let mut block_merkle_tree = self.get_block_merkle_tree(&prev_hash)?.clone(); block_merkle_tree.insert(prev_hash); - self.save_block_merkle_tree(header.hash(), block_merkle_tree); + self.save_block_merkle_tree(*header.hash(), block_merkle_tree); } Ok(()) } pub fn save_block_header(&mut self, header: BlockHeader) -> Result<(), Error> { self.update_and_save_block_merkle_tree(&header)?; - self.chain_store_cache_update.headers.insert(header.hash(), header); + self.chain_store_cache_update.headers.insert(*header.hash(), header); Ok(()) } @@ -1819,7 +1816,7 @@ impl<'a> ChainStoreUpdate<'a> { }) .unwrap_or(Ok(()))?; // Set `block_hash` on previous one - block_hash = self.get_block_header(&block_hash)?.prev_hash; + block_hash = *self.get_block_header(&block_hash)?.prev_hash(); } GCMode::StateSync => { // Do nothing here @@ -1830,7 +1827,7 @@ impl<'a> ChainStoreUpdate<'a> { .get_block(&block_hash) .expect("block data is not expected to be already cleaned") .clone(); - let height = block.header.inner_lite.height; + let height = block.header.height(); if height == self.get_genesis_height() { if let GCMode::Fork(_) = gc_mode { // Broken GC prerequisites found @@ -1842,7 +1839,7 @@ impl<'a> ChainStoreUpdate<'a> { } // 2. Delete shard_id-indexed data (shards, receipts, transactions) - for shard_id in 0..block.header.inner_rest.chunk_mask.len() as ShardId { + for shard_id in 0..block.header.chunk_mask().len() as ShardId { // 2a. Delete outgoing receipts (ColOutgoingReceipts) store_update.delete(ColOutgoingReceipts, &get_block_shard_id(&block_hash, shard_id)); self.chain_store @@ -1941,7 +1938,7 @@ impl<'a> ChainStoreUpdate<'a> { self.get_all_block_hashes_by_height(height).expect("current height exists"); let mut epoch_to_hashes = epoch_to_hashes_ref.clone(); let hashes = epoch_to_hashes - .get_mut(&block.header.inner_lite.epoch_id) + .get_mut(&block.header.epoch_id()) .expect("current epoch id should exist"); hashes.remove(&block_hash); store_update.set_ser( @@ -1953,7 +1950,7 @@ impl<'a> ChainStoreUpdate<'a> { .block_hash_per_height .cache_set(index_to_bytes(height), epoch_to_hashes); // 5b. Decreasing block refcount - self.dec_block_refcount(&block.header.prev_hash)?; + self.dec_block_refcount(block.header.prev_hash())?; } GCMode::Canonical(_) => { // 6. Canonical Chain only clearing @@ -2002,22 +1999,18 @@ impl<'a> ChainStoreUpdate<'a> { .map_err::(|e| e.into())?; } for (hash, block) in self.chain_store_cache_update.blocks.iter() { - let mut map = match self - .chain_store - .get_all_block_hashes_by_height(block.header.inner_lite.height) - { - Ok(m) => m.clone(), - Err(_) => HashMap::new(), - }; - map.entry(block.header.inner_lite.epoch_id.clone()) + let mut map = + match self.chain_store.get_all_block_hashes_by_height(block.header.height()) { + Ok(m) => m.clone(), + Err(_) => HashMap::new(), + }; + map.entry(block.header.epoch_id().clone()) .or_insert_with(|| HashSet::new()) .insert(*hash); store_update - .set_ser(ColBlockPerHeight, &index_to_bytes(block.header.inner_lite.height), &map) + .set_ser(ColBlockPerHeight, &index_to_bytes(block.header.height()), &map) .map_err::(|e| e.into())?; - self.chain_store_cache_update - .block_hash_per_height - .insert(block.header.inner_lite.height, map); + self.chain_store_cache_update.block_hash_per_height.insert(block.header.height(), map); store_update .set_ser(ColBlock, hash.as_ref(), block) .map_err::(|e| e.into())?; @@ -2347,7 +2340,7 @@ mod tests { use near_primitives::hash::hash; use near_primitives::types::{BlockHeight, EpochId, NumBlocks}; use near_primitives::utils::index_to_bytes; - use near_primitives::validator_signer::{InMemoryValidatorSigner, ValidatorSigner}; + use near_primitives::validator_signer::InMemoryValidatorSigner; use near_store::test_utils::create_test_store; use near_store::StoreValidator; @@ -2406,7 +2399,7 @@ mod tests { prev_block = block.clone(); store_update.save_block_header(block.header.clone()).unwrap(); store_update - .update_height_if_not_challenged(block.header.inner_lite.height, block.hash()) + .update_height_if_not_challenged(block.header.height(), *block.hash()) .unwrap(); long_fork.push(block); } @@ -2447,7 +2440,7 @@ mod tests { prev_block = block.clone(); store_update.save_block_header(block.header.clone()).unwrap(); store_update - .update_height_if_not_challenged(block.header.inner_lite.height, block.hash()) + .update_height_if_not_challenged(block.header.height(), *block.hash()) .unwrap(); blocks.push(block); } @@ -2470,7 +2463,7 @@ mod tests { let mut store_update = chain.mut_store().store_update(); store_update.save_block_header(new_block.header.clone()).unwrap(); store_update - .update_height_if_not_challenged(new_block.header.inner_lite.height, new_block.hash()) + .update_height_if_not_challenged(new_block.header.height(), *new_block.hash()) .unwrap(); store_update.commit().unwrap(); assert_eq!( @@ -2539,18 +2532,12 @@ mod tests { Arc::new(InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1")); let block1 = Block::empty_with_height(&genesis, 1, &*signer.clone()); let mut block2 = block1.clone(); - block2.header.inner_lite.epoch_id = EpochId(hash(&[1, 2, 3])); - let (block_hash, signature) = signer.sign_block_header_parts( - block2.header.prev_hash, - &block2.header.inner_lite, - &block2.header.inner_rest, - ); - block2.header.hash = block_hash; - block2.header.signature = signature; + block2.header.mut_header().inner_lite.epoch_id = EpochId(hash(&[1, 2, 3])); + block2.header.resign(&*signer); let mut store_update = chain.mut_store().store_update(); store_update.chain_store_cache_update.height_to_hashes.insert(1, Some(hash(&[1]))); - store_update.chain_store_cache_update.blocks.insert(block1.header.hash, block1.clone()); + store_update.chain_store_cache_update.blocks.insert(*block1.header.hash(), block1.clone()); store_update.commit().unwrap(); let block_hash = chain.mut_store().height.cache_get(&index_to_bytes(1)).cloned(); @@ -2559,7 +2546,7 @@ mod tests { let mut store_update = chain.mut_store().store_update(); store_update.chain_store_cache_update.height_to_hashes.insert(1, Some(hash(&[2]))); - store_update.chain_store_cache_update.blocks.insert(block2.header.hash, block2.clone()); + store_update.chain_store_cache_update.blocks.insert(*block2.header.hash(), block2.clone()); store_update.commit().unwrap(); let block_hash1 = chain.mut_store().height.cache_get(&index_to_bytes(1)).cloned(); @@ -2585,14 +2572,14 @@ mod tests { blocks.push(block.clone()); let mut store_update = chain.mut_store().store_update(); store_update.save_block(block.clone()); - store_update.inc_block_refcount(&block.header.prev_hash).unwrap(); + store_update.inc_block_refcount(block.header.prev_hash()).unwrap(); store_update.save_head(&Tip::from_header(&block.header)).unwrap(); store_update.save_block_header(block.header.clone()).unwrap(); store_update .chain_store_cache_update .height_to_hashes - .insert(i, Some(block.header.hash)); - store_update.save_next_block_hash(&prev_block.hash(), block.hash()); + .insert(i, Some(*block.header.hash())); + store_update.save_next_block_hash(&prev_block.hash(), *block.hash()); store_update.commit().unwrap(); prev_block = block.clone(); @@ -2636,14 +2623,14 @@ mod tests { let block = Block::empty_with_height(&prev_block, i, &*signer); blocks.push(block.clone()); store_update.save_block(block.clone()); - store_update.inc_block_refcount(&block.header.prev_hash).unwrap(); + store_update.inc_block_refcount(block.header.prev_hash()).unwrap(); store_update.save_head(&Tip::from_header(&block.header)).unwrap(); store_update.save_block_header(block.header.clone()).unwrap(); store_update .chain_store_cache_update .height_to_hashes - .insert(i, Some(block.header.hash)); - store_update.save_next_block_hash(&prev_block.hash(), block.hash()); + .insert(i, Some(*block.header.hash())); + store_update.save_next_block_hash(&prev_block.hash(), *block.hash()); store_update.commit().unwrap(); prev_block = block.clone(); @@ -2662,28 +2649,28 @@ mod tests { .values() .flatten() .collect::>(), - vec![&blocks[5].hash()] + vec![blocks[5].hash()] ); assert!(chain.mut_store().get_next_block_hash(&blocks[5].hash()).is_ok()); let trie = chain.runtime_adapter.get_tries(); let mut store_update = chain.mut_store().store_update(); - assert!(store_update.clear_block_data(blocks[5].hash(), GCMode::Canonical(trie)).is_ok()); + assert!(store_update.clear_block_data(*blocks[5].hash(), GCMode::Canonical(trie)).is_ok()); store_update.commit().unwrap(); - assert!(chain.get_block(&blocks[4].hash()).is_err()); - assert!(chain.get_block(&blocks[5].hash()).is_ok()); - assert!(chain.get_block(&blocks[6].hash()).is_ok()); + assert!(chain.get_block(blocks[4].hash()).is_err()); + assert!(chain.get_block(blocks[5].hash()).is_ok()); + assert!(chain.get_block(blocks[6].hash()).is_ok()); // block header should be available - assert!(chain.get_block_header(&blocks[4].hash()).is_ok()); - assert!(chain.get_block_header(&blocks[5].hash()).is_ok()); - assert!(chain.get_block_header(&blocks[6].hash()).is_ok()); + assert!(chain.get_block_header(blocks[4].hash()).is_ok()); + assert!(chain.get_block_header(blocks[5].hash()).is_ok()); + assert!(chain.get_block_header(blocks[6].hash()).is_ok()); assert!(chain.mut_store().get_all_block_hashes_by_height(4).is_err()); assert!(chain.mut_store().get_all_block_hashes_by_height(5).is_ok()); assert!(chain.mut_store().get_all_block_hashes_by_height(6).is_ok()); - assert!(chain.mut_store().get_next_block_hash(&blocks[4].hash()).is_err()); - assert!(chain.mut_store().get_next_block_hash(&blocks[5].hash()).is_ok()); - assert!(chain.mut_store().get_next_block_hash(&blocks[6].hash()).is_ok()); + assert!(chain.mut_store().get_next_block_hash(blocks[4].hash()).is_err()); + assert!(chain.mut_store().get_next_block_hash(blocks[5].hash()).is_ok()); + assert!(chain.mut_store().get_next_block_hash(blocks[6].hash()).is_ok()); } /// Test that MAX_HEIGHTS_TO_CLEAR works properly @@ -2701,14 +2688,14 @@ mod tests { let mut store_update = chain.mut_store().store_update(); store_update.save_block(block.clone()); - store_update.inc_block_refcount(&block.header.prev_hash).unwrap(); + store_update.inc_block_refcount(block.header.prev_hash()).unwrap(); store_update.save_head(&Tip::from_header(&block.header)).unwrap(); store_update.save_block_header(block.header.clone()).unwrap(); store_update .chain_store_cache_update .height_to_hashes - .insert(i, Some(block.header.hash)); - store_update.save_next_block_hash(&prev_block.hash(), block.hash()); + .insert(i, Some(*block.header.hash())); + store_update.save_next_block_hash(&prev_block.hash(), *block.hash()); store_update.commit().unwrap(); prev_block = block.clone(); diff --git a/chain/chain/src/test_utils.rs b/chain/chain/src/test_utils.rs index b9bc8d1103f..527f453e9d0 100644 --- a/chain/chain/src/test_utils.rs +++ b/chain/chain/src/test_utils.rs @@ -192,7 +192,7 @@ impl KeyValueRuntime { let mut hash_to_valset = self.hash_to_valset.write().unwrap(); let mut epoch_start_map = self.epoch_start.write().unwrap(); - let prev_prev_hash = prev_block_header.prev_hash; + let prev_prev_hash = *prev_block_header.prev_hash(); let prev_epoch = hash_to_epoch.get(&prev_prev_hash); let prev_next_epoch = hash_to_next_epoch.get(&prev_prev_hash).unwrap(); let prev_valset = match prev_epoch { @@ -202,23 +202,18 @@ impl KeyValueRuntime { let prev_epoch_start = *epoch_start_map.get(&prev_prev_hash).unwrap(); - let last_final_height = - if prev_block_header.inner_rest.last_final_block == CryptoHash::default() { - 0 - } else { - self.get_block_header(&prev_block_header.inner_rest.last_final_block) - .unwrap() - .unwrap() - .inner_lite - .height - }; + let last_final_height = if prev_block_header.last_final_block() == &CryptoHash::default() { + 0 + } else { + self.get_block_header(prev_block_header.last_final_block()).unwrap().unwrap().height() + }; let increment_epoch = prev_prev_hash == CryptoHash::default() // genesis is in its own epoch || last_final_height + 3 >= prev_epoch_start + self.epoch_length; let needs_next_epoch_approvals = !increment_epoch && last_final_height + 3 < prev_epoch_start + self.epoch_length - && prev_block_header.inner_lite.height + 3 >= prev_epoch_start + self.epoch_length; + && prev_block_header.height() + 3 >= prev_epoch_start + self.epoch_length; let (epoch, next_epoch, valset, epoch_start) = if increment_epoch { let new_valset = match prev_valset { @@ -229,7 +224,7 @@ impl KeyValueRuntime { prev_next_epoch.clone(), EpochId(prev_hash), new_valset, - prev_block_header.inner_lite.height + 1, + prev_block_header.height() + 1, ) } else { ( @@ -282,8 +277,8 @@ impl RuntimeAdapter for KeyValueRuntime { fn verify_block_signature(&self, header: &BlockHeader) -> Result<(), Error> { let validators = &self.validators - [self.get_epoch_and_valset(header.prev_hash).map_err(|err| err.to_string())?.1]; - let validator = &validators[(header.inner_lite.height as usize) % validators.len()]; + [self.get_epoch_and_valset(*header.prev_hash()).map_err(|err| err.to_string())?.1]; + let validator = &validators[(header.height() as usize) % validators.len()]; if !header.verify_block_producer(&validator.public_key) { return Err(ErrorKind::InvalidBlockProposer.into()); } @@ -851,7 +846,7 @@ impl RuntimeAdapter for KeyValueRuntime { parent_hash ))) })?; - let prev_prev_hash = prev_block_header.prev_hash; + let prev_prev_hash = *prev_block_header.prev_hash(); Ok(self.get_epoch_and_valset(*parent_hash)?.0 != self.get_epoch_and_valset(prev_prev_hash)?.0) } @@ -870,14 +865,14 @@ impl RuntimeAdapter for KeyValueRuntime { fn get_epoch_start_height(&self, block_hash: &CryptoHash) -> Result { let epoch_id = self.get_epoch_and_valset(*block_hash)?.0; match self.get_block_header(&epoch_id.0)? { - Some(block_header) => Ok(block_header.inner_lite.height), + Some(block_header) => Ok(block_header.height()), None => Ok(0), } } fn get_gc_stop_height(&self, block_hash: &CryptoHash) -> Result { let block_height = - self.get_block_header(block_hash)?.map(|h| h.inner_lite.height).unwrap_or_default(); + self.get_block_header(block_hash)?.map(|h| h.height()).unwrap_or_default(); Ok(block_height.saturating_sub(NUM_EPOCHS_TO_KEEP_STORE_DATA * self.epoch_length)) } @@ -1042,34 +1037,35 @@ pub fn display_chain(me: &Option, chain: &mut Chain, tail: bool) { .get_block_header(&CryptoHash::try_from(key.as_ref()).unwrap()) .unwrap() .clone(); - if !tail || header.inner_lite.height + 10 > head.height { + if !tail || header.height() + 10 > head.height { headers.push(header); } } headers.sort_by(|h_left, h_right| { - if h_left.inner_lite.height > h_right.inner_lite.height { + if h_left.height() > h_right.height() { Ordering::Greater } else { Ordering::Less } }); for header in headers { - if header.prev_hash == CryptoHash::default() { + if header.prev_hash() == &CryptoHash::default() { // Genesis block. - debug!("{: >3} {}", header.inner_lite.height, format_hash(header.hash())); + debug!("{: >3} {}", header.height(), format_hash(*header.hash())); } else { - let parent_header = chain_store.get_block_header(&header.prev_hash).unwrap().clone(); + let parent_header = chain_store.get_block_header(header.prev_hash()).unwrap().clone(); let maybe_block = chain_store.get_block(&header.hash()).ok().cloned(); - let epoch_id = runtime_adapter.get_epoch_id_from_prev_block(&header.prev_hash).unwrap(); + let epoch_id = + runtime_adapter.get_epoch_id_from_prev_block(header.prev_hash()).unwrap(); let block_producer = - runtime_adapter.get_block_producer(&epoch_id, header.inner_lite.height).unwrap(); + runtime_adapter.get_block_producer(&epoch_id, header.height()).unwrap(); debug!( "{: >3} {} | {: >10} | parent: {: >3} {} | {}", - header.inner_lite.height, - format_hash(header.hash()), + header.height(), + format_hash(*header.hash()), block_producer, - parent_header.inner_lite.height, - format_hash(parent_header.hash()), + parent_header.height(), + format_hash(*parent_header.hash()), if let Some(block) = &maybe_block { format!("chunks: {}", block.chunks.len()) } else { diff --git a/chain/chain/src/types.rs b/chain/chain/src/types.rs index c6638166e6e..770f4f3708f 100644 --- a/chain/chain/src/types.rs +++ b/chain/chain/src/types.rs @@ -519,11 +519,11 @@ impl Tip { /// Creates a new tip based on provided header. pub fn from_header(header: &BlockHeader) -> Tip { Tip { - height: header.inner_lite.height, - last_block_hash: header.hash(), - prev_block_hash: header.prev_hash, - epoch_id: header.inner_lite.epoch_id.clone(), - next_epoch_id: header.inner_lite.next_epoch_id.clone(), + height: header.height(), + last_block_hash: *header.hash(), + prev_block_hash: *header.prev_hash(), + epoch_id: header.epoch_id().clone(), + next_epoch_id: header.next_epoch_id().clone(), } } } @@ -586,15 +586,15 @@ mod tests { let b1 = Block::empty(&genesis, &signer); assert!(b1.header.verify_block_producer(&signer.public_key())); let other_signer = InMemoryValidatorSigner::from_seed("other2", KeyType::ED25519, "other2"); - let approvals = vec![Some(Approval::new(b1.hash(), 1, 2, &other_signer).signature)]; + let approvals = vec![Some(Approval::new(*b1.hash(), 1, 2, &other_signer).signature)]; let b2 = Block::empty_with_approvals( &b1, 2, - b1.header.inner_lite.epoch_id.clone(), - EpochId(genesis.hash()), + b1.header.epoch_id().clone(), + EpochId(*genesis.hash()), approvals, &signer, - genesis.header.inner_lite.next_bp_hash, + *genesis.header.next_bp_hash(), CryptoHash::default(), ); b2.header.verify_block_producer(&signer.public_key()); diff --git a/chain/chain/src/validate.rs b/chain/chain/src/validate.rs index 350aa958092..1b19f352afb 100644 --- a/chain/chain/src/validate.rs +++ b/chain/chain/src/validate.rs @@ -154,32 +154,30 @@ fn validate_double_sign( ) -> Result<(CryptoHash, Vec), Error> { let left_block_header = BlockHeader::try_from_slice(&block_double_sign.left_block_header)?; let right_block_header = BlockHeader::try_from_slice(&block_double_sign.right_block_header)?; - let block_producer = runtime_adapter.get_block_producer( - &left_block_header.inner_lite.epoch_id, - left_block_header.inner_lite.height, - )?; + let block_producer = runtime_adapter + .get_block_producer(&left_block_header.epoch_id(), left_block_header.height())?; if left_block_header.hash() != right_block_header.hash() - && left_block_header.inner_lite.height == right_block_header.inner_lite.height + && left_block_header.height() == right_block_header.height() && runtime_adapter.verify_validator_signature( - &left_block_header.inner_lite.epoch_id, - &left_block_header.prev_hash, + &left_block_header.epoch_id(), + &left_block_header.prev_hash(), &block_producer, left_block_header.hash().as_ref(), - &left_block_header.signature, + left_block_header.signature(), )? && runtime_adapter.verify_validator_signature( - &right_block_header.inner_lite.epoch_id, - &right_block_header.prev_hash, + &right_block_header.epoch_id(), + &right_block_header.prev_hash(), &block_producer, right_block_header.hash().as_ref(), - &right_block_header.signature, + right_block_header.signature(), )? { // Deterministically return header with higher hash. Ok(if left_block_header.hash() > right_block_header.hash() { - (left_block_header.hash(), vec![block_producer]) + (*left_block_header.hash(), vec![block_producer]) } else { - (right_block_header.hash(), vec![block_producer]) + (*right_block_header.hash(), vec![block_producer]) }) } else { Err(ErrorKind::MaliciousChallenge.into()) @@ -226,10 +224,10 @@ fn validate_chunk_proofs_challenge( MaybeEncodedShardChunk::Decoded(chunk) => &chunk.header, }; let chunk_producer = validate_chunk_authorship(runtime_adapter, &chunk_header)?; - let account_to_slash_for_valid_challenge = Ok((block_header.hash(), vec![chunk_producer])); + let account_to_slash_for_valid_challenge = Ok((*block_header.hash(), vec![chunk_producer])); if !Block::validate_chunk_header_proof( &chunk_header, - &block_header.inner_rest.chunk_headers_root, + &block_header.chunk_headers_root(), &chunk_proofs.merkle_proof, ) { // Merkle proof is invalid. It's a malicious challenge. @@ -279,7 +277,7 @@ fn validate_chunk_state_challenge( let _ = validate_chunk_authorship(runtime_adapter, &chunk_state.prev_chunk.header)?; if !Block::validate_chunk_header_proof( &chunk_state.prev_chunk.header, - &prev_block_header.inner_rest.chunk_headers_root, + &prev_block_header.chunk_headers_root(), &chunk_state.prev_merkle_proof, ) { return Err(ErrorKind::MaliciousChallenge.into()); @@ -290,7 +288,7 @@ fn validate_chunk_state_challenge( let chunk_producer = validate_chunk_authorship(runtime_adapter, &chunk_state.chunk_header)?; if !Block::validate_chunk_header_proof( &chunk_state.chunk_header, - &block_header.inner_rest.chunk_headers_root, + &block_header.chunk_headers_root(), &chunk_state.merkle_proof, ) { return Err(ErrorKind::MaliciousChallenge.into()); @@ -303,14 +301,14 @@ fn validate_chunk_state_challenge( partial_storage, chunk_state.prev_chunk.header.inner.shard_id, &chunk_state.prev_chunk.header.inner.prev_state_root, - block_header.inner_lite.height, - block_header.inner_lite.timestamp, - &block_header.prev_hash, + block_header.height(), + block_header.raw_timestamp(), + &block_header.prev_hash(), &block_header.hash(), &chunk_state.prev_chunk.receipts, &chunk_state.prev_chunk.transactions, &[], - prev_block_header.inner_rest.gas_price, + prev_block_header.gas_price(), chunk_state.prev_chunk.header.inner.gas_limit, &ChallengesResult::default(), ) @@ -321,7 +319,7 @@ fn validate_chunk_state_challenge( || result.validator_proposals != chunk_state.chunk_header.inner.validator_proposals || result.total_gas_burnt != chunk_state.chunk_header.inner.gas_used { - Ok((block_header.hash(), vec![chunk_producer])) + Ok((*block_header.hash(), vec![chunk_producer])) } else { // If all the data matches, this is actually valid chunk and challenge is malicious. Err(ErrorKind::MaliciousChallenge.into()) diff --git a/chain/chain/tests/challenges.rs b/chain/chain/tests/challenges.rs index 7cac85d0d62..a0b5e3b4e38 100644 --- a/chain/chain/tests/challenges.rs +++ b/chain/chain/tests/challenges.rs @@ -8,10 +8,10 @@ fn challenges_new_head_prev() { let (mut chain, _, signer) = setup(); let mut hashes = vec![]; for i in 0..5 { - let prev_hash = chain.head_header().unwrap().hash(); + let prev_hash = *chain.head_header().unwrap().hash(); let prev = chain.get_block(&prev_hash).unwrap(); let block = Block::empty(&prev, &*signer); - hashes.push(block.hash()); + hashes.push(*block.hash()); let tip = chain .process_block(&None, block, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}) .unwrap(); @@ -22,27 +22,27 @@ fn challenges_new_head_prev() { // The block to be added below after we invalidated fourth block. let last_block = Block::empty(&chain.get_block(&hashes[3]).unwrap(), &*signer); - assert_eq!(last_block.header.inner_lite.height, 5); + assert_eq!(last_block.header.height(), 5); let prev = chain.get_block(&hashes[1]).unwrap(); let challenger_block = Block::empty_with_height(&prev, 3, &*signer); - let challenger_hash = challenger_block.hash(); + let challenger_hash = *challenger_block.hash(); let _ = chain .process_block(&None, challenger_block, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}) .unwrap(); // At this point the challenger block is not on canonical chain - assert_eq!(chain.head_header().unwrap().inner_lite.height, 5); + assert_eq!(chain.head_header().unwrap().height(), 5); // Challenge fourth block. The third block and the challenger block have the same height, the // current logic will choose the third block. chain.mark_block_as_challenged(&hashes[3], &challenger_hash).unwrap(); - assert_eq!(chain.head_header().unwrap().hash(), hashes[2]); + assert_eq!(chain.head_header().unwrap().hash(), &hashes[2]); - assert_eq!(chain.get_header_by_height(2).unwrap().hash(), hashes[1]); - assert_eq!(chain.get_header_by_height(3).unwrap().hash(), hashes[2]); + assert_eq!(chain.get_header_by_height(2).unwrap().hash(), &hashes[1]); + assert_eq!(chain.get_header_by_height(3).unwrap().hash(), &hashes[2]); assert!(chain.get_header_by_height(4).is_err()); // Try to add a block on top of the fifth block. @@ -54,7 +54,7 @@ fn challenges_new_head_prev() { } else { assert!(false); } - assert_eq!(chain.head_header().unwrap().hash(), hashes[2]); + assert_eq!(chain.head_header().unwrap().hash(), &hashes[2]); // Add two more blocks let b3 = Block::empty(&chain.get_block(&hashes[2]).unwrap().clone(), &*signer); @@ -70,7 +70,7 @@ fn challenges_new_head_prev() { .unwrap() .last_block_hash; - assert_eq!(chain.head_header().unwrap().hash(), new_head); + assert_eq!(chain.head_header().unwrap().hash(), &new_head); // Add two more blocks on an alternative chain let b3 = Block::empty(&chain.get_block(&hashes[2]).unwrap().clone(), &*signer); @@ -84,7 +84,7 @@ fn challenges_new_head_prev() { .unwrap(); let challenger_hash = b4.hash(); - assert_eq!(chain.head_header().unwrap().hash(), new_head); + assert_eq!(chain.head_header().unwrap().hash(), &new_head); chain.mark_block_as_challenged(&new_head, &challenger_hash).unwrap(); @@ -95,7 +95,7 @@ fn challenges_new_head_prev() { fn test_no_challenge_on_same_header() { init_test_logger(); let (mut chain, _, signer) = setup(); - let prev_hash = chain.head_header().unwrap().hash(); + let prev_hash = *chain.head_header().unwrap().hash(); let prev = chain.get_block(&prev_hash).unwrap(); let block = Block::empty(&prev, &*signer); let tip = chain diff --git a/chain/chain/tests/gc.rs b/chain/chain/tests/gc.rs index 85d8bb6f31a..01f0e446ef9 100644 --- a/chain/chain/tests/gc.rs +++ b/chain/chain/tests/gc.rs @@ -62,10 +62,10 @@ mod tests { let mut store_update = chain.mut_store().store_update(); if i == 0 { store_update - .save_block_merkle_tree(prev_block.hash(), PartialMerkleTree::default()); + .save_block_merkle_tree(*prev_block.hash(), PartialMerkleTree::default()); } store_update.save_block(block.clone()); - store_update.inc_block_refcount(&block.header.prev_hash).unwrap(); + store_update.inc_block_refcount(block.header.prev_hash()).unwrap(); store_update.save_block_header(block.header.clone()).unwrap(); let tip = Tip::from_header(&block.header); if head.height < tip.height { @@ -80,10 +80,7 @@ mod tests { let trie_changes = trie.update(&state_root, trie_changes_data.iter().cloned()).unwrap(); if verbose { - println!( - "state new {:?} {:?}", - block.header.inner_lite.height, trie_changes_data - ); + println!("state new {:?} {:?}", block.header.height(), trie_changes_data); } let new_root = trie_changes.new_root; @@ -93,7 +90,7 @@ mod tests { shard_id, trie_changes, Default::default(), - block.hash(), + *block.hash(), ); store_update.save_trie_changes(wrapped_trie_changes); @@ -201,7 +198,7 @@ mod tests { .update(&state_root2, changes1[shard_to_check_trie as usize].iter().cloned()) .unwrap(); // i == gc_height is the only height should be processed here - if block1.header.inner_lite.height > gc_height || i == gc_height { + if block1.header.height() > gc_height || i == gc_height { let mut trie_store_update2 = StoreUpdate::new_with_tries(tries2.clone()); tries2 .apply_insertions( @@ -234,7 +231,7 @@ mod tests { for i in start_index..start_index + simple_chain.length { let (block1, state_root1, _) = states1[i as usize].clone(); let state_root1 = state_root1[shard_to_check_trie as usize]; - if block1.header.inner_lite.height > gc_height || i == gc_height { + if block1.header.height() > gc_height || i == gc_height { assert!(trie1.iter(&state_root1).is_ok()); assert!(trie2.iter(&state_root1).is_ok()); let a = trie1 diff --git a/chain/chain/tests/simple_chain.rs b/chain/chain/tests/simple_chain.rs index 2d2f07f04b7..89d2fbca3bf 100644 --- a/chain/chain/tests/simple_chain.rs +++ b/chain/chain/tests/simple_chain.rs @@ -2,6 +2,7 @@ use near_chain::test_utils::setup; use near_chain::{Block, ChainStoreAccess, ErrorKind, Provenance}; use near_logger_utils::init_test_logger; use near_primitives::hash::CryptoHash; +use near_primitives::protocol_version::PROTOCOL_VERSION; use num_rational::Rational; #[test] @@ -16,7 +17,7 @@ fn build_chain() { init_test_logger(); let (mut chain, _, signer) = setup(); for i in 0..4 { - let prev_hash = chain.head_header().unwrap().hash(); + let prev_hash = *chain.head_header().unwrap().hash(); let prev = chain.get_block(&prev_hash).unwrap(); let block = Block::empty(&prev, &*signer); let tip = chain @@ -31,18 +32,19 @@ fn build_chain() { fn build_chain_with_orhpans() { init_test_logger(); let (mut chain, _, signer) = setup(); - let mut blocks = vec![chain.get_block(&chain.genesis().hash()).unwrap().clone()]; + let mut blocks = vec![chain.get_block(&chain.genesis().hash().clone()).unwrap().clone()]; for i in 1..4 { let block = Block::empty(&blocks[i - 1], &*signer); blocks.push(block); } let last_block = &blocks[blocks.len() - 1]; let block = Block::produce( + PROTOCOL_VERSION, &last_block.header, 10, last_block.chunks.clone(), - last_block.header.inner_lite.epoch_id.clone(), - last_block.header.inner_lite.next_epoch_id.clone(), + last_block.header.epoch_id().clone(), + last_block.header.next_epoch_id().clone(), vec![], Rational::from_integer(0), 0, @@ -50,7 +52,7 @@ fn build_chain_with_orhpans() { vec![], vec![], &*signer, - last_block.header.inner_lite.next_bp_hash.clone(), + last_block.header.next_bp_hash().clone(), CryptoHash::default(), ); assert_eq!( @@ -117,7 +119,7 @@ fn build_chain_with_orhpans() { fn build_chain_with_skips_and_forks() { init_test_logger(); let (mut chain, _, signer) = setup(); - let genesis = chain.get_block(&chain.genesis().hash()).unwrap(); + let genesis = chain.get_block(&chain.genesis().hash().clone()).unwrap(); let b1 = Block::empty(&genesis, &*signer); let b2 = Block::empty_with_height(&genesis, 2, &*signer); let b3 = Block::empty_with_height(&b1, 3, &*signer); @@ -129,7 +131,7 @@ fn build_chain_with_skips_and_forks() { assert!(chain.process_block(&None, b4, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).is_ok()); assert!(chain.process_block(&None, b5, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).is_ok()); assert!(chain.get_header_by_height(1).is_err()); - assert_eq!(chain.get_header_by_height(5).unwrap().inner_lite.height, 5); + assert_eq!(chain.get_header_by_height(5).unwrap().height(), 5); } /// Verifies that the block at height are updated correctly when blocks from different forks are @@ -154,20 +156,20 @@ fn blocks_at_height() { let e_7 = Block::empty_with_height(&b_1, 7, &*signer); - let b_1_hash = b_1.hash(); - let b_2_hash = b_2.hash(); - let b_3_hash = b_3.hash(); + let b_1_hash = *b_1.hash(); + let b_2_hash = *b_2.hash(); + let b_3_hash = *b_3.hash(); - let c_1_hash = c_1.hash(); - let c_3_hash = c_3.hash(); - let c_4_hash = c_4.hash(); - let c_5_hash = c_5.hash(); + let c_1_hash = *c_1.hash(); + let c_3_hash = *c_3.hash(); + let c_4_hash = *c_4.hash(); + let c_5_hash = *c_5.hash(); - let d_3_hash = d_3.hash(); - let d_4_hash = d_4.hash(); - let d_6_hash = d_6.hash(); + let d_3_hash = *d_3.hash(); + let d_4_hash = *d_4.hash(); + let d_6_hash = *d_6.hash(); - let e_7_hash = e_7.hash(); + let e_7_hash = *e_7.hash(); assert_ne!(d_3_hash, b_3_hash); @@ -176,9 +178,9 @@ fn blocks_at_height() { chain.process_block(&None, b_3, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).unwrap(); assert_eq!(chain.header_head().unwrap().height, 3); - assert_eq!(chain.get_header_by_height(1).unwrap().hash(), b_1_hash); - assert_eq!(chain.get_header_by_height(2).unwrap().hash(), b_2_hash); - assert_eq!(chain.get_header_by_height(3).unwrap().hash(), b_3_hash); + assert_eq!(chain.get_header_by_height(1).unwrap().hash(), &b_1_hash); + assert_eq!(chain.get_header_by_height(2).unwrap().hash(), &b_2_hash); + assert_eq!(chain.get_header_by_height(3).unwrap().hash(), &b_3_hash); chain.process_block(&None, c_1, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).unwrap(); chain.process_block(&None, c_3, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).unwrap(); @@ -186,46 +188,46 @@ fn blocks_at_height() { chain.process_block(&None, c_5, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).unwrap(); assert_eq!(chain.header_head().unwrap().height, 5); - assert_eq!(chain.get_header_by_height(1).unwrap().hash(), c_1_hash); + assert_eq!(chain.get_header_by_height(1).unwrap().hash(), &c_1_hash); assert!(chain.get_header_by_height(2).is_err()); - assert_eq!(chain.get_header_by_height(3).unwrap().hash(), c_3_hash); - assert_eq!(chain.get_header_by_height(4).unwrap().hash(), c_4_hash); - assert_eq!(chain.get_header_by_height(5).unwrap().hash(), c_5_hash); + assert_eq!(chain.get_header_by_height(3).unwrap().hash(), &c_3_hash); + assert_eq!(chain.get_header_by_height(4).unwrap().hash(), &c_4_hash); + assert_eq!(chain.get_header_by_height(5).unwrap().hash(), &c_5_hash); chain.process_block(&None, d_3, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).unwrap(); chain.process_block(&None, d_4, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).unwrap(); chain.process_block(&None, d_6, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).unwrap(); assert_eq!(chain.header_head().unwrap().height, 6); - assert_eq!(chain.get_header_by_height(1).unwrap().hash(), b_1_hash); - assert_eq!(chain.get_header_by_height(2).unwrap().hash(), b_2_hash); - assert_eq!(chain.get_header_by_height(3).unwrap().hash(), d_3_hash); - assert_eq!(chain.get_header_by_height(4).unwrap().hash(), d_4_hash); + assert_eq!(chain.get_header_by_height(1).unwrap().hash(), &b_1_hash); + assert_eq!(chain.get_header_by_height(2).unwrap().hash(), &b_2_hash); + assert_eq!(chain.get_header_by_height(3).unwrap().hash(), &d_3_hash); + assert_eq!(chain.get_header_by_height(4).unwrap().hash(), &d_4_hash); assert!(chain.get_header_by_height(5).is_err()); - assert_eq!(chain.get_header_by_height(6).unwrap().hash(), d_6_hash); + assert_eq!(chain.get_header_by_height(6).unwrap().hash(), &d_6_hash); chain.process_block(&None, e_7, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).unwrap(); - assert_eq!(chain.get_header_by_height(1).unwrap().hash(), b_1_hash); + assert_eq!(chain.get_header_by_height(1).unwrap().hash(), &b_1_hash); for h in 2..=5 { assert!(chain.get_header_by_height(h).is_err()); } - assert_eq!(chain.get_header_by_height(7).unwrap().hash(), e_7_hash); + assert_eq!(chain.get_header_by_height(7).unwrap().hash(), &e_7_hash); } #[test] fn next_blocks() { init_test_logger(); let (mut chain, _, signer) = setup(); - let genesis = chain.get_block(&chain.genesis().hash()).unwrap(); + let genesis = chain.get_block(&chain.genesis().hash().clone()).unwrap(); let b1 = Block::empty(&genesis, &*signer); let b2 = Block::empty_with_height(&b1, 2, &*signer); let b3 = Block::empty_with_height(&b1, 3, &*signer); let b4 = Block::empty_with_height(&b3, 4, &*signer); - let b1_hash = b1.hash(); - let b2_hash = b2.hash(); - let b3_hash = b3.hash(); - let b4_hash = b4.hash(); + let b1_hash = *b1.hash(); + let b2_hash = *b2.hash(); + let b3_hash = *b3.hash(); + let b4_hash = *b4.hash(); assert!(chain.process_block(&None, b1, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).is_ok()); assert!(chain.process_block(&None, b2, Provenance::PRODUCED, |_| {}, |_| {}, |_| {}).is_ok()); assert_eq!(chain.mut_store().get_next_block_hash(&b1_hash).unwrap(), &b2_hash); diff --git a/chain/chain/tests/sync_chain.rs b/chain/chain/tests/sync_chain.rs index fa3af8f59f2..ec9ea12b7b9 100644 --- a/chain/chain/tests/sync_chain.rs +++ b/chain/chain/tests/sync_chain.rs @@ -8,7 +8,7 @@ fn chain_sync_headers() { init_test_logger(); let (mut chain, _, bls_signer) = setup(); assert_eq!(chain.sync_head().unwrap().height, 0); - let mut blocks = vec![chain.get_block(&chain.genesis().hash()).unwrap().clone()]; + let mut blocks = vec![chain.get_block(&chain.genesis().hash().clone()).unwrap().clone()]; let mut block_merkle_tree = PartialMerkleTree::default(); for i in 0..4 { blocks.push(Block::empty_with_block_merkle_tree( diff --git a/chain/chunks/src/lib.rs b/chain/chunks/src/lib.rs index e941282a29d..0806093b31c 100644 --- a/chain/chunks/src/lib.rs +++ b/chain/chunks/src/lib.rs @@ -523,14 +523,14 @@ impl ShardsManager { .entry(shard_id) .and_modify(|stored_chunk| { let epoch_id = unwrap_or_return!( - runtime_adapter.get_epoch_id_from_prev_block(&known_header.prev_hash) + runtime_adapter.get_epoch_id_from_prev_block(known_header.prev_hash()) ); let block_producer = unwrap_or_return!(runtime_adapter.get_block_producer(&epoch_id, height)); if runtime_adapter .verify_validator_signature( &epoch_id, - &known_header.prev_hash, + &known_header.prev_hash(), &block_producer, header.hash.as_ref(), &header.signature, diff --git a/chain/client/src/client.rs b/chain/client/src/client.rs index 7424c642fca..83868164efd 100644 --- a/chain/client/src/client.rs +++ b/chain/client/src/client.rs @@ -38,6 +38,7 @@ use crate::sync::{BlockSync, HeaderSync, StateSync, StateSyncResult}; use crate::types::{Error, ShardSyncDownload}; use crate::SyncStatus; use near_network::types::PartialEncodedChunkResponseMsg; +use near_primitives::protocol_version::PROTOCOL_VERSION; const NUM_REBROADCAST_BLOCKS: usize = 30; @@ -148,10 +149,10 @@ impl Client { pub fn remove_transactions_for_block(&mut self, me: AccountId, block: &Block) { for (shard_id, chunk_header) in block.chunks.iter().enumerate() { let shard_id = shard_id as ShardId; - if block.header.inner_lite.height == chunk_header.height_included { + if block.header.height() == chunk_header.height_included { if self.shards_mgr.cares_about_shard_this_or_next_epoch( Some(&me), - &block.header.prev_hash, + &block.header.prev_hash(), shard_id, true, ) { @@ -171,10 +172,10 @@ impl Client { pub fn reintroduce_transactions_for_block(&mut self, me: AccountId, block: &Block) { for (shard_id, chunk_header) in block.chunks.iter().enumerate() { let shard_id = shard_id as ShardId; - if block.header.inner_lite.height == chunk_header.height_included { + if block.header.height() == chunk_header.height_included { if self.shards_mgr.cares_about_shard_this_or_next_epoch( Some(&me), - &block.header.prev_hash, + &block.header.prev_hash(), shard_id, false, ) { @@ -290,9 +291,9 @@ impl Client { let prev = self.chain.get_block_header(&head.last_block_hash)?.clone(); let prev_hash = head.last_block_hash; let prev_height = head.height; - let prev_prev_hash = prev.prev_hash; - let prev_epoch_id = prev.inner_lite.epoch_id.clone(); - let prev_next_bp_hash = prev.inner_lite.next_bp_hash; + let prev_prev_hash = *prev.prev_hash(); + let prev_epoch_id = prev.epoch_id().clone(); + let prev_next_bp_hash = *prev.next_bp_hash(); // Check and update the doomslug tip here. This guarantees that our endorsement will be in the // doomslug witness. Have to do it before checking the ability to produce a block. @@ -322,7 +323,7 @@ impl Client { ))); } - debug!(target: "client", "{:?} Producing block at height {}, parent {} @ {}", validator_signer.validator_id(), next_height, prev.inner_lite.height, format_hash(head.last_block_hash)); + debug!(target: "client", "{:?} Producing block at height {}, parent {} @ {}", validator_signer.validator_id(), next_height, prev.height(), format_hash(head.last_block_hash)); let new_chunks = self.shards_mgr.prepare_chunks(&prev_hash); // If we are producing empty blocks and there are no transactions. @@ -395,7 +396,11 @@ impl Client { // TODO(2445): Enable challenges when they are working correctly. // let challenges = self.challenges.drain().map(|(_, challenge)| challenge).collect(); + // MOO + let protocol_version = PROTOCOL_VERSION; + let block = Block::produce( + protocol_version, &prev_header, next_height, chunks, @@ -443,7 +448,7 @@ impl Client { } if self.runtime_adapter.is_next_block_epoch_start(&prev_block_hash)? { - let prev_prev_hash = self.chain.get_block_header(&prev_block_hash)?.prev_hash; + let prev_prev_hash = *self.chain.get_block_header(&prev_block_hash)?.prev_hash(); if !self.chain.prev_block_is_caught_up(&prev_prev_hash, &prev_block_hash)? { // See comment in similar snipped in `produce_block` debug!(target: "client", "Produce chunk: prev block is not caught up"); @@ -539,7 +544,7 @@ impl Client { let transaction_validity_period = chain.transaction_validity_period; runtime_adapter .prepare_transactions( - prev_block_header.inner_rest.gas_price, + prev_block_header.gas_price(), chunk_extra.gas_limit, shard_id, chunk_extra.state_root.clone(), @@ -642,7 +647,7 @@ impl Client { pub fn rebroadcast_block(&mut self, block: Block) { if self.rebroadcasted_blocks.cache_get(&block.hash()).is_none() { self.network_adapter.do_send(NetworkRequests::Block { block: block.clone() }); - self.rebroadcasted_blocks.cache_set(block.hash(), ()); + self.rebroadcasted_blocks.cache_set(*block.hash(), ()); } } @@ -700,11 +705,11 @@ impl Client { if tip.last_block_hash != self.doomslug.get_tip().0 { // We need to update the doomslug tip let last_final_hash = - self.chain.get_block_header(&tip.last_block_hash)?.inner_rest.last_final_block; + *self.chain.get_block_header(&tip.last_block_hash)?.last_final_block(); let last_final_height = if last_final_hash == CryptoHash::default() { - self.chain.genesis().inner_lite.height + self.chain.genesis().height() } else { - self.chain.get_block_header(&last_final_hash)?.inner_lite.height + self.chain.get_block_header(&last_final_hash)?.height() }; self.doomslug.set_tip( @@ -764,7 +769,7 @@ impl Client { .unwrap_or_default(); let skips = self .pending_approvals - .cache_remove(&ApprovalInner::Skip(block.header.inner_lite.height)) + .cache_remove(&ApprovalInner::Skip(block.header.height())) .unwrap_or_default(); for (_account_id, approval) in endorsements.into_iter().chain(skips.into_iter()) { @@ -775,7 +780,7 @@ impl Client { } if status.is_new_head() { - self.shards_mgr.update_largest_seen_height(block.header.inner_lite.height); + self.shards_mgr.update_largest_seen_height(block.header.height()); if !self.config.archive { if let Err(err) = self.chain.clear_data(self.runtime_adapter.get_tries()) { error!(target: "client", "Can't clear old data, {:?}", err); @@ -812,22 +817,22 @@ impl Client { let mut to_reintroduce = vec![]; while remove_head.hash() != reintroduce_head.hash() { - while remove_head.inner_lite.height > reintroduce_head.inner_lite.height { - to_remove.push(remove_head.hash()); + while remove_head.height() > reintroduce_head.height() { + to_remove.push(*remove_head.hash()); remove_head = self .chain - .get_block_header(&remove_head.prev_hash) + .get_block_header(remove_head.prev_hash()) .unwrap() .clone(); } - while reintroduce_head.inner_lite.height > remove_head.inner_lite.height - || reintroduce_head.inner_lite.height == remove_head.inner_lite.height + while reintroduce_head.height() > remove_head.height() + || reintroduce_head.height() == remove_head.height() && reintroduce_head.hash() != remove_head.hash() { - to_reintroduce.push(reintroduce_head.hash()); + to_reintroduce.push(*reintroduce_head.hash()); reintroduce_head = self .chain - .get_block_header(&reintroduce_head.prev_hash) + .get_block_header(reintroduce_head.prev_hash()) .unwrap() .clone(); } @@ -864,15 +869,15 @@ impl Client { .unwrap(); let chunk_proposer = self .runtime_adapter - .get_chunk_producer(&epoch_id, block.header.inner_lite.height + 1, shard_id) + .get_chunk_producer(&epoch_id, block.header.height() + 1, shard_id) .unwrap(); if chunk_proposer == *validator_signer.validator_id() { match self.produce_chunk( - block.hash(), + *block.hash(), &epoch_id, block.chunks[shard_id as usize].clone(), - block.header.inner_lite.height + 1, + block.header.height() + 1, shard_id, ) { Ok(Some((encoded_chunk, merkle_paths, receipts))) => self @@ -895,7 +900,7 @@ impl Client { } // Process stored partial encoded chunks - let next_height = block.header.inner_lite.height + 1; + let next_height = block.header.height() + 1; let mut partial_encoded_chunks = self.shards_mgr.get_stored_partial_encoded_chunks(next_height); for (_shard_id, partial_encoded_chunk) in partial_encoded_chunks.drain() { @@ -968,7 +973,7 @@ impl Client { ApprovalInner::Endorsement(parent_hash) => parent_hash.clone(), ApprovalInner::Skip(parent_height) => { match self.chain.get_header_by_height(*parent_height) { - Ok(header) => header.hash(), + Ok(header) => *header.hash(), Err(e) => { process_error(e, approval, &mut self.pending_approvals); return; @@ -1171,7 +1176,7 @@ impl Client { if self.runtime_adapter.cares_about_shard(me, &head.last_block_hash, shard_id, true) || self.runtime_adapter.will_care_about_shard(me, &head.last_block_hash, shard_id, true) { - let gas_price = cur_block_header.inner_rest.gas_price; + let gas_price = cur_block_header.gas_price(); let state_root = match self.chain.get_chunk_extra(&head.last_block_hash, shard_id) { Ok(chunk_extra) => chunk_extra.state_root, Err(_) => { diff --git a/chain/client/src/client_actor.rs b/chain/client/src/client_actor.rs index 879feeb30ea..5c6f058d4d9 100644 --- a/chain/client/src/client_actor.rs +++ b/chain/client/src/client_actor.rs @@ -17,9 +17,9 @@ use near_chain::{ byzantine_assert, Block, BlockHeader, ChainGenesis, ChainStoreAccess, Provenance, RuntimeAdapter, }; +use near_chain_configs::ClientConfig; #[cfg(feature = "adversarial")] use near_chain_configs::GenesisConfig; -use near_chain_configs::{ClientConfig, PROTOCOL_VERSION}; use near_crypto::Signature; #[cfg(feature = "metric_recorder")] use near_network::recorder::MetricRecorder; @@ -31,6 +31,7 @@ use near_network::{ }; use near_primitives::hash::CryptoHash; use near_primitives::network::{AnnounceAccount, PeerId}; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{BlockHeight, EpochId}; use near_primitives::unwrap_or_return; use near_primitives::utils::from_timestamp; @@ -280,16 +281,16 @@ impl Handler for ClientActor { .client .chain .mut_store() - .get_all_block_hashes_by_height(block.header.inner_lite.height); + .get_all_block_hashes_by_height(block.header.height()); if was_requested || !blocks_at_height.is_ok() { if let SyncStatus::StateSync(sync_hash, _) = &mut self.client.sync_status { if let Ok(header) = self.client.chain.get_block_header(sync_hash) { - if block.hash() == header.prev_hash { + if block.hash() == header.prev_hash() { if let Err(_) = self.client.chain.save_block(&block) { error!(target: "client", "Failed to save a block during state sync"); } return NetworkClientResponses::NoResponse; - } else if &block.hash() == sync_hash { + } else if block.hash() == sync_hash { self.client.chain.save_orphan(&block); return NetworkClientResponses::NoResponse; } @@ -300,12 +301,12 @@ impl Handler for ClientActor { match self .client .runtime_adapter - .get_epoch_id_from_prev_block(&block.header.prev_hash) + .get_epoch_id_from_prev_block(block.header.prev_hash()) { Ok(epoch_id) => { if let Some(hashes) = blocks_at_height.unwrap().get(&epoch_id) { - if !hashes.contains(&block.header.hash) { - warn!(target: "client", "Rejecting unrequested block {}, height {}", block.header.hash, block.header.inner_lite.height); + if !hashes.contains(block.header.hash()) { + warn!(target: "client", "Rejecting unrequested block {}, height {}", block.header.hash(), block.header.height()); } } } @@ -479,7 +480,7 @@ impl Handler for ClientActor { .chain .get_block_header(&head.last_block_hash) .map_err(|err| err.to_string())?; - let latest_block_time = header.inner_lite.timestamp.clone(); + let latest_block_time = header.raw_timestamp().clone(); if msg.is_health_check { let now = Utc::now(); let block_timestamp = from_timestamp(latest_block_time); @@ -517,7 +518,7 @@ impl Handler for ClientActor { sync_info: StatusSyncInfo { latest_block_hash: head.last_block_hash.into(), latest_block_height: head.height, - latest_state_root: header.inner_lite.prev_state_root.clone().into(), + latest_state_root: header.prev_state_root().clone().into(), latest_block_time: from_timestamp(latest_block_time), syncing: self.client.sync_status.is_syncing(), }, @@ -686,7 +687,7 @@ impl ClientActor { fn produce_block(&mut self, next_height: BlockHeight) -> Result<(), Error> { match self.client.produce_block(next_height) { Ok(Some(block)) => { - let block_hash = block.hash(); + let block_hash = *block.hash(); let res = self.process_block(block, Provenance::PRODUCED); match &res { Ok(_) => Ok(()), @@ -724,10 +725,10 @@ impl ClientActor { accepted_block.provenance, ); let block = self.client.chain.get_block(&accepted_block.hash).unwrap(); - let gas_used = Block::compute_gas_used(&block.chunks, block.header.inner_lite.height); - let gas_limit = Block::compute_gas_limit(&block.chunks, block.header.inner_lite.height); + let gas_used = Block::compute_gas_used(&block.chunks, block.header.height()); + let gas_limit = Block::compute_gas_limit(&block.chunks, block.header.height()); - let last_final_hash = block.header.inner_rest.last_final_block; + let last_final_hash = *block.header.last_final_block(); self.info_helper.block_processed(gas_used, gas_limit); self.check_send_announce_account(last_final_hash); @@ -751,8 +752,7 @@ impl ClientActor { if self.client.chain.process_block_header(&block.header, |_| {}).is_ok() { let head = self.client.chain.head()?; // do not broadcast blocks that are too far back. - if head.height < block.header.inner_lite.height - || head.epoch_id == block.header.inner_lite.epoch_id + if head.height < block.header.height() || &head.epoch_id == block.header.epoch_id() { self.client.rebroadcast_block(block.clone()); } @@ -770,15 +770,15 @@ impl ClientActor { peer_id: PeerId, was_requested: bool, ) -> NetworkClientResponses { - let hash = block.hash(); - debug!(target: "client", "{:?} Received block {} <- {} at {} from {}, requested: {}", self.client.validator_signer.as_ref().map(|vs| vs.validator_id()), hash, block.header.prev_hash, block.header.inner_lite.height, peer_id, was_requested); + let hash = *block.hash(); + debug!(target: "client", "{:?} Received block {} <- {} at {} from {}, requested: {}", self.client.validator_signer.as_ref().map(|vs| vs.validator_id()), hash, block.header.prev_hash(), block.header.height(), peer_id, was_requested); // drop the block if it is too far ahead let head = unwrap_or_return!(self.client.chain.head(), NetworkClientResponses::NoResponse); - if block.header.inner_lite.height >= head.height + BLOCK_HORIZON { - debug!(target: "client", "dropping block {} that is too far ahead. Block height {} current head height {}", block.hash(), block.header.inner_lite.height, head.height); + if block.header.height() >= head.height + BLOCK_HORIZON { + debug!(target: "client", "dropping block {} that is too far ahead. Block height {} current head height {}", block.hash(), block.header.height(), head.height); return NetworkClientResponses::NoResponse; } - let prev_hash = block.header.prev_hash; + let prev_hash = *block.header.prev_hash(); let provenance = if was_requested { near_chain::Provenance::SYNC } else { near_chain::Provenance::NONE }; match self.process_block(block, provenance) { @@ -941,7 +941,7 @@ impl ClientActor { let header_head = self.client.chain.header_head()?; let mut sync_hash = header_head.prev_block_hash; for _ in 0..self.client.config.state_fetch_horizon { - sync_hash = self.client.chain.get_block_header(&sync_hash)?.prev_hash; + sync_hash = *self.client.chain.get_block_header(&sync_hash)?.prev_hash(); } let epoch_start_sync_hash = StateSync::get_epoch_start_sync_hash(&mut self.client.chain, &sync_hash)?; @@ -1107,7 +1107,9 @@ impl ClientActor { highest_height_peer(&self.network_info.highest_height_peers) { if let Ok(header) = self.client.chain.get_block_header(&sync_hash) { - for hash in vec![header.prev_hash, header.hash].into_iter() { + for hash in + vec![*header.prev_hash(), *header.hash()].into_iter() + { self.request_block_by_hash( hash, peer_info.peer_info.id.clone(), diff --git a/chain/client/src/sync.rs b/chain/client/src/sync.rs index 6e622bef7e0..25533931401 100644 --- a/chain/client/src/sync.rs +++ b/chain/client/src/sync.rs @@ -252,8 +252,8 @@ impl HeaderSync { // Walk backwards to find last known hash. let last_loc = locator.last().unwrap().clone(); if let Ok(header) = chain.get_header_by_height(h) { - if header.inner_lite.height != last_loc.0 { - locator.push((header.inner_lite.height, header.hash())); + if header.height() != last_loc.0 { + locator.push((header.height(), *header.hash())); } } } @@ -479,7 +479,7 @@ impl StateSync { chain: &mut Chain, now: DateTime, ) -> Result<(bool, bool), near_chain::Error> { - let prev_hash = chain.get_block_header(&sync_hash)?.prev_hash.clone(); + let prev_hash = chain.get_block_header(&sync_hash)?.prev_hash().clone(); let (request_block, have_block) = if !chain.block_exists(&prev_hash)? { match self.last_time_block_requested { None => (true, false), @@ -690,17 +690,17 @@ impl StateSync { sync_hash: &CryptoHash, ) -> Result { let mut header = chain.get_block_header(sync_hash)?; - let mut epoch_id = header.inner_lite.epoch_id.clone(); - let mut hash = header.hash.clone(); - let mut prev_hash = header.prev_hash.clone(); + let mut epoch_id = header.epoch_id().clone(); + let mut hash = header.hash().clone(); + let mut prev_hash = header.prev_hash().clone(); loop { header = chain.get_block_header(&prev_hash)?; - if epoch_id != header.inner_lite.epoch_id { + if &epoch_id != header.epoch_id() { return Ok(hash); } - epoch_id = header.inner_lite.epoch_id.clone(); - hash = header.hash.clone(); - prev_hash = header.prev_hash.clone(); + epoch_id = header.epoch_id().clone(); + hash = header.hash().clone(); + prev_hash = header.prev_hash().clone(); } } @@ -716,8 +716,8 @@ impl StateSync { highest_height_peers: &Vec, ) -> Result { let prev_block_hash = - unwrap_or_return!(chain.get_block_header(&sync_hash), Ok(shard_sync_download)) - .prev_hash; + *unwrap_or_return!(chain.get_block_header(&sync_hash), Ok(shard_sync_download)) + .prev_hash(); let epoch_hash = unwrap_or_return!( runtime_adapter.get_epoch_id_from_prev_block(&prev_block_hash), Ok(shard_sync_download) @@ -877,6 +877,7 @@ mod test { use super::*; use near_primitives::merkle::PartialMerkleTree; + use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::EpochId; use near_primitives::validator_signer::InMemoryValidatorSigner; use num_rational::Ratio; @@ -933,7 +934,7 @@ mod test { chain_info: PeerChainInfo { genesis_id: GenesisId { chain_id: "unittest".to_string(), - hash: chain.genesis().hash(), + hash: *chain.genesis().hash(), }, height: chain2.head().unwrap().height, tracked_shards: vec![], @@ -951,7 +952,7 @@ mod test { NetworkRequests::BlockHeadersRequest { hashes: [3, 1, 0] .iter() - .map(|i| chain.get_block_by_height(*i).unwrap().hash()) + .map(|i| *chain.get_block_by_height(*i).unwrap().hash()) .collect(), peer_id: peer1.peer_info.id } @@ -1002,7 +1003,7 @@ mod test { 1000, 100, ); - let genesis = chain.get_block(&chain.genesis().hash()).unwrap().clone(); + let genesis = chain.get_block(&chain.genesis().hash().clone()).unwrap().clone(); let mut last_block = &genesis; let mut all_blocks = vec![]; @@ -1020,8 +1021,8 @@ mod test { account_id, ); Approval::new( - last_block.hash(), - last_block.header.inner_lite.height, + *last_block.hash(), + last_block.header.height(), current_height, &signer, ) @@ -1029,16 +1030,15 @@ mod test { }) }) .collect(); - let (epoch_id, next_epoch_id) = if last_block.header.prev_hash == CryptoHash::default() + let (epoch_id, next_epoch_id) = if last_block.header.prev_hash() + == &CryptoHash::default() { - (last_block.header.inner_lite.next_epoch_id.clone(), EpochId(last_block.hash())) + (last_block.header.next_epoch_id().clone(), EpochId(*last_block.hash())) } else { - ( - last_block.header.inner_lite.epoch_id.clone(), - last_block.header.inner_lite.next_epoch_id.clone(), - ) + (last_block.header.epoch_id().clone(), last_block.header.next_epoch_id().clone()) }; let block = Block::produce( + PROTOCOL_VERSION, &last_block.header, current_height, last_block.chunks.clone(), @@ -1051,10 +1051,10 @@ mod test { vec![], vec![], &*signers[3], - last_block.header.inner_lite.next_bp_hash.clone(), + last_block.header.next_bp_hash().clone(), block_merkle_tree.root(), ); - block_merkle_tree.insert(block.hash()); + block_merkle_tree.insert(*block.hash()); all_blocks.push(block); @@ -1066,7 +1066,7 @@ mod test { // banned for _iter in 0..12 { let block = &all_blocks[last_added_block_ord]; - let current_height = block.header.inner_lite.height; + let current_height = block.header.height(); set_syncing_peer(&mut header_sync); header_sync.header_sync_due( &SyncStatus::HeaderSync { current_height, highest_height }, @@ -1083,7 +1083,7 @@ mod test { // Now the same, but only 20 heights / sec for _iter in 0..12 { let block = &all_blocks[last_added_block_ord]; - let current_height = block.header.inner_lite.height; + let current_height = block.header.height(); set_syncing_peer(&mut header_sync); header_sync.header_sync_due( &SyncStatus::HeaderSync { current_height, highest_height }, diff --git a/chain/client/src/test_utils.rs b/chain/client/src/test_utils.rs index 004e11e2cd2..543c1a3e530 100644 --- a/chain/client/src/test_utils.rs +++ b/chain/client/src/test_utils.rs @@ -11,7 +11,7 @@ use rand::{thread_rng, Rng}; use near_chain::test_utils::KeyValueRuntime; use near_chain::{Chain, ChainGenesis, DoomslugThresholdMode, Provenance, RuntimeAdapter}; -use near_chain_configs::{ClientConfig, PROTOCOL_VERSION}; +use near_chain_configs::ClientConfig; use near_crypto::{InMemorySigner, KeyType, PublicKey}; #[cfg(feature = "metric_recorder")] use near_network::recorder::MetricRecorder; @@ -26,6 +26,7 @@ use near_network::{ }; use near_primitives::block::{ApprovalInner, Block, GenesisId}; use near_primitives::hash::{hash, CryptoHash}; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::transaction::SignedTransaction; use near_primitives::types::{ AccountId, Balance, BlockHeight, BlockHeightDelta, NumBlocks, NumSeats, NumShards, @@ -85,7 +86,7 @@ pub fn setup( DoomslugThresholdMode::NoApprovals }; let mut chain = Chain::new(runtime.clone(), &chain_genesis, doomslug_threshold_mode).unwrap(); - let genesis_block = chain.get_block(&chain.genesis().hash()).unwrap().clone(); + let genesis_block = chain.get_block(&chain.genesis().hash().clone()).unwrap().clone(); let signer = Arc::new(InMemoryValidatorSigner::from_seed(account_id, KeyType::ED25519, account_id)); @@ -353,12 +354,12 @@ pub fn setup_mock_all_validators( let my_height = &mut last_height1[my_ord]; - *my_height = max(*my_height, block.header.inner_lite.height); + *my_height = max(*my_height, block.header.height()); hash_to_height1 .write() .unwrap() - .insert(block.header.hash(), block.header.inner_lite.height); + .insert(*block.header.hash(), block.header.height()); } NetworkRequests::PartialEncodedChunkRequest { account_id: their_account_id, @@ -687,7 +688,7 @@ pub fn setup_mock_all_validators( hash_to_height .write() .unwrap() - .insert(genesis_block.read().unwrap().as_ref().unwrap().header.clone().hash(), 0); + .insert(*genesis_block.read().unwrap().as_ref().unwrap().header.clone().hash(), 0); *locked_connectors = ret.clone(); let value = genesis_block.read().unwrap(); (value.clone().unwrap(), ret) @@ -895,10 +896,10 @@ impl TestEnv { .query( 0, &last_block.chunks[0].inner.prev_state_root, - last_block.header.inner_lite.height, - last_block.header.inner_lite.timestamp, - &last_block.header.hash, - &last_block.header.inner_lite.epoch_id, + last_block.header.height(), + last_block.header.raw_timestamp(), + last_block.header.hash(), + last_block.header.epoch_id(), &QueryRequest::ViewAccount { account_id }, ) .unwrap(); diff --git a/chain/client/src/view_client.rs b/chain/client/src/view_client.rs index cf6c141785c..071580cd885 100644 --- a/chain/client/src/view_client.rs +++ b/chain/client/src/view_client.rs @@ -111,7 +111,7 @@ impl ViewClientActor { ) -> Result { match block_id { None => Ok(self.chain.head()?.last_block_hash), - Some(BlockId::Height(height)) => Ok(self.chain.get_header_by_height(height)?.hash()), + Some(BlockId::Height(height)) => Ok(*self.chain.get_header_by_height(height)?.hash()), Some(BlockId::Hash(block_hash)) => Ok(block_hash), } } @@ -131,9 +131,9 @@ impl ViewClientActor { fn get_block_hash_by_finality(&mut self, finality: &Finality) -> Result { let head_header = self.chain.head_header()?; match finality { - Finality::None => Ok(head_header.hash), - Finality::DoomSlug => Ok(head_header.inner_rest.last_ds_final_block), - Finality::Final => Ok(head_header.inner_rest.last_final_block), + Finality::None => Ok(*head_header.hash()), + Finality::DoomSlug => Ok(*head_header.last_ds_final_block()), + Finality::Final => Ok(*head_header.last_final_block()), } } @@ -169,17 +169,17 @@ impl ViewClientActor { // If we have state for the shard that we query return query result directly. // Otherwise route query to peers. - match self.chain.get_chunk_extra(&header.hash, shard_id) { + match self.chain.get_chunk_extra(header.hash(), shard_id) { Ok(chunk_extra) => { let state_root = chunk_extra.state_root; self.runtime_adapter .query( shard_id, &state_root, - header.inner_lite.height, - header.inner_lite.timestamp, - &header.hash, - &header.inner_lite.epoch_id, + header.height(), + header.raw_timestamp(), + header.hash(), + header.epoch_id(), &msg.request, ) .map(Some) @@ -314,7 +314,7 @@ impl ViewClientActor { let mut headers = vec![]; let max_height = self.chain.header_head()?.height; // TODO: this may be inefficient if there are a lot of skipped blocks. - for h in header.inner_lite.height + 1..=max_height { + for h in header.height() + 1..=max_height { if let Ok(header) = self.chain.get_header_by_height(h) { headers.push(header.clone()); if headers.len() >= sync::MAX_BLOCK_HEADERS as usize { @@ -388,10 +388,7 @@ impl Handler for ViewClientActor { } .and_then(|block| { self.runtime_adapter - .get_block_producer( - &block.header.inner_lite.epoch_id, - block.header.inner_lite.height, - ) + .get_block_producer(&block.header.epoch_id(), block.header.height()) .map(|author| BlockView::from_author_block(author, block)) }) .map_err(|err| err.to_string()) @@ -445,7 +442,7 @@ impl Handler for ViewClientActor { .and_then(|chunk| { self.chain .get_block_by_height(chunk.header.height_included) - .map(|block| (block.header.inner_lite.epoch_id.clone(), chunk)) + .map(|block| (block.header.epoch_id().clone(), chunk)) }) .and_then(|(epoch_id, chunk)| { self.runtime_adapter @@ -518,9 +515,9 @@ impl Handler for ViewClientActor { fn handle(&mut self, request: GetNextLightClientBlock, _: &mut Context) -> Self::Result { let last_block_header = self.chain.get_block_header(&request.last_block_hash).map_err(|err| err.to_string())?; - let last_epoch_id = last_block_header.inner_lite.epoch_id.clone(); - let last_next_epoch_id = last_block_header.inner_lite.next_epoch_id.clone(); - let last_height = last_block_header.inner_lite.height; + let last_epoch_id = last_block_header.epoch_id().clone(); + let last_next_epoch_id = last_block_header.next_epoch_id().clone(); + let last_height = last_block_header.height(); let head = self.chain.head().map_err(|err| err.to_string())?; if last_epoch_id == head.epoch_id || last_next_epoch_id == head.epoch_id { @@ -692,7 +689,7 @@ impl Handler for ViewClientActor { NetworkViewClientResponses::ChainInfo { genesis_id: GenesisId { chain_id: self.config.chain_id.clone(), - hash: self.chain.genesis().hash(), + hash: *self.chain.genesis().hash(), }, height, tracked_shards: self.config.tracked_shards.clone(), @@ -800,8 +797,6 @@ impl Handler for ViewClientActor { let header = self .maybe_block_id_to_block_hash(msg.block_id) .and_then(|block_hash| self.chain.get_block_header(&block_hash)); - header - .map(|b| GasPriceView { gas_price: b.inner_rest.gas_price }) - .map_err(|e| e.to_string()) + header.map(|b| GasPriceView { gas_price: b.gas_price() }).map_err(|e| e.to_string()) } } diff --git a/chain/client/tests/bug_repros.rs b/chain/client/tests/bug_repros.rs index 767480b93a6..6009dea36b8 100644 --- a/chain/client/tests/bug_repros.rs +++ b/chain/client/tests/bug_repros.rs @@ -92,12 +92,12 @@ fn repro_1183() { .0 .do_send(NetworkClientMessages::Transaction { transaction: SignedTransaction::send_money( - block.header.inner_lite.height * 16 + nonce_delta, + block.header.height() * 16 + nonce_delta, from.to_string(), to.to_string(), &InMemorySigner::from_seed(from, KeyType::ED25519, from), 1, - block.header.prev_hash, + *block.header.prev_hash(), ), is_forwarded: false, check_only: false, @@ -109,7 +109,7 @@ fn repro_1183() { *last_block = Some(block.clone()); *delayed_one_parts = vec![]; - if block.header.inner_lite.height >= 25 { + if block.header.height() >= 25 { System::current().stop(); } (NetworkResponses::NoResponse, false) @@ -167,7 +167,7 @@ fn test_sync_from_achival_node() { Box::new(move |_: String, msg: &NetworkRequests| -> (NetworkResponses, bool) { if let NetworkRequests::Block { block } = msg { let mut largest_height = largest_height.write().unwrap(); - *largest_height = max(block.header.inner_lite.height, *largest_height); + *largest_height = max(block.header.height(), *largest_height); } if *largest_height.read().unwrap() >= 50 { System::current().stop(); @@ -184,8 +184,8 @@ fn test_sync_from_achival_node() { )) } } - if block.header.inner_lite.height <= 10 { - blocks.write().unwrap().insert(block.hash(), block.clone()); + if block.header.height() <= 10 { + blocks.write().unwrap().insert(*block.hash(), block.clone()); } (NetworkResponses::NoResponse, false) } @@ -215,7 +215,7 @@ fn test_sync_from_achival_node() { } match msg { NetworkRequests::Block { block } => { - if block.header.inner_lite.height <= 10 { + if block.header.height() <= 10 { block_counter += 1; } (NetworkResponses::NoResponse, true) diff --git a/chain/client/tests/catching_up.rs b/chain/client/tests/catching_up.rs index 1448f12639d..12c169c431b 100644 --- a/chain/client/tests/catching_up.rs +++ b/chain/client/tests/catching_up.rs @@ -160,7 +160,7 @@ mod tests { match *phase { ReceiptsSyncPhases::WaitingForFirstBlock => { if let NetworkRequests::Block { block } = msg { - assert!(block.header.inner_lite.height <= send); + assert!(block.header.height() <= send); // This tx is rather fragile, specifically it's important that // 1. the `from` and `to` account are not in the same shard; // 2. ideally the producer of the chunk at height 3 for the shard @@ -170,7 +170,7 @@ mod tests { // for height 1, because such block producer will produce // the chunk for height 2 right away, before we manage to send // the transaction. - if block.header.inner_lite.height == send { + if block.header.height() == send { println!( "From shard: {}, to shard: {}", source_shard_id, destination_shard_id, @@ -182,7 +182,7 @@ mod tests { account_to.clone(), 111, 1, - block.header.prev_hash, + *block.header.prev_hash(), ); } *phase = ReceiptsSyncPhases::WaitingForSecondBlock; @@ -192,8 +192,8 @@ mod tests { ReceiptsSyncPhases::WaitingForSecondBlock => { // This block now contains a chunk with the transaction sent above. if let NetworkRequests::Block { block } = msg { - assert!(block.header.inner_lite.height <= send + 1); - if block.header.inner_lite.height == send + 1 { + assert!(block.header.height() <= send + 1); + if block.header.height() == send + 1 { *phase = ReceiptsSyncPhases::WaitingForDistantEpoch; } } @@ -201,9 +201,9 @@ mod tests { ReceiptsSyncPhases::WaitingForDistantEpoch => { // This block now contains a chunk with the transaction sent above. if let NetworkRequests::Block { block } = msg { - assert!(block.header.inner_lite.height >= send + 1); - assert!(block.header.inner_lite.height <= wait_till); - if block.header.inner_lite.height == wait_till { + assert!(block.header.height() >= send + 1); + assert!(block.header.height() <= wait_till); + if block.header.height() == wait_till { *phase = ReceiptsSyncPhases::VerifyingOutgoingReceipts; } } @@ -303,12 +303,12 @@ mod tests { ReceiptsSyncPhases::WaitingForValidate => { // This block now contains a chunk with the transaction sent above. if let NetworkRequests::Block { block } = msg { - assert!(block.header.inner_lite.height >= wait_till); - assert!(block.header.inner_lite.height <= wait_till + 20); - if block.header.inner_lite.height == wait_till + 20 { + assert!(block.header.height() >= wait_till); + assert!(block.header.height() <= wait_till + 20); + if block.header.height() == wait_till + 20 { System::current().stop(); } - if block.header.inner_lite.height == wait_till + 10 { + if block.header.height() == wait_till + 10 { for i in 0..16 { actix::spawn( connectors1.write().unwrap()[i] @@ -450,20 +450,19 @@ mod tests { match *phase { RandomSinglePartPhases::WaitingForFirstBlock => { if let NetworkRequests::Block { block } = msg { - assert_eq!(block.header.inner_lite.height, 1); + assert_eq!(block.header.height(), 1); *phase = RandomSinglePartPhases::WaitingForThirdEpoch; } } RandomSinglePartPhases::WaitingForThirdEpoch => { if let NetworkRequests::Block { block } = msg { - if block.header.inner_lite.height == 1 { + if block.header.height() == 1 { return (NetworkResponses::NoResponse, false); } - assert!(block.header.inner_lite.height >= 2); - assert!(block.header.inner_lite.height <= height); + assert!(block.header.height() >= 2); + assert!(block.header.height() <= height); let mut tx_count = 0; - if block.header.inner_lite.height == height - && block.header.inner_lite.height >= 2 + if block.header.height() == height && block.header.height() >= 2 { for (i, validator1) in flat_validators.iter().enumerate() { for (j, validator2) in @@ -491,7 +490,7 @@ mod tests { validator2.to_string(), amount, (12345 + tx_count) as u64, - block.header.prev_hash, + *block.header.prev_hash(), ); } tx_count += 1; @@ -504,14 +503,11 @@ mod tests { } RandomSinglePartPhases::WaitingForSixEpoch => { if let NetworkRequests::Block { block } = msg { - assert!(block.header.inner_lite.height >= height); - assert!(block.header.inner_lite.height <= 32); + assert!(block.header.height() >= height); + assert!(block.header.height() <= 32); let check_height = if skip_15 { 28 } else { 26 }; - if block.header.inner_lite.height >= check_height { - println!( - "BLOCK HEIGHT {:?}", - block.header.inner_lite.height - ); + if block.header.height() >= check_height { + println!("BLOCK HEIGHT {:?}", block.header.height()); for i in 0..16 { for j in 0..16 { let amounts1 = amounts.clone(); @@ -548,7 +544,7 @@ mod tests { } } } - if block.header.inner_lite.height == 32 { + if block.header.height() == 32 { println!( "SEEN HEIGHTS SAME BLOCK {:?}", seen_heights_same_block.len() @@ -648,13 +644,10 @@ mod tests { Arc::new(RwLock::new(Box::new( move |_account_id: String, msg: &NetworkRequests| { if let NetworkRequests::Block { block } = msg { - check_height(block.hash(), block.header.inner_lite.height); - check_height( - block.header.prev_hash, - block.header.inner_lite.height - 1, - ); + check_height(*block.hash(), block.header.height()); + check_height(*block.header.prev_hash(), block.header.height() - 1); - if block.header.inner_lite.height >= 25 { + if block.header.height() >= 25 { System::current().stop(); } } @@ -711,26 +704,20 @@ mod tests { Arc::new(RwLock::new(Box::new( move |_account_id: String, msg: &NetworkRequests| { let propagate = if let NetworkRequests::Block { block } = msg { - check_height(block.hash(), block.header.inner_lite.height); + check_height(*block.hash(), block.header.height()); - if block.header.inner_lite.height % 10 == 5 { - check_height( - block.header.prev_hash, - block.header.inner_lite.height - 2, - ); + if block.header.height() % 10 == 5 { + check_height(*block.header.prev_hash(), block.header.height() - 2); } else { - check_height( - block.header.prev_hash, - block.header.inner_lite.height - 1, - ); + check_height(*block.header.prev_hash(), block.header.height() - 1); } - if block.header.inner_lite.height >= 25 { + if block.header.height() >= 25 { System::current().stop(); } // Do not propagate blocks at heights %10=4 - block.header.inner_lite.height % 10 != 4 + block.header.height() % 10 != 4 } else { true }; @@ -814,10 +801,10 @@ mod tests { } } if let NetworkRequests::Block { block } = msg { - if block.header.inner_lite.height == 12 { - println!("BLOCK {:?}", block,); - *unaccepted_block_hash = block.header.hash; - assert_eq!(4, block.header.inner_rest.chunks_included); + if block.header.height() == 12 { + println!("BLOCK {:?}", block); + *unaccepted_block_hash = *block.header.hash(); + assert_eq!(4, block.header.chunks_included()); *phase = ChunkGrievingPhases::SecondAttack; } } @@ -865,11 +852,11 @@ mod tests { } } if let NetworkRequests::Block { block } = msg { - if block.header.inner_lite.height == 42 { + if block.header.height() == 42 { println!("BLOCK {:?}", block,); // This is the main assert of the test // Chunk from malicious node shouldn't be accepted at all - assert_eq!(3, block.header.inner_rest.chunks_included); + assert_eq!(3, block.header.chunks_included()); System::current().stop(); } } @@ -1001,12 +988,12 @@ mod tests { } if let NetworkRequests::Block { block } = msg { // There is no chunks at height 1 - if block.header.inner_lite.height > 1 { + if block.header.height() > 1 { println!("BLOCK {:?}", block,); - if block.header.inner_lite.height % epoch_length != 1 { - assert_eq!(4, block.header.inner_rest.chunks_included); + if block.header.height() % epoch_length != 1 { + assert_eq!(4, block.header.chunks_included()); } - if block.header.inner_lite.height == last_height { + if block.header.height() == last_height { System::current().stop(); } } diff --git a/chain/client/tests/challenges.rs b/chain/client/tests/challenges.rs index 353f844f982..b2bc2bec5a5 100644 --- a/chain/client/tests/challenges.rs +++ b/chain/client/tests/challenges.rs @@ -23,6 +23,7 @@ use near_primitives::challenge::{ }; use near_primitives::hash::CryptoHash; use near_primitives::merkle::{merklize, MerklePath, PartialMerkleTree}; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::receipt::Receipt; use near_primitives::serialize::BaseDecode; use near_primitives::sharding::{EncodedShardChunk, ReedSolomonWrapper}; @@ -45,13 +46,14 @@ fn test_verify_block_double_sign_challenge() { let signer = InMemoryValidatorSigner::from_seed("test0", KeyType::ED25519, "test0"); let mut block_merkle_tree = PartialMerkleTree::default(); - block_merkle_tree.insert(genesis.hash()); + block_merkle_tree.insert(*genesis.hash()); let b2 = Block::produce( + PROTOCOL_VERSION, &genesis.header, 2, genesis.chunks.clone(), - b1.header.inner_lite.epoch_id.clone(), - b1.header.inner_lite.next_epoch_id.clone(), + b1.header.epoch_id().clone(), + b1.header.next_epoch_id().clone(), vec![], Rational::from_integer(0), 0, @@ -59,10 +61,10 @@ fn test_verify_block_double_sign_challenge() { vec![], vec![], &signer, - b1.header.inner_lite.next_bp_hash.clone(), + b1.header.next_bp_hash().clone(), block_merkle_tree.root(), ); - let epoch_id = b1.header.inner_lite.epoch_id.clone(); + let epoch_id = b1.header.epoch_id().clone(); let valid_challenge = Challenge::produce( ChallengeBody::BlockDoubleSign(BlockDoubleSign { left_block_header: b2.header.try_to_vec().unwrap(), @@ -72,7 +74,7 @@ fn test_verify_block_double_sign_challenge() { ); let runtime_adapter = env.clients[1].chain.runtime_adapter.clone(); assert_eq!( - validate_challenge(&*runtime_adapter, &epoch_id, &genesis.hash(), &valid_challenge,) + &validate_challenge(&*runtime_adapter, &epoch_id, &genesis.hash(), &valid_challenge) .unwrap() .0, if b1.hash() > b2.hash() { b1.hash() } else { b2.hash() } @@ -138,8 +140,8 @@ fn create_chunk( client.chain.get_block_by_height(client.chain.head().unwrap().height).unwrap().clone(); let (mut chunk, mut merkle_paths, receipts) = client .produce_chunk( - last_block.hash(), - &last_block.header.inner_lite.epoch_id, + *last_block.hash(), + last_block.header.epoch_id(), last_block.chunks[0].clone(), 2, 0, @@ -187,13 +189,14 @@ fn create_chunk( } let mut block_merkle_tree = client.chain.mut_store().get_block_merkle_tree(&last_block.hash()).unwrap().clone(); - block_merkle_tree.insert(last_block.hash()); + block_merkle_tree.insert(*last_block.hash()); let block = Block::produce( + PROTOCOL_VERSION, &last_block.header, 2, vec![chunk.header.clone()], - last_block.header.inner_lite.epoch_id.clone(), - last_block.header.inner_lite.next_epoch_id.clone(), + last_block.header.epoch_id().clone(), + last_block.header.next_epoch_id().clone(), vec![], Rational::from_integer(0), 0, @@ -201,7 +204,7 @@ fn create_chunk( vec![], vec![], &*client.validator_signer.as_ref().unwrap().clone(), - last_block.header.inner_lite.next_bp_hash, + *last_block.header.next_bp_hash(), block_merkle_tree.root(), ); (chunk, merkle_paths, receipts, block) @@ -219,7 +222,7 @@ fn test_verify_chunk_invalid_proofs_challenge() { MaybeEncodedShardChunk::Encoded(chunk), &block, ); - assert_eq!(challenge_result.unwrap(), (block.hash(), vec!["test0".to_string()])); + assert_eq!(challenge_result.unwrap(), (*block.hash(), vec!["test0".to_string()])); } #[test] @@ -237,7 +240,7 @@ fn test_verify_chunk_invalid_proofs_challenge_decoded_chunk() { MaybeEncodedShardChunk::Decoded(chunk), &block, ); - assert_eq!(challenge_result.unwrap(), (block.hash(), vec!["test0".to_string()])); + assert_eq!(challenge_result.unwrap(), (*block.hash(), vec!["test0".to_string()])); } #[test] @@ -261,7 +264,7 @@ fn test_verify_chunk_proofs_malicious_challenge_valid_order_transactions() { let mut env = TestEnv::new(ChainGenesis::test(), 1, 1); env.produce_block(0, 1); - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); let signer = InMemorySigner::from_seed("test0", KeyType::ED25519, "test0"); let (chunk, _merkle_paths, _receipts, block) = create_chunk_with_transactions( @@ -300,7 +303,7 @@ fn test_verify_chunk_proofs_challenge_transaction_order() { let mut env = TestEnv::new(ChainGenesis::test(), 1, 1); env.produce_block(0, 1); - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); let signer = InMemorySigner::from_seed("test0", KeyType::ED25519, "test0"); let (chunk, _merkle_paths, _receipts, block) = create_chunk_with_transactions( @@ -330,7 +333,7 @@ fn test_verify_chunk_proofs_challenge_transaction_order() { MaybeEncodedShardChunk::Encoded(chunk), &block, ); - assert_eq!(challenge_result.unwrap(), (block.hash(), vec!["test0".to_string()])); + assert_eq!(challenge_result.unwrap(), (*block.hash(), vec!["test0".to_string()])); } fn challenge( @@ -351,8 +354,8 @@ fn challenge( let runtime_adapter = env.clients[0].chain.runtime_adapter.clone(); validate_challenge( &*runtime_adapter, - &block.header.inner_lite.epoch_id, - &block.header.prev_hash, + &block.header.epoch_id(), + &block.header.prev_hash(), &valid_challenge, ) } @@ -371,7 +374,7 @@ fn test_verify_chunk_invalid_state_challenge() { let mut env = TestEnv::new_with_runtime(ChainGenesis::test(), 1, 1, runtimes); let signer = InMemorySigner::from_seed("test0", KeyType::ED25519, "test0"); let validator_signer = InMemoryValidatorSigner::from_seed("test0", KeyType::ED25519, "test0"); - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); env.produce_block(0, 1); env.clients[0].process_tx( SignedTransaction::send_money( @@ -397,10 +400,10 @@ fn test_verify_chunk_invalid_state_challenge() { let (mut invalid_chunk, merkle_paths) = env.clients[0] .shards_mgr .create_encoded_shard_chunk( - last_block.hash(), + *last_block.hash(), StateRoot::default(), CryptoHash::default(), - last_block.header.inner_lite.height + 1, + last_block.header.height() + 1, 0, 0, 1_000, @@ -428,16 +431,17 @@ fn test_verify_chunk_invalid_state_challenge() { ) .unwrap(); - invalid_chunk.header.height_included = last_block.header.inner_lite.height + 1; + invalid_chunk.header.height_included = last_block.header.height() + 1; let mut block_merkle_tree = client.chain.mut_store().get_block_merkle_tree(&last_block.hash()).unwrap().clone(); - block_merkle_tree.insert(last_block.hash()); + block_merkle_tree.insert(*last_block.hash()); let block = Block::produce( + PROTOCOL_VERSION, &last_block.header, - last_block.header.inner_lite.height + 1, + last_block.header.height() + 1, vec![invalid_chunk.header.clone()], - last_block.header.inner_lite.epoch_id.clone(), - last_block.header.inner_lite.next_epoch_id.clone(), + last_block.header.epoch_id().clone(), + last_block.header.next_epoch_id().clone(), vec![], Rational::from_integer(0), 0, @@ -445,7 +449,7 @@ fn test_verify_chunk_invalid_state_challenge() { vec![], vec![], &validator_signer, - last_block.header.inner_lite.next_bp_hash, + *last_block.header.next_bp_hash(), block_merkle_tree.root(), ); @@ -503,12 +507,12 @@ fn test_verify_chunk_invalid_state_challenge() { assert_eq!( validate_challenge( &*runtime_adapter, - &block.header.inner_lite.epoch_id, - &block.header.prev_hash, + &block.header.epoch_id(), + &block.header.prev_hash(), &challenge, ) .unwrap(), - (block.hash(), vec!["test0".to_string()]) + (*block.hash(), vec!["test0".to_string()]) ); // Process the block with invalid chunk and make sure it's marked as invalid at the end. @@ -650,7 +654,7 @@ fn test_fishermen_challenge() { let mut env = TestEnv::new_with_runtime(ChainGenesis::test(), 3, 1, vec![runtime1, runtime2, runtime3]); let signer = InMemorySigner::from_seed("test1", KeyType::ED25519, "test1"); - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); let stake_transaction = SignedTransaction::stake( 1, "test1".to_string(), @@ -732,7 +736,7 @@ fn test_challenge_in_different_epoch() { let fork2_block = env.clients[1].produce_block(9).unwrap().unwrap(); fork_blocks.push(fork2_block); for block in fork_blocks { - let height = block.header.inner_lite.height; + let height = block.header.height(); let (_, result) = env.clients[0].process_block(block, Provenance::NONE); match env.clients[0].run_catchup(&vec![]) { Ok(accepted_blocks) => { diff --git a/chain/client/tests/chunks_management.rs b/chain/client/tests/chunks_management.rs index a585ef3f9ef..1dd208dfe45 100644 --- a/chain/client/tests/chunks_management.rs +++ b/chain/client/tests/chunks_management.rs @@ -14,7 +14,6 @@ use near_crypto::KeyType; use near_logger_utils::{init_integration_logger, init_test_logger}; use near_network::types::PartialEncodedChunkRequestMsg; use near_network::{NetworkClientMessages, NetworkRequests, NetworkResponses, PeerInfo}; -use near_primitives::block::BlockHeader; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::sharding::{PartialEncodedChunk, ShardChunkHeader}; use near_primitives::transaction::SignedTransaction; @@ -123,63 +122,63 @@ fn chunks_produced_and_distributed_common( Arc::new(RwLock::new(Box::new(move |from_whom: String, msg: &NetworkRequests| { match msg { NetworkRequests::Block { block } => { - check_height(block.hash(), block.header.inner_lite.height); - check_height(block.header.prev_hash, block.header.inner_lite.height - 1); + check_height(*block.hash(), block.header.height()); + check_height(*block.header.prev_hash(), block.header.height() - 1); - let h = block.header.inner_lite.height; + let h = block.header.height(); let mut height_to_hash = height_to_hash.write().unwrap(); - height_to_hash.insert(h, block.hash()); + height_to_hash.insert(h, *block.hash()); let mut height_to_epoch = height_to_epoch.write().unwrap(); - height_to_epoch.insert(h, block.header.inner_lite.epoch_id.clone()); + height_to_epoch.insert(h, block.header.epoch_id().clone()); println!( "[{:?}]: BLOCK {} HEIGHT {}; HEADER HEIGHTS: {} / {} / {} / {};\nAPPROVALS: {:?}", Instant::now(), block.hash(), - block.header.inner_lite.height, + block.header.height(), block.chunks[0].inner.height_created, block.chunks[1].inner.height_created, block.chunks[2].inner.height_created, block.chunks[3].inner.height_created, - block.header.inner_rest.approvals, + block.header.approvals(), ); if h > 1 { // Make sure doomslug finality is computed correctly. - assert_eq!(block.header.inner_rest.last_ds_final_block, *height_to_hash.get(&(h - 1)).unwrap()); + assert_eq!(block.header.last_ds_final_block(), height_to_hash.get(&(h - 1)).unwrap()); // Make sure epoch length actually corresponds to the desired epoch length // The switches are expected at 0->1, 5->6 and 10->11 let prev_epoch_id = height_to_epoch.get(&(h - 1)).unwrap().clone(); - assert_eq!(block.header.inner_lite.epoch_id == prev_epoch_id, h % 5 != 1); + assert_eq!(block.header.epoch_id() == &prev_epoch_id, h % 5 != 1); // Make sure that the blocks leading to the epoch switch have twice as // many approval slots - assert_eq!(block.header.inner_rest.approvals.len() == 8, h % 5 == 0 || h % 5 == 4); + assert_eq!(block.header.approvals().len() == 8, h % 5 == 0 || h % 5 == 4); } if h > 2 { // Make sure BFT finality is computed correctly - assert_eq!(block.header.inner_rest.last_final_block, *height_to_hash.get(&(h - 2)).unwrap()); + assert_eq!(block.header.last_final_block(), height_to_hash.get(&(h - 2)).unwrap()); } - if block.header.inner_lite.height > 1 { + if block.header.height() > 1 { for shard_id in 0..4 { // If messages from 1 to 4 are dropped, 4 at their heights will // receive the block significantly later than the chunks, and // thus would discard the chunks - if !drop_from_1_to_4 || block.header.inner_lite.height % 4 != 3 { + if !drop_from_1_to_4 || block.header.height() % 4 != 3 { assert_eq!( - block.header.inner_lite.height, + block.header.height(), block.chunks[shard_id].inner.height_created ); } } } - if block.header.inner_lite.height >= 12 { - println!("PREV BLOCK HASH: {}", block.header.prev_hash); + if block.header.height() >= 12 { + println!("PREV BLOCK HASH: {}", block.header.prev_hash()); println!( "STATS: responses: {} requests: {}", partial_chunk_msgs, partial_chunk_request_msgs @@ -226,8 +225,7 @@ fn chunks_produced_and_distributed_common( let view_client = connectors.write().unwrap()[0].1.clone(); actix::spawn(view_client.send(GetBlock::latest()).then(move |res| { - let header: BlockHeader = res.unwrap().unwrap().header.into(); - let block_hash = header.hash; + let block_hash = res.unwrap().unwrap().header.hash; let connectors_ = connectors.write().unwrap(); connectors_[0] .0 @@ -307,7 +305,7 @@ fn store_partial_encoded_chunk_sanity() { parts: vec![], receipts: vec![], }; - let block_hash = env.clients[0].chain.genesis().hash(); + let block_hash = *env.clients[0].chain.genesis().hash(); let block = env.clients[0].chain.get_block(&block_hash).unwrap().clone(); assert_eq!(env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(1).len(), 0); env.clients[0] diff --git a/chain/client/tests/consensus.rs b/chain/client/tests/consensus.rs index d3b330de4b0..0aa5a97243c 100644 --- a/chain/client/tests/consensus.rs +++ b/chain/client/tests/consensus.rs @@ -82,32 +82,31 @@ mod tests { match msg { NetworkRequests::Block { block } => { - if !all_blocks.contains_key(&block.header.inner_lite.height) { + if !all_blocks.contains_key(&block.header.height()) { println!( "BLOCK @{} EPOCH: {:?}, APPROVALS: {:?}", - block.header.inner_lite.height, - block.header.inner_lite.epoch_id, + block.header.height(), + block.header.epoch_id(), block .header - .inner_rest - .approvals + .approvals() .iter() .map(|x| if x.is_some() { 1 } else { 0 }) .collect::>() ); } - all_blocks.insert(block.header.inner_lite.height, block.clone()); - block_to_prev_block.insert(block.hash(), block.header.prev_hash); - block_to_height.insert(block.hash(), block.header.inner_lite.height); + all_blocks.insert(block.header.height(), block.clone()); + block_to_prev_block.insert(*block.hash(), *block.header.prev_hash()); + block_to_height.insert(*block.hash(), block.header.height()); - if *largest_block_height / 20 < block.header.inner_lite.height / 20 { + if *largest_block_height / 20 < block.header.height() / 20 { // Periodically verify the finality println!("VERIFYING FINALITY CONDITIONS"); for block in all_blocks.values() { if let Some(prev_hash) = block_to_prev_block.get(&block.hash()) { if let Some(prev_height) = block_to_height.get(prev_hash) { - let cur_height = block.header.inner_lite.height; + let cur_height = block.header.height(); for f in final_block_heights.iter() { if f < &cur_height && f > prev_height { assert!( @@ -126,26 +125,22 @@ mod tests { } } - if block.header.inner_lite.height > *largest_block_height + 3 { - *largest_block_height = block.header.inner_lite.height; + if block.header.height() > *largest_block_height + 3 { + *largest_block_height = block.header.height(); if delayed_blocks.len() < 2 { delayed_blocks.push(block.clone()); return (NetworkResponses::NoResponse, false); } } - *largest_block_height = std::cmp::max( - block.header.inner_lite.height, - *largest_block_height, - ); + *largest_block_height = + std::cmp::max(block.header.height(), *largest_block_height); let mut new_delayed_blocks = vec![]; for delayed_block in delayed_blocks.iter() { if delayed_block.hash() == block.hash() { return (NetworkResponses::NoResponse, false); } - if delayed_block.header.inner_lite.height - <= block.header.inner_lite.height + 2 - { + if delayed_block.header.height() <= block.header.height() + 2 { for target_ord in 0..24 { connectors1.write().unwrap()[target_ord].0.do_send( NetworkClientMessages::Block( @@ -162,7 +157,7 @@ mod tests { *delayed_blocks = new_delayed_blocks; let mut heights = vec![]; - let mut cur_hash = block.hash(); + let mut cur_hash = *block.hash(); while let Some(height) = block_to_height.get(&cur_hash) { heights.push(height); cur_hash = block_to_prev_block.get(&cur_hash).unwrap().clone(); @@ -178,7 +173,7 @@ mod tests { is_final, delayed_blocks .iter() - .map(|x| x.header.inner_lite.height) + .map(|x| x.header.height()) .collect::>(), block.hash(), heights, diff --git a/chain/client/tests/cross_shard_tx.rs b/chain/client/tests/cross_shard_tx.rs index 35b360de659..0993befcdca 100644 --- a/chain/client/tests/cross_shard_tx.rs +++ b/chain/client/tests/cross_shard_tx.rs @@ -430,7 +430,7 @@ mod tests { ))), ); *connectors.write().unwrap() = conn; - let block_hash = genesis_block.hash(); + let block_hash = *genesis_block.hash(); let connectors_ = connectors.write().unwrap(); let iteration = Arc::new(AtomicUsize::new(0)); diff --git a/chain/client/tests/process_blocks.rs b/chain/client/tests/process_blocks.rs index 8a40b446f1d..b06a517edfd 100644 --- a/chain/client/tests/process_blocks.rs +++ b/chain/client/tests/process_blocks.rs @@ -26,10 +26,11 @@ use near_network::{ FullPeerInfo, NetworkClientMessages, NetworkClientResponses, NetworkRequests, NetworkResponses, PeerInfo, }; -use near_primitives::block::{Approval, ApprovalInner, BlockHeader}; +use near_primitives::block::{Approval, ApprovalInner}; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::merkle::merklize; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::sharding::{EncodedShardChunk, ReedSolomonWrapper}; use near_primitives::transaction::{SignedTransaction, Transaction}; use near_primitives::types::{BlockHeight, EpochId, MerkleHash, NumBlocks}; @@ -118,8 +119,7 @@ fn produce_blocks_with_tx() { ); near_network::test_utils::wait_or_panic(5000); actix::spawn(view_client.send(GetBlock::latest()).then(move |res| { - let header: BlockHeader = res.unwrap().unwrap().header.into(); - let block_hash = header.hash; + let block_hash = res.unwrap().unwrap().header.hash; client.do_send(NetworkClientMessages::Transaction { transaction: SignedTransaction::empty(block_hash), is_forwarded: false, @@ -162,6 +162,7 @@ fn receive_network_block() { let signer = InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1"); block_merkle_tree.insert(last_block.header.hash); let block = Block::produce( + PROTOCOL_VERSION, &last_block.header.clone().into(), last_block.header.height + 1, last_block.chunks.into_iter().map(Into::into).collect(), @@ -210,13 +211,13 @@ fn produce_block_with_approvals() { // block if block.header.num_approvals() == validators.len() as u64 - 2 { System::current().stop(); - } else if block.header.inner_lite.height == 10 { - println!("{}", block.header.inner_lite.height); + } else if block.header.height() == 10 { + println!("{}", block.header.height()); println!( "{} != {} -2 (height: {})", block.header.num_approvals(), validators.len(), - block.header.inner_lite.height + block.header.height() ); assert!(false); @@ -230,6 +231,7 @@ fn produce_block_with_approvals() { let signer1 = InMemoryValidatorSigner::from_seed("test2", KeyType::ED25519, "test2"); block_merkle_tree.insert(last_block.header.hash); let block = Block::produce( + PROTOCOL_VERSION, &last_block.header.clone().into(), last_block.header.height + 1, last_block.chunks.into_iter().map(Into::into).collect(), @@ -259,8 +261,8 @@ fn produce_block_with_approvals() { let s = if i > 10 { "test1".to_string() } else { format!("test{}", i) }; let signer = InMemoryValidatorSigner::from_seed(&s, KeyType::ED25519, &s); let approval = Approval::new( - block.hash(), - block.header.inner_lite.height, + *block.hash(), + block.header.height(), 10, // the height at which "test1" is producing &signer, ); @@ -307,7 +309,7 @@ fn produce_block_with_approvals_arrived_early() { Box::new(move |_: String, msg: &NetworkRequests| -> (NetworkResponses, bool) { match msg { NetworkRequests::Block { block } => { - if block.header.inner_lite.height == 3 { + if block.header.height() == 3 { for (i, (client, _)) in conns.clone().into_iter().enumerate() { if i > 0 { client.do_send(NetworkClientMessages::Block( @@ -319,7 +321,7 @@ fn produce_block_with_approvals_arrived_early() { } *block_holder.write().unwrap() = Some(block.clone()); return (NetworkResponses::NoResponse, false); - } else if block.header.inner_lite.height == 4 { + } else if block.header.height() == 4 { System::current().stop(); } (NetworkResponses::NoResponse, true) @@ -362,10 +364,10 @@ fn invalid_blocks() { Box::new(move |msg, _ctx, _client_actor| { match msg { NetworkRequests::Block { block } => { - assert_eq!(block.header.inner_lite.height, 1); + assert_eq!(block.header.height(), 1); assert_eq!( - block.header.inner_lite.prev_state_root, - merklize(&vec![MerkleHash::default()]).0 + block.header.prev_state_root(), + &merklize(&vec![MerkleHash::default()]).0 ); System::current().stop(); } @@ -379,6 +381,7 @@ fn invalid_blocks() { let signer = InMemoryValidatorSigner::from_seed("test", KeyType::ED25519, "test"); // Send block with invalid chunk mask let mut block = Block::produce( + PROTOCOL_VERSION, &last_block.header.clone().into(), last_block.header.height + 1, last_block.chunks.iter().cloned().map(Into::into).collect(), @@ -398,7 +401,7 @@ fn invalid_blocks() { last_block.header.next_bp_hash, CryptoHash::default(), ); - block.header.inner_rest.chunk_mask = vec![]; + block.header.mut_header().inner_rest.chunk_mask = vec![]; client.do_send(NetworkClientMessages::Block( block.clone(), PeerInfo::random().id, @@ -408,6 +411,7 @@ fn invalid_blocks() { // Send proper block. block_merkle_tree.insert(last_block.header.hash); let block2 = Block::produce( + PROTOCOL_VERSION, &last_block.header.clone().into(), last_block.header.height + 1, last_block.chunks.into_iter().map(Into::into).collect(), @@ -449,7 +453,7 @@ fn skip_block_production() { Box::new(move |msg, _ctx, _client_actor| { match msg { NetworkRequests::Block { block } => { - if block.header.inner_lite.height > 3 { + if block.header.height() > 3 { System::current().stop(); } } @@ -559,7 +563,7 @@ fn test_process_invalid_tx() { public_key: signer.public_key(), nonce: 0, receiver_id: "".to_string(), - block_hash: client.chain.genesis().hash(), + block_hash: *client.chain.genesis().hash(), actions: vec![], }, ); @@ -605,15 +609,9 @@ fn test_time_attack() { let signer = InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1"); let genesis = client.chain.get_block_by_height(0).unwrap(); let mut b1 = Block::empty_with_height(genesis, 1, &signer); - b1.header.inner_lite.timestamp = + b1.header.mut_header().inner_lite.timestamp = to_timestamp(b1.header.timestamp() + chrono::Duration::seconds(60)); - let (hash, signature) = signer.sign_block_header_parts( - b1.header.prev_hash, - &b1.header.inner_lite, - &b1.header.inner_rest, - ); - b1.header.hash = hash; - b1.header.signature = signature; + b1.header.resign(&signer); let _ = client.process_block(b1, Provenance::NONE); @@ -642,7 +640,7 @@ fn test_invalid_approvals() { let signer = InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1"); let genesis = client.chain.get_block_by_height(0).unwrap(); let mut b1 = Block::empty_with_height(genesis, 1, &signer); - b1.header.inner_rest.approvals = (0..100) + b1.header.mut_header().inner_rest.approvals = (0..100) .map(|i| { Some( InMemoryValidatorSigner::from_seed( @@ -650,17 +648,12 @@ fn test_invalid_approvals() { KeyType::ED25519, &format!("test{}", i), ) - .sign_approval(&ApprovalInner::Endorsement(genesis.hash()), 1), + .sign_approval(&ApprovalInner::Endorsement(*genesis.hash()), 1), ) }) .collect(); - let (hash, signature) = signer.sign_block_header_parts( - b1.header.prev_hash, - &b1.header.inner_lite, - &b1.header.inner_rest, - ); - b1.header.hash = hash; - b1.header.signature = signature; + b1.header.resign(&signer); + let (_, tip) = client.process_block(b1, Provenance::NONE); match tip { Err(e) => match e.kind() { @@ -699,14 +692,8 @@ fn test_invalid_gas_price() { let signer = InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1"); let genesis = client.chain.get_block_by_height(0).unwrap(); let mut b1 = Block::empty_with_height(genesis, 1, &signer); - b1.header.inner_rest.gas_price = 0; - let (hash, signature) = signer.sign_block_header_parts( - b1.header.prev_hash, - &b1.header.inner_lite, - &b1.header.inner_rest, - ); - b1.header.hash = hash; - b1.header.signature = signature; + b1.header.mut_header().inner_rest.gas_price = 0; + b1.header.resign(&signer); let (_, result) = client.process_block(b1, Provenance::NONE); match result { @@ -746,7 +733,7 @@ fn test_minimum_gas_price() { env.produce_block(0, i); } let block = env.clients[0].chain.get_block_by_height(100).unwrap(); - assert!(block.header.inner_rest.gas_price >= min_gas_price); + assert!(block.header.gas_price() >= min_gas_price); } fn test_gc_with_epoch_length_common(epoch_length: NumBlocks) { @@ -772,7 +759,7 @@ fn test_gc_with_epoch_length_common(epoch_length: NumBlocks) { for i in 1..=epoch_length * (NUM_EPOCHS_TO_KEEP_STORE_DATA + 1) { println!("height = {}", i); if i < epoch_length { - let block_hash = blocks[i as usize - 1].hash(); + let block_hash = *blocks[i as usize - 1].hash(); assert!(matches!( env.clients[0].chain.get_block(&block_hash).unwrap_err().kind(), ErrorKind::BlockMissing(missing_block_hash) if missing_block_hash == block_hash @@ -852,7 +839,7 @@ fn test_gc_long_epoch() { assert!(env.clients[0] .chain .mut_store() - .get_all_block_hashes_by_height(block.header.inner_lite.height) + .get_all_block_hashes_by_height(block.header.height()) .is_ok()); } assert!(check_refcount_map(&mut env.clients[0].chain).is_ok()); @@ -890,7 +877,7 @@ fn test_tx_forwarding() { chain_genesis.epoch_length = 100; let mut env = TestEnv::new(chain_genesis, 50, 50); let genesis_block = env.clients[0].chain.get_block_by_height(0).unwrap(); - let genesis_hash = genesis_block.hash(); + let genesis_hash = *genesis_block.hash(); // forward to 2 chunk producers env.clients[0].process_tx(SignedTransaction::empty(genesis_hash), false, false); assert_eq!(env.network_adapters[0].requests.read().unwrap().len(), 4); @@ -902,7 +889,7 @@ fn test_tx_forwarding_no_double_forwarding() { chain_genesis.epoch_length = 100; let mut env = TestEnv::new(chain_genesis, 50, 50); let genesis_block = env.clients[0].chain.get_block_by_height(0).unwrap(); - let genesis_hash = genesis_block.hash(); + let genesis_hash = *genesis_block.hash(); env.clients[0].process_tx(SignedTransaction::empty(genesis_hash), true, false); assert!(env.network_adapters[0].requests.read().unwrap().is_empty()); } @@ -932,7 +919,7 @@ fn test_tx_forward_around_epoch_boundary() { chain_genesis.epoch_length = epoch_length; chain_genesis.gas_limit = genesis.config.gas_limit; let mut env = TestEnv::new_with_runtime(chain_genesis, 3, 2, runtimes); - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); let signer = InMemorySigner::from_seed("test1", KeyType::ED25519, "test1"); let tx = SignedTransaction::stake( 1, @@ -1041,17 +1028,14 @@ fn test_gc_tail_update() { // simulate save sync hash block let prev_sync_block = blocks[blocks.len() - 3].clone(); let sync_block = blocks[blocks.len() - 2].clone(); - env.clients[1].chain.reset_data_pre_state_sync(sync_block.hash()).unwrap(); + env.clients[1].chain.reset_data_pre_state_sync(*sync_block.hash()).unwrap(); env.clients[1].chain.save_block(&sync_block).unwrap(); env.clients[1] .chain - .reset_heads_post_state_sync(&None, sync_block.hash(), |_| {}, |_| {}, |_| {}) + .reset_heads_post_state_sync(&None, *sync_block.hash(), |_| {}, |_| {}, |_| {}) .unwrap(); env.process_block(1, blocks.pop().unwrap(), Provenance::NONE); - assert_eq!( - env.clients[1].chain.store().tail().unwrap(), - prev_sync_block.header.inner_lite.height - ); + assert_eq!(env.clients[1].chain.store().tail().unwrap(), prev_sync_block.header.height()); assert!(check_refcount_map(&mut env.clients[0].chain).is_ok()); assert!(check_refcount_map(&mut env.clients[1].chain).is_ok()); } @@ -1102,7 +1086,7 @@ fn test_gas_price_change() { ))]; let mut env = TestEnv::new_with_runtime(chain_genesis, 1, 1, runtimes); let genesis_block = env.clients[0].chain.get_block_by_height(0).unwrap(); - let genesis_hash = genesis_block.hash(); + let genesis_hash = *genesis_block.hash(); let signer = InMemorySigner::from_seed("test1", KeyType::ED25519, "test1"); let tx = SignedTransaction::send_money( 1, @@ -1135,14 +1119,8 @@ fn test_invalid_block_root() { let mut env = TestEnv::new(ChainGenesis::test(), 1, 1); let mut b1 = env.clients[0].produce_block(1).unwrap().unwrap(); let signer = InMemoryValidatorSigner::from_seed("test0", KeyType::ED25519, "test0"); - b1.header.inner_lite.block_merkle_root = CryptoHash::default(); - let (hash, signature) = signer.sign_block_header_parts( - b1.header.prev_hash, - &b1.header.inner_lite, - &b1.header.inner_rest, - ); - b1.header.hash = hash; - b1.header.signature = signature; + b1.header.mut_header().inner_lite.block_merkle_root = CryptoHash::default(); + b1.header.resign(&signer); let (_, tip) = env.clients[0].process_block(b1, Provenance::NONE); match tip { Err(e) => match e.kind() { diff --git a/chain/client/tests/query_client.rs b/chain/client/tests/query_client.rs index 6906d3f1c48..b86df392b71 100644 --- a/chain/client/tests/query_client.rs +++ b/chain/client/tests/query_client.rs @@ -7,9 +7,10 @@ use near_crypto::KeyType; use near_logger_utils::init_test_logger; use near_network::{NetworkClientMessages, PeerInfo}; use near_primitives::block::{Block, BlockHeader}; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{BlockIdOrFinality, EpochId}; use near_primitives::utils::to_timestamp; -use near_primitives::validator_signer::{InMemoryValidatorSigner, ValidatorSigner}; +use near_primitives::validator_signer::InMemoryValidatorSigner; use near_primitives::views::{QueryRequest, QueryResponseKind}; use num_rational::Rational; @@ -49,8 +50,9 @@ fn query_status_not_crash() { actix::spawn(view_client.send(GetBlockWithMerkleTree::latest()).then(move |res| { let (block, mut block_merkle_tree) = res.unwrap().unwrap(); let header: BlockHeader = block.header.clone().into(); - block_merkle_tree.insert(header.hash); + block_merkle_tree.insert(*header.hash()); let mut next_block = Block::produce( + PROTOCOL_VERSION, &header, block.header.height + 1, block.chunks.into_iter().map(|c| c.into()).collect(), @@ -66,15 +68,10 @@ fn query_status_not_crash() { block.header.next_bp_hash, block_merkle_tree.root(), ); - next_block.header.inner_lite.timestamp = + next_block.header.mut_header().inner_lite.timestamp = to_timestamp(next_block.header.timestamp() + chrono::Duration::seconds(60)); - let (hash, signature) = signer.sign_block_header_parts( - next_block.header.prev_hash, - &next_block.header.inner_lite, - &next_block.header.inner_rest, - ); - next_block.header.hash = hash; - next_block.header.signature = signature; + next_block.header.resign(&signer); + actix::spawn( client .send(NetworkClientMessages::Block(next_block, PeerInfo::random().id, false)) diff --git a/chain/epoch_manager/Cargo.toml b/chain/epoch_manager/Cargo.toml index 73afbdb8810..0fab11b3d04 100644 --- a/chain/epoch_manager/Cargo.toml +++ b/chain/epoch_manager/Cargo.toml @@ -17,7 +17,6 @@ serde_json = "1" primitive-types = { version = "0.7", default-features = false } num-rational = "0.2.4" -near-chain-configs = { path = "../../core/chain-configs" } near-crypto = { path = "../../core/crypto" } near-primitives = { path = "../../core/primitives" } near-chain = { path = "../chain" } diff --git a/chain/epoch_manager/src/lib.rs b/chain/epoch_manager/src/lib.rs index 599fd442ff9..34038e6b2fa 100644 --- a/chain/epoch_manager/src/lib.rs +++ b/chain/epoch_manager/src/lib.rs @@ -1057,9 +1057,9 @@ mod tests { use num_rational::Rational; - use near_chain_configs::PROTOCOL_VERSION; use near_primitives::challenge::SlashedValidator; use near_primitives::hash::hash; + use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::ValidatorKickoutReason::NotEnoughBlocks; use near_store::test_utils::create_test_store; diff --git a/chain/epoch_manager/src/test_utils.rs b/chain/epoch_manager/src/test_utils.rs index cb8b0ff6229..faae9f1af78 100644 --- a/chain/epoch_manager/src/test_utils.rs +++ b/chain/epoch_manager/src/test_utils.rs @@ -2,10 +2,10 @@ use std::collections::{BTreeMap, HashMap}; use num_rational::Rational; -use near_chain_configs::PROTOCOL_VERSION; use near_crypto::{KeyType, SecretKey}; use near_primitives::challenge::SlashedValidator; use near_primitives::hash::{hash, CryptoHash}; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{ AccountId, Balance, BlockHeight, BlockHeightDelta, EpochHeight, NumSeats, NumShards, ValidatorId, ValidatorKickoutReason, ValidatorStake, diff --git a/chain/epoch_manager/src/types.rs b/chain/epoch_manager/src/types.rs index 924cef36c89..01ebbd06922 100644 --- a/chain/epoch_manager/src/types.rs +++ b/chain/epoch_manager/src/types.rs @@ -5,9 +5,9 @@ use borsh::{BorshDeserialize, BorshSerialize}; use num_rational::Rational; use serde::Serialize; -use near_chain_configs::ProtocolVersion; use near_primitives::challenge::SlashedValidator; use near_primitives::hash::CryptoHash; +use near_primitives::protocol_version::ProtocolVersion; use near_primitives::serialize::to_base; use near_primitives::types::{ AccountId, Balance, BlockChunkValidatorStats, BlockHeight, BlockHeightDelta, EpochHeight, diff --git a/chain/jsonrpc/tests/rpc_query.rs b/chain/jsonrpc/tests/rpc_query.rs index 4b80f642ebb..109a1a5672c 100644 --- a/chain/jsonrpc/tests/rpc_query.rs +++ b/chain/jsonrpc/tests/rpc_query.rs @@ -3,7 +3,6 @@ use std::convert::TryFrom; use actix::{Actor, System}; use futures::{future, FutureExt}; -use near_chain_configs::PROTOCOL_VERSION; use near_crypto::{KeyType, PublicKey, Signature}; use near_jsonrpc::client::new_client; use near_jsonrpc_client::ChunkId; @@ -11,6 +10,7 @@ use near_logger_utils::init_test_logger; use near_network::test_utils::WaitOrTimeout; use near_primitives::account::{AccessKey, AccessKeyPermission}; use near_primitives::hash::CryptoHash; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::rpc::{RpcGenesisRecordsRequest, RpcPagination, RpcQueryRequest}; use near_primitives::types::{BlockId, BlockIdOrFinality, Finality, ShardId}; use near_primitives::views::{QueryRequest, QueryResponseKind}; diff --git a/chain/network/src/peer.rs b/chain/network/src/peer.rs index c2665112e91..9088e8ef18f 100644 --- a/chain/network/src/peer.rs +++ b/chain/network/src/peer.rs @@ -10,11 +10,11 @@ use actix::{ }; use tracing::{debug, error, info, warn}; -use near_chain_configs::PROTOCOL_VERSION; use near_metrics; use near_primitives::block::GenesisId; use near_primitives::hash::CryptoHash; use near_primitives::network::PeerId; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::unwrap_option_or_return; use near_primitives::utils::DisplayOption; @@ -108,16 +108,16 @@ impl Tracker { self.sent_bytes.increment(size); } - fn has_received(&self, hash: CryptoHash) -> bool { - self.received.contains(&hash) + fn has_received(&self, hash: &CryptoHash) -> bool { + self.received.contains(hash) } fn push_received(&mut self, hash: CryptoHash) { self.received.push(hash); } - fn has_request(&self, hash: CryptoHash) -> bool { - self.requested.contains(&hash) + fn has_request(&self, hash: &CryptoHash) -> bool { + self.requested.contains(hash) } fn push_request(&mut self, hash: CryptoHash) { @@ -410,11 +410,10 @@ impl Peer { let network_client_msg = match msg { PeerMessage::Block(block) => { near_metrics::inc_counter(&metrics::PEER_BLOCK_RECEIVED_TOTAL); - let block_hash = block.hash(); + let block_hash = *block.hash(); self.tracker.push_received(block_hash); - self.chain_info.height = - max(self.chain_info.height, block.header.inner_lite.height); - NetworkClientMessages::Block(block, peer_id, self.tracker.has_request(block_hash)) + self.chain_info.height = max(self.chain_info.height, block.header.height()); + NetworkClientMessages::Block(block, peer_id, self.tracker.has_request(&block_hash)) } PeerMessage::Transaction(transaction) => { near_metrics::inc_counter(&metrics::PEER_TRANSACTION_RECEIVED_TOTAL); diff --git a/chain/network/src/recorder.rs b/chain/network/src/recorder.rs index 381bef939b6..c6b73f38b97 100644 --- a/chain/network/src/recorder.rs +++ b/chain/network/src/recorder.rs @@ -205,7 +205,7 @@ impl From<&PeerMessage> for PeerMessageMetadata { fn from(msg: &PeerMessage) -> Self { let hash = match msg { PeerMessage::Challenge(challenge) => Some(challenge.hash), - PeerMessage::Block(block) => Some(block.hash()), + PeerMessage::Block(block) => Some(*block.hash()), _ => None, }; diff --git a/chain/network/src/types.rs b/chain/network/src/types.rs index 11a4ddbdef0..9bbb84256e4 100644 --- a/chain/network/src/types.rs +++ b/chain/network/src/types.rs @@ -17,7 +17,6 @@ use tracing::{error, warn}; use near_chain::types::ShardStateSyncResponse; use near_chain::{Block, BlockHeader}; -use near_chain_configs::PROTOCOL_VERSION; use near_crypto::{PublicKey, SecretKey, Signature}; use near_metrics; use near_primitives::block::{Approval, ApprovalMessage, GenesisId}; @@ -25,6 +24,7 @@ use near_primitives::challenge::Challenge; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::network::{AnnounceAccount, PeerId}; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::sharding::{ ChunkHash, PartialEncodedChunk, PartialEncodedChunkPart, ReceiptProof, }; diff --git a/chain/network/tests/runner/mod.rs b/chain/network/tests/runner/mod.rs index 8d4c0b1ebdb..13684ab1808 100644 --- a/chain/network/tests/runner/mod.rs +++ b/chain/network/tests/runner/mod.rs @@ -10,7 +10,7 @@ use futures::{future, FutureExt, TryFutureExt}; use near_chain::test_utils::KeyValueRuntime; use near_chain::ChainGenesis; -use near_chain_configs::{ClientConfig, PROTOCOL_VERSION}; +use near_chain_configs::ClientConfig; use near_client::{ClientActor, ViewClientActor}; use near_crypto::KeyType; use near_logger_utils::init_test_logger; @@ -23,6 +23,7 @@ use near_network::utils::blacklist_from_iter; use near_network::{ NetworkConfig, NetworkRecipient, NetworkRequests, NetworkResponses, PeerInfo, PeerManagerActor, }; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{AccountId, ValidatorId}; use near_primitives::validator_signer::InMemoryValidatorSigner; use near_store::test_utils::create_test_store; diff --git a/core/primitives/src/block_header.rs b/core/primitives/src/block_header.rs index bf3b6b5fac8..34d81022a61 100644 --- a/core/primitives/src/block_header.rs +++ b/core/primitives/src/block_header.rs @@ -206,39 +206,27 @@ pub enum BlockHeader { } impl BlockHeader { - pub fn compute_inner_hash(inner_lite: &T, inner_rest: &[u8]) -> CryptoHash { - let hash_lite = hash(&inner_lite.try_to_vec().expect("Failed to serialize")); + pub fn compute_inner_hash(inner_lite: &[u8], inner_rest: &[u8]) -> CryptoHash { + let hash_lite = hash(inner_lite); let hash_rest = hash(inner_rest); combine_hash(hash_lite, hash_rest) } - // &inner_rest.try_to_vec().expect("Failed to serialize") - pub fn compute_hash( - prev_hash: CryptoHash, - inner_lite: &T, - inner_rest: &[u8], - ) -> CryptoHash { + pub fn compute_hash(prev_hash: CryptoHash, inner_lite: &[u8], inner_rest: &[u8]) -> CryptoHash { let hash_inner = BlockHeader::compute_inner_hash(inner_lite, inner_rest); return combine_hash(hash_inner, prev_hash); } pub fn init(&mut self) { + let hash = BlockHeader::compute_hash( + *self.prev_hash(), + &self.inner_lite_bytes(), + &self.inner_rest_bytes(), + ); match self { - BlockHeader::BlockHeaderV1(header) => { - header.hash = BlockHeader::compute_hash( - header.prev_hash, - &header.inner_lite, - &header.inner_rest.try_to_vec().expect("Failed to serialize"), - ) - } - BlockHeader::BlockHeaderV2(header) => { - header.hash = BlockHeader::compute_hash( - header.prev_hash, - &header.inner_lite, - &header.inner_rest.try_to_vec().expect("Failed to serialize"), - ) - } + BlockHeader::BlockHeaderV1(header) => header.hash = hash, + BlockHeader::BlockHeaderV2(header) => header.hash = hash, } } @@ -299,7 +287,7 @@ impl BlockHeader { }; let (hash, signature) = signer.sign_block_header_parts( prev_hash, - &inner_lite, + &inner_lite.try_to_vec().expect("Failed to serialize"), &inner_rest.try_to_vec().expect("Failed to serialize"), ); Self::BlockHeaderV1(BlockHeaderV1 { @@ -330,7 +318,7 @@ impl BlockHeader { }; let (hash, signature) = signer.sign_block_header_parts( prev_hash, - &inner_lite, + &inner_lite.try_to_vec().expect("Failed to serialize"), &inner_rest.try_to_vec().expect("Failed to serialize"), ); Self::BlockHeaderV2(BlockHeaderV2 { @@ -385,7 +373,7 @@ impl BlockHeader { }; let hash = BlockHeader::compute_hash( CryptoHash::default(), - &inner_lite, + &inner_lite.try_to_vec().expect("Failed to serialize"), &inner_rest.try_to_vec().expect("Failed to serialize"), ); // Genesis always has v1 of BlockHeader. @@ -592,6 +580,28 @@ impl BlockHeader { BlockHeader::BlockHeaderV2(header) => header.inner_rest.latest_protocol_version, } } + + pub fn inner_lite_bytes(&self) -> Vec { + match self { + BlockHeader::BlockHeaderV1(header) => { + header.inner_lite.try_to_vec().expect("Failed to serialize") + } + BlockHeader::BlockHeaderV2(header) => { + header.inner_lite.try_to_vec().expect("Failed to serialize") + } + } + } + + pub fn inner_rest_bytes(&self) -> Vec { + match self { + BlockHeader::BlockHeaderV1(header) => { + header.inner_rest.try_to_vec().expect("Failed to serialize") + } + BlockHeader::BlockHeaderV2(header) => { + header.inner_rest.try_to_vec().expect("Failed to serialize") + } + } + } } //impl BorshSerialize for BlockHeader { diff --git a/core/primitives/src/test_utils.rs b/core/primitives/src/test_utils.rs index 21f4bbd407c..cd11cc313f2 100644 --- a/core/primitives/src/test_utils.rs +++ b/core/primitives/src/test_utils.rs @@ -2,6 +2,7 @@ use near_crypto::{EmptySigner, PublicKey, Signature, Signer}; use crate::account::{AccessKey, AccessKeyPermission, Account}; use crate::block::Block; +use crate::block_header::{BlockHeader, BlockHeaderV2}; use crate::hash::CryptoHash; use crate::merkle::PartialMerkleTree; use crate::protocol_version::PROTOCOL_VERSION; @@ -239,6 +240,26 @@ impl SignedTransaction { } } +impl BlockHeader { + pub fn mut_header(&mut self) -> &mut BlockHeaderV2 { + match self { + BlockHeader::BlockHeaderV2(header) => header, + _ => panic!("Invalid block header version"), + } + } + + pub fn resign(&mut self, signer: &dyn ValidatorSigner) { + let (hash, signature) = signer.sign_block_header_parts( + *self.prev_hash(), + &self.inner_lite_bytes(), + &self.inner_rest_bytes(), + ); + let mut header = self.mut_header(); + header.hash = hash; + header.signature = signature; + } +} + impl Block { pub fn empty_with_epoch( prev: &Block, diff --git a/core/primitives/src/validator_signer.rs b/core/primitives/src/validator_signer.rs index 709056afc8f..4539338d423 100644 --- a/core/primitives/src/validator_signer.rs +++ b/core/primitives/src/validator_signer.rs @@ -5,7 +5,7 @@ use borsh::BorshSerialize; use near_crypto::{InMemorySigner, KeyType, PublicKey, Signature, Signer}; -use crate::block::{Approval, ApprovalInner, BlockHeader, BlockHeaderInnerLite}; +use crate::block::{Approval, ApprovalInner, BlockHeader}; use crate::challenge::ChallengeBody; use crate::hash::{hash, CryptoHash}; use crate::network::{AnnounceAccount, PeerId}; @@ -28,7 +28,7 @@ pub trait ValidatorSigner: Sync + Send { fn sign_block_header_parts( &self, prev_hash: CryptoHash, - inner_lite: &BlockHeaderInnerLite, + inner_lite: &[u8], inner_rest: &[u8], ) -> (CryptoHash, Signature); @@ -84,7 +84,7 @@ impl ValidatorSigner for EmptyValidatorSigner { fn sign_block_header_parts( &self, prev_hash: CryptoHash, - inner_lite: &BlockHeaderInnerLite, + inner_lite: &[u8], inner_rest: &[u8], ) -> (CryptoHash, Signature) { let hash = BlockHeader::compute_hash(prev_hash, inner_lite, inner_rest); @@ -180,7 +180,7 @@ impl ValidatorSigner for InMemoryValidatorSigner { fn sign_block_header_parts( &self, prev_hash: CryptoHash, - inner_lite: &BlockHeaderInnerLite, + inner_lite: &[u8], inner_rest: &[u8], ) -> (CryptoHash, Signature) { let hash = BlockHeader::compute_hash(prev_hash, inner_lite, inner_rest); diff --git a/core/primitives/src/views.rs b/core/primitives/src/views.rs index 04737f9969b..e448682f664 100644 --- a/core/primitives/src/views.rs +++ b/core/primitives/src/views.rs @@ -15,11 +15,13 @@ use near_crypto::{PublicKey, Signature}; use crate::account::{AccessKey, AccessKeyPermission, Account, FunctionCallPermission}; use crate::block::{Block, BlockHeader}; +use crate::block_header::{BlockHeaderInnerLite, BlockHeaderInnerRestV2, BlockHeaderV2}; use crate::challenge::{Challenge, ChallengesResult}; use crate::errors::TxExecutionError; use crate::hash::{hash, CryptoHash}; use crate::logging; use crate::merkle::MerklePath; +use crate::protocol_version::ProtocolVersion; use crate::receipt::{ActionReceipt, DataReceipt, DataReceiver, Receipt, ReceiptEnum}; use crate::rpc::RpcPagination; use crate::serialize::{ @@ -34,8 +36,8 @@ use crate::transaction::{ FunctionCallAction, SignedTransaction, StakeAction, TransferAction, }; use crate::types::{ - AccountId, AccountWithPublicKey, Balance, BlockHeight, FunctionArgs, Gas, Nonce, NumBlocks, - ShardId, StateChangeCause, StateChangeKind, StateChangeValue, StateChangeWithCause, + AccountId, AccountWithPublicKey, Balance, BlockHeight, EpochId, FunctionArgs, Gas, Nonce, + NumBlocks, ShardId, StateChangeCause, StateChangeKind, StateChangeValue, StateChangeWithCause, StateChangesRequest, StateRoot, StorageUsage, StoreKey, StoreValue, ValidatorKickoutReason, ValidatorStake, Version, }; @@ -345,6 +347,7 @@ pub struct BlockHeaderView { pub block_merkle_root: CryptoHash, pub approvals: Vec>, pub signature: Signature, + pub latest_protocol_version: ProtocolVersion, } impl From for BlockHeaderView { @@ -381,51 +384,53 @@ impl From for BlockHeaderView { block_merkle_root: header.block_merkle_root().clone(), approvals: header.approvals().to_vec(), signature: header.signature().clone(), + latest_protocol_version: header.latest_protocol_version(), } } } -//impl From for BlockHeader { -// fn from(view: BlockHeaderView) -> Self { -// let mut header = Self { -// prev_hash: view.prev_hash, -// inner_lite: BlockHeaderInnerLite { -// height: view.height, -// epoch_id: EpochId(view.epoch_id), -// next_epoch_id: EpochId(view.next_epoch_id), -// prev_state_root: view.prev_state_root, -// outcome_root: view.outcome_root, -// timestamp: view.timestamp, -// next_bp_hash: view.next_bp_hash, -// block_merkle_root: view.block_merkle_root, -// }, -// inner_rest: BlockHeaderInnerRestV2 { -// chunk_receipts_root: view.chunk_receipts_root, -// chunk_headers_root: view.chunk_headers_root, -// chunk_tx_root: view.chunk_tx_root, -// chunks_included: view.chunks_included, -// challenges_root: view.challenges_root, -// random_value: view.random_value, -// validator_proposals: view -// .validator_proposals -// .into_iter() -// .map(|v| v.into()) -// .collect(), -// chunk_mask: view.chunk_mask, -// gas_price: view.gas_price, -// total_supply: view.total_supply, -// challenges_result: view.challenges_result, -// last_final_block: view.last_final_block, -// last_ds_final_block: view.last_ds_final_block, -// approvals: view.approvals.clone(), -// }, -// signature: view.signature, -// hash: CryptoHash::default(), -// }; -// header.init(); -// header -// } -//} +impl From for BlockHeader { + fn from(view: BlockHeaderView) -> Self { + let mut header = BlockHeader::BlockHeaderV2(BlockHeaderV2 { + prev_hash: view.prev_hash, + inner_lite: BlockHeaderInnerLite { + height: view.height, + epoch_id: EpochId(view.epoch_id), + next_epoch_id: EpochId(view.next_epoch_id), + prev_state_root: view.prev_state_root, + outcome_root: view.outcome_root, + timestamp: view.timestamp, + next_bp_hash: view.next_bp_hash, + block_merkle_root: view.block_merkle_root, + }, + inner_rest: BlockHeaderInnerRestV2 { + chunk_receipts_root: view.chunk_receipts_root, + chunk_headers_root: view.chunk_headers_root, + chunk_tx_root: view.chunk_tx_root, + chunks_included: view.chunks_included, + challenges_root: view.challenges_root, + random_value: view.random_value, + validator_proposals: view + .validator_proposals + .into_iter() + .map(|v| v.into()) + .collect(), + chunk_mask: view.chunk_mask, + gas_price: view.gas_price, + total_supply: view.total_supply, + challenges_result: view.challenges_result, + last_final_block: view.last_final_block, + last_ds_final_block: view.last_ds_final_block, + approvals: view.approvals.clone(), + latest_protocol_version: view.latest_protocol_version, + }, + signature: view.signature, + hash: CryptoHash::default(), + }); + header.init(); + header + } +} #[derive(Serialize, Debug, Clone, BorshDeserialize, BorshSerialize)] pub struct BlockHeaderInnerLiteView { diff --git a/genesis-tools/genesis-csv-to-json/src/csv_to_json_configs.rs b/genesis-tools/genesis-csv-to-json/src/csv_to_json_configs.rs index be0ac724073..a7695d8e29b 100644 --- a/genesis-tools/genesis-csv-to-json/src/csv_to_json_configs.rs +++ b/genesis-tools/genesis-csv-to-json/src/csv_to_json_configs.rs @@ -1,7 +1,8 @@ use std::fs::File; use std::path::Path; -use near_chain_configs::{Genesis, GenesisConfig, GENESIS_CONFIG_VERSION, PROTOCOL_VERSION}; +use near_chain_configs::{Genesis, GenesisConfig, GENESIS_CONFIG_VERSION}; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{Balance, NumShards, ShardId}; use near_primitives::utils::get_num_seats_per_shard; use neard::config::{ diff --git a/genesis-tools/genesis-populate/src/lib.rs b/genesis-tools/genesis-populate/src/lib.rs index 7693ba8bca2..1491378a8c2 100644 --- a/genesis-tools/genesis-populate/src/lib.rs +++ b/genesis-tools/genesis-populate/src/lib.rs @@ -9,6 +9,7 @@ use std::sync::Arc; use borsh::BorshSerialize; use indicatif::{ProgressBar, ProgressStyle}; +use near_chain::types::BlockHeaderInfo; use near_chain::{Block, Chain, ChainStore, RuntimeAdapter, Tip}; use near_chain_configs::Genesis; use near_crypto::{InMemorySigner, KeyType}; @@ -199,20 +200,7 @@ impl GenesisBuilder { let mut store = ChainStore::new(self.store.clone(), self.genesis.config.genesis_height); let mut store_update = store.store_update(); - self.runtime - .add_validator_proposals( - CryptoHash::default(), - genesis.hash(), - genesis.header.inner_rest.random_value, - genesis.header.inner_lite.height, - 0, - vec![], - vec![], - vec![], - self.genesis.config.total_supply.clone(), - self.genesis.config.protocol_version, - ) - .unwrap(); + self.runtime.add_validator_proposals(BlockHeaderInfo::new(&genesis.header, 0)).unwrap(); store_update .save_block_header(genesis.header.clone()) .expect("save genesis block header shouldn't fail"); diff --git a/neard/src/config.rs b/neard/src/config.rs index f79e77a6b4b..63e31122ca5 100644 --- a/neard/src/config.rs +++ b/neard/src/config.rs @@ -12,9 +12,7 @@ use log::info; use num_rational::Rational; use serde::{Deserialize, Serialize}; -use near_chain_configs::{ - ClientConfig, Genesis, GenesisConfig, GENESIS_CONFIG_VERSION, PROTOCOL_VERSION, -}; +use near_chain_configs::{ClientConfig, Genesis, GenesisConfig, GENESIS_CONFIG_VERSION}; use near_crypto::{InMemorySigner, KeyFile, KeyType, PublicKey, Signer}; use near_jsonrpc::RpcConfig; use near_network::test_utils::open_port; @@ -23,6 +21,7 @@ use near_network::utils::blacklist_from_iter; use near_network::NetworkConfig; use near_primitives::account::{AccessKey, Account}; use near_primitives::hash::CryptoHash; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::state_record::StateRecord; use near_primitives::types::{ AccountId, AccountInfo, Balance, BlockHeightDelta, Gas, NumBlocks, NumSeats, NumShards, ShardId, diff --git a/neard/src/runtime.rs b/neard/src/runtime.rs index 37b8d004d06..c552c190b10 100644 --- a/neard/src/runtime.rs +++ b/neard/src/runtime.rs @@ -13,13 +13,13 @@ use log::{debug, error, warn}; use near_chain::chain::NUM_EPOCHS_TO_KEEP_STORE_DATA; use near_chain::types::{ApplyTransactionResult, BlockHeaderInfo}; use near_chain::{BlockHeader, Error, ErrorKind, RuntimeAdapter}; -use near_chain_configs::{Genesis, ProtocolVersion}; +use near_chain_configs::Genesis; use near_crypto::{PublicKey, Signature}; use near_epoch_manager::{BlockInfo, EpochConfig, EpochError, EpochManager, RewardCalculator}; use near_pool::types::PoolIterator; use near_primitives::account::{AccessKey, Account}; use near_primitives::block::{Approval, ApprovalInner}; -use near_primitives::challenge::{ChallengesResult, SlashedValidator}; +use near_primitives::challenge::ChallengesResult; use near_primitives::errors::{InvalidTxError, RuntimeError}; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::receipt::Receipt; @@ -416,8 +416,8 @@ impl RuntimeAdapter for NightshadeRuntime { fn verify_block_signature(&self, header: &BlockHeader) -> Result<(), Error> { let mut epoch_manager = self.epoch_manager.write().expect(POISONED_LOCK_ERR); - let validator = epoch_manager - .get_block_producer_info(&header.inner_lite.epoch_id, header.inner_lite.height)?; + let validator = + epoch_manager.get_block_producer_info(&header.epoch_id(), header.height())?; if !header.verify_block_producer(&validator.public_key) { return Err(ErrorKind::InvalidBlockProposer.into()); } @@ -573,16 +573,16 @@ impl RuntimeAdapter for NightshadeRuntime { fn verify_header_signature(&self, header: &BlockHeader) -> Result { let mut epoch_manager = self.epoch_manager.write().expect(POISONED_LOCK_ERR); - let block_producer = epoch_manager - .get_block_producer_info(&header.inner_lite.epoch_id, header.inner_lite.height)?; - let slashed = match epoch_manager.get_slashed_validators(&header.prev_hash) { + let block_producer = + epoch_manager.get_block_producer_info(&header.epoch_id(), header.height())?; + let slashed = match epoch_manager.get_slashed_validators(header.prev_hash()) { Ok(slashed) => slashed, - Err(_) => return Err(EpochError::MissingBlock(header.prev_hash).into()), + Err(_) => return Err(EpochError::MissingBlock(*header.prev_hash()).into()), }; if slashed.contains_key(&block_producer.account_id) { return Ok(false); } - Ok(header.signature.verify(header.hash.as_ref(), &block_producer.public_key)) + Ok(header.signature().verify(header.hash().as_ref(), &block_producer.public_key)) } fn verify_chunk_header_signature(&self, header: &ShardChunkHeader) -> Result { @@ -831,24 +831,28 @@ impl RuntimeAdapter for NightshadeRuntime { fn add_validator_proposals(&self, block_header_info: BlockHeaderInfo) -> Result<(), Error> { // Check that genesis block doesn't have any proposals. - assert!(height > 0 || (proposals.is_empty() && slashed_validators.is_empty())); - debug!(target: "runtime", "add validator proposals at block height {} {:?}", height, proposals); + assert!( + block_header_info.height > 0 + || (block_header_info.proposals.is_empty() + && block_header_info.slashed_validators.is_empty()) + ); + debug!(target: "runtime", "add validator proposals at block height {} {:?}", block_header_info.height, block_header_info.proposals); // Deal with validator proposals and epoch finishing. let mut epoch_manager = self.epoch_manager.write().expect(POISONED_LOCK_ERR); let block_info = BlockInfo::new( block_header_info.height, block_header_info.last_finalized_height, - block_header_info.parent_hash, + block_header_info.prev_hash, block_header_info.proposals, block_header_info.chunk_mask, block_header_info.slashed_validators, block_header_info.total_supply, - block_header_info.protocol_version, + block_header_info.latest_protocol_version, ); - let rng_seed = (block_header_info.rng_seed.0).0; + let rng_seed = (block_header_info.random_value.0).0; // TODO: don't commit here, instead contribute to upstream store update. epoch_manager - .record_block_info(¤t_hash, block_info, rng_seed)? + .record_block_info(&block_header_info.hash, block_info, rng_seed)? .commit() .map_err(|err| err.into()) } @@ -1248,6 +1252,7 @@ mod test { use near_chain::{ReceiptResult, Tip}; use near_crypto::{InMemorySigner, KeyType, Signer}; use near_logger_utils::init_test_logger; + use near_primitives::challenge::SlashedValidator; use near_primitives::transaction::{ Action, CreateAccountAction, DeleteAccountAction, StakeAction, }; @@ -1373,18 +1378,18 @@ mod test { store_update.commit().unwrap(); let genesis_hash = hash(&vec![0]); runtime - .add_validator_proposals( - CryptoHash::default(), - genesis_hash, - [0; 32].as_ref().try_into().unwrap(), - 0, - 0, - vec![], - vec![], - vec![], - genesis_total_supply, - genesis_protocol_version, - ) + .add_validator_proposals(BlockHeaderInfo { + prev_hash: CryptoHash::default(), + hash: genesis_hash, + random_value: [0; 32].as_ref().try_into().unwrap(), + height: 0, + last_finalized_height: 0, + proposals: vec![], + slashed_validators: vec![], + chunk_mask: vec![], + total_supply: genesis_total_supply, + latest_protocol_version: genesis_protocol_version, + }) .unwrap(); Self { runtime, @@ -1440,18 +1445,18 @@ mod test { self.last_shard_proposals.insert(i as ShardId, proposals); } self.runtime - .add_validator_proposals( - self.head.last_block_hash, - new_hash, - [0; 32].as_ref().try_into().unwrap(), - self.head.height + 1, - self.head.height.saturating_sub(1), - self.last_proposals.clone(), - challenges_result, + .add_validator_proposals(BlockHeaderInfo { + prev_hash: self.head.last_block_hash, + hash: new_hash, + random_value: [0; 32].as_ref().try_into().unwrap(), + height: self.head.height + 1, + last_finalized_height: self.head.height.saturating_sub(1), + proposals: self.last_proposals.clone(), + slashed_validators: challenges_result, chunk_mask, - self.runtime.genesis.config.total_supply, - self.runtime.genesis.config.protocol_version, - ) + total_supply: self.runtime.genesis.config.total_supply, + latest_protocol_version: self.runtime.genesis.config.protocol_version, + }) .unwrap(); self.last_receipts = new_receipts; self.last_proposals = all_proposals; @@ -1854,18 +1859,18 @@ mod test { }; new_env .runtime - .add_validator_proposals( + .add_validator_proposals(BlockHeaderInfo { prev_hash, - cur_hash, - [0; 32].as_ref().try_into().unwrap(), - i, - i.saturating_sub(2), - new_env.last_proposals.clone(), - vec![], - vec![true], - new_env.runtime.genesis.config.total_supply, - new_env.runtime.genesis.config.protocol_version, - ) + hash: cur_hash, + random_value: [0; 32].as_ref().try_into().unwrap(), + height: i, + last_finalized_height: i.saturating_sub(2), + proposals: new_env.last_proposals.clone(), + slashed_validators: vec![], + chunk_mask: vec![true], + total_supply: new_env.runtime.genesis.config.total_supply, + latest_protocol_version: new_env.runtime.genesis.config.protocol_version, + }) .unwrap(); new_env.head.height = i; new_env.head.last_block_hash = cur_hash; diff --git a/neard/src/shard_tracker.rs b/neard/src/shard_tracker.rs index 8a728a2368c..87bbe63d42b 100644 --- a/neard/src/shard_tracker.rs +++ b/neard/src/shard_tracker.rs @@ -236,7 +236,7 @@ mod tests { use near_store::test_utils::create_test_store; use super::{account_id_to_shard_id, ShardTracker, POISONED_LOCK_ERR}; - use near_chain_configs::PROTOCOL_VERSION; + use near_primitives::protocol_version::PROTOCOL_VERSION; use num_rational::Rational; const DEFAULT_TOTAL_SUPPLY: u128 = 1_000_000_000_000; diff --git a/neard/tests/economics.rs b/neard/tests/economics.rs index 4174bb2a8ce..c57b6728425 100644 --- a/neard/tests/economics.rs +++ b/neard/tests/economics.rs @@ -75,7 +75,7 @@ fn test_burn_mint() { }); let signer = InMemorySigner::from_seed("test0", KeyType::ED25519, "test0"); let initial_total_supply = env.chain_genesis.total_supply; - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); env.clients[0].process_tx( SignedTransaction::send_money( 1, @@ -96,7 +96,7 @@ fn test_burn_mint() { // print_accounts(&mut env); // assert_eq!( // calc_total_supply(&mut env), - // env.clients[0].chain.get_block_by_height(i + 1).unwrap().header.inner_rest.total_supply + // env.clients[0].chain.get_block_by_height(i + 1).unwrap().header.total_supply() // ); } @@ -105,17 +105,14 @@ fn test_burn_mint() { // We burn half of the cost when tx executed and the other half in the next block for the receipt processing. let half_transfer_cost = fee_helper.transfer_cost() / 2; assert_eq!( - block3.header.inner_rest.total_supply, + block3.header.total_supply(), // supply + 1% of protocol rewards + 3/4 * 9% of validator rewards. initial_total_supply * 10775 / 10000 - half_transfer_cost ); assert_eq!(block3.chunks[0].inner.balance_burnt, half_transfer_cost); // Block 4: subtract 2nd part of transfer. let block4 = env.clients[0].chain.get_block_by_height(4).unwrap().clone(); - assert_eq!( - block4.header.inner_rest.total_supply, - block3.header.inner_rest.total_supply - half_transfer_cost - ); + assert_eq!(block4.header.total_supply(), block3.header.total_supply() - half_transfer_cost); assert_eq!(block4.chunks[0].inner.balance_burnt, half_transfer_cost); // Check that Protocol Treasury account got it's 1% as well. assert_eq!( @@ -125,8 +122,8 @@ fn test_burn_mint() { // Block 5: reward from previous block. let block5 = env.clients[0].chain.get_block_by_height(5).unwrap().clone(); assert_eq!( - block5.header.inner_rest.total_supply, + block5.header.total_supply(), // previous supply + 10% - block4.header.inner_rest.total_supply * 110 / 100 + block4.header.total_supply() * 110 / 100 ); } diff --git a/neard/tests/rpc_nodes.rs b/neard/tests/rpc_nodes.rs index 7ae3d85ce84..8006170299a 100644 --- a/neard/tests/rpc_nodes.rs +++ b/neard/tests/rpc_nodes.rs @@ -30,7 +30,7 @@ fn test_tx_propagation() { let (genesis_config, rpc_addrs, clients) = start_nodes(4, &dirs, 2, 2, 10, 0); let view_client = clients[0].1.clone(); - let genesis_hash = genesis_block(genesis_config).hash(); + let genesis_hash = *genesis_block(genesis_config).hash(); let signer = InMemorySigner::from_seed("near.1", KeyType::ED25519, "near.1"); let transaction = SignedTransaction::send_money( 1, @@ -109,7 +109,7 @@ fn test_tx_propagation_through_rpc() { let (genesis_config, rpc_addrs, clients) = start_nodes(4, &dirs, 2, 2, 10, 0); let view_client = clients[0].1.clone(); - let genesis_hash = genesis_block(genesis_config).hash(); + let genesis_hash = *genesis_block(genesis_config).hash(); let signer = InMemorySigner::from_seed("near.1", KeyType::ED25519, "near.1"); let transaction = SignedTransaction::send_money( 1, @@ -174,7 +174,7 @@ fn test_tx_status_with_light_client() { let (genesis_config, rpc_addrs, clients) = start_nodes(4, &dirs, 2, 2, 10, 0); let view_client = clients[0].1.clone(); - let genesis_hash = genesis_block(genesis_config).hash(); + let genesis_hash = *genesis_block(genesis_config).hash(); let signer = InMemorySigner::from_seed("near.1", KeyType::ED25519, "near.1"); let transaction = SignedTransaction::send_money( 1, @@ -247,7 +247,7 @@ fn test_tx_status_with_light_client1() { let (genesis_config, rpc_addrs, clients) = start_nodes(4, &dirs, 2, 2, 10, 0); let view_client = clients[0].1.clone(); - let genesis_hash = genesis_block(genesis_config).hash(); + let genesis_hash = *genesis_block(genesis_config).hash(); let signer = InMemorySigner::from_seed("near.3", KeyType::ED25519, "near.3"); let transaction = SignedTransaction::send_money( 1, diff --git a/neard/tests/sync_nodes.rs b/neard/tests/sync_nodes.rs index f445912d5a8..759150c1349 100644 --- a/neard/tests/sync_nodes.rs +++ b/neard/tests/sync_nodes.rs @@ -15,6 +15,7 @@ use near_network::test_utils::{convert_boot_nodes, open_port, WaitOrTimeout}; use near_network::{NetworkClientMessages, PeerInfo}; use near_primitives::block::Approval; use near_primitives::merkle::PartialMerkleTree; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::transaction::SignedTransaction; use near_primitives::types::{BlockHeightDelta, EpochId, ValidatorStake}; use near_primitives::validator_signer::{InMemoryValidatorSigner, ValidatorSigner}; @@ -33,33 +34,28 @@ fn add_blocks( let mut prev = &blocks[blocks.len() - 1]; let mut block_merkle_tree = PartialMerkleTree::default(); for block in blocks.iter() { - block_merkle_tree.insert(block.hash()); + block_merkle_tree.insert(*block.hash()); } for _ in 0..num { - let epoch_id = match prev.header.inner_lite.height + 1 { + let epoch_id = match prev.header.height() + 1 { height if height <= epoch_length => EpochId::default(), height => { - EpochId(blocks[(((height - 1) / epoch_length - 1) * epoch_length) as usize].hash()) + EpochId(*blocks[(((height - 1) / epoch_length - 1) * epoch_length) as usize].hash()) } }; let next_epoch_id = EpochId( - blocks[(((prev.header.inner_lite.height) / epoch_length) * epoch_length) as usize] - .hash(), + *blocks[(((prev.header.height()) / epoch_length) * epoch_length) as usize].hash(), ); let block = Block::produce( + PROTOCOL_VERSION, &prev.header, - prev.header.inner_lite.height + 1, + prev.header.height() + 1, blocks[0].chunks.clone(), epoch_id, next_epoch_id, vec![Some( - Approval::new( - prev.hash(), - prev.header.inner_lite.height, - prev.header.inner_lite.height + 1, - signer, - ) - .signature, + Approval::new(*prev.hash(), prev.header.height(), prev.header.height() + 1, signer) + .signature, )], Rational::from_integer(0), 0, @@ -75,7 +71,7 @@ fn add_blocks( .unwrap(), block_merkle_tree.root(), ); - block_merkle_tree.insert(block.hash()); + block_merkle_tree.insert(*block.hash()); let _ = client.do_send(NetworkClientMessages::Block( block.clone(), PeerInfo::random().id, @@ -234,7 +230,7 @@ fn sync_state_stake_change() { let dir2 = tempfile::Builder::new().prefix("sync_state_stake_change_2").tempdir().unwrap(); let (client1, view_client1) = start_with_config(dir1.path(), near1.clone()); - let genesis_hash = genesis_block(genesis).hash(); + let genesis_hash = *genesis_block(genesis).hash(); let signer = Arc::new(InMemorySigner::from_seed("test1", KeyType::ED25519, "test1")); let unstake_transaction = SignedTransaction::stake( 1, diff --git a/test-utils/state-viewer/src/main.rs b/test-utils/state-viewer/src/main.rs index 653155a8427..e21522b9aa9 100644 --- a/test-utils/state-viewer/src/main.rs +++ b/test-utils/state-viewer/src/main.rs @@ -5,8 +5,8 @@ use std::sync::Arc; use ansi_term::Color::Red; use clap::{App, Arg, SubCommand}; +use near_chain::types::BlockHeaderInfo; use near_chain::{ChainStore, ChainStoreAccess, RuntimeAdapter}; -use near_chain_configs::PROTOCOL_VERSION; use near_logger_utils::init_integration_logger; use near_network::peer_store::PeerStore; use near_primitives::block::BlockHeader; @@ -60,13 +60,10 @@ fn load_trie_stop_at_height( continue; } }; - let last_final_block_hash = chain_store - .get_block_header(&cur_block_hash) - .unwrap() - .inner_rest - .last_final_block; + let last_final_block_hash = + *chain_store.get_block_header(&cur_block_hash).unwrap().last_final_block(); let last_final_block = chain_store.get_block(&last_final_block_hash).unwrap(); - if last_final_block.header.inner_lite.height >= height { + if last_final_block.header.height() >= height { break last_final_block.clone(); } else { cur_height += 1; @@ -105,12 +102,12 @@ fn print_chain( if let Ok(block_hash) = chain_store.get_block_hash_by_height(height) { let header = chain_store.get_block_header(&block_hash).unwrap().clone(); if height == 0 { - println!("{: >3} {}", header.inner_lite.height, format_hash(header.hash())); + println!("{: >3} {}", header.height(), format_hash(*header.hash())); } else { - let parent_header = chain_store.get_block_header(&header.prev_hash).unwrap(); - let epoch_id = runtime.get_epoch_id_from_prev_block(&header.prev_hash).unwrap(); + let parent_header = chain_store.get_block_header(header.prev_hash()).unwrap(); + let epoch_id = runtime.get_epoch_id_from_prev_block(header.prev_hash()).unwrap(); cur_epoch_id = Some(epoch_id.clone()); - if runtime.is_next_block_epoch_start(&header.prev_hash).unwrap() { + if runtime.is_next_block_epoch_start(header.prev_hash()).unwrap() { println!("{:?}", account_id_to_blocks); account_id_to_blocks = HashMap::new(); println!( @@ -122,18 +119,18 @@ fn print_chain( ); } let block_producer = - runtime.get_block_producer(&epoch_id, header.inner_lite.height).unwrap(); + runtime.get_block_producer(&epoch_id, header.height()).unwrap(); account_id_to_blocks .entry(block_producer.clone()) .and_modify(|e| *e += 1) .or_insert(1); println!( "{: >3} {} | {: >10} | parent: {: >3} {}", - header.inner_lite.height, - format_hash(header.hash()), + header.height(), + format_hash(*header.hash()), block_producer, - parent_header.inner_lite.height, - format_hash(parent_header.hash()), + parent_header.height(), + format_hash(*parent_header.hash()), ); } } else { @@ -172,19 +169,10 @@ fn replay_chain( if let Ok(block_hash) = chain_store.get_block_hash_by_height(height) { let header = chain_store.get_block_header(&block_hash).unwrap().clone(); runtime - .add_validator_proposals( - header.prev_hash, - header.hash(), - header.inner_rest.random_value, - header.inner_lite.height, - chain_store.get_block_height(&header.inner_rest.last_final_block).unwrap(), - header.inner_rest.validator_proposals, - vec![], - header.inner_rest.chunk_mask, - header.inner_rest.total_supply, - // TODO: !!! - PROTOCOL_VERSION, - ) + .add_validator_proposals(BlockHeaderInfo::new( + &header, + chain_store.get_block_height(&header.last_final_block()).unwrap(), + )) .unwrap(); } } @@ -264,10 +252,7 @@ fn main() { } ("state", Some(_args)) => { let (runtime, state_roots, header) = load_trie(store, &home_dir, &near_config); - println!( - "Storage roots are {:?}, block height is {}", - state_roots, header.inner_lite.height - ); + println!("Storage roots are {:?}, block height is {}", state_roots, header.height()); for (shard_id, state_root) in state_roots.iter().enumerate() { let trie = runtime.get_trie_for_shard(shard_id as u64); let trie = TrieIterator::new(&trie, &state_root).unwrap(); @@ -283,7 +268,7 @@ fn main() { let height = args.value_of("height").map(|s| s.parse::().unwrap()); let (runtime, state_roots, header) = load_trie_stop_at_height(store, home_dir, &near_config, height); - let height = header.inner_lite.height; + let height = header.height(); let home_dir = PathBuf::from(&home_dir); let new_genesis = diff --git a/test-utils/state-viewer/src/state_dump.rs b/test-utils/state-viewer/src/state_dump.rs index 13d0a1543ef..0aaf2c27561 100644 --- a/test-utils/state-viewer/src/state_dump.rs +++ b/test-utils/state-viewer/src/state_dump.rs @@ -16,14 +16,12 @@ pub fn state_dump( ) -> Genesis { println!( "Generating genesis from state data of #{} / {}", - last_block_header.inner_lite.height, last_block_header.hash + last_block_header.height(), + last_block_header.hash() ); - let genesis_height = last_block_header.inner_lite.height + 1; + let genesis_height = last_block_header.height() + 1; let block_producers = runtime - .get_epoch_block_producers_ordered( - &last_block_header.inner_lite.epoch_id, - &last_block_header.hash, - ) + .get_epoch_block_producers_ordered(&last_block_header.epoch_id(), last_block_header.hash()) .unwrap(); let validators = block_producers .into_iter() @@ -112,7 +110,7 @@ mod test { fn test_dump_state_preserve_validators() { let epoch_length = 4; let (store, genesis, mut env) = setup(epoch_length); - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); let signer = InMemorySigner::from_seed("test1", KeyType::ED25519, "test1"); let tx = SignedTransaction::stake( 1, @@ -157,7 +155,7 @@ mod test { fn test_dump_state_return_locked() { let epoch_length = 4; let (store, genesis, mut env) = setup(epoch_length); - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); let signer = InMemorySigner::from_seed("test1", KeyType::ED25519, "test1"); let tx = SignedTransaction::stake( 1, @@ -218,7 +216,7 @@ mod test { chain_genesis.epoch_length = epoch_length; chain_genesis.gas_limit = genesis.config.gas_limit; let mut env = TestEnv::new_with_runtime(chain_genesis, 2, 1, runtimes); - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); let signer = InMemorySigner::from_seed("test1", KeyType::ED25519, "test1"); let tx = SignedTransaction::send_money( 1, @@ -267,7 +265,7 @@ mod test { let mut chain_genesis = ChainGenesis::test(); chain_genesis.epoch_length = epoch_length; let mut env = TestEnv::new_with_runtime(chain_genesis, 1, 2, runtimes); - let genesis_hash = env.clients[0].chain.genesis().hash(); + let genesis_hash = *env.clients[0].chain.genesis().hash(); let signer = InMemorySigner::from_seed("test1", KeyType::ED25519, "test1"); let tx = SignedTransaction::stake( 1, diff --git a/test-utils/testlib/src/lib.rs b/test-utils/testlib/src/lib.rs index 4e6eb9a006a..8d706706c3c 100644 --- a/test-utils/testlib/src/lib.rs +++ b/test-utils/testlib/src/lib.rs @@ -24,7 +24,7 @@ pub mod user; /// Compute genesis hash from genesis. pub fn genesis_hash(genesis: Arc) -> CryptoHash { - genesis_header(genesis).hash + *genesis_header(genesis).hash() } /// Utility to generate genesis header from config for testing purposes. @@ -44,7 +44,7 @@ pub fn genesis_block(genesis: Arc) -> Block { let chain_genesis = ChainGenesis::from(&genesis); let runtime = Arc::new(NightshadeRuntime::new(dir.path(), store, genesis, vec![], vec![])); let mut chain = Chain::new(runtime, &chain_genesis, DoomslugThresholdMode::TwoThirds).unwrap(); - chain.get_block(&chain.genesis().hash()).unwrap().clone() + chain.get_block(&chain.genesis().hash().clone()).unwrap().clone() } pub fn start_nodes( From 769c2bce73f020fdc9fbe858e3fe9bae9f8155be Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Fri, 22 May 2020 16:28:27 -0700 Subject: [PATCH 05/21] Adding support for legacy communication protocl --- chain/network/src/peer.rs | 16 ++++++++- chain/network/src/types.rs | 29 +++++++++++++-- core/primitives/src/block.rs | 25 +++++++++++++ core/primitives/src/block_header.rs | 55 ++++++++++++++++------------- 4 files changed, 97 insertions(+), 28 deletions(-) diff --git a/chain/network/src/peer.rs b/chain/network/src/peer.rs index 9088e8ef18f..a54a08b6c32 100644 --- a/chain/network/src/peer.rs +++ b/chain/network/src/peer.rs @@ -12,6 +12,7 @@ use tracing::{debug, error, info, warn}; use near_metrics; use near_primitives::block::GenesisId; +use near_primitives::block_header::BlockHeader; use near_primitives::hash::CryptoHash; use near_primitives::network::PeerId; use near_primitives::protocol_version::PROTOCOL_VERSION; @@ -204,6 +205,7 @@ impl Peer { // Record block requests in tracker. match &msg { PeerMessage::Block(b) if self.tracker.has_received(b.hash()) => return, + PeerMessage::BlockLegacy(b) if self.tracker.has_received(&b.header.hash) => return, PeerMessage::BlockRequest(h) => self.tracker.push_request(*h), _ => (), }; @@ -381,6 +383,7 @@ impl Peer { .do_send(PeerRequest::RouteBack(body, msg_hash.unwrap())); } Ok(NetworkViewClientResponses::Block(block)) => { + // MOO need protocol version act.send_message(PeerMessage::Block(*block)) } Ok(NetworkViewClientResponses::BlockHeaders(headers)) => { @@ -406,6 +409,15 @@ impl Peer { near_metrics::inc_counter(&metrics::PEER_CLIENT_MESSAGE_RECEIVED_TOTAL); let peer_id = unwrap_option_or_return!(self.peer_id()); + // Convert legacy protocol messages. + let msg = match msg { + PeerMessage::BlockLegacy(b) => PeerMessage::Block(b.into()), + PeerMessage::BlockHeadersLegacy(h) => PeerMessage::BlockHeaders( + h.into_iter().map(|h| BlockHeader::BlockHeaderV1(h)).collect(), + ), + m => m, + }; + // Wrap peer message into what client expects. let network_client_msg = match msg { PeerMessage::Block(block) => { @@ -480,7 +492,9 @@ impl Peer { | PeerMessage::RequestUpdateNonce(_) | PeerMessage::ResponseUpdateNonce(_) | PeerMessage::BlockRequest(_) - | PeerMessage::BlockHeadersRequest(_) => { + | PeerMessage::BlockHeadersRequest(_) + | PeerMessage::BlockLegacy(_) + | PeerMessage::BlockHeadersLegacy(_) => { error!(target: "network", "Peer receive_client_message received unexpected type: {:?}", msg); return; } diff --git a/chain/network/src/types.rs b/chain/network/src/types.rs index 9bbb84256e4..98a981f5590 100644 --- a/chain/network/src/types.rs +++ b/chain/network/src/types.rs @@ -19,7 +19,7 @@ use near_chain::types::ShardStateSyncResponse; use near_chain::{Block, BlockHeader}; use near_crypto::{PublicKey, SecretKey, Signature}; use near_metrics; -use near_primitives::block::{Approval, ApprovalMessage, GenesisId}; +use near_primitives::block::{Approval, ApprovalMessage, GenesisId, LegacyBlock}; use near_primitives::challenge::Challenge; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; @@ -38,6 +38,7 @@ use crate::peer::Peer; #[cfg(feature = "metric_recorder")] use crate::recorder::MetricRecorder; use crate::routing::{Edge, EdgeInfo, RoutingTableInfo}; +use near_primitives::block_header::BlockHeaderV1; /// Number of hops a message is allowed to travel before being dropped. /// This is used to avoid infinite loop because of inconsistent view of the network @@ -391,6 +392,9 @@ impl SyncData { } } +/// Warning, position of each message type in this enum defines the protocol due to serialization. +/// DO NOT MOVE, REORDER, DELETE items from the list. Only add new items to the end. +/// If need to remove old items - replace with `None`. #[derive(BorshSerialize, BorshDeserialize, Serialize, PartialEq, Eq, Clone, Debug)] // TODO(#1313): Use Box #[allow(clippy::large_enum_variant)] @@ -408,10 +412,14 @@ pub enum PeerMessage { PeersResponse(Vec), BlockHeadersRequest(Vec), - BlockHeaders(Vec), + /// Legacy BlockHeader request. + /// TODO(2713): leave space but remove usage. + BlockHeadersLegacy(Vec), BlockRequest(CryptoHash), - Block(Block), + /// Legacy Block response. + /// TODO(2713): leave space but remove usage. + BlockLegacy(LegacyBlock), Transaction(SignedTransaction), Routed(RoutedMessage), @@ -420,6 +428,9 @@ pub enum PeerMessage { Disconnect, Challenge(Challenge), + + BlockHeaders(Vec), + Block(Block), } impl fmt::Display for PeerMessage { @@ -435,8 +446,10 @@ impl fmt::Display for PeerMessage { PeerMessage::PeersResponse(_) => f.write_str("PeersResponse"), PeerMessage::BlockHeadersRequest(_) => f.write_str("BlockHeaderRequest"), PeerMessage::BlockHeaders(_) => f.write_str("BlockHeaders"), + PeerMessage::BlockHeadersLegacy(_) => f.write_str("BlockHeadersLegacy"), PeerMessage::BlockRequest(_) => f.write_str("BlockRequest"), PeerMessage::Block(_) => f.write_str("Block"), + PeerMessage::BlockLegacy(_) => f.write_str("BlockLegacy"), PeerMessage::Transaction(_) => f.write_str("Transaction"), PeerMessage::Routed(routed_message) => match routed_message.body { RoutedMessageBody::BlockApproval(_) => f.write_str("BlockApproval"), @@ -523,6 +536,10 @@ impl PeerMessage { size as i64, ); } + PeerMessage::BlockHeadersLegacy(_) => { + near_metrics::inc_counter(&metrics::BLOCK_HEADERS_RECEIVED_TOTAL); + near_metrics::inc_counter_by(&metrics::BLOCK_HEADERS_RECEIVED_BYTES, size as i64); + } PeerMessage::BlockHeaders(_) => { near_metrics::inc_counter(&metrics::BLOCK_HEADERS_RECEIVED_TOTAL); near_metrics::inc_counter_by(&metrics::BLOCK_HEADERS_RECEIVED_BYTES, size as i64); @@ -535,6 +552,10 @@ impl PeerMessage { near_metrics::inc_counter(&metrics::BLOCK_RECEIVED_TOTAL); near_metrics::inc_counter_by(&metrics::BLOCK_RECEIVED_BYTES, size as i64); } + PeerMessage::BlockLegacy(_) => { + near_metrics::inc_counter(&metrics::BLOCK_RECEIVED_TOTAL); + near_metrics::inc_counter_by(&metrics::BLOCK_RECEIVED_BYTES, size as i64); + } PeerMessage::Transaction(_) => { near_metrics::inc_counter(&metrics::TRANSACTION_RECEIVED_TOTAL); near_metrics::inc_counter_by(&metrics::TRANSACTION_RECEIVED_BYTES, size as i64); @@ -669,7 +690,9 @@ impl PeerMessage { pub fn is_client_message(&self) -> bool { match self { PeerMessage::Block(_) + | PeerMessage::BlockLegacy(_) | PeerMessage::BlockHeaders(_) + | PeerMessage::BlockHeadersLegacy(_) | PeerMessage::Transaction(_) | PeerMessage::Challenge(_) => true, PeerMessage::Routed(r) => match r.body { diff --git a/core/primitives/src/block.rs b/core/primitives/src/block.rs index 9ade204594b..2256a49ab84 100644 --- a/core/primitives/src/block.rs +++ b/core/primitives/src/block.rs @@ -19,6 +19,31 @@ use crate::types::{Balance, BlockHeight, EpochId, Gas, NumShards, StateRoot}; use crate::utils::to_timestamp; use crate::validator_signer::{EmptyValidatorSigner, ValidatorSigner}; +/// Legacy Block before BlockHeader were updatable. +/// TOOD(2713): Delete after move past version 14. +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +pub struct LegacyBlock { + pub header: BlockHeaderV1, + pub chunks: Vec, + pub challenges: Challenges, + + // Data to confirm the correctness of randomness beacon output + pub vrf_value: near_crypto::vrf::Value, + pub vrf_proof: near_crypto::vrf::Proof, +} + +impl From for Block { + fn from(block: LegacyBlock) -> Self { + Self { + header: BlockHeader::BlockHeaderV1(block.header), + chunks: block.chunks, + challenges: block.challenges, + vrf_proof: block.vrf_proof, + vrf_value: block.vrf_value, + } + } +} + #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] pub struct Block { pub header: BlockHeader, diff --git a/core/primitives/src/block_header.rs b/core/primitives/src/block_header.rs index 34d81022a61..43ae63655e6 100644 --- a/core/primitives/src/block_header.rs +++ b/core/primitives/src/block_header.rs @@ -612,36 +612,43 @@ impl BlockHeader { #[cfg(test)] mod tests { - // use borsh::ser::BorshSerialize; - // - // use crate::block::Block; - use crate::serialize::from_base; + use crate::block::Block; + use crate::serialize::{from_base, to_base}; use super::*; #[test] - fn test_block_header_v1_deserialize() { + fn test_block_header_genesis_deserialize() { // This is serialized BlockHeader converting from v1 which doesn't have version number. - // let chunks = vec![]; - // let challenges = vec![]; - // let block_header_v1 = BlockHeader::genesis( - // 0, - // Block::compute_state_root(&chunks), - // Block::compute_chunk_receipts_root(&chunks), - // Block::compute_chunk_headers_root(&chunks).0, - // Block::compute_chunk_tx_root(&chunks), - // Block::compute_chunks_included(&chunks, 0), - // Block::compute_challenges_root(&challenges), - // Utc::now(), - // 100, - // 1_000_000, - // CryptoHash::default(), - // ); - let block_header_v1_enc = "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111119g3LQYu8NYhqU9RHSeqTwaGjiCojJtbKmHraACCNtFbduZbaV2QUaM1fBMVuoXXoXZxnC5Qicu74eS3rRY7DNWGycYjQknptSjzT4H1RXubmP7g3wg5DXC6jrG2K5zBmn8AFPHviziwHK1DsHWct58EXmKX1WjMR7mvahinN5DMAqd1vRN8o45uQP6HunhgnuC22Jo1uT6E1TyBjgyMLPnxq2SZ4jWvSn6d5H4u4qwgQ5RBJR1sP53gVptwrF6vvtCSpe6jNM6JfC6R9VgG5UeW91wua2Mo8cgzfF5SZ7hgLHkmkVqZqx6Pt98C44JTWHAvzrFpZ3xUeSBxKXeqE3zs8koVfz2hYyCASsx5xXwtVEJsARgmjBojJ8s8v2P3sETiF1rTTRVkth9TF7tcc4TSW8JCzhpgDiu2vVLaUkc8452h9Yrn2Ruh9GmWbZT3anrPrHr8GEGaLmNiAN4pF6eUjDxqf44y95eKrz7dPWcYj3gsdKcTgQB98xt6NhPbSE33az6DkrqgZDqapWQBWcPkrXqUstWkLBPVypgjpJPSkdeJvVDP8WwfM"; - // assert_eq!(to_base(block_header_v1.try_to_vec().unwrap()), block_header_v1_enc); - let _block_header_v1 = + let chunks = vec![]; + let challenges = vec![]; + let timestamp = from_timestamp(0); + let block_header = BlockHeader::genesis( + 0, + Block::compute_state_root(&chunks), + Block::compute_chunk_receipts_root(&chunks), + Block::compute_chunk_headers_root(&chunks).0, + Block::compute_chunk_tx_root(&chunks), + Block::compute_chunks_included(&chunks, 0), + Block::compute_challenges_root(&challenges), + timestamp, + 100, + 1_000_000, + CryptoHash::default(), + ); + let block_header_v1_enc = "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111AuX3ahfw71vXubTc6dKkCTnEitpHVEc9bSeZNTJeeVz5mu7wocuVidGE4qAkz4DYZcqsy3YDpBg6VcPLLmXNhQMDJTHpcvKfoUqvLnWcueRvAgQRCxpSr66XUCNwHdP1bvyCT6cFzCcWGBuHM4PsPvPAWVQEkFC9zaTYDGaazC7mAuwq7Dc5NyKG8DjKD3XqAJoZAgq5F2f5xoUa69X6n51MZmNC7QaenrooR1q"; + match block_header { + BlockHeader::BlockHeaderV1(header) => { + assert_eq!(to_base(header.try_to_vec().unwrap()), block_header_v1_enc) + } + _ => panic!("Invalid block header version"), + }; + let block_header_v1 = BlockHeaderV1::try_from_slice(&from_base(block_header_v1_enc).unwrap()) .expect("Failed to deserialize old block header"); - // assert_eq!(block_header_v1.latest_protocol_version(), PROTOCOL_VERSION_V14); + assert_eq!( + BlockHeader::BlockHeaderV1(block_header_v1).latest_protocol_version(), + PROTOCOL_VERSION_V14 + ); } } From dde363d0df16ed5075ad69a5b943720a94ea90cd Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Fri, 22 May 2020 17:06:49 -0700 Subject: [PATCH 06/21] Fix up networking to use oldest backward compatible version --- chain/network/src/types.rs | 5 +++-- core/primitives/src/block_header.rs | 14 +++++++++++++- neard/src/main.rs | 3 ++- pytest/lib/utils.py | 3 ++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/chain/network/src/types.rs b/chain/network/src/types.rs index 98a981f5590..ee641666749 100644 --- a/chain/network/src/types.rs +++ b/chain/network/src/types.rs @@ -24,7 +24,7 @@ use near_primitives::challenge::Challenge; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::network::{AnnounceAccount, PeerId}; -use near_primitives::protocol_version::PROTOCOL_VERSION; +use near_primitives::protocol_version::PROTOCOL_VERSION_V14; use near_primitives::sharding::{ ChunkHash, PartialEncodedChunk, PartialEncodedChunkPart, ReceiptProof, }; @@ -178,7 +178,8 @@ impl Handshake { edge_info: EdgeInfo, ) -> Self { Handshake { - version: PROTOCOL_VERSION, + // TODO: figure out how we are going to indicate backward compatible versions of protocol. + version: PROTOCOL_VERSION_V14, peer_id, target_peer_id, listen_port, diff --git a/core/primitives/src/block_header.rs b/core/primitives/src/block_header.rs index 43ae63655e6..dc782b57ec9 100644 --- a/core/primitives/src/block_header.rs +++ b/core/primitives/src/block_header.rs @@ -164,6 +164,7 @@ impl ApprovalMessage { } #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +#[borsh_init(init)] pub struct BlockHeaderV1 { pub prev_hash: CryptoHash, @@ -180,6 +181,16 @@ pub struct BlockHeaderV1 { pub hash: CryptoHash, } +impl BlockHeaderV1 { + pub fn init(&mut self) { + self.hash = BlockHeader::compute_hash( + self.prev_hash, + &self.inner_lite.try_to_vec().expect("Failed to serialize"), + &self.inner_rest.try_to_vec().expect("Failed to serialize"), + ); + } +} + #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] pub struct BlockHeaderV2 { pub prev_hash: CryptoHash, @@ -637,7 +648,7 @@ mod tests { CryptoHash::default(), ); let block_header_v1_enc = "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111AuX3ahfw71vXubTc6dKkCTnEitpHVEc9bSeZNTJeeVz5mu7wocuVidGE4qAkz4DYZcqsy3YDpBg6VcPLLmXNhQMDJTHpcvKfoUqvLnWcueRvAgQRCxpSr66XUCNwHdP1bvyCT6cFzCcWGBuHM4PsPvPAWVQEkFC9zaTYDGaazC7mAuwq7Dc5NyKG8DjKD3XqAJoZAgq5F2f5xoUa69X6n51MZmNC7QaenrooR1q"; - match block_header { + match &block_header { BlockHeader::BlockHeaderV1(header) => { assert_eq!(to_base(header.try_to_vec().unwrap()), block_header_v1_enc) } @@ -646,6 +657,7 @@ mod tests { let block_header_v1 = BlockHeaderV1::try_from_slice(&from_base(block_header_v1_enc).unwrap()) .expect("Failed to deserialize old block header"); + assert_eq!(&block_header_v1.hash, block_header.hash()); assert_eq!( BlockHeader::BlockHeaderV1(block_header_v1).latest_protocol_version(), PROTOCOL_VERSION_V14 diff --git a/neard/src/main.rs b/neard/src/main.rs index 9d3042c9591..cb6111b5fbf 100644 --- a/neard/src/main.rs +++ b/neard/src/main.rs @@ -13,6 +13,7 @@ use tracing_subscriber::filter::LevelFilter; use tracing_subscriber::EnvFilter; use git_version::git_version; +use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::Version; use neard::config::init_testnet_configs; use neard::genesis_validate::validate_genesis; @@ -98,7 +99,7 @@ fn main() { .get_matches(); init_logging(matches.value_of("verbose")); - info!(target: "near", "Version: {}, Build: {}", version.version, version.build); + info!(target: "near", "Version: {}, Build: {}, Latest Protocol: {}", version.version, version.build, PROTOCOL_VERSION); #[cfg(feature = "adversarial")] { diff --git a/pytest/lib/utils.py b/pytest/lib/utils.py index f816e3b9c7d..d44b79256ec 100644 --- a/pytest/lib/utils.py +++ b/pytest/lib/utils.py @@ -271,7 +271,7 @@ def collect_gcloud_config(num_nodes): os.environ[CONFIG_ENV_VAR] = outfile -def wait_for_blocks_or_timeout(node, num_blocks, timeout, callback=None): +def wait_for_blocks_or_timeout(node, num_blocks, timeout, callback=None, check_sec=1): status = node.get_status() start_height = status['sync_info']['latest_block_height'] max_height = 0 @@ -283,3 +283,4 @@ def wait_for_blocks_or_timeout(node, num_blocks, timeout, callback=None): if callback is not None: if callback(): break + time.sleep(check_sec) From f6803c813ebc9e3c17dd1d88526af295d7c52702 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Fri, 22 May 2020 17:14:04 -0700 Subject: [PATCH 07/21] Update sample genesis to use latest protocol, while adding marker for first backward compatible one --- chain/network/src/types.rs | 4 ++-- core/primitives/src/protocol_version.rs | 2 ++ neard/res/genesis_config.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/chain/network/src/types.rs b/chain/network/src/types.rs index ee641666749..4e4778a0fb7 100644 --- a/chain/network/src/types.rs +++ b/chain/network/src/types.rs @@ -24,7 +24,7 @@ use near_primitives::challenge::Challenge; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::network::{AnnounceAccount, PeerId}; -use near_primitives::protocol_version::PROTOCOL_VERSION_V14; +use near_primitives::protocol_version::FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION; use near_primitives::sharding::{ ChunkHash, PartialEncodedChunk, PartialEncodedChunkPart, ReceiptProof, }; @@ -179,7 +179,7 @@ impl Handshake { ) -> Self { Handshake { // TODO: figure out how we are going to indicate backward compatible versions of protocol. - version: PROTOCOL_VERSION_V14, + version: FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION, peer_id, target_peer_id, listen_port, diff --git a/core/primitives/src/protocol_version.rs b/core/primitives/src/protocol_version.rs index 83cac05e51c..10569945c4c 100644 --- a/core/primitives/src/protocol_version.rs +++ b/core/primitives/src/protocol_version.rs @@ -8,3 +8,5 @@ pub const PROTOCOL_VERSION_V14: ProtocolVersion = 14; /// Current latest version of the protocol. pub const PROTOCOL_VERSION: ProtocolVersion = 15; + +pub const FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION: ProtocolVersion = PROTOCOL_VERSION_V14; diff --git a/neard/res/genesis_config.json b/neard/res/genesis_config.json index 3b7e51cf8d0..ca6a7e4ed4a 100644 --- a/neard/res/genesis_config.json +++ b/neard/res/genesis_config.json @@ -1,6 +1,6 @@ { "config_version": 1, - "protocol_version": 14, + "protocol_version": 15, "genesis_time": "1970-01-01T00:00:00.000000000Z", "chain_id": "sample", "genesis_height": 0, From 630553c2b4ee13e9ceadf94435cca1c76a39b092 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Sun, 24 May 2020 12:59:38 -0700 Subject: [PATCH 08/21] Remove backward compatibility. Bring protocol version from epoch manager to client --- chain/chain/src/chain.rs | 1 + chain/chain/src/test_utils.rs | 6 +- chain/chain/src/types.rs | 5 + chain/client/src/client.rs | 23 +- chain/network/src/peer.rs | 15 +- chain/network/src/types.rs | 26 +-- core/primitives/benches/serialization.rs | 1 + core/primitives/src/block.rs | 27 +-- core/primitives/src/block_header.rs | 247 +++------------------- core/primitives/src/protocol_version.rs | 7 +- core/primitives/src/test_utils.rs | 7 +- core/primitives/src/views.rs | 6 +- genesis-tools/genesis-populate/src/lib.rs | 1 + neard/src/runtime.rs | 6 + 14 files changed, 75 insertions(+), 303 deletions(-) diff --git a/chain/chain/src/chain.rs b/chain/chain/src/chain.rs index 283879f05c2..31ba888d353 100644 --- a/chain/chain/src/chain.rs +++ b/chain/chain/src/chain.rs @@ -271,6 +271,7 @@ impl Chain { chain_genesis.height, ); let genesis = Block::genesis( + chain_genesis.protocol_version, genesis_chunks.iter().map(|chunk| chunk.header.clone()).collect(), chain_genesis.time, chain_genesis.height, diff --git a/chain/chain/src/test_utils.rs b/chain/chain/src/test_utils.rs index 527f453e9d0..a92423034ee 100644 --- a/chain/chain/src/test_utils.rs +++ b/chain/chain/src/test_utils.rs @@ -15,7 +15,7 @@ use near_primitives::account::{AccessKey, Account}; use near_primitives::challenge::ChallengesResult; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; -use near_primitives::protocol_version::PROTOCOL_VERSION; +use near_primitives::protocol_version::{ProtocolVersion, PROTOCOL_VERSION}; use near_primitives::receipt::{ActionReceipt, Receipt, ReceiptEnum}; use near_primitives::serialize::to_base; use near_primitives::sharding::ShardChunkHeader; @@ -884,6 +884,10 @@ impl RuntimeAdapter for KeyValueRuntime { Ok(0) } + fn get_epoch_protocol_version(&self, _epoch_id: &EpochId) -> Result { + Ok(PROTOCOL_VERSION) + } + fn get_validator_info(&self, _block_hash: &CryptoHash) -> Result { Ok(EpochValidatorInfo { current_validators: vec![], diff --git a/chain/chain/src/types.rs b/chain/chain/src/types.rs index 770f4f3708f..c3ecddbef83 100644 --- a/chain/chain/src/types.rs +++ b/chain/chain/src/types.rs @@ -340,6 +340,9 @@ pub trait RuntimeAdapter: Send + Sync { /// Amount of tokens minted in given epoch. fn get_epoch_minted_amount(&self, epoch_id: &EpochId) -> Result; + /// Epoch active protocol version. + fn get_epoch_protocol_version(&self, epoch_id: &EpochId) -> Result; + /// Add proposals for validators. fn add_validator_proposals(&self, block_header_info: BlockHeaderInfo) -> Result<(), Error>; @@ -563,6 +566,7 @@ mod tests { use near_crypto::KeyType; use near_primitives::block::{genesis_chunks, Approval}; use near_primitives::merkle::verify_path; + use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::transaction::{ExecutionOutcome, ExecutionStatus}; use near_primitives::validator_signer::InMemoryValidatorSigner; @@ -575,6 +579,7 @@ mod tests { let num_shards = 32; let genesis_chunks = genesis_chunks(vec![StateRoot::default()], num_shards, 1_000_000, 0); let genesis = Block::genesis( + PROTOCOL_VERSION, genesis_chunks.into_iter().map(|chunk| chunk.header).collect(), Utc::now(), 0, diff --git a/chain/client/src/client.rs b/chain/client/src/client.rs index 83868164efd..082f7bcf530 100644 --- a/chain/client/src/client.rs +++ b/chain/client/src/client.rs @@ -18,6 +18,7 @@ use near_chain::{ }; use near_chain_configs::ClientConfig; use near_chunks::{ProcessPartialEncodedChunkResult, ShardsManager}; +use near_network::types::PartialEncodedChunkResponseMsg; use near_network::{FullPeerInfo, NetworkAdapter, NetworkClientResponses, NetworkRequests}; use near_primitives::block::{Approval, ApprovalInner, ApprovalMessage, Block, BlockHeader}; use near_primitives::challenge::{Challenge, ChallengeBody}; @@ -37,8 +38,6 @@ use crate::metrics; use crate::sync::{BlockSync, HeaderSync, StateSync, StateSyncResult}; use crate::types::{Error, ShardSyncDownload}; use crate::SyncStatus; -use near_network::types::PartialEncodedChunkResponseMsg; -use near_primitives::protocol_version::PROTOCOL_VERSION; const NUM_REBROADCAST_BLOCKS: usize = 30; @@ -382,11 +381,11 @@ impl Client { let prev_header = &prev_block.header; + let next_epoch_id = + self.runtime_adapter.get_next_epoch_id_from_prev_block(&head.last_block_hash)?; + let minted_amount = if self.runtime_adapter.is_next_block_epoch_start(&head.last_block_hash)? { - let next_epoch_id = self - .runtime_adapter - .get_next_epoch_id_from_prev_block(&head.last_block_hash)?; Some(self.runtime_adapter.get_epoch_minted_amount(&next_epoch_id)?) } else { None @@ -396,8 +395,7 @@ impl Client { // TODO(2445): Enable challenges when they are working correctly. // let challenges = self.challenges.drain().map(|(_, challenge)| challenge).collect(); - // MOO - let protocol_version = PROTOCOL_VERSION; + let protocol_version = self.runtime_adapter.get_epoch_protocol_version(&next_epoch_id)?; let block = Block::produce( protocol_version, @@ -1361,8 +1359,12 @@ impl Client { #[cfg(test)] mod test { - use crate::test_utils::TestEnv; + use std::collections::HashMap; + use std::path::Path; + use std::sync::Arc; + use cached::Cached; + use near_chain::{ChainGenesis, RuntimeAdapter}; use near_chain_configs::Genesis; use near_crypto::KeyType; @@ -1371,9 +1373,8 @@ mod test { use near_primitives::validator_signer::InMemoryValidatorSigner; use near_store::test_utils::create_test_store; use neard::config::GenesisExt; - use std::collections::HashMap; - use std::path::Path; - use std::sync::Arc; + + use crate::test_utils::TestEnv; #[test] fn test_pending_approvals() { diff --git a/chain/network/src/peer.rs b/chain/network/src/peer.rs index a54a08b6c32..26a25e0c834 100644 --- a/chain/network/src/peer.rs +++ b/chain/network/src/peer.rs @@ -12,7 +12,6 @@ use tracing::{debug, error, info, warn}; use near_metrics; use near_primitives::block::GenesisId; -use near_primitives::block_header::BlockHeader; use near_primitives::hash::CryptoHash; use near_primitives::network::PeerId; use near_primitives::protocol_version::PROTOCOL_VERSION; @@ -205,7 +204,6 @@ impl Peer { // Record block requests in tracker. match &msg { PeerMessage::Block(b) if self.tracker.has_received(b.hash()) => return, - PeerMessage::BlockLegacy(b) if self.tracker.has_received(&b.header.hash) => return, PeerMessage::BlockRequest(h) => self.tracker.push_request(*h), _ => (), }; @@ -409,15 +407,6 @@ impl Peer { near_metrics::inc_counter(&metrics::PEER_CLIENT_MESSAGE_RECEIVED_TOTAL); let peer_id = unwrap_option_or_return!(self.peer_id()); - // Convert legacy protocol messages. - let msg = match msg { - PeerMessage::BlockLegacy(b) => PeerMessage::Block(b.into()), - PeerMessage::BlockHeadersLegacy(h) => PeerMessage::BlockHeaders( - h.into_iter().map(|h| BlockHeader::BlockHeaderV1(h)).collect(), - ), - m => m, - }; - // Wrap peer message into what client expects. let network_client_msg = match msg { PeerMessage::Block(block) => { @@ -492,9 +481,7 @@ impl Peer { | PeerMessage::RequestUpdateNonce(_) | PeerMessage::ResponseUpdateNonce(_) | PeerMessage::BlockRequest(_) - | PeerMessage::BlockHeadersRequest(_) - | PeerMessage::BlockLegacy(_) - | PeerMessage::BlockHeadersLegacy(_) => { + | PeerMessage::BlockHeadersRequest(_) => { error!(target: "network", "Peer receive_client_message received unexpected type: {:?}", msg); return; } diff --git a/chain/network/src/types.rs b/chain/network/src/types.rs index 4e4778a0fb7..32c3d0f43c9 100644 --- a/chain/network/src/types.rs +++ b/chain/network/src/types.rs @@ -19,7 +19,7 @@ use near_chain::types::ShardStateSyncResponse; use near_chain::{Block, BlockHeader}; use near_crypto::{PublicKey, SecretKey, Signature}; use near_metrics; -use near_primitives::block::{Approval, ApprovalMessage, GenesisId, LegacyBlock}; +use near_primitives::block::{Approval, ApprovalMessage, GenesisId}; use near_primitives::challenge::Challenge; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; @@ -38,7 +38,6 @@ use crate::peer::Peer; #[cfg(feature = "metric_recorder")] use crate::recorder::MetricRecorder; use crate::routing::{Edge, EdgeInfo, RoutingTableInfo}; -use near_primitives::block_header::BlockHeaderV1; /// Number of hops a message is allowed to travel before being dropped. /// This is used to avoid infinite loop because of inconsistent view of the network @@ -413,14 +412,10 @@ pub enum PeerMessage { PeersResponse(Vec), BlockHeadersRequest(Vec), - /// Legacy BlockHeader request. - /// TODO(2713): leave space but remove usage. - BlockHeadersLegacy(Vec), + BlockHeaders(Vec), BlockRequest(CryptoHash), - /// Legacy Block response. - /// TODO(2713): leave space but remove usage. - BlockLegacy(LegacyBlock), + Block(Block), Transaction(SignedTransaction), Routed(RoutedMessage), @@ -429,9 +424,6 @@ pub enum PeerMessage { Disconnect, Challenge(Challenge), - - BlockHeaders(Vec), - Block(Block), } impl fmt::Display for PeerMessage { @@ -447,10 +439,8 @@ impl fmt::Display for PeerMessage { PeerMessage::PeersResponse(_) => f.write_str("PeersResponse"), PeerMessage::BlockHeadersRequest(_) => f.write_str("BlockHeaderRequest"), PeerMessage::BlockHeaders(_) => f.write_str("BlockHeaders"), - PeerMessage::BlockHeadersLegacy(_) => f.write_str("BlockHeadersLegacy"), PeerMessage::BlockRequest(_) => f.write_str("BlockRequest"), PeerMessage::Block(_) => f.write_str("Block"), - PeerMessage::BlockLegacy(_) => f.write_str("BlockLegacy"), PeerMessage::Transaction(_) => f.write_str("Transaction"), PeerMessage::Routed(routed_message) => match routed_message.body { RoutedMessageBody::BlockApproval(_) => f.write_str("BlockApproval"), @@ -537,10 +527,6 @@ impl PeerMessage { size as i64, ); } - PeerMessage::BlockHeadersLegacy(_) => { - near_metrics::inc_counter(&metrics::BLOCK_HEADERS_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::BLOCK_HEADERS_RECEIVED_BYTES, size as i64); - } PeerMessage::BlockHeaders(_) => { near_metrics::inc_counter(&metrics::BLOCK_HEADERS_RECEIVED_TOTAL); near_metrics::inc_counter_by(&metrics::BLOCK_HEADERS_RECEIVED_BYTES, size as i64); @@ -553,10 +539,6 @@ impl PeerMessage { near_metrics::inc_counter(&metrics::BLOCK_RECEIVED_TOTAL); near_metrics::inc_counter_by(&metrics::BLOCK_RECEIVED_BYTES, size as i64); } - PeerMessage::BlockLegacy(_) => { - near_metrics::inc_counter(&metrics::BLOCK_RECEIVED_TOTAL); - near_metrics::inc_counter_by(&metrics::BLOCK_RECEIVED_BYTES, size as i64); - } PeerMessage::Transaction(_) => { near_metrics::inc_counter(&metrics::TRANSACTION_RECEIVED_TOTAL); near_metrics::inc_counter_by(&metrics::TRANSACTION_RECEIVED_BYTES, size as i64); @@ -691,9 +673,7 @@ impl PeerMessage { pub fn is_client_message(&self) -> bool { match self { PeerMessage::Block(_) - | PeerMessage::BlockLegacy(_) | PeerMessage::BlockHeaders(_) - | PeerMessage::BlockHeadersLegacy(_) | PeerMessage::Transaction(_) | PeerMessage::Challenge(_) => true, PeerMessage::Routed(r) => match r.body { diff --git a/core/primitives/benches/serialization.rs b/core/primitives/benches/serialization.rs index bf7e644e70b..c7f5fb97528 100644 --- a/core/primitives/benches/serialization.rs +++ b/core/primitives/benches/serialization.rs @@ -37,6 +37,7 @@ fn create_transaction() -> SignedTransaction { fn create_block() -> Block { let genesis_chunks = genesis_chunks(vec![StateRoot::default()], 1, 1_000, 0); let genesis = Block::genesis( + PROTOCOL_VERSION, genesis_chunks.into_iter().map(|chunk| chunk.header).collect(), Utc::now(), 0, diff --git a/core/primitives/src/block.rs b/core/primitives/src/block.rs index 2256a49ab84..79c6eebc32a 100644 --- a/core/primitives/src/block.rs +++ b/core/primitives/src/block.rs @@ -19,31 +19,6 @@ use crate::types::{Balance, BlockHeight, EpochId, Gas, NumShards, StateRoot}; use crate::utils::to_timestamp; use crate::validator_signer::{EmptyValidatorSigner, ValidatorSigner}; -/// Legacy Block before BlockHeader were updatable. -/// TOOD(2713): Delete after move past version 14. -#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct LegacyBlock { - pub header: BlockHeaderV1, - pub chunks: Vec, - pub challenges: Challenges, - - // Data to confirm the correctness of randomness beacon output - pub vrf_value: near_crypto::vrf::Value, - pub vrf_proof: near_crypto::vrf::Proof, -} - -impl From for Block { - fn from(block: LegacyBlock) -> Self { - Self { - header: BlockHeader::BlockHeaderV1(block.header), - chunks: block.chunks, - challenges: block.challenges, - vrf_proof: block.vrf_proof, - vrf_value: block.vrf_value, - } - } -} - #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] pub struct Block { pub header: BlockHeader, @@ -94,6 +69,7 @@ pub fn genesis_chunks( impl Block { /// Returns genesis block for given genesis date and state root. pub fn genesis( + genesis_protocol_version: ProtocolVersion, chunks: Vec, timestamp: DateTime, height: BlockHeight, @@ -104,6 +80,7 @@ impl Block { let challenges = vec![]; Block { header: BlockHeader::genesis( + genesis_protocol_version, height, Block::compute_state_root(&chunks), Block::compute_chunk_receipts_root(&chunks), diff --git a/core/primitives/src/block_header.rs b/core/primitives/src/block_header.rs index dc782b57ec9..3b772e2686c 100644 --- a/core/primitives/src/block_header.rs +++ b/core/primitives/src/block_header.rs @@ -7,7 +7,7 @@ use near_crypto::{KeyType, PublicKey, Signature}; use crate::challenge::ChallengesResult; use crate::hash::{hash, CryptoHash}; use crate::merkle::combine_hash; -use crate::protocol_version::{ProtocolVersion, PROTOCOL_VERSION, PROTOCOL_VERSION_V14}; +use crate::protocol_version::{ProtocolVersion, PROTOCOL_VERSION}; use crate::types::{AccountId, Balance, BlockHeight, EpochId, MerkleHash, ValidatorStake}; use crate::utils::{from_timestamp, to_timestamp}; use crate::validator_signer::ValidatorSigner; @@ -33,41 +33,7 @@ pub struct BlockHeaderInnerLite { } #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct BlockHeaderInnerRestV1 { - /// Root hash of the chunk receipts in the given block. - pub chunk_receipts_root: MerkleHash, - /// Root hash of the chunk headers in the given block. - pub chunk_headers_root: MerkleHash, - /// Root hash of the chunk transactions in the given block. - pub chunk_tx_root: MerkleHash, - /// Number of chunks included into the block. - pub chunks_included: u64, - /// Root hash of the challenges in the given block. - pub challenges_root: MerkleHash, - /// The output of the randomness beacon - pub random_value: CryptoHash, - /// Validator proposals. - pub validator_proposals: Vec, - /// Mask for new chunks included in the block - pub chunk_mask: Vec, - /// Gas price. Same for all chunks - pub gas_price: Balance, - /// Total supply of tokens in the system - pub total_supply: Balance, - /// List of challenges result from previous block. - pub challenges_result: ChallengesResult, - - /// Last block that has full BFT finality - pub last_final_block: CryptoHash, - /// Last block that has doomslug finality - pub last_ds_final_block: CryptoHash, - - /// All the approvals included in this block - pub approvals: Vec>, -} - -#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct BlockHeaderInnerRestV2 { +pub struct BlockHeaderInnerRest { /// Root hash of the chunk receipts in the given block. pub chunk_receipts_root: MerkleHash, /// Root hash of the chunk headers in the given block. @@ -164,41 +130,13 @@ impl ApprovalMessage { } #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -#[borsh_init(init)] pub struct BlockHeaderV1 { pub prev_hash: CryptoHash, /// Inner part of the block header that gets hashed, split into two parts, one that is sent /// to light clients, and the rest pub inner_lite: BlockHeaderInnerLite, - pub inner_rest: BlockHeaderInnerRestV1, - - /// Signature of the block producer. - pub signature: Signature, - - /// Cached value of hash for this block. - #[borsh_skip] - pub hash: CryptoHash, -} - -impl BlockHeaderV1 { - pub fn init(&mut self) { - self.hash = BlockHeader::compute_hash( - self.prev_hash, - &self.inner_lite.try_to_vec().expect("Failed to serialize"), - &self.inner_rest.try_to_vec().expect("Failed to serialize"), - ); - } -} - -#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct BlockHeaderV2 { - pub prev_hash: CryptoHash, - - /// Inner part of the block header that gets hashed, split into two parts, one that is sent - /// to light clients, and the rest - pub inner_lite: BlockHeaderInnerLite, - pub inner_rest: BlockHeaderInnerRestV2, + pub inner_rest: BlockHeaderInnerRest, /// Signature of the block producer. pub signature: Signature, @@ -212,8 +150,6 @@ pub struct BlockHeaderV2 { #[borsh_init(init)] pub enum BlockHeader { BlockHeaderV1(BlockHeaderV1), - /// Added `latest_protocol_version` to `BlockHeaderInnerRest`. - BlockHeaderV2(BlockHeaderV2), } impl BlockHeader { @@ -237,12 +173,11 @@ impl BlockHeader { ); match self { BlockHeader::BlockHeaderV1(header) => header.hash = hash, - BlockHeader::BlockHeaderV2(header) => header.hash = hash, } } pub fn new( - protocol_version: ProtocolVersion, + _protocol_version: ProtocolVersion, height: BlockHeight, prev_hash: CryptoHash, prev_state_root: MerkleHash, @@ -278,72 +213,33 @@ impl BlockHeader { next_bp_hash, block_merkle_root, }; - match protocol_version { - PROTOCOL_VERSION_V14 => { - let inner_rest = BlockHeaderInnerRestV1 { - chunk_receipts_root, - chunk_headers_root, - chunk_tx_root, - chunks_included, - challenges_root, - random_value, - validator_proposals, - chunk_mask, - gas_price, - total_supply, - challenges_result, - last_final_block, - last_ds_final_block, - approvals, - }; - let (hash, signature) = signer.sign_block_header_parts( - prev_hash, - &inner_lite.try_to_vec().expect("Failed to serialize"), - &inner_rest.try_to_vec().expect("Failed to serialize"), - ); - Self::BlockHeaderV1(BlockHeaderV1 { - prev_hash, - inner_lite, - inner_rest, - signature, - hash, - }) - } - _ => { - let inner_rest = BlockHeaderInnerRestV2 { - chunk_receipts_root, - chunk_headers_root, - chunk_tx_root, - chunks_included, - challenges_root, - random_value, - validator_proposals, - chunk_mask, - gas_price, - total_supply, - challenges_result, - last_final_block, - last_ds_final_block, - approvals, - latest_protocol_version: PROTOCOL_VERSION, - }; - let (hash, signature) = signer.sign_block_header_parts( - prev_hash, - &inner_lite.try_to_vec().expect("Failed to serialize"), - &inner_rest.try_to_vec().expect("Failed to serialize"), - ); - Self::BlockHeaderV2(BlockHeaderV2 { - prev_hash, - inner_lite, - inner_rest, - signature, - hash, - }) - } - } + let inner_rest = BlockHeaderInnerRest { + chunk_receipts_root, + chunk_headers_root, + chunk_tx_root, + chunks_included, + challenges_root, + random_value, + validator_proposals, + chunk_mask, + gas_price, + total_supply, + challenges_result, + last_final_block, + last_ds_final_block, + approvals, + latest_protocol_version: PROTOCOL_VERSION, + }; + let (hash, signature) = signer.sign_block_header_parts( + prev_hash, + &inner_lite.try_to_vec().expect("Failed to serialize"), + &inner_rest.try_to_vec().expect("Failed to serialize"), + ); + Self::BlockHeaderV1(BlockHeaderV1 { prev_hash, inner_lite, inner_rest, signature, hash }) } pub fn genesis( + genesis_protocol_version: ProtocolVersion, height: BlockHeight, state_root: MerkleHash, chunk_receipts_root: MerkleHash, @@ -366,7 +262,7 @@ impl BlockHeader { next_bp_hash, block_merkle_root: CryptoHash::default(), }; - let inner_rest = BlockHeaderInnerRestV1 { + let inner_rest = BlockHeaderInnerRest { chunk_receipts_root, chunk_headers_root, chunk_tx_root, @@ -381,6 +277,7 @@ impl BlockHeader { last_final_block: CryptoHash::default(), last_ds_final_block: CryptoHash::default(), approvals: vec![], + latest_protocol_version: genesis_protocol_version, }; let hash = BlockHeader::compute_hash( CryptoHash::default(), @@ -400,175 +297,150 @@ impl BlockHeader { pub fn hash(&self) -> &CryptoHash { match self { BlockHeader::BlockHeaderV1(header) => &header.hash, - BlockHeader::BlockHeaderV2(header) => &header.hash, } } pub fn prev_hash(&self) -> &CryptoHash { match self { BlockHeader::BlockHeaderV1(header) => &header.prev_hash, - BlockHeader::BlockHeaderV2(header) => &header.prev_hash, } } pub fn signature(&self) -> &Signature { match self { BlockHeader::BlockHeaderV1(header) => &header.signature, - BlockHeader::BlockHeaderV2(header) => &header.signature, } } pub fn height(&self) -> BlockHeight { match self { BlockHeader::BlockHeaderV1(header) => header.inner_lite.height, - BlockHeader::BlockHeaderV2(header) => header.inner_lite.height, } } pub fn epoch_id(&self) -> &EpochId { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_lite.epoch_id, - BlockHeader::BlockHeaderV2(header) => &header.inner_lite.epoch_id, } } pub fn next_epoch_id(&self) -> &EpochId { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_lite.next_epoch_id, - BlockHeader::BlockHeaderV2(header) => &header.inner_lite.next_epoch_id, } } pub fn prev_state_root(&self) -> &MerkleHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_lite.prev_state_root, - BlockHeader::BlockHeaderV2(header) => &header.inner_lite.prev_state_root, } } pub fn chunk_receipts_root(&self) -> &MerkleHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.chunk_receipts_root, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.chunk_receipts_root, } } pub fn chunk_headers_root(&self) -> &MerkleHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.chunk_headers_root, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.chunk_headers_root, } } pub fn chunk_tx_root(&self) -> &MerkleHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.chunk_tx_root, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.chunk_tx_root, } } pub fn chunks_included(&self) -> u64 { match self { BlockHeader::BlockHeaderV1(header) => header.inner_rest.chunks_included, - BlockHeader::BlockHeaderV2(header) => header.inner_rest.chunks_included, } } pub fn challenges_root(&self) -> &MerkleHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.challenges_root, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.challenges_root, } } pub fn outcome_root(&self) -> &MerkleHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_lite.outcome_root, - BlockHeader::BlockHeaderV2(header) => &header.inner_lite.outcome_root, } } pub fn raw_timestamp(&self) -> u64 { match self { BlockHeader::BlockHeaderV1(header) => header.inner_lite.timestamp, - BlockHeader::BlockHeaderV2(header) => header.inner_lite.timestamp, } } pub fn validator_proposals(&self) -> &[ValidatorStake] { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.validator_proposals, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.validator_proposals, } } pub fn chunk_mask(&self) -> &[bool] { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.chunk_mask, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.chunk_mask, } } pub fn gas_price(&self) -> Balance { match self { BlockHeader::BlockHeaderV1(header) => header.inner_rest.gas_price, - BlockHeader::BlockHeaderV2(header) => header.inner_rest.gas_price, } } pub fn total_supply(&self) -> Balance { match self { BlockHeader::BlockHeaderV1(header) => header.inner_rest.total_supply, - BlockHeader::BlockHeaderV2(header) => header.inner_rest.total_supply, } } pub fn random_value(&self) -> &CryptoHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.random_value, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.random_value, } } pub fn last_final_block(&self) -> &CryptoHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.last_final_block, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.last_final_block, } } pub fn last_ds_final_block(&self) -> &CryptoHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.last_ds_final_block, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.last_ds_final_block, } } pub fn challenges_result(&self) -> &ChallengesResult { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.challenges_result, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.challenges_result, } } pub fn next_bp_hash(&self) -> &CryptoHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_lite.next_bp_hash, - BlockHeader::BlockHeaderV2(header) => &header.inner_lite.next_bp_hash, } } pub fn block_merkle_root(&self) -> &CryptoHash { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_lite.block_merkle_root, - BlockHeader::BlockHeaderV2(header) => &header.inner_lite.block_merkle_root, } } pub fn approvals(&self) -> &[Option] { match self { BlockHeader::BlockHeaderV1(header) => &header.inner_rest.approvals, - BlockHeader::BlockHeaderV2(header) => &header.inner_rest.approvals, } } @@ -587,8 +459,7 @@ impl BlockHeader { pub fn latest_protocol_version(&self) -> u32 { match self { - BlockHeader::BlockHeaderV1(_header) => PROTOCOL_VERSION_V14, - BlockHeader::BlockHeaderV2(header) => header.inner_rest.latest_protocol_version, + BlockHeader::BlockHeaderV1(header) => header.inner_rest.latest_protocol_version, } } @@ -597,9 +468,6 @@ impl BlockHeader { BlockHeader::BlockHeaderV1(header) => { header.inner_lite.try_to_vec().expect("Failed to serialize") } - BlockHeader::BlockHeaderV2(header) => { - header.inner_lite.try_to_vec().expect("Failed to serialize") - } } } @@ -608,59 +476,6 @@ impl BlockHeader { BlockHeader::BlockHeaderV1(header) => { header.inner_rest.try_to_vec().expect("Failed to serialize") } - BlockHeader::BlockHeaderV2(header) => { - header.inner_rest.try_to_vec().expect("Failed to serialize") - } } } } - -//impl BorshSerialize for BlockHeader { -// -//} - -//impl BorshDeserialize for BlockHeader {} - -#[cfg(test)] -mod tests { - use crate::block::Block; - use crate::serialize::{from_base, to_base}; - - use super::*; - - #[test] - fn test_block_header_genesis_deserialize() { - // This is serialized BlockHeader converting from v1 which doesn't have version number. - let chunks = vec![]; - let challenges = vec![]; - let timestamp = from_timestamp(0); - let block_header = BlockHeader::genesis( - 0, - Block::compute_state_root(&chunks), - Block::compute_chunk_receipts_root(&chunks), - Block::compute_chunk_headers_root(&chunks).0, - Block::compute_chunk_tx_root(&chunks), - Block::compute_chunks_included(&chunks, 0), - Block::compute_challenges_root(&challenges), - timestamp, - 100, - 1_000_000, - CryptoHash::default(), - ); - let block_header_v1_enc = "11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111AuX3ahfw71vXubTc6dKkCTnEitpHVEc9bSeZNTJeeVz5mu7wocuVidGE4qAkz4DYZcqsy3YDpBg6VcPLLmXNhQMDJTHpcvKfoUqvLnWcueRvAgQRCxpSr66XUCNwHdP1bvyCT6cFzCcWGBuHM4PsPvPAWVQEkFC9zaTYDGaazC7mAuwq7Dc5NyKG8DjKD3XqAJoZAgq5F2f5xoUa69X6n51MZmNC7QaenrooR1q"; - match &block_header { - BlockHeader::BlockHeaderV1(header) => { - assert_eq!(to_base(header.try_to_vec().unwrap()), block_header_v1_enc) - } - _ => panic!("Invalid block header version"), - }; - let block_header_v1 = - BlockHeaderV1::try_from_slice(&from_base(block_header_v1_enc).unwrap()) - .expect("Failed to deserialize old block header"); - assert_eq!(&block_header_v1.hash, block_header.hash()); - assert_eq!( - BlockHeader::BlockHeaderV1(block_header_v1).latest_protocol_version(), - PROTOCOL_VERSION_V14 - ); - } -} diff --git a/core/primitives/src/protocol_version.rs b/core/primitives/src/protocol_version.rs index 10569945c4c..8baa131d2d1 100644 --- a/core/primitives/src/protocol_version.rs +++ b/core/primitives/src/protocol_version.rs @@ -1,12 +1,7 @@ /// Protocol version type. pub type ProtocolVersion = u32; -/// First protocol version backward compatibility started. -/// Changes 14 -> 15: -/// - Added `latest_protocol_version` into `BlockHeaderInnerRest`. -pub const PROTOCOL_VERSION_V14: ProtocolVersion = 14; - /// Current latest version of the protocol. pub const PROTOCOL_VERSION: ProtocolVersion = 15; -pub const FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION: ProtocolVersion = PROTOCOL_VERSION_V14; +pub const FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION: ProtocolVersion = PROTOCOL_VERSION; diff --git a/core/primitives/src/test_utils.rs b/core/primitives/src/test_utils.rs index cd11cc313f2..f03ea5ae482 100644 --- a/core/primitives/src/test_utils.rs +++ b/core/primitives/src/test_utils.rs @@ -2,7 +2,7 @@ use near_crypto::{EmptySigner, PublicKey, Signature, Signer}; use crate::account::{AccessKey, AccessKeyPermission, Account}; use crate::block::Block; -use crate::block_header::{BlockHeader, BlockHeaderV2}; +use crate::block_header::{BlockHeader, BlockHeaderV1}; use crate::hash::CryptoHash; use crate::merkle::PartialMerkleTree; use crate::protocol_version::PROTOCOL_VERSION; @@ -241,10 +241,9 @@ impl SignedTransaction { } impl BlockHeader { - pub fn mut_header(&mut self) -> &mut BlockHeaderV2 { + pub fn mut_header(&mut self) -> &mut BlockHeaderV1 { match self { - BlockHeader::BlockHeaderV2(header) => header, - _ => panic!("Invalid block header version"), + BlockHeader::BlockHeaderV1(header) => header, } } diff --git a/core/primitives/src/views.rs b/core/primitives/src/views.rs index e448682f664..50ef2b172b7 100644 --- a/core/primitives/src/views.rs +++ b/core/primitives/src/views.rs @@ -15,7 +15,7 @@ use near_crypto::{PublicKey, Signature}; use crate::account::{AccessKey, AccessKeyPermission, Account, FunctionCallPermission}; use crate::block::{Block, BlockHeader}; -use crate::block_header::{BlockHeaderInnerLite, BlockHeaderInnerRestV2, BlockHeaderV2}; +use crate::block_header::{BlockHeaderInnerLite, BlockHeaderInnerRest, BlockHeaderV1}; use crate::challenge::{Challenge, ChallengesResult}; use crate::errors::TxExecutionError; use crate::hash::{hash, CryptoHash}; @@ -391,7 +391,7 @@ impl From for BlockHeaderView { impl From for BlockHeader { fn from(view: BlockHeaderView) -> Self { - let mut header = BlockHeader::BlockHeaderV2(BlockHeaderV2 { + let mut header = BlockHeader::BlockHeaderV1(BlockHeaderV1 { prev_hash: view.prev_hash, inner_lite: BlockHeaderInnerLite { height: view.height, @@ -403,7 +403,7 @@ impl From for BlockHeader { next_bp_hash: view.next_bp_hash, block_merkle_root: view.block_merkle_root, }, - inner_rest: BlockHeaderInnerRestV2 { + inner_rest: BlockHeaderInnerRest { chunk_receipts_root: view.chunk_receipts_root, chunk_headers_root: view.chunk_headers_root, chunk_tx_root: view.chunk_tx_root, diff --git a/genesis-tools/genesis-populate/src/lib.rs b/genesis-tools/genesis-populate/src/lib.rs index 1491378a8c2..2fc515b4b0e 100644 --- a/genesis-tools/genesis-populate/src/lib.rs +++ b/genesis-tools/genesis-populate/src/lib.rs @@ -189,6 +189,7 @@ impl GenesisBuilder { self.genesis.config.genesis_height, ); let genesis = Block::genesis( + self.genesis.config.protocol_version, genesis_chunks.into_iter().map(|chunk| chunk.header).collect(), self.genesis.config.genesis_time, self.genesis.config.genesis_height, diff --git a/neard/src/runtime.rs b/neard/src/runtime.rs index c552c190b10..1deb8fb9c9f 100644 --- a/neard/src/runtime.rs +++ b/neard/src/runtime.rs @@ -22,6 +22,7 @@ use near_primitives::block::{Approval, ApprovalInner}; use near_primitives::challenge::ChallengesResult; use near_primitives::errors::{InvalidTxError, RuntimeError}; use near_primitives::hash::{hash, CryptoHash}; +use near_primitives::protocol_version::ProtocolVersion; use near_primitives::receipt::Receipt; use near_primitives::sharding::ShardChunkHeader; use near_primitives::state_record::StateRecord; @@ -829,6 +830,11 @@ impl RuntimeAdapter for NightshadeRuntime { Ok(epoch_manager.get_epoch_info(epoch_id)?.minted_amount) } + fn get_epoch_protocol_version(&self, epoch_id: &EpochId) -> Result { + let mut epoch_manager = self.epoch_manager.write().expect(POISONED_LOCK_ERR); + Ok(epoch_manager.get_epoch_info(epoch_id)?.protocol_version) + } + fn add_validator_proposals(&self, block_header_info: BlockHeaderInfo) -> Result<(), Error> { // Check that genesis block doesn't have any proposals. assert!( From 28f330195059b6ec0b9334b9e0b74ec2908c03d3 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Mon, 25 May 2020 07:41:33 -0700 Subject: [PATCH 09/21] Adding database version for future migrations --- Cargo.lock | 20 +++++-- chain/chain/src/chain.rs | 2 +- chain/chain/src/test_utils.rs | 2 +- chain/chain/src/types.rs | 4 +- chain/chain/tests/simple_chain.rs | 2 +- chain/client/src/client_actor.rs | 2 +- chain/client/src/info.rs | 2 +- chain/client/src/sync.rs | 2 +- chain/client/src/test_utils.rs | 2 +- chain/client/tests/challenges.rs | 2 +- chain/client/tests/process_blocks.rs | 2 +- chain/client/tests/query_client.rs | 2 +- chain/epoch_manager/src/lib.rs | 2 +- chain/epoch_manager/src/test_utils.rs | 2 +- chain/epoch_manager/src/types.rs | 2 +- chain/jsonrpc/tests/rpc_query.rs | 2 +- chain/network/src/peer.rs | 2 +- chain/network/src/types.rs | 2 +- chain/network/tests/runner/mod.rs | 2 +- core/chain-configs/src/client_config.rs | 3 +- core/chain-configs/src/genesis_config.rs | 2 +- core/primitives/benches/serialization.rs | 2 +- core/primitives/src/block.rs | 2 +- core/primitives/src/block_header.rs | 2 +- core/primitives/src/lib.rs | 2 +- core/primitives/src/protocol_version.rs | 7 --- core/primitives/src/test_utils.rs | 2 +- core/primitives/src/types.rs | 10 ---- core/primitives/src/version.rs | 22 ++++++++ core/primitives/src/views.rs | 4 +- core/store/Cargo.toml | 2 +- core/store/src/db.rs | 52 +++++++++---------- core/store/src/lib.rs | 15 +++++- .../src/csv_to_json_configs.rs | 2 +- neard/src/config.rs | 2 +- neard/src/lib.rs | 41 ++++++++++++--- neard/src/main.rs | 3 +- neard/src/runtime.rs | 2 +- neard/src/shard_tracker.rs | 2 +- neard/tests/sync_nodes.rs | 2 +- test-utils/loadtester/src/main.rs | 3 +- 41 files changed, 145 insertions(+), 97 deletions(-) delete mode 100644 core/primitives/src/protocol_version.rs create mode 100644 core/primitives/src/version.rs diff --git a/Cargo.lock b/Cargo.lock index e9c5402ed84..22242729fa8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2040,7 +2040,7 @@ dependencies = [ "near-store-validator", "num-rational", "rand 0.7.3", - "rocksdb", + "rocksdb 0.13.0", "serde", "tracing", ] @@ -2109,7 +2109,7 @@ dependencies = [ "num-rational", "rand 0.7.3", "reed-solomon-erasure", - "rocksdb", + "rocksdb 0.13.0", "serde", "serde_json", "strum", @@ -2355,7 +2355,7 @@ dependencies = [ "near-primitives", "num_cpus", "rand 0.7.3", - "rocksdb", + "rocksdb 0.14.0", "serde", "serde_json", "tempfile", @@ -2494,7 +2494,7 @@ dependencies = [ "node-runtime", "num-rational", "rand 0.7.3", - "rocksdb", + "rocksdb 0.13.0", "serde", "serde_json", "tempfile", @@ -2551,7 +2551,7 @@ dependencies = [ "num-rational", "rand 0.7.3", "rayon", - "rocksdb", + "rocksdb 0.13.0", "serde", "serde_json", "sha2", @@ -3210,6 +3210,16 @@ dependencies = [ "librocksdb-sys", ] +[[package]] +name = "rocksdb" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61aa17a99a2413cd71c1106691bf59dad7de0cd5099127f90e9d99c429c40d4a" +dependencies = [ + "libc", + "librocksdb-sys", +] + [[package]] name = "runtime-params-estimator" version = "0.9.0" diff --git a/chain/chain/src/chain.rs b/chain/chain/src/chain.rs index 9410b4e7663..d9851793bc5 100644 --- a/chain/chain/src/chain.rs +++ b/chain/chain/src/chain.rs @@ -20,7 +20,6 @@ use near_primitives::challenge::{ }; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::merkle::{merklize, verify_path}; -use near_primitives::protocol_version::ProtocolVersion; use near_primitives::receipt::Receipt; use near_primitives::sharding::{ ChunkHash, ChunkHashHeight, ReceiptProof, ShardChunk, ShardChunkHeader, ShardProof, @@ -31,6 +30,7 @@ use near_primitives::types::{ NumBlocks, ShardId, StateHeaderKey, ValidatorStake, }; use near_primitives::unwrap_or_return; +use near_primitives::version::ProtocolVersion; use near_primitives::views::{ ExecutionOutcomeWithIdView, ExecutionStatusView, FinalExecutionOutcomeView, FinalExecutionStatus, LightClientBlockView, diff --git a/chain/chain/src/test_utils.rs b/chain/chain/src/test_utils.rs index 725ca0aeefe..b4527d4badb 100644 --- a/chain/chain/src/test_utils.rs +++ b/chain/chain/src/test_utils.rs @@ -15,7 +15,6 @@ use near_primitives::account::{AccessKey, Account}; use near_primitives::challenge::ChallengesResult; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; -use near_primitives::protocol_version::{ProtocolVersion, PROTOCOL_VERSION}; use near_primitives::receipt::{ActionReceipt, Receipt, ReceiptEnum}; use near_primitives::serialize::to_base; use near_primitives::sharding::ShardChunkHeader; @@ -28,6 +27,7 @@ use near_primitives::types::{ ShardId, StateRoot, StateRootNode, ValidatorStake, ValidatorStats, }; use near_primitives::validator_signer::InMemoryValidatorSigner; +use near_primitives::version::{ProtocolVersion, PROTOCOL_VERSION}; use near_primitives::views::{ AccessKeyInfoView, AccessKeyList, CallResult, EpochValidatorInfo, QueryRequest, QueryResponse, QueryResponseKind, ViewStateResult, diff --git a/chain/chain/src/types.rs b/chain/chain/src/types.rs index 17b4b904285..1cf6aad7489 100644 --- a/chain/chain/src/types.rs +++ b/chain/chain/src/types.rs @@ -12,7 +12,6 @@ use near_primitives::challenge::{ChallengesResult, SlashedValidator}; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::merkle::{merklize, MerklePath}; -use near_primitives::protocol_version::ProtocolVersion; use near_primitives::receipt::Receipt; use near_primitives::sharding::{ReceiptProof, ShardChunk, ShardChunkHeader}; use near_primitives::transaction::{ExecutionOutcomeWithId, SignedTransaction}; @@ -20,6 +19,7 @@ use near_primitives::types::{ AccountId, ApprovalStake, Balance, BlockHeight, EpochId, Gas, MerkleHash, ShardId, StateRoot, StateRootNode, ValidatorStake, ValidatorStats, }; +use near_primitives::version::ProtocolVersion; use near_primitives::views::{EpochValidatorInfo, QueryRequest, QueryResponse}; use near_store::{PartialStorage, ShardTries, Store, StoreUpdate, Trie, WrappedTrieChanges}; @@ -566,9 +566,9 @@ mod tests { use near_crypto::KeyType; use near_primitives::block::{genesis_chunks, Approval}; use near_primitives::merkle::verify_path; - use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::transaction::{ExecutionOutcome, ExecutionStatus}; use near_primitives::validator_signer::InMemoryValidatorSigner; + use near_primitives::version::PROTOCOL_VERSION; use crate::Chain; diff --git a/chain/chain/tests/simple_chain.rs b/chain/chain/tests/simple_chain.rs index 89d2fbca3bf..802e537aaac 100644 --- a/chain/chain/tests/simple_chain.rs +++ b/chain/chain/tests/simple_chain.rs @@ -2,7 +2,7 @@ use near_chain::test_utils::setup; use near_chain::{Block, ChainStoreAccess, ErrorKind, Provenance}; use near_logger_utils::init_test_logger; use near_primitives::hash::CryptoHash; -use near_primitives::protocol_version::PROTOCOL_VERSION; +use near_primitives::version::PROTOCOL_VERSION; use num_rational::Rational; #[test] diff --git a/chain/client/src/client_actor.rs b/chain/client/src/client_actor.rs index 253a2b9dcd4..57ac3878e62 100644 --- a/chain/client/src/client_actor.rs +++ b/chain/client/src/client_actor.rs @@ -31,11 +31,11 @@ use near_network::{ }; use near_primitives::hash::CryptoHash; use near_primitives::network::{AnnounceAccount, PeerId}; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{BlockHeight, EpochId}; use near_primitives::unwrap_or_return; use near_primitives::utils::from_timestamp; use near_primitives::validator_signer::ValidatorSigner; +use near_primitives::version::PROTOCOL_VERSION; use near_primitives::views::ValidatorInfo; #[cfg(feature = "adversarial")] use near_store::ColBlock; diff --git a/chain/client/src/info.rs b/chain/client/src/info.rs index 3b1913daf9f..05fc25cd623 100644 --- a/chain/client/src/info.rs +++ b/chain/client/src/info.rs @@ -15,9 +15,9 @@ use near_primitives::serialize::to_base; use near_primitives::telemetry::{ TelemetryAgentInfo, TelemetryChainInfo, TelemetryInfo, TelemetrySystemInfo, }; -use near_primitives::types::Version; use near_primitives::types::{BlockHeight, Gas}; use near_primitives::validator_signer::ValidatorSigner; +use near_primitives::version::Version; use near_telemetry::{telemetry, TelemetryActor}; use crate::types::ShardSyncStatus; diff --git a/chain/client/src/sync.rs b/chain/client/src/sync.rs index 25533931401..39dd15ab5ce 100644 --- a/chain/client/src/sync.rs +++ b/chain/client/src/sync.rs @@ -877,9 +877,9 @@ mod test { use super::*; use near_primitives::merkle::PartialMerkleTree; - use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::EpochId; use near_primitives::validator_signer::InMemoryValidatorSigner; + use near_primitives::version::PROTOCOL_VERSION; use num_rational::Ratio; #[test] diff --git a/chain/client/src/test_utils.rs b/chain/client/src/test_utils.rs index 543c1a3e530..26c8bb648b9 100644 --- a/chain/client/src/test_utils.rs +++ b/chain/client/src/test_utils.rs @@ -26,12 +26,12 @@ use near_network::{ }; use near_primitives::block::{ApprovalInner, Block, GenesisId}; use near_primitives::hash::{hash, CryptoHash}; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::transaction::SignedTransaction; use near_primitives::types::{ AccountId, Balance, BlockHeight, BlockHeightDelta, NumBlocks, NumSeats, NumShards, }; use near_primitives::validator_signer::{InMemoryValidatorSigner, ValidatorSigner}; +use near_primitives::version::PROTOCOL_VERSION; use near_primitives::views::{AccountView, QueryRequest, QueryResponseKind}; use near_store::test_utils::create_test_store; use near_store::Store; diff --git a/chain/client/tests/challenges.rs b/chain/client/tests/challenges.rs index b2bc2bec5a5..bc7a80bedfb 100644 --- a/chain/client/tests/challenges.rs +++ b/chain/client/tests/challenges.rs @@ -23,13 +23,13 @@ use near_primitives::challenge::{ }; use near_primitives::hash::CryptoHash; use near_primitives::merkle::{merklize, MerklePath, PartialMerkleTree}; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::receipt::Receipt; use near_primitives::serialize::BaseDecode; use near_primitives::sharding::{EncodedShardChunk, ReedSolomonWrapper}; use near_primitives::transaction::SignedTransaction; use near_primitives::types::StateRoot; use near_primitives::validator_signer::InMemoryValidatorSigner; +use near_primitives::version::PROTOCOL_VERSION; use near_store::test_utils::create_test_store; use neard::config::{GenesisExt, FISHERMEN_THRESHOLD}; use neard::NightshadeRuntime; diff --git a/chain/client/tests/process_blocks.rs b/chain/client/tests/process_blocks.rs index b06a517edfd..553bdd051ba 100644 --- a/chain/client/tests/process_blocks.rs +++ b/chain/client/tests/process_blocks.rs @@ -30,12 +30,12 @@ use near_primitives::block::{Approval, ApprovalInner}; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::merkle::merklize; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::sharding::{EncodedShardChunk, ReedSolomonWrapper}; use near_primitives::transaction::{SignedTransaction, Transaction}; use near_primitives::types::{BlockHeight, EpochId, MerkleHash, NumBlocks}; use near_primitives::utils::to_timestamp; use near_primitives::validator_signer::{InMemoryValidatorSigner, ValidatorSigner}; +use near_primitives::version::PROTOCOL_VERSION; use near_store::test_utils::create_test_store; use neard::config::{GenesisExt, TESTING_INIT_BALANCE, TESTING_INIT_STAKE}; use neard::NEAR_BASE; diff --git a/chain/client/tests/query_client.rs b/chain/client/tests/query_client.rs index b86df392b71..23b9211aabc 100644 --- a/chain/client/tests/query_client.rs +++ b/chain/client/tests/query_client.rs @@ -7,10 +7,10 @@ use near_crypto::KeyType; use near_logger_utils::init_test_logger; use near_network::{NetworkClientMessages, PeerInfo}; use near_primitives::block::{Block, BlockHeader}; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{BlockIdOrFinality, EpochId}; use near_primitives::utils::to_timestamp; use near_primitives::validator_signer::InMemoryValidatorSigner; +use near_primitives::version::PROTOCOL_VERSION; use near_primitives::views::{QueryRequest, QueryResponseKind}; use num_rational::Rational; diff --git a/chain/epoch_manager/src/lib.rs b/chain/epoch_manager/src/lib.rs index ca1e67c620a..d5abdff677f 100644 --- a/chain/epoch_manager/src/lib.rs +++ b/chain/epoch_manager/src/lib.rs @@ -1060,8 +1060,8 @@ mod tests { use near_primitives::challenge::SlashedValidator; use near_primitives::hash::hash; - use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::ValidatorKickoutReason::NotEnoughBlocks; + use near_primitives::version::PROTOCOL_VERSION; use near_store::test_utils::create_test_store; use crate::test_utils::{ diff --git a/chain/epoch_manager/src/test_utils.rs b/chain/epoch_manager/src/test_utils.rs index faae9f1af78..9f8489aa547 100644 --- a/chain/epoch_manager/src/test_utils.rs +++ b/chain/epoch_manager/src/test_utils.rs @@ -5,12 +5,12 @@ use num_rational::Rational; use near_crypto::{KeyType, SecretKey}; use near_primitives::challenge::SlashedValidator; use near_primitives::hash::{hash, CryptoHash}; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{ AccountId, Balance, BlockHeight, BlockHeightDelta, EpochHeight, NumSeats, NumShards, ValidatorId, ValidatorKickoutReason, ValidatorStake, }; use near_primitives::utils::get_num_seats_per_shard; +use near_primitives::version::PROTOCOL_VERSION; use near_store::test_utils::create_test_store; use crate::types::{EpochConfig, EpochInfo, ValidatorWeight}; diff --git a/chain/epoch_manager/src/types.rs b/chain/epoch_manager/src/types.rs index b341867db2e..b0d5802fe4e 100644 --- a/chain/epoch_manager/src/types.rs +++ b/chain/epoch_manager/src/types.rs @@ -6,12 +6,12 @@ use serde::Serialize; use near_primitives::challenge::SlashedValidator; use near_primitives::hash::CryptoHash; -use near_primitives::protocol_version::ProtocolVersion; use near_primitives::types::{ AccountId, Balance, BlockChunkValidatorStats, BlockHeight, BlockHeightDelta, EpochHeight, EpochId, NumSeats, NumShards, ShardId, ValidatorId, ValidatorKickoutReason, ValidatorStake, ValidatorStats, }; +use near_primitives::version::ProtocolVersion; use crate::EpochManager; diff --git a/chain/jsonrpc/tests/rpc_query.rs b/chain/jsonrpc/tests/rpc_query.rs index 60c6b7dba4b..c705f6b84a4 100644 --- a/chain/jsonrpc/tests/rpc_query.rs +++ b/chain/jsonrpc/tests/rpc_query.rs @@ -10,9 +10,9 @@ use near_logger_utils::init_test_logger; use near_network::test_utils::WaitOrTimeout; use near_primitives::account::{AccessKey, AccessKeyPermission}; use near_primitives::hash::CryptoHash; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::rpc::{RpcGenesisRecordsRequest, RpcPagination, RpcQueryRequest}; use near_primitives::types::{BlockId, BlockIdOrFinality, Finality, ShardId}; +use near_primitives::version::PROTOCOL_VERSION; use near_primitives::views::{QueryRequest, QueryResponseKind}; #[macro_use] diff --git a/chain/network/src/peer.rs b/chain/network/src/peer.rs index 26a25e0c834..bfedc354f9d 100644 --- a/chain/network/src/peer.rs +++ b/chain/network/src/peer.rs @@ -14,9 +14,9 @@ use near_metrics; use near_primitives::block::GenesisId; use near_primitives::hash::CryptoHash; use near_primitives::network::PeerId; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::unwrap_option_or_return; use near_primitives::utils::DisplayOption; +use near_primitives::version::PROTOCOL_VERSION; use crate::codec::{bytes_to_peer_message, peer_message_to_bytes, Codec}; use crate::rate_counter::RateCounter; diff --git a/chain/network/src/types.rs b/chain/network/src/types.rs index 32c3d0f43c9..00d8b3b8e95 100644 --- a/chain/network/src/types.rs +++ b/chain/network/src/types.rs @@ -24,13 +24,13 @@ use near_primitives::challenge::Challenge; use near_primitives::errors::InvalidTxError; use near_primitives::hash::{hash, CryptoHash}; use near_primitives::network::{AnnounceAccount, PeerId}; -use near_primitives::protocol_version::FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION; use near_primitives::sharding::{ ChunkHash, PartialEncodedChunk, PartialEncodedChunkPart, ReceiptProof, }; use near_primitives::transaction::{ExecutionOutcomeWithIdAndProof, SignedTransaction}; use near_primitives::types::{AccountId, BlockHeight, BlockIdOrFinality, EpochId, ShardId}; use near_primitives::utils::{from_timestamp, to_timestamp}; +use near_primitives::version::FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION; use near_primitives::views::{FinalExecutionOutcomeView, QueryRequest, QueryResponse}; use crate::metrics; diff --git a/chain/network/tests/runner/mod.rs b/chain/network/tests/runner/mod.rs index 13684ab1808..109177b0cac 100644 --- a/chain/network/tests/runner/mod.rs +++ b/chain/network/tests/runner/mod.rs @@ -23,9 +23,9 @@ use near_network::utils::blacklist_from_iter; use near_network::{ NetworkConfig, NetworkRecipient, NetworkRequests, NetworkResponses, PeerInfo, PeerManagerActor, }; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{AccountId, ValidatorId}; use near_primitives::validator_signer::InMemoryValidatorSigner; +use near_primitives::version::PROTOCOL_VERSION; use near_store::test_utils::create_test_store; use near_telemetry::{TelemetryActor, TelemetryConfig}; use num_rational::Rational; diff --git a/core/chain-configs/src/client_config.rs b/core/chain-configs/src/client_config.rs index 2bd7c9c140d..06cf128696b 100644 --- a/core/chain-configs/src/client_config.rs +++ b/core/chain-configs/src/client_config.rs @@ -4,7 +4,8 @@ use std::time::Duration; use serde::{Deserialize, Serialize}; -use near_primitives::types::{AccountId, BlockHeightDelta, NumBlocks, NumSeats, ShardId, Version}; +use near_primitives::types::{AccountId, BlockHeightDelta, NumBlocks, NumSeats, ShardId}; +use near_primitives::version::Version; #[derive(Clone, Serialize, Deserialize)] pub struct ClientConfig { diff --git a/core/chain-configs/src/genesis_config.rs b/core/chain-configs/src/genesis_config.rs index 6d7a3a59ac4..13d42173d03 100644 --- a/core/chain-configs/src/genesis_config.rs +++ b/core/chain-configs/src/genesis_config.rs @@ -12,13 +12,13 @@ use num_rational::Rational; use serde::{Deserialize, Serialize}; use smart_default::SmartDefault; -use near_primitives::protocol_version::{ProtocolVersion, PROTOCOL_VERSION}; use near_primitives::serialize::{u128_dec_format, u128_dec_format_compatible}; use near_primitives::state_record::StateRecord; use near_primitives::types::{ AccountId, AccountInfo, Balance, BlockHeight, BlockHeightDelta, EpochHeight, Gas, NumBlocks, NumSeats, }; +use near_primitives::version::{ProtocolVersion, PROTOCOL_VERSION}; use near_runtime_configs::RuntimeConfig; fn default_online_min_threshold() -> Rational { diff --git a/core/primitives/benches/serialization.rs b/core/primitives/benches/serialization.rs index c7f5fb97528..e97033c01ef 100644 --- a/core/primitives/benches/serialization.rs +++ b/core/primitives/benches/serialization.rs @@ -9,11 +9,11 @@ use near_crypto::{KeyType, PublicKey, Signature}; use near_primitives::account::Account; use near_primitives::block::{genesis_chunks, Block}; use near_primitives::hash::CryptoHash; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::test_utils::account_new; use near_primitives::transaction::{Action, SignedTransaction, Transaction, TransferAction}; use near_primitives::types::{EpochId, StateRoot}; use near_primitives::validator_signer::InMemoryValidatorSigner; +use near_primitives::version::PROTOCOL_VERSION; use num_rational::Rational; fn create_transaction() -> SignedTransaction { diff --git a/core/primitives/src/block.rs b/core/primitives/src/block.rs index 79c6eebc32a..74e5f22f2a9 100644 --- a/core/primitives/src/block.rs +++ b/core/primitives/src/block.rs @@ -11,13 +11,13 @@ pub use crate::block_header::*; use crate::challenge::{Challenges, ChallengesResult}; use crate::hash::{hash, CryptoHash}; use crate::merkle::{merklize, verify_path, MerklePath}; -use crate::protocol_version::ProtocolVersion; use crate::sharding::{ ChunkHashHeight, EncodedShardChunk, ReedSolomonWrapper, ShardChunk, ShardChunkHeader, }; use crate::types::{Balance, BlockHeight, EpochId, Gas, NumShards, StateRoot}; use crate::utils::to_timestamp; use crate::validator_signer::{EmptyValidatorSigner, ValidatorSigner}; +use crate::version::ProtocolVersion; #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] pub struct Block { diff --git a/core/primitives/src/block_header.rs b/core/primitives/src/block_header.rs index 3b772e2686c..33dff231f8c 100644 --- a/core/primitives/src/block_header.rs +++ b/core/primitives/src/block_header.rs @@ -7,10 +7,10 @@ use near_crypto::{KeyType, PublicKey, Signature}; use crate::challenge::ChallengesResult; use crate::hash::{hash, CryptoHash}; use crate::merkle::combine_hash; -use crate::protocol_version::{ProtocolVersion, PROTOCOL_VERSION}; use crate::types::{AccountId, Balance, BlockHeight, EpochId, MerkleHash, ValidatorStake}; use crate::utils::{from_timestamp, to_timestamp}; use crate::validator_signer::ValidatorSigner; +use crate::version::{ProtocolVersion, PROTOCOL_VERSION}; #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] pub struct BlockHeaderInnerLite { diff --git a/core/primitives/src/lib.rs b/core/primitives/src/lib.rs index d635243cd11..83663f29685 100644 --- a/core/primitives/src/lib.rs +++ b/core/primitives/src/lib.rs @@ -17,7 +17,6 @@ pub mod hash; pub mod logging; pub mod merkle; pub mod network; -pub mod protocol_version; pub mod receipt; pub mod rpc; pub mod serialize; @@ -30,4 +29,5 @@ pub mod trie_key; pub mod types; pub mod utils; pub mod validator_signer; +pub mod version; pub mod views; diff --git a/core/primitives/src/protocol_version.rs b/core/primitives/src/protocol_version.rs deleted file mode 100644 index 661832583f2..00000000000 --- a/core/primitives/src/protocol_version.rs +++ /dev/null @@ -1,7 +0,0 @@ -/// Protocol version type. -pub type ProtocolVersion = u32; - -/// Current latest version of the protocol. -pub const PROTOCOL_VERSION: ProtocolVersion = 18; - -pub const FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION: ProtocolVersion = PROTOCOL_VERSION; diff --git a/core/primitives/src/test_utils.rs b/core/primitives/src/test_utils.rs index b1e6431e526..bd710722d88 100644 --- a/core/primitives/src/test_utils.rs +++ b/core/primitives/src/test_utils.rs @@ -6,7 +6,6 @@ use crate::block_header::{BlockHeader, BlockHeaderV1}; use crate::errors::EpochError; use crate::hash::CryptoHash; use crate::merkle::PartialMerkleTree; -use crate::protocol_version::PROTOCOL_VERSION; use crate::transaction::{ Action, AddKeyAction, CreateAccountAction, DeleteAccountAction, DeleteKeyAction, DeployContractAction, FunctionCallAction, SignedTransaction, StakeAction, Transaction, @@ -14,6 +13,7 @@ use crate::transaction::{ }; use crate::types::{AccountId, Balance, BlockHeight, EpochId, EpochInfoProvider, Gas, Nonce}; use crate::validator_signer::ValidatorSigner; +use crate::version::PROTOCOL_VERSION; use num_rational::Rational; use std::collections::HashMap; diff --git a/core/primitives/src/types.rs b/core/primitives/src/types.rs index e38b7c70036..3b6ae6351a9 100644 --- a/core/primitives/src/types.rs +++ b/core/primitives/src/types.rs @@ -473,16 +473,6 @@ impl ChunkExtra { } } -/// Database version. -pub type DbVersion = u32; - -/// Data structure for semver version and github tag or commit. -#[derive(Serialize, Deserialize, Clone, Debug, Default)] -pub struct Version { - pub version: String, - pub build: String, -} - #[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize, Serialize, Deserialize)] #[serde(untagged)] pub enum BlockId { diff --git a/core/primitives/src/version.rs b/core/primitives/src/version.rs new file mode 100644 index 00000000000..4c1a24bb945 --- /dev/null +++ b/core/primitives/src/version.rs @@ -0,0 +1,22 @@ +use serde::{Deserialize, Serialize}; + +/// Data structure for semver version and github tag or commit. +#[derive(Serialize, Deserialize, Clone, Debug, Default)] +pub struct Version { + pub version: String, + pub build: String, +} + +/// Database version. +pub type DbVersion = u32; + +/// Current version of the database. +pub const DB_VERSION: DbVersion = 1; + +/// Protocol version type. +pub type ProtocolVersion = u32; + +/// Current latest version of the protocol. +pub const PROTOCOL_VERSION: ProtocolVersion = 18; + +pub const FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION: ProtocolVersion = PROTOCOL_VERSION; diff --git a/core/primitives/src/views.rs b/core/primitives/src/views.rs index 50ef2b172b7..dda52736d85 100644 --- a/core/primitives/src/views.rs +++ b/core/primitives/src/views.rs @@ -21,7 +21,6 @@ use crate::errors::TxExecutionError; use crate::hash::{hash, CryptoHash}; use crate::logging; use crate::merkle::MerklePath; -use crate::protocol_version::ProtocolVersion; use crate::receipt::{ActionReceipt, DataReceipt, DataReceiver, Receipt, ReceiptEnum}; use crate::rpc::RpcPagination; use crate::serialize::{ @@ -39,8 +38,9 @@ use crate::types::{ AccountId, AccountWithPublicKey, Balance, BlockHeight, EpochId, FunctionArgs, Gas, Nonce, NumBlocks, ShardId, StateChangeCause, StateChangeKind, StateChangeValue, StateChangeWithCause, StateChangesRequest, StateRoot, StorageUsage, StoreKey, StoreValue, ValidatorKickoutReason, - ValidatorStake, Version, + ValidatorStake, }; +use crate::version::{ProtocolVersion, Version}; /// A view of the account #[derive(BorshSerialize, BorshDeserialize, Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] diff --git a/core/store/Cargo.toml b/core/store/Cargo.toml index 9eef1f27cd7..374035ad466 100644 --- a/core/store/Cargo.toml +++ b/core/store/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" byteorder = "1.2" derive_more = "0.99.3" elastic-array = "0.11" -rocksdb = "0.13" +rocksdb = "0.14" serde = { version = "1", features = [ "derive" ] } serde_json = "1" cached = "0.12" diff --git a/core/store/src/db.rs b/core/store/src/db.rs index 019fa3d4d3f..8c76116fa91 100644 --- a/core/store/src/db.rs +++ b/core/store/src/db.rs @@ -8,7 +8,7 @@ use rocksdb::{ ReadOptions, WriteBatch, DB, }; -use near_primitives::types::DbVersion; +use near_primitives::version::DbVersion; #[derive(Debug, Clone, PartialEq)] pub struct DBError(rocksdb::Error); @@ -173,7 +173,6 @@ impl DBTransaction { pub struct RocksDB { db: DB, cfs: Vec<*const ColumnFamily>, - read_options: ReadOptions, } // DB was already Send+Sync. cf and read_options are const pointers using only functions in @@ -201,16 +200,15 @@ pub trait Database: Sync + Send { impl Database for RocksDB { fn get(&self, col: DBCol, key: &[u8]) -> Result>, DBError> { - unsafe { Ok(self.db.get_cf_opt(&*self.cfs[col as usize], key, &self.read_options)?) } + let read_options = rocksdb_read_options(); + unsafe { Ok(self.db.get_cf_opt(&*self.cfs[col as usize], key, &read_options)?) } } fn iter<'a>(&'a self, col: DBCol) -> Box, Box<[u8]>)> + 'a> { + let read_options = rocksdb_read_options(); unsafe { let cf_handle = &*self.cfs[col as usize]; - let iterator = self - .db - .iterator_cf_opt(cf_handle, &self.read_options, IteratorMode::Start) - .unwrap(); + let iterator = self.db.iterator_cf_opt(cf_handle, read_options, IteratorMode::Start); Box::new(iterator) } } @@ -232,10 +230,9 @@ impl Database for RocksDB { .db .iterator_cf_opt( cf_handle, - &read_options, + read_options, IteratorMode::From(key_prefix, Direction::Forward), ) - .unwrap() .take_while(move |(key, _value)| key.starts_with(key_prefix)); Box::new(iterator) } @@ -246,10 +243,10 @@ impl Database for RocksDB { for op in transaction.ops { match op { DBOp::Insert { col, key, value } => unsafe { - batch.put_cf(&*self.cfs[col as usize], key, value)?; + batch.put_cf(&*self.cfs[col as usize], key, value); }, DBOp::Delete { col, key } => unsafe { - batch.delete_cf(&*self.cfs[col as usize], key)?; + batch.delete_cf(&*self.cfs[col as usize], key); }, } } @@ -335,10 +332,9 @@ fn rocksdb_column_options() -> Options { } impl RocksDB { - /// Returns version of the database on the disk. + /// Returns version of the database state on disk. pub fn get_version>(path: P) -> Result { - // Read one column first with version. - let db = RocksDB::init_db(path, 1)?; + let db = RocksDB::new_read_only(path)?; db.get(DBCol::ColDbVersion, VERSION_KEY).map(|result| { serde_json::from_slice( &result @@ -348,25 +344,25 @@ impl RocksDB { }) } - fn init_db>(path: P, num_cols: usize) -> Result { + fn new_read_only>(path: P) -> Result { + let options = Options::default(); + let cf_names: Vec<_> = vec!["col0".to_string()]; + let db = DB::open_cf_for_read_only(&options, path, cf_names.iter(), false)?; + let cfs = + cf_names.iter().map(|n| db.cf_handle(n).unwrap() as *const ColumnFamily).collect(); + Ok(Self { db, cfs }) + } + + pub fn new>(path: P) -> Result { let options = rocksdb_options(); - let cf_names: Vec<_> = (0..num_cols).map(|col| format!("col{}", col)).collect(); + let cf_names: Vec<_> = (0..NUM_COLS).map(|col| format!("col{}", col)).collect(); let cf_descriptors = cf_names .iter() .map(|cf_name| ColumnFamilyDescriptor::new(cf_name, rocksdb_column_options())); let db = DB::open_cf_descriptors(&options, path, cf_descriptors)?; - let cfs = cf_names - .iter() - .map(|n| { - let ptr: *const ColumnFamily = db.cf_handle(n).unwrap(); - ptr - }) - .collect(); - Ok(Self { db, cfs, read_options: rocksdb_read_options() }) - } - - pub fn new>(path: P) -> Result { - RocksDB::init_db(path, NUM_COLS) + let cfs = + cf_names.iter().map(|n| db.cf_handle(n).unwrap() as *const ColumnFamily).collect(); + Ok(Self { db, cfs }) } } diff --git a/core/store/src/lib.rs b/core/store/src/lib.rs index 260fd865b72..00c2c7210ca 100644 --- a/core/store/src/lib.rs +++ b/core/store/src/lib.rs @@ -20,9 +20,10 @@ use near_primitives::hash::CryptoHash; use near_primitives::receipt::{Receipt, ReceivedData}; use near_primitives::serialize::to_base; use near_primitives::trie_key::{trie_key_parsers, TrieKey}; -use near_primitives::types::{AccountId, DbVersion}; +use near_primitives::types::AccountId; +use near_primitives::version::{DbVersion, DB_VERSION}; -use crate::db::{DBOp, DBTransaction, Database, RocksDB}; +use crate::db::{DBOp, DBTransaction, Database, RocksDB, VERSION_KEY}; pub use crate::trie::{ iterator::TrieIterator, update::TrieUpdate, update::TrieUpdateIterator, update::TrieUpdateValuePtr, KeyForStateChanges, PartialStorage, ShardTries, Trie, TrieChanges, @@ -253,6 +254,16 @@ pub fn get_store_version(path: &str) -> DbVersion { RocksDB::get_version(path).expect("Failed to open the database") } +pub fn set_store_version(store: &Store) { + let mut store_update = store.store_update(); + store_update.set( + DBCol::ColDbVersion, + VERSION_KEY, + &serde_json::to_vec(&DB_VERSION).expect("Faile to serialize version"), + ); + store_update.commit().expect("Failed to write version to database"); +} + pub fn create_store(path: &str) -> Arc { let db = Arc::new(RocksDB::new(path).expect("Failed to open the database")); Arc::new(Store::new(db)) diff --git a/genesis-tools/genesis-csv-to-json/src/csv_to_json_configs.rs b/genesis-tools/genesis-csv-to-json/src/csv_to_json_configs.rs index 810352c207a..31b5b80cc6c 100644 --- a/genesis-tools/genesis-csv-to-json/src/csv_to_json_configs.rs +++ b/genesis-tools/genesis-csv-to-json/src/csv_to_json_configs.rs @@ -2,9 +2,9 @@ use std::fs::File; use std::path::Path; use near_chain_configs::{Genesis, GenesisConfig}; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::types::{Balance, NumShards, ShardId}; use near_primitives::utils::get_num_seats_per_shard; +use near_primitives::version::PROTOCOL_VERSION; use neard::config::{ Config, BLOCK_PRODUCER_KICKOUT_THRESHOLD, CHUNK_PRODUCER_KICKOUT_THRESHOLD, CONFIG_FILENAME, EXPECTED_EPOCH_LENGTH, FISHERMEN_THRESHOLD, GAS_PRICE_ADJUSTMENT_RATE, GENESIS_CONFIG_FILENAME, diff --git a/neard/src/config.rs b/neard/src/config.rs index 2dce4ea7e4e..76e21160e6b 100644 --- a/neard/src/config.rs +++ b/neard/src/config.rs @@ -21,7 +21,6 @@ use near_network::utils::blacklist_from_iter; use near_network::NetworkConfig; use near_primitives::account::{AccessKey, Account}; use near_primitives::hash::CryptoHash; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::state_record::StateRecord; use near_primitives::types::{ AccountId, AccountInfo, Balance, BlockHeightDelta, EpochHeight, Gas, NumBlocks, NumSeats, @@ -29,6 +28,7 @@ use near_primitives::types::{ }; use near_primitives::utils::{generate_random_string, get_num_seats_per_shard}; use near_primitives::validator_signer::{InMemoryValidatorSigner, ValidatorSigner}; +use near_primitives::version::PROTOCOL_VERSION; use near_runtime_configs::RuntimeConfig; use near_telemetry::TelemetryConfig; diff --git a/neard/src/lib.rs b/neard/src/lib.rs index 4b1984a8bb9..2c1cb8408c1 100644 --- a/neard/src/lib.rs +++ b/neard/src/lib.rs @@ -4,14 +4,14 @@ use std::sync::Arc; use actix::{Actor, Addr}; use log::info; +use tracing::trace; use near_chain::ChainGenesis; use near_client::{ClientActor, ViewClientActor}; use near_jsonrpc::start_http; use near_network::{NetworkRecipient, PeerManagerActor}; -use near_store::{create_store, get_store_version}; +use near_store::{create_store, get_store_version, set_store_version, Store}; use near_telemetry::TelemetryActor; -use tracing::trace; pub use crate::config::{init_configs, load_config, load_test_config, NearConfig, NEAR_BASE}; pub use crate::runtime::NightshadeRuntime; @@ -23,13 +23,22 @@ mod shard_tracker; const STORE_PATH: &str = "data"; +pub fn store_path_exists(path: &String) -> bool { + match fs::canonicalize(path) { + Ok(_) => true, + _ => false, + } +} + pub fn get_store_path(base_path: &Path) -> String { let mut store_path = base_path.to_owned(); store_path.push(STORE_PATH); match fs::canonicalize(store_path.clone()) { - Ok(path) => info!(target: "near", "Opening store database at {:?}", path), + Ok(path) => { + info!(target: "near", "Opening store database at {:?}", path); + } _ => { - info!(target: "near", "Did not find {:?} path, will be creating new store database", store_path) + info!(target: "near", "Did not find {:?} path, will be creating new store database", store_path); } }; store_path.to_str().unwrap().to_owned() @@ -48,14 +57,30 @@ pub fn get_default_home() -> String { } } +/// Function checks current version of the database and applies migrations to the database. +pub fn apply_store_migrations(path: &String) { + let _db_version = get_store_version(path); + // Add migrations here based on `db_version`. +} + +pub fn init_and_migrate_store(home_dir: &Path) -> Arc { + let path = get_store_path(home_dir); + let store_exists = store_path_exists(&path); + if store_exists { + apply_store_migrations(&path); + } + let store = create_store(&path); + if !store_exists { + set_store_version(&store); + } + store +} + pub fn start_with_config( home_dir: &Path, config: NearConfig, ) -> (Addr, Addr) { - let path = get_store_path(home_dir); - let _db_version = get_store_version(&path); - // TODO: add migrations & other stuff here based on `db_version`. - let store = create_store(&path); + let store = init_and_migrate_store(home_dir); near_actix_utils::init_stop_on_panic(); let runtime = Arc::new(NightshadeRuntime::new( home_dir, diff --git a/neard/src/main.rs b/neard/src/main.rs index cb6111b5fbf..5a8969fd6cf 100644 --- a/neard/src/main.rs +++ b/neard/src/main.rs @@ -13,8 +13,7 @@ use tracing_subscriber::filter::LevelFilter; use tracing_subscriber::EnvFilter; use git_version::git_version; -use near_primitives::protocol_version::PROTOCOL_VERSION; -use near_primitives::types::Version; +use near_primitives::version::{Version, PROTOCOL_VERSION}; use neard::config::init_testnet_configs; use neard::genesis_validate::validate_genesis; use neard::{get_default_home, get_store_path, init_configs, load_config, start_with_config}; diff --git a/neard/src/runtime.rs b/neard/src/runtime.rs index aa556745d66..d49711d1386 100644 --- a/neard/src/runtime.rs +++ b/neard/src/runtime.rs @@ -22,7 +22,6 @@ use near_primitives::block::{Approval, ApprovalInner}; use near_primitives::challenge::ChallengesResult; use near_primitives::errors::{EpochError, InvalidTxError, RuntimeError}; use near_primitives::hash::{hash, CryptoHash}; -use near_primitives::protocol_version::ProtocolVersion; use near_primitives::receipt::Receipt; use near_primitives::sharding::ShardChunkHeader; use near_primitives::state_record::StateRecord; @@ -33,6 +32,7 @@ use near_primitives::types::{ MerkleHash, NumShards, ShardId, StateChangeCause, StateRoot, StateRootNode, ValidatorStake, ValidatorStats, }; +use near_primitives::version::ProtocolVersion; use near_primitives::views::{ AccessKeyInfoView, CallResult, EpochValidatorInfo, QueryError, QueryRequest, QueryResponse, QueryResponseKind, ViewStateResult, diff --git a/neard/src/shard_tracker.rs b/neard/src/shard_tracker.rs index cc4aaed83e8..a7451b432cb 100644 --- a/neard/src/shard_tracker.rs +++ b/neard/src/shard_tracker.rs @@ -237,7 +237,7 @@ mod tests { use near_store::test_utils::create_test_store; use super::{account_id_to_shard_id, ShardTracker, POISONED_LOCK_ERR}; - use near_primitives::protocol_version::PROTOCOL_VERSION; + use near_primitives::version::PROTOCOL_VERSION; use num_rational::Rational; const DEFAULT_TOTAL_SUPPLY: u128 = 1_000_000_000_000; diff --git a/neard/tests/sync_nodes.rs b/neard/tests/sync_nodes.rs index 83477440a8d..61b706f964e 100644 --- a/neard/tests/sync_nodes.rs +++ b/neard/tests/sync_nodes.rs @@ -15,10 +15,10 @@ use near_network::test_utils::{convert_boot_nodes, open_port, WaitOrTimeout}; use near_network::{NetworkClientMessages, PeerInfo}; use near_primitives::block::Approval; use near_primitives::merkle::PartialMerkleTree; -use near_primitives::protocol_version::PROTOCOL_VERSION; use near_primitives::transaction::SignedTransaction; use near_primitives::types::{BlockHeightDelta, EpochId, ValidatorStake}; use near_primitives::validator_signer::{InMemoryValidatorSigner, ValidatorSigner}; +use near_primitives::version::PROTOCOL_VERSION; use neard::config::{GenesisExt, TESTING_INIT_STAKE}; use neard::{load_test_config, start_with_config}; use testlib::{genesis_block, test_helpers::heavy_test}; diff --git a/test-utils/loadtester/src/main.rs b/test-utils/loadtester/src/main.rs index 760cf68339f..f3a560bdec2 100644 --- a/test-utils/loadtester/src/main.rs +++ b/test-utils/loadtester/src/main.rs @@ -13,8 +13,9 @@ use log::info; use git_version::git_version; use near_crypto::Signer; -use near_primitives::types::{NumSeats, NumShards, Version}; +use near_primitives::types::{NumSeats, NumShards}; use near_primitives::validator_signer::ValidatorSigner; +use near_primitives::version::Version; use near_store::{create_store, ColState}; use neard::config::create_testnet_configs; use neard::{get_default_home, get_store_path}; From d1c857e440074fabb704a2bd06e1eb0da4c176e6 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Mon, 25 May 2020 07:46:42 -0700 Subject: [PATCH 10/21] Update rocksdb to 0.14 --- Cargo.lock | 20 +++++--------------- chain/chain/Cargo.toml | 2 +- chain/client/Cargo.toml | 2 +- neard/Cargo.toml | 2 +- runtime/runtime/Cargo.toml | 2 +- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 22242729fa8..000f21844eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2040,7 +2040,7 @@ dependencies = [ "near-store-validator", "num-rational", "rand 0.7.3", - "rocksdb 0.13.0", + "rocksdb", "serde", "tracing", ] @@ -2109,7 +2109,7 @@ dependencies = [ "num-rational", "rand 0.7.3", "reed-solomon-erasure", - "rocksdb 0.13.0", + "rocksdb", "serde", "serde_json", "strum", @@ -2355,7 +2355,7 @@ dependencies = [ "near-primitives", "num_cpus", "rand 0.7.3", - "rocksdb 0.14.0", + "rocksdb", "serde", "serde_json", "tempfile", @@ -2494,7 +2494,7 @@ dependencies = [ "node-runtime", "num-rational", "rand 0.7.3", - "rocksdb 0.13.0", + "rocksdb", "serde", "serde_json", "tempfile", @@ -2551,7 +2551,7 @@ dependencies = [ "num-rational", "rand 0.7.3", "rayon", - "rocksdb 0.13.0", + "rocksdb", "serde", "serde_json", "sha2", @@ -3200,16 +3200,6 @@ dependencies = [ "winapi 0.3.8", ] -[[package]] -name = "rocksdb" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12069b106981c6103d3eab7dd1c86751482d0779a520b7c14954c8b586c1e643" -dependencies = [ - "libc", - "librocksdb-sys", -] - [[package]] name = "rocksdb" version = "0.14.0" diff --git a/chain/chain/Cargo.toml b/chain/chain/Cargo.toml index ba0a9dcbdfc..3cda43ea229 100644 --- a/chain/chain/Cargo.toml +++ b/chain/chain/Cargo.toml @@ -9,7 +9,7 @@ chrono = { version = "0.4.4", features = ["serde"] } log = "0.4" failure = "0.1" failure_derive = "0.1" -rocksdb = "0.13" +rocksdb = "0.14" rand = "0.7" serde = { version = "1", features = [ "derive" ] } cached = "0.12" diff --git a/chain/client/Cargo.toml b/chain/client/Cargo.toml index 9555f3505ef..4a533e5b175 100644 --- a/chain/client/Cargo.toml +++ b/chain/client/Cargo.toml @@ -9,7 +9,7 @@ ansi_term = "0.11" actix = "0.9" futures = "0.3" chrono = { version = "0.4.4", features = ["serde"] } -rocksdb = "0.13" +rocksdb = "0.14" log = "0.4" rand = "0.7" serde = { version = "1", features = ["derive"] } diff --git a/neard/Cargo.toml b/neard/Cargo.toml index ae598255d87..66f3baf1010 100644 --- a/neard/Cargo.toml +++ b/neard/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" actix = "0.9" byteorder = "1.2" easy-ext = "0.2" -rocksdb = "0.13" +rocksdb = "0.14" log = "0.4" chrono = { version = "0.4.4", features = ["serde"] } git-version = "0.3.1" diff --git a/runtime/runtime/Cargo.toml b/runtime/runtime/Cargo.toml index 6c6e170204c..527ddbb0d6a 100644 --- a/runtime/runtime/Cargo.toml +++ b/runtime/runtime/Cargo.toml @@ -9,7 +9,7 @@ byteorder = "1.2" serde = { version = "1", features = ["derive"] } serde_json = "1.0" log = "0.4" -rocksdb = "0.13" +rocksdb = "0.14" rand = "0.7" sha2 = "0.8" sha3 = "0.8" From e16ecc8cd59b09f10be85571a06313dbb17cb7be Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Mon, 25 May 2020 09:23:12 -0700 Subject: [PATCH 11/21] Adding migration and update sample json --- neard/res/genesis_config.json | 8 ++++--- scripts/migrations/18-protocol-upgrade.py | 27 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 scripts/migrations/18-protocol-upgrade.py diff --git a/neard/res/genesis_config.json b/neard/res/genesis_config.json index 3cff1dcf893..2650a3460a6 100644 --- a/neard/res/genesis_config.json +++ b/neard/res/genesis_config.json @@ -1,5 +1,4 @@ { - "config_version": 1, "protocol_version": 18, "genesis_time": "1970-01-01T00:00:00.000000000Z", "chain_id": "sample", @@ -11,9 +10,12 @@ "avg_hidden_validator_seats_per_shard": [ 0 ], - "protocol_upgrade_stake_threshold": [8, 10], - "protocol_upgrade_num_epochs": 2, "dynamic_resharding": false, + "protocol_upgrade_stake_threshold": [ + 4, + 5 + ], + "protocol_upgrade_num_epochs": 2, "epoch_length": 500, "gas_limit": 1000000000000000, "min_gas_price": "5000", diff --git a/scripts/migrations/18-protocol-upgrade.py b/scripts/migrations/18-protocol-upgrade.py new file mode 100644 index 00000000000..00ad0ac8c20 --- /dev/null +++ b/scripts/migrations/18-protocol-upgrade.py @@ -0,0 +1,27 @@ +""" +Protocol upgrade parameters, including: +* Adding `latest_protocol_version` to BlockHeaderInnerRest. +* Collecting this information inside EpochManager. +* Switching protocol version to the next one based on `protocol_upgrade_stake_threshold` and `protocol_upgrade_num_epochs`. +* Removing `config_version`. +""" + +import sys +import os +import json +from collections import OrderedDict + +home = sys.argv[1] +output_home = sys.argv[2] + +config = json.load(open(os.path.join(home, 'output.json')), object_pairs_hook=OrderedDict) + +assert config['protocol_version'] == 17 + +config['protocol_version'] = 18 + +config.pop('config_version') +config['protocol_upgrade_stake_threshold'] = [4, 5] +config['protocol_upgrade_num_epochs'] = 2 + +json.dump(config, open(os.path.join(output_home, 'output.json'), 'w'), indent=2) From 890efa701221dd0dba09341a1b0d9afeea6cd6cc Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Thu, 28 May 2020 10:30:02 -0700 Subject: [PATCH 12/21] Fix merge conflict --- chain/chunks/src/test_utils.rs | 13 +++++++++---- chain/client/tests/bug_repros.rs | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/chain/chunks/src/test_utils.rs b/chain/chunks/src/test_utils.rs index 55a8930dce2..bae328899a6 100644 --- a/chain/chunks/src/test_utils.rs +++ b/chain/chunks/src/test_utils.rs @@ -1,5 +1,7 @@ -use crate::{Seal, SealsManager, ACCEPTING_SEAL_PERIOD_MS, PAST_SEAL_HEIGHT_HORIZON}; +use std::sync::Arc; + use chrono::Utc; + use near_chain::test_utils::KeyValueRuntime; use near_chain::types::RuntimeAdapter; use near_chain::ChainStore; @@ -8,8 +10,10 @@ use near_primitives::hash::{self, CryptoHash}; use near_primitives::sharding::ChunkHash; use near_primitives::types::BlockHeight; use near_primitives::types::{AccountId, ShardId}; +use near_primitives::version::PROTOCOL_VERSION; use near_store::Store; -use std::sync::Arc; + +use crate::{Seal, SealsManager, ACCEPTING_SEAL_PERIOD_MS, PAST_SEAL_HEIGHT_HORIZON}; pub struct SealsManagerTestFixture { pub mock_chunk_producer: AccountId, @@ -55,6 +59,7 @@ impl Default for SealsManagerTestFixture { // in the header is used to check that the `SealsManager` seals cache is properly // cleared. let mock_distant_block_header = BlockHeader::genesis( + PROTOCOL_VERSION, mock_height + PAST_SEAL_HEIGHT_HORIZON + 1, Default::default(), Default::default(), @@ -67,7 +72,7 @@ impl Default for SealsManagerTestFixture { Default::default(), Default::default(), ); - let mock_distant_block_hash = mock_distant_block_header.hash.clone(); + let mock_distant_block_hash = mock_distant_block_header.hash().clone(); Self::store_block_header(store, mock_distant_block_header); Self { @@ -86,7 +91,7 @@ impl Default for SealsManagerTestFixture { impl SealsManagerTestFixture { fn store_block_header(store: Arc, header: BlockHeader) { - let mut chain_store = ChainStore::new(store, header.inner_lite.height); + let mut chain_store = ChainStore::new(store, header.height()); let mut update = chain_store.store_update(); update.save_block_header(header).unwrap(); update.commit().unwrap(); diff --git a/chain/client/tests/bug_repros.rs b/chain/client/tests/bug_repros.rs index 6009dea36b8..5d05c833dd4 100644 --- a/chain/client/tests/bug_repros.rs +++ b/chain/client/tests/bug_repros.rs @@ -1,6 +1,8 @@ // This test tracks tests that reproduce previously fixed bugs to make sure the regressions we // fix do not resurface +use std::cmp::max; +use std::collections::HashMap; use std::sync::{Arc, RwLock}; use actix::{Addr, System}; @@ -15,8 +17,6 @@ use near_network::types::NetworkRequests::PartialEncodedChunkMessage; use near_network::{NetworkClientMessages, NetworkRequests, NetworkResponses, PeerInfo}; use near_primitives::block::Block; use near_primitives::transaction::SignedTransaction; -use std::cmp::max; -use std::collections::HashMap; #[test] fn repro_1183() { From 00dd273b5543fc987520527630bb9228736a0f40 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Fri, 29 May 2020 04:57:05 -0700 Subject: [PATCH 13/21] Make Block data structure upgradable --- chain/chain/src/chain.rs | 221 +++++++++++---------- chain/chain/src/store.rs | 88 ++++---- chain/chain/src/test_utils.rs | 8 +- chain/chain/src/types.rs | 12 +- chain/chain/tests/challenges.rs | 4 +- chain/chain/tests/gc.rs | 12 +- chain/chain/tests/simple_chain.rs | 10 +- chain/chain/tests/sync_chain.rs | 2 +- chain/client/src/client.rs | 36 ++-- chain/client/src/client_actor.rs | 27 +-- chain/client/src/sync.rs | 32 +-- chain/client/src/test_utils.rs | 16 +- chain/client/src/view_client.rs | 12 +- chain/client/tests/bug_repros.rs | 12 +- chain/client/tests/catching_up.rs | 89 +++++---- chain/client/tests/challenges.rs | 84 ++++---- chain/client/tests/chunks_management.rs | 56 +++--- chain/client/tests/consensus.rs | 28 +-- chain/client/tests/process_blocks.rs | 50 ++--- chain/client/tests/query_client.rs | 6 +- chain/network/src/peer.rs | 2 +- core/primitives/benches/serialization.rs | 4 +- core/primitives/src/block.rs | 106 ++++++---- core/primitives/src/test_utils.rs | 24 ++- core/primitives/src/views.rs | 4 +- genesis-tools/genesis-populate/src/lib.rs | 8 +- neard/src/runtime.rs | 6 +- neard/tests/economics.rs | 12 +- neard/tests/sync_nodes.rs | 19 +- test-utils/state-viewer/src/main.rs | 6 +- test-utils/state-viewer/src/state_dump.rs | 19 +- test-utils/store-validator/src/validate.rs | 10 +- 32 files changed, 551 insertions(+), 474 deletions(-) diff --git a/chain/chain/src/chain.rs b/chain/chain/src/chain.rs index d9851793bc5..54820dc8962 100644 --- a/chain/chain/src/chain.rs +++ b/chain/chain/src/chain.rs @@ -119,10 +119,10 @@ impl OrphanBlockPool { fn add(&mut self, orphan: Orphan) { let height_hashes = - self.height_idx.entry(orphan.block.header.height()).or_insert_with(|| vec![]); + self.height_idx.entry(orphan.block.header().height()).or_insert_with(|| vec![]); height_hashes.push(*orphan.block.hash()); let prev_hash_entries = - self.prev_hash_idx.entry(*orphan.block.header.prev_hash()).or_insert_with(|| vec![]); + self.prev_hash_idx.entry(*orphan.block.header().prev_hash()).or_insert_with(|| vec![]); prev_hash_entries.push(*orphan.block.hash()); self.orphans.insert(*orphan.block.hash(), orphan); @@ -316,18 +316,19 @@ impl Chain { store_update.save_chunk(&chunk.chunk_hash, chunk.clone()); } runtime_adapter.add_validator_proposals(BlockHeaderInfo::new( - &genesis.header, + &genesis.header(), // genesis height is considered final chain_genesis.height, ))?; - store_update.save_block_header(genesis.header.clone())?; + store_update.save_block_header(genesis.header().clone())?; store_update.save_block(genesis.clone()); store_update.save_block_extra( &genesis.hash(), BlockExtra { challenges_result: vec![] }, ); - for (chunk_header, state_root) in genesis.chunks.iter().zip(state_roots.iter()) + for (chunk_header, state_root) in + genesis.chunks().iter().zip(state_roots.iter()) { store_update.save_chunk_extra( &genesis.hash(), @@ -343,7 +344,7 @@ impl Chain { ); } - head = Tip::from_header(&genesis.header); + head = Tip::from_header(genesis.header()); store_update.save_head(&head)?; store_update.save_sync_head(&head); @@ -363,7 +364,7 @@ impl Chain { runtime_adapter, orphans: OrphanBlockPool::new(), blocks_with_missing_chunks: OrphanBlockPool::new(), - genesis: genesis.header, + genesis: genesis.header().clone(), transaction_validity_period: chain_genesis.transaction_validity_period, epoch_length: chain_genesis.epoch_length, block_economics_config: BlockEconomicsConfig { @@ -975,18 +976,18 @@ impl Chain { me: &Option, block: &Block, ) -> Result<(), Error> { - let prev_hash = *block.header.prev_hash(); + let prev_hash = *block.header().prev_hash(); let shards_to_dl = self.get_shards_to_dl_state(me, &prev_hash); let prev_block = self.get_block(&prev_hash)?; debug!(target: "chain", "Downloading state for {:?}, I'm {:?}", shards_to_dl, me); let state_dl_info = StateSyncInfo { - epoch_tail_hash: *block.header.hash(), + epoch_tail_hash: *block.header().hash(), shards: shards_to_dl .iter() .map(|shard_id| { - let chunk = &prev_block.chunks[*shard_id as usize]; + let chunk = &prev_block.chunks()[*shard_id as usize]; ShardInfo(*shard_id, chunk.chunk_hash()) }) .collect(), @@ -1017,7 +1018,7 @@ impl Chain { { near_metrics::inc_counter(&metrics::BLOCK_PROCESSED_TOTAL); - if block.chunks.len() != self.runtime_adapter.num_shards() as usize { + if block.chunks().len() != self.runtime_adapter.num_shards() as usize { return Err(ErrorKind::IncorrectNumberOfChunkHeaders.into()); } @@ -1062,7 +1063,7 @@ impl Chain { } // Sum validator balances in full NEARs (divided by 10**24) let sum = block - .header + .header() .validator_proposals() .iter() .map(|validator_stake| (validator_stake.stake / NEAR_BASE) as i64) @@ -1080,7 +1081,7 @@ impl Chain { ErrorKind::Orphan => { let tail_height = self.store.tail()?; // we only add blocks that couldn't have been gc'ed to the orphan pool. - if block.header.height() >= tail_height { + if block.header().height() >= tail_height { let block_hash = *block.hash(); let orphan = Orphan { block, provenance, added: Instant::now() }; @@ -1117,7 +1118,7 @@ impl Chain { ErrorKind::EpochOutOfBounds => { // Possibly block arrived before we finished processing all of the blocks for epoch before last. // Or someone is attacking with invalid chain. - debug!(target: "chain", "Received block {}/{} ignored, as epoch is unknown", block.header.height(), block.hash()); + debug!(target: "chain", "Received block {}/{} ignored, as epoch is unknown", block.header().height(), block.hash()); Err(e) } ErrorKind::Unfit(ref msg) => { @@ -1125,7 +1126,7 @@ impl Chain { target: "chain", "Block {} at {} is unfit at this time: {}", block.hash(), - block.header.height(), + block.header().height(), msg ); Err(ErrorKind::Unfit(msg.clone()).into()) @@ -1183,7 +1184,7 @@ impl Chain { let mut new_blocks_accepted = vec![]; if let Some(orphans) = self.blocks_with_missing_chunks.remove_by_prev_hash(prev_hash) { for orphan in orphans.into_iter() { - let block_hash = *orphan.block.header.hash(); + let block_hash = *orphan.block.header().hash(); let res = self.process_block_single( me, orphan.block, @@ -1301,36 +1302,36 @@ impl Chain { // 3. In inner loops we use all prefixes with no relation to the context described above. let sync_block = self.get_block(&sync_hash).expect("block has already been checked for existence"); - let sync_block_header = sync_block.header.clone(); - let sync_block_epoch_id = sync_block.header.epoch_id().clone(); - if shard_id as usize >= sync_block.chunks.len() { + let sync_block_header = sync_block.header().clone(); + let sync_block_epoch_id = sync_block.header().epoch_id().clone(); + if shard_id as usize >= sync_block.chunks().len() { return Err(ErrorKind::InvalidStateRequest("ShardId out of bounds".into()).into()); } // The chunk was applied at height `chunk_header.height_included`. // Getting the `current` state. let sync_prev_block = self.get_block(sync_block_header.prev_hash())?; - if &sync_block_epoch_id == sync_prev_block.header.epoch_id() { + if &sync_block_epoch_id == sync_prev_block.header().epoch_id() { return Err(ErrorKind::InvalidStateRequest( "sync_hash is not the first hash of the epoch".into(), ) .into()); } - if shard_id as usize >= sync_prev_block.chunks.len() { + if shard_id as usize >= sync_prev_block.chunks().len() { return Err(ErrorKind::InvalidStateRequest("ShardId out of bounds".into()).into()); } // Chunk header here is the same chunk header as at the `current` height. - let chunk_header = sync_prev_block.chunks[shard_id as usize].clone(); + let chunk_header = sync_prev_block.chunks()[shard_id as usize].clone(); let (chunk_headers_root, chunk_proofs) = merklize( &sync_prev_block - .chunks + .chunks() .iter() .map(|shard_chunk| { ChunkHashHeight(shard_chunk.hash.clone(), shard_chunk.height_included) }) .collect::>(), ); - assert_eq!(&chunk_headers_root, sync_prev_block.header.chunk_headers_root()); + assert_eq!(&chunk_headers_root, sync_prev_block.header().chunk_headers_root()); let chunk = self.get_chunk_clone_from_header(&chunk_header)?; let chunk_proof = chunk_proofs[shard_id as usize].clone(); @@ -1342,22 +1343,22 @@ impl Chain { .get_block(block_header.prev_hash()) { Ok(prev_block) => { - if shard_id as usize >= prev_block.chunks.len() { + if shard_id as usize >= prev_block.chunks().len() { return Err( ErrorKind::InvalidStateRequest("ShardId out of bounds".into()).into() ); } - let prev_chunk_header = prev_block.chunks[shard_id as usize].clone(); + let prev_chunk_header = prev_block.chunks()[shard_id as usize].clone(); let (prev_chunk_headers_root, prev_chunk_proofs) = merklize( &prev_block - .chunks + .chunks() .iter() .map(|shard_chunk| { ChunkHashHeight(shard_chunk.hash.clone(), shard_chunk.height_included) }) .collect::>(), ); - assert_eq!(&prev_chunk_headers_root, prev_block.header.chunk_headers_root()); + assert_eq!(&prev_chunk_headers_root, prev_block.header().chunk_headers_root()); let prev_chunk_proof = prev_chunk_proofs[shard_id as usize].clone(); let prev_chunk_height_included = prev_chunk_header.height_included; @@ -1388,7 +1389,7 @@ impl Chain { let block = self.get_block(&block_hash)?; let (block_receipts_root, block_receipts_proofs) = merklize( &block - .chunks + .chunks() .iter() .map(|chunk| chunk.inner.outgoing_receipts_root) .collect::>(), @@ -1402,7 +1403,7 @@ impl Chain { let receipts_hash = hash(&ReceiptList(shard_id, receipts.to_vec()).try_to_vec()?); let from_shard_id = *from_shard_id as usize; - let root_proof = block.chunks[from_shard_id].inner.outgoing_receipts_root; + let root_proof = block.chunks()[from_shard_id].inner.outgoing_receipts_root; root_proofs_cur .push(RootProof(root_proof, block_receipts_proofs[from_shard_id].clone())); @@ -1448,22 +1449,22 @@ impl Chain { ) -> Result, Error> { let sync_block = self.get_block(&sync_hash).expect("block has already been checked for existence"); - let sync_block_header = sync_block.header.clone(); - let sync_block_epoch_id = sync_block.header.epoch_id().clone(); - if shard_id as usize >= sync_block.chunks.len() { + let sync_block_header = sync_block.header().clone(); + let sync_block_epoch_id = sync_block.header().epoch_id().clone(); + if shard_id as usize >= sync_block.chunks().len() { return Err(ErrorKind::InvalidStateRequest("shard_id out of bounds".into()).into()); } let sync_prev_block = self.get_block(sync_block_header.prev_hash())?; - if &sync_block_epoch_id == sync_prev_block.header.epoch_id() { + if &sync_block_epoch_id == sync_prev_block.header().epoch_id() { return Err(ErrorKind::InvalidStateRequest( "sync_hash is not the first hash of the epoch".into(), ) .into()); } - if shard_id as usize >= sync_prev_block.chunks.len() { + if shard_id as usize >= sync_prev_block.chunks().len() { return Err(ErrorKind::InvalidStateRequest("shard_id out of bounds".into()).into()); } - let state_root = sync_prev_block.chunks[shard_id as usize].inner.prev_state_root.clone(); + let state_root = sync_prev_block.chunks()[shard_id as usize].inner.prev_state_root.clone(); let state_root_node = self.runtime_adapter.get_state_root_node(shard_id, &state_root); let num_parts = Self::get_num_state_parts(state_root_node.memory_usage); @@ -1587,7 +1588,7 @@ impl Chain { ErrorKind::Other("set_shard_state failed: invalid proofs".into()).into() ); } - // We know there were exactly `block_header.inner.chunks_included` chunks included + // We know there were exactly `block_header.chunks_included` chunks included // on the height of block `block_hash`. // There were no other proofs except for included chunks. // According to Pigeonhole principle, it's enough to ensure all receipt_proofs are distinct @@ -1787,7 +1788,7 @@ impl Chain { // Apply the epoch start block separately, since it doesn't follow the pattern let block = self.store.get_block(&epoch_first_block)?.clone(); - let prev_block = self.store.get_block(block.header.prev_hash())?.clone(); + let prev_block = self.store.get_block(block.header().prev_hash())?.clone(); let mut chain_update = ChainUpdate::new( &mut self.store, @@ -1801,9 +1802,9 @@ impl Chain { chain_update.apply_chunks(me, &block, &prev_block, ApplyChunksMode::NextEpoch)?; chain_update.commit()?; - affected_blocks.insert(*block.header.hash()); + affected_blocks.insert(*block.header().hash()); - let first_epoch = block.header.epoch_id().clone(); + let first_epoch = block.header().epoch_id().clone(); let mut queue = vec![*epoch_first_block]; let mut cur = 0; @@ -1834,7 +1835,7 @@ impl Chain { chain_update.commit()?; - affected_blocks.insert(*block.header.hash()); + affected_blocks.insert(*block.header().hash()); queue.push(next_block_hash); } if saw_one { @@ -1853,7 +1854,7 @@ impl Chain { // `epoch_first_block` we should only remove the pair with hash = epoch_first_block, while // for all the blocks in the queue we can remove all the pairs that have them as `prev_hash` // since we processed all the blocks built on top of them above during the BFS - chain_store_update.remove_block_to_catchup(*block.header.prev_hash(), *epoch_first_block); + chain_store_update.remove_block_to_catchup(*block.header().prev_hash(), *epoch_first_block); for block_hash in queue { debug!(target: "chain", "Catching up: removing prev={:?} from the queue. I'm {:?}", block_hash, me); @@ -2254,15 +2255,15 @@ impl<'a> ChainUpdate<'a> { return Ok(()); } let mut missing = vec![]; - let height = block.header.height(); - for (shard_id, chunk_header) in block.chunks.iter().enumerate() { + let height = block.header().height(); + for (shard_id, chunk_header) in block.chunks().iter().enumerate() { // Check if any chunks are invalid in this block. if let Some(encoded_chunk) = self.chain_store_update.is_invalid_chunk(&chunk_header.hash)? { - let merkle_paths = Block::compute_chunk_headers_root(&block.chunks).1; + let merkle_paths = Block::compute_chunk_headers_root(&block.chunks()).1; let chunk_proof = ChunkProofs { - block_header: block.header.try_to_vec().expect("Failed to serialize"), + block_header: block.header().try_to_vec().expect("Failed to serialize"), merkle_proof: merkle_paths[shard_id].clone(), chunk: MaybeEncodedShardChunk::Encoded(encoded_chunk.clone()), }; @@ -2304,13 +2305,13 @@ impl<'a> ChainUpdate<'a> { me: &Option, block: &Block, ) -> Result<(), Error> { - if !self.care_about_any_shard_or_part(me, *block.header.prev_hash())? { + if !self.care_about_any_shard_or_part(me, *block.header().prev_hash())? { return Ok(()); } - let height = block.header.height(); + let height = block.header().height(); let mut receipt_proofs_by_shard_id = HashMap::new(); - for chunk_header in block.chunks.iter() { + for chunk_header in block.chunks().iter() { if chunk_header.height_included == height { let partial_encoded_chunk = self.chain_store_update.get_partial_chunk(&chunk_header.chunk_hash()).unwrap(); @@ -2342,13 +2343,13 @@ impl<'a> ChainUpdate<'a> { block: &Block, chunk_header: &ShardChunkHeader, ) -> Result { - let prev_chunk_header = &prev_block.chunks[chunk_header.inner.shard_id as usize]; - let prev_merkle_proofs = Block::compute_chunk_headers_root(&prev_block.chunks).1; - let merkle_proofs = Block::compute_chunk_headers_root(&block.chunks).1; + let prev_chunk_header = &prev_block.chunks()[chunk_header.inner.shard_id as usize]; + let prev_merkle_proofs = Block::compute_chunk_headers_root(&prev_block.chunks()).1; + let merkle_proofs = Block::compute_chunk_headers_root(&block.chunks()).1; let prev_chunk = self .chain_store_update .get_chain_store() - .get_chunk_clone_from_header(&prev_block.chunks[chunk_header.inner.shard_id as usize]) + .get_chunk_clone_from_header(&prev_block.chunks()[chunk_header.inner.shard_id as usize]) .unwrap(); let receipt_proof_response: Vec = self.chain_store_update.get_incoming_receipts_for_shard( @@ -2359,9 +2360,9 @@ impl<'a> ChainUpdate<'a> { let receipts = collect_receipts_from_response(&receipt_proof_response); let challenges_result = self.verify_challenges( - &block.challenges, - &block.header.epoch_id(), - &block.header.prev_hash(), + block.challenges(), + block.header().epoch_id(), + block.header().prev_hash(), Some(&block.hash()), )?; let apply_result = self @@ -2370,13 +2371,13 @@ impl<'a> ChainUpdate<'a> { chunk_header.inner.shard_id, &prev_chunk.header.inner.prev_state_root, prev_chunk.header.height_included, - prev_block.header.raw_timestamp(), + prev_block.header().raw_timestamp(), &prev_chunk.header.inner.prev_block_hash, &prev_block.hash(), &receipts, &prev_chunk.transactions, &prev_chunk.header.inner.validator_proposals, - prev_block.header.gas_price(), + prev_block.header().gas_price(), prev_chunk.header.inner.gas_limit, &challenges_result, true, @@ -2384,8 +2385,8 @@ impl<'a> ChainUpdate<'a> { .unwrap(); let partial_state = apply_result.proof.unwrap().nodes; Ok(ChunkState { - prev_block_header: prev_block.header.try_to_vec()?, - block_header: block.header.try_to_vec()?, + prev_block_header: prev_block.header().try_to_vec()?, + block_header: block.header().try_to_vec()?, prev_merkle_proof: prev_merkle_proofs[chunk_header.inner.shard_id as usize].clone(), merkle_proof: merkle_proofs[chunk_header.inner.shard_id as usize].clone(), prev_chunk, @@ -2402,44 +2403,44 @@ impl<'a> ChainUpdate<'a> { mode: ApplyChunksMode, ) -> Result<(), Error> { let challenges_result = self.verify_challenges( - &block.challenges, - &block.header.epoch_id(), - &block.header.prev_hash(), + block.challenges(), + block.header().epoch_id(), + block.header().prev_hash(), Some(&block.hash()), )?; self.chain_store_update.save_block_extra(&block.hash(), BlockExtra { challenges_result }); for (shard_id, (chunk_header, prev_chunk_header)) in - (block.chunks.iter().zip(prev_block.chunks.iter())).enumerate() + (block.chunks().iter().zip(prev_block.chunks().iter())).enumerate() { let shard_id = shard_id as ShardId; let care_about_shard = match mode { ApplyChunksMode::ThisEpoch => self.runtime_adapter.cares_about_shard( me.as_ref(), - &block.header.prev_hash(), + &block.header().prev_hash(), shard_id, true, ), ApplyChunksMode::NextEpoch => { self.runtime_adapter.will_care_about_shard( me.as_ref(), - &block.header.prev_hash(), + &block.header().prev_hash(), shard_id, true, ) && !self.runtime_adapter.cares_about_shard( me.as_ref(), - &block.header.prev_hash(), + &block.header().prev_hash(), shard_id, true, ) } }; if care_about_shard { - if chunk_header.height_included == block.header.height() { + if chunk_header.height_included == block.header().height() { // Validate state root. let prev_chunk_extra = self .chain_store_update - .get_chunk_extra(&block.header.prev_hash(), shard_id)? + .get_chunk_extra(&block.header().prev_hash(), shard_id)? .clone(); // Validate that all next chunk information matches previous chunk extra. @@ -2448,7 +2449,7 @@ impl<'a> ChainUpdate<'a> { // because we're asking prev_chunk_header for already committed block self.chain_store_update.get_chain_store(), &*self.runtime_adapter, - &block.header.prev_hash(), + &block.header().prev_hash(), &prev_chunk_extra, prev_chunk_header, chunk_header, @@ -2476,9 +2477,9 @@ impl<'a> ChainUpdate<'a> { self.chain_store_update.get_chunk_clone_from_header(&chunk_header)?; if !validate_transactions_order(&chunk.transactions) { - let merkle_paths = Block::compute_chunk_headers_root(&block.chunks).1; + let merkle_paths = Block::compute_chunk_headers_root(&block.chunks()).1; let chunk_proof = ChunkProofs { - block_header: block.header.try_to_vec().expect("Failed to serialize"), + block_header: block.header().try_to_vec().expect("Failed to serialize"), merkle_proof: merkle_paths[shard_id as usize].clone(), chunk: MaybeEncodedShardChunk::Decoded(chunk), }; @@ -2496,15 +2497,15 @@ impl<'a> ChainUpdate<'a> { shard_id, &chunk.header.inner.prev_state_root, chunk_header.height_included, - block.header.raw_timestamp(), + block.header().raw_timestamp(), &chunk_header.inner.prev_block_hash, &block.hash(), &receipts, &chunk.transactions, &chunk.header.inner.validator_proposals, - prev_block.header.gas_price(), + prev_block.header().gas_price(), chunk.header.inner.gas_limit, - &block.header.challenges_result(), + &block.header().challenges_result(), ) .map_err(|e| ErrorKind::Other(e.to_string()))?; @@ -2560,16 +2561,16 @@ impl<'a> ChainUpdate<'a> { .apply_transactions( shard_id, &new_extra.state_root, - block.header.height(), - block.header.raw_timestamp(), + block.header().height(), + block.header().raw_timestamp(), &prev_block.hash(), &block.hash(), &[], &[], &new_extra.validator_proposals, - block.header.gas_price(), + block.header().gas_price(), new_extra.gas_limit, - &block.header.challenges_result(), + &block.header().challenges_result(), ) .map_err(|e| ErrorKind::Other(e.to_string()))?; @@ -2597,23 +2598,23 @@ impl<'a> ChainUpdate<'a> { where F: FnMut(ChallengeBody) -> (), { - debug!(target: "chain", "Process block {} at {}, approvals: {}, me: {:?}", block.hash(), block.header.height(), block.header.num_approvals(), me); + debug!(target: "chain", "Process block {} at {}, approvals: {}, me: {:?}", block.hash(), block.header().height(), block.header().num_approvals(), me); // Check if we have already processed this block previously. - self.check_known(block.header.hash())?; + self.check_known(block.header().hash())?; // Delay hitting the db for current chain head until we know this block is not already known. let head = self.chain_store_update.head()?; - let is_next = block.header.prev_hash() == &head.last_block_hash; + let is_next = block.header().prev_hash() == &head.last_block_hash; // Check that we know the epoch of the block before we try to get the header // (so that a block from unknown epoch doesn't get marked as an orphan) - if !self.runtime_adapter.epoch_exists(&block.header.epoch_id()) { + if !self.runtime_adapter.epoch_exists(&block.header().epoch_id()) { return Err(ErrorKind::EpochOutOfBounds.into()); } // First real I/O expense. - let prev = self.get_previous_header(&block.header)?; + let prev = self.get_previous_header(block.header())?; let prev_hash = *prev.hash(); let prev_prev_hash = *prev.prev_hash(); let prev_gas_price = prev.gas_price(); @@ -2627,7 +2628,7 @@ impl<'a> ChainUpdate<'a> { // A heuristic to prevent block height to jump too fast towards BlockHeight::max and cause // overflow-related problems - if block.header.height() > head.height + self.epoch_length * 20 { + if block.header().height() > head.height + self.epoch_length * 20 { return Err(ErrorKind::InvalidBlockHeight.into()); } @@ -2650,17 +2651,17 @@ impl<'a> ChainUpdate<'a> { debug!(target: "chain", "{:?} Process block {}, is_caught_up: {}, need_to_start_fetching_state: {}", me, block.hash(), is_caught_up, needs_to_start_fetching_state); // Check the header is valid before we proceed with the full block. - self.process_header_for_block(&block.header, provenance, on_challenge)?; + self.process_header_for_block(block.header(), provenance, on_challenge)?; self.runtime_adapter.verify_block_vrf( - &block.header.epoch_id(), - block.header.height(), + &block.header().epoch_id(), + block.header().height(), &prev_random_value, - block.vrf_value, - block.vrf_proof, + block.vrf_value(), + block.vrf_proof(), )?; - if block.header.random_value() != &hash(block.vrf_value.0.as_ref()) { + if block.header().random_value() != &hash(block.vrf_value().0.as_ref()) { return Err(ErrorKind::InvalidRandomnessBeaconOutput.into()); } @@ -2684,9 +2685,11 @@ impl<'a> ChainUpdate<'a> { self.save_incoming_receipts_from_block(me, &block)?; // Do basic validation of chunks before applying the transactions - for (chunk_header, prev_chunk_header) in block.chunks.iter().zip(prev_block.chunks.iter()) { - if chunk_header.height_included == block.header.height() { - if &chunk_header.inner.prev_block_hash != block.header.prev_hash() { + for (chunk_header, prev_chunk_header) in + block.chunks().iter().zip(prev_block.chunks().iter()) + { + if chunk_header.height_included == block.header().height() { + if &chunk_header.inner.prev_block_hash != block.header().prev_hash() { return Err(ErrorKind::InvalidChunk.into()); } } else { @@ -2709,30 +2712,32 @@ impl<'a> ChainUpdate<'a> { // Verify that proposals from chunks match block header proposals. let mut all_chunk_proposals = vec![]; - for chunk in block.chunks.iter() { - if block.header.height() == chunk.height_included { + for chunk in block.chunks().iter() { + if block.header().height() == chunk.height_included { all_chunk_proposals.extend(chunk.inner.validator_proposals.clone()); } } - if all_chunk_proposals.as_slice() != block.header.validator_proposals() { + if all_chunk_proposals.as_slice() != block.header().validator_proposals() { return Err(ErrorKind::InvalidValidatorProposals.into()); } // If block checks out, record validator proposals for given block. - let last_final_block = block.header.last_final_block(); + let last_final_block = block.header().last_final_block(); let last_finalized_height = if last_final_block == &CryptoHash::default() { self.chain_store_update.get_genesis_height() } else { self.chain_store_update.get_block_header(last_final_block)?.height() }; - self.runtime_adapter - .add_validator_proposals(BlockHeaderInfo::new(&block.header, last_finalized_height))?; + self.runtime_adapter.add_validator_proposals(BlockHeaderInfo::new( + &block.header(), + last_finalized_height, + ))?; // Add validated block to the db, even if it's not the canonical fork. self.chain_store_update.save_block(block.clone()); - self.chain_store_update.inc_block_refcount(block.header.prev_hash())?; - for (shard_id, chunk_headers) in block.chunks.iter().enumerate() { - if chunk_headers.height_included == block.header.height() { + self.chain_store_update.inc_block_refcount(block.header().prev_hash())?; + for (shard_id, chunk_headers) in block.chunks().iter().enumerate() { + if chunk_headers.height_included == block.header().height() { self.chain_store_update .save_block_hash_with_new_chunk(*block.hash(), shard_id as ShardId); } @@ -2751,8 +2756,8 @@ impl<'a> ChainUpdate<'a> { // Presently the epoch boundary is defined by the height, and the fork choice rule // is also just height, so the very first block to cross the epoch end is guaranteed // to be the head of the chain, and result in the light client block produced. - if block.header.epoch_id() != &prev_epoch_id { - let prev = self.get_previous_header(&block.header)?.clone(); + if block.header().epoch_id() != &prev_epoch_id { + let prev = self.get_previous_header(&block.header())?.clone(); if prev.last_final_block() != &CryptoHash::default() { let light_client_block = self.create_light_client_block(&prev)?; self.chain_store_update @@ -2979,8 +2984,8 @@ impl<'a> ChainUpdate<'a> { // if we made a fork with higher height than the head (which should also be true // when extending the head), update it let head = self.chain_store_update.head()?; - if block.header.height() > head.height { - let tip = Tip::from_header(&block.header); + if block.header().height() > head.height { + let tip = Tip::from_header(&block.header()); self.chain_store_update.save_body_head(&tip)?; near_metrics::set_gauge(&metrics::BLOCK_HEIGHT_HEAD, tip.height as i64); @@ -3315,7 +3320,7 @@ pub fn check_refcount_map(chain: &mut Chain) -> Result<(), Error> { }; for block_hash in blocks_current_height.iter() { if let Ok(prev_hash) = - chain.get_block(&block_hash).map(|block| *block.header.prev_hash()) + chain.get_block(&block_hash).map(|block| *block.header().prev_hash()) { *block_refcounts.entry(prev_hash).or_insert(0) += 1; } diff --git a/chain/chain/src/store.rs b/chain/chain/src/store.rs index 1bbd4576f83..a27b4406d97 100644 --- a/chain/chain/src/store.rs +++ b/chain/chain/src/store.rs @@ -1825,7 +1825,7 @@ impl<'a> ChainStoreUpdate<'a> { .get_block(&block_hash) .expect("block data is not expected to be already cleaned") .clone(); - let height = block.header.height(); + let height = block.header().height(); if height == self.get_genesis_height() { if let GCMode::Fork(_) = gc_mode { // Broken GC prerequisites found @@ -1837,7 +1837,7 @@ impl<'a> ChainStoreUpdate<'a> { } // 2. Delete shard_id-indexed data (shards, receipts, transactions) - for shard_id in 0..block.header.chunk_mask().len() as ShardId { + for shard_id in 0..block.header().chunk_mask().len() as ShardId { // 2a. Delete outgoing receipts (ColOutgoingReceipts) store_update.delete(ColOutgoingReceipts, &get_block_shard_id(&block_hash, shard_id)); self.chain_store @@ -1865,7 +1865,7 @@ impl<'a> ChainStoreUpdate<'a> { // 2f. Delete from ColStateParts // Already done, check chain.clear_downloaded_parts() } - for chunk_header in block.chunks { + for chunk_header in block.chunks() { if let Ok(chunk) = self.get_chunk_clone_from_header(&chunk_header) { // 2g. Delete from receipt_id_to_shard_id (ColReceiptIdToShardId) for receipt in chunk.receipts { @@ -1936,7 +1936,7 @@ impl<'a> ChainStoreUpdate<'a> { self.get_all_block_hashes_by_height(height).expect("current height exists"); let mut epoch_to_hashes = epoch_to_hashes_ref.clone(); let hashes = epoch_to_hashes - .get_mut(&block.header.epoch_id()) + .get_mut(&block.header().epoch_id()) .expect("current epoch id should exist"); hashes.remove(&block_hash); store_update.set_ser( @@ -1948,7 +1948,7 @@ impl<'a> ChainStoreUpdate<'a> { .block_hash_per_height .cache_set(index_to_bytes(height), epoch_to_hashes); // 5b. Decreasing block refcount - self.dec_block_refcount(block.header.prev_hash())?; + self.dec_block_refcount(block.header().prev_hash())?; } GCMode::Canonical(_) => { // 6. Canonical Chain only clearing @@ -1998,17 +1998,19 @@ impl<'a> ChainStoreUpdate<'a> { } for (hash, block) in self.chain_store_cache_update.blocks.iter() { let mut map = - match self.chain_store.get_all_block_hashes_by_height(block.header.height()) { + match self.chain_store.get_all_block_hashes_by_height(block.header().height()) { Ok(m) => m.clone(), Err(_) => HashMap::new(), }; - map.entry(block.header.epoch_id().clone()) + map.entry(block.header().epoch_id().clone()) .or_insert_with(|| HashSet::new()) .insert(*hash); store_update - .set_ser(ColBlockPerHeight, &index_to_bytes(block.header.height()), &map) + .set_ser(ColBlockPerHeight, &index_to_bytes(block.header().height()), &map) .map_err::(|e| e.into())?; - self.chain_store_cache_update.block_hash_per_height.insert(block.header.height(), map); + self.chain_store_cache_update + .block_hash_per_height + .insert(block.header().height(), map); store_update .set_ser(ColBlock, hash.as_ref(), block) .map_err::(|e| e.into())?; @@ -2377,10 +2379,10 @@ mod tests { Arc::new(InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1")); let short_fork = vec![Block::empty_with_height(&genesis, 1, &*signer.clone())]; let mut store_update = chain.mut_store().store_update(); - store_update.save_block_header(short_fork[0].header.clone()).unwrap(); + store_update.save_block_header(short_fork[0].header().clone()).unwrap(); store_update.commit().unwrap(); - let short_fork_head = short_fork[0].clone().header; + let short_fork_head = short_fork[0].header().clone(); assert!(chain .mut_store() .check_transaction_validity_period( @@ -2395,15 +2397,15 @@ mod tests { for i in 1..(transaction_validity_period + 3) { let block = Block::empty_with_height(&prev_block, i, &*signer.clone()); prev_block = block.clone(); - store_update.save_block_header(block.header.clone()).unwrap(); + store_update.save_block_header(block.header().clone()).unwrap(); store_update - .update_height_if_not_challenged(block.header.height(), *block.hash()) + .update_height_if_not_challenged(block.header().height(), *block.hash()) .unwrap(); long_fork.push(block); } store_update.commit().unwrap(); let valid_base_hash = long_fork[1].hash(); - let cur_header = &long_fork.last().unwrap().header; + let cur_header = &long_fork.last().unwrap().header(); assert!(chain .mut_store() .check_transaction_validity_period( @@ -2436,15 +2438,15 @@ mod tests { for i in 1..(transaction_validity_period + 2) { let block = Block::empty_with_height(&prev_block, i, &*signer.clone()); prev_block = block.clone(); - store_update.save_block_header(block.header.clone()).unwrap(); + store_update.save_block_header(block.header().clone()).unwrap(); store_update - .update_height_if_not_challenged(block.header.height(), *block.hash()) + .update_height_if_not_challenged(block.header().height(), *block.hash()) .unwrap(); blocks.push(block); } store_update.commit().unwrap(); let valid_base_hash = blocks[1].hash(); - let cur_header = &blocks.last().unwrap().header; + let cur_header = &blocks.last().unwrap().header(); assert!(chain .mut_store() .check_transaction_validity_period( @@ -2459,14 +2461,14 @@ mod tests { &*signer.clone(), ); let mut store_update = chain.mut_store().store_update(); - store_update.save_block_header(new_block.header.clone()).unwrap(); + store_update.save_block_header(new_block.header().clone()).unwrap(); store_update - .update_height_if_not_challenged(new_block.header.height(), *new_block.hash()) + .update_height_if_not_challenged(new_block.header().height(), *new_block.hash()) .unwrap(); store_update.commit().unwrap(); assert_eq!( chain.mut_store().check_transaction_validity_period( - &new_block.header, + &new_block.header(), &valid_base_hash, transaction_validity_period ), @@ -2487,12 +2489,12 @@ mod tests { for i in 1..(transaction_validity_period + 2) { let block = Block::empty_with_height(&prev_block, i, &*signer.clone()); prev_block = block.clone(); - store_update.save_block_header(block.header.clone()).unwrap(); + store_update.save_block_header(block.header().clone()).unwrap(); short_fork.push(block); } store_update.commit().unwrap(); - let short_fork_head = short_fork.last().unwrap().clone().header; + let short_fork_head = short_fork.last().unwrap().header().clone(); assert_eq!( chain.mut_store().check_transaction_validity_period( &short_fork_head, @@ -2507,11 +2509,11 @@ mod tests { for i in 1..(transaction_validity_period * 5) { let block = Block::empty_with_height(&prev_block, i, &*signer.clone()); prev_block = block.clone(); - store_update.save_block_header(block.header.clone()).unwrap(); + store_update.save_block_header(block.header().clone()).unwrap(); long_fork.push(block); } store_update.commit().unwrap(); - let long_fork_head = &long_fork.last().unwrap().header; + let long_fork_head = &long_fork.last().unwrap().header(); assert_eq!( chain.mut_store().check_transaction_validity_period( long_fork_head, @@ -2530,12 +2532,15 @@ mod tests { Arc::new(InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1")); let block1 = Block::empty_with_height(&genesis, 1, &*signer.clone()); let mut block2 = block1.clone(); - block2.header.mut_header().inner_lite.epoch_id = EpochId(hash(&[1, 2, 3])); - block2.header.resign(&*signer); + block2.mut_header().get_mut().inner_lite.epoch_id = EpochId(hash(&[1, 2, 3])); + block2.mut_header().resign(&*signer); let mut store_update = chain.mut_store().store_update(); store_update.chain_store_cache_update.height_to_hashes.insert(1, Some(hash(&[1]))); - store_update.chain_store_cache_update.blocks.insert(*block1.header.hash(), block1.clone()); + store_update + .chain_store_cache_update + .blocks + .insert(*block1.header().hash(), block1.clone()); store_update.commit().unwrap(); let block_hash = chain.mut_store().height.cache_get(&index_to_bytes(1)).cloned(); @@ -2544,7 +2549,10 @@ mod tests { let mut store_update = chain.mut_store().store_update(); store_update.chain_store_cache_update.height_to_hashes.insert(1, Some(hash(&[2]))); - store_update.chain_store_cache_update.blocks.insert(*block2.header.hash(), block2.clone()); + store_update + .chain_store_cache_update + .blocks + .insert(*block2.header().hash(), block2.clone()); store_update.commit().unwrap(); let block_hash1 = chain.mut_store().height.cache_get(&index_to_bytes(1)).cloned(); @@ -2570,13 +2578,13 @@ mod tests { blocks.push(block.clone()); let mut store_update = chain.mut_store().store_update(); store_update.save_block(block.clone()); - store_update.inc_block_refcount(block.header.prev_hash()).unwrap(); - store_update.save_head(&Tip::from_header(&block.header)).unwrap(); - store_update.save_block_header(block.header.clone()).unwrap(); + store_update.inc_block_refcount(block.header().prev_hash()).unwrap(); + store_update.save_head(&Tip::from_header(block.header())).unwrap(); + store_update.save_block_header(block.header().clone()).unwrap(); store_update .chain_store_cache_update .height_to_hashes - .insert(i, Some(*block.header.hash())); + .insert(i, Some(*block.header().hash())); store_update.save_next_block_hash(&prev_block.hash(), *block.hash()); store_update.commit().unwrap(); @@ -2621,13 +2629,13 @@ mod tests { let block = Block::empty_with_height(&prev_block, i, &*signer); blocks.push(block.clone()); store_update.save_block(block.clone()); - store_update.inc_block_refcount(block.header.prev_hash()).unwrap(); - store_update.save_head(&Tip::from_header(&block.header)).unwrap(); - store_update.save_block_header(block.header.clone()).unwrap(); + store_update.inc_block_refcount(block.header().prev_hash()).unwrap(); + store_update.save_head(&Tip::from_header(&block.header())).unwrap(); + store_update.save_block_header(block.header().clone()).unwrap(); store_update .chain_store_cache_update .height_to_hashes - .insert(i, Some(*block.header.hash())); + .insert(i, Some(*block.header().hash())); store_update.save_next_block_hash(&prev_block.hash(), *block.hash()); store_update.commit().unwrap(); @@ -2686,13 +2694,13 @@ mod tests { let mut store_update = chain.mut_store().store_update(); store_update.save_block(block.clone()); - store_update.inc_block_refcount(block.header.prev_hash()).unwrap(); - store_update.save_head(&Tip::from_header(&block.header)).unwrap(); - store_update.save_block_header(block.header.clone()).unwrap(); + store_update.inc_block_refcount(block.header().prev_hash()).unwrap(); + store_update.save_head(&Tip::from_header(&block.header())).unwrap(); + store_update.save_block_header(block.header().clone()).unwrap(); store_update .chain_store_cache_update .height_to_hashes - .insert(i, Some(*block.header.hash())); + .insert(i, Some(*block.header().hash())); store_update.save_next_block_hash(&prev_block.hash(), *block.hash()); store_update.commit().unwrap(); diff --git a/chain/chain/src/test_utils.rs b/chain/chain/src/test_utils.rs index b4527d4badb..4a786cc4d78 100644 --- a/chain/chain/src/test_utils.rs +++ b/chain/chain/src/test_utils.rs @@ -290,8 +290,8 @@ impl RuntimeAdapter for KeyValueRuntime { _epoch_id: &EpochId, _block_height: BlockHeight, _prev_random_value: &CryptoHash, - _vrf_value: near_crypto::vrf::Value, - _vrf_proof: near_crypto::vrf::Proof, + _vrf_value: &near_crypto::vrf::Value, + _vrf_proof: &near_crypto::vrf::Proof, ) -> Result<(), Error> { Ok(()) } @@ -1071,13 +1071,13 @@ pub fn display_chain(me: &Option, chain: &mut Chain, tail: bool) { parent_header.height(), format_hash(*parent_header.hash()), if let Some(block) = &maybe_block { - format!("chunks: {}", block.chunks.len()) + format!("chunks: {}", block.chunks().len()) } else { "-".to_string() } ); if let Some(block) = maybe_block { - for chunk_header in block.chunks.iter() { + for chunk_header in block.chunks().iter() { let chunk_producer = runtime_adapter .get_chunk_producer( &epoch_id, diff --git a/chain/chain/src/types.rs b/chain/chain/src/types.rs index 1cf6aad7489..9234a5052d2 100644 --- a/chain/chain/src/types.rs +++ b/chain/chain/src/types.rs @@ -157,8 +157,8 @@ pub trait RuntimeAdapter: Send + Sync { epoch_id: &EpochId, block_height: BlockHeight, prev_random_value: &CryptoHash, - vrf_value: near_crypto::vrf::Value, - vrf_proof: near_crypto::vrf::Proof, + vrf_value: &near_crypto::vrf::Value, + vrf_proof: &near_crypto::vrf::Proof, ) -> Result<(), Error>; /// Validates a given signed transaction on top of the given state root. @@ -589,20 +589,20 @@ mod tests { ); let signer = InMemoryValidatorSigner::from_seed("other", KeyType::ED25519, "other"); let b1 = Block::empty(&genesis, &signer); - assert!(b1.header.verify_block_producer(&signer.public_key())); + assert!(b1.header().verify_block_producer(&signer.public_key())); let other_signer = InMemoryValidatorSigner::from_seed("other2", KeyType::ED25519, "other2"); let approvals = vec![Some(Approval::new(*b1.hash(), 1, 2, &other_signer).signature)]; let b2 = Block::empty_with_approvals( &b1, 2, - b1.header.epoch_id().clone(), + b1.header().epoch_id().clone(), EpochId(*genesis.hash()), approvals, &signer, - *genesis.header.next_bp_hash(), + *genesis.header().next_bp_hash(), CryptoHash::default(), ); - b2.header.verify_block_producer(&signer.public_key()); + b2.header().verify_block_producer(&signer.public_key()); } #[test] diff --git a/chain/chain/tests/challenges.rs b/chain/chain/tests/challenges.rs index a0b5e3b4e38..a4f2e4ebab5 100644 --- a/chain/chain/tests/challenges.rs +++ b/chain/chain/tests/challenges.rs @@ -22,7 +22,7 @@ fn challenges_new_head_prev() { // The block to be added below after we invalidated fourth block. let last_block = Block::empty(&chain.get_block(&hashes[3]).unwrap(), &*signer); - assert_eq!(last_block.header.height(), 5); + assert_eq!(last_block.header().height(), 5); let prev = chain.get_block(&hashes[1]).unwrap(); let challenger_block = Block::empty_with_height(&prev, 3, &*signer); @@ -102,7 +102,7 @@ fn test_no_challenge_on_same_header() { .process_block(&None, block.clone(), Provenance::PRODUCED, |_| {}, |_| {}, |_| {}) .unwrap(); assert_eq!(tip.unwrap().height, 1); - if let Err(e) = chain.process_block_header(&block.header, |_| panic!("Unexpected Challenge")) { + if let Err(e) = chain.process_block_header(block.header(), |_| panic!("Unexpected Challenge")) { match e.kind() { ErrorKind::Unfit(_) => {} _ => panic!("Wrong error kind {}", e), diff --git a/chain/chain/tests/gc.rs b/chain/chain/tests/gc.rs index 0c0dd4255b6..5835ea31c61 100644 --- a/chain/chain/tests/gc.rs +++ b/chain/chain/tests/gc.rs @@ -66,9 +66,9 @@ mod tests { .save_block_merkle_tree(*prev_block.hash(), PartialMerkleTree::default()); } store_update.save_block(block.clone()); - store_update.inc_block_refcount(block.header.prev_hash()).unwrap(); - store_update.save_block_header(block.header.clone()).unwrap(); - let tip = Tip::from_header(&block.header); + store_update.inc_block_refcount(block.header().prev_hash()).unwrap(); + store_update.save_block_header(block.header().clone()).unwrap(); + let tip = Tip::from_header(block.header()); if head.height < tip.height { store_update.save_head(&tip).unwrap(); } @@ -81,7 +81,7 @@ mod tests { let trie_changes = trie.update(&state_root, trie_changes_data.iter().cloned()).unwrap(); if verbose { - println!("state new {:?} {:?}", block.header.height(), trie_changes_data); + println!("state new {:?} {:?}", block.header().height(), trie_changes_data); } let new_root = trie_changes.new_root; @@ -198,7 +198,7 @@ mod tests { .update(&state_root2, changes1[shard_to_check_trie as usize].iter().cloned()) .unwrap(); // i == gc_height is the only height should be processed here - if block1.header.height() > gc_height || i == gc_height { + if block1.header().height() > gc_height || i == gc_height { let mut trie_store_update2 = StoreUpdate::new_with_tries(tries2.clone()); tries2 .apply_insertions( @@ -231,7 +231,7 @@ mod tests { for i in start_index..start_index + simple_chain.length { let (block1, state_root1, _) = states1[i as usize].clone(); let state_root1 = state_root1[shard_to_check_trie as usize]; - if block1.header.height() > gc_height || i == gc_height { + if block1.header().height() > gc_height || i == gc_height { assert!(trie1.iter(&state_root1).is_ok()); assert!(trie2.iter(&state_root1).is_ok()); let a = trie1 diff --git a/chain/chain/tests/simple_chain.rs b/chain/chain/tests/simple_chain.rs index 802e537aaac..9029e53033d 100644 --- a/chain/chain/tests/simple_chain.rs +++ b/chain/chain/tests/simple_chain.rs @@ -40,11 +40,11 @@ fn build_chain_with_orhpans() { let last_block = &blocks[blocks.len() - 1]; let block = Block::produce( PROTOCOL_VERSION, - &last_block.header, + &last_block.header(), 10, - last_block.chunks.clone(), - last_block.header.epoch_id().clone(), - last_block.header.next_epoch_id().clone(), + last_block.chunks().clone(), + last_block.header().epoch_id().clone(), + last_block.header().next_epoch_id().clone(), vec![], Rational::from_integer(0), 0, @@ -52,7 +52,7 @@ fn build_chain_with_orhpans() { vec![], vec![], &*signer, - last_block.header.next_bp_hash().clone(), + last_block.header().next_bp_hash().clone(), CryptoHash::default(), ); assert_eq!( diff --git a/chain/chain/tests/sync_chain.rs b/chain/chain/tests/sync_chain.rs index ec9ea12b7b9..a74bb04ce05 100644 --- a/chain/chain/tests/sync_chain.rs +++ b/chain/chain/tests/sync_chain.rs @@ -18,7 +18,7 @@ fn chain_sync_headers() { )); } chain - .sync_block_headers(blocks.drain(1..).map(|block| block.header).collect(), |_| { + .sync_block_headers(blocks.drain(1..).map(|block| block.header().clone()).collect(), |_| { panic!("Unexpected") }) .unwrap(); diff --git a/chain/client/src/client.rs b/chain/client/src/client.rs index f5eaf00985a..378f911a614 100644 --- a/chain/client/src/client.rs +++ b/chain/client/src/client.rs @@ -147,12 +147,12 @@ impl Client { } pub fn remove_transactions_for_block(&mut self, me: AccountId, block: &Block) { - for (shard_id, chunk_header) in block.chunks.iter().enumerate() { + for (shard_id, chunk_header) in block.chunks().iter().enumerate() { let shard_id = shard_id as ShardId; - if block.header.height() == chunk_header.height_included { + if block.header().height() == chunk_header.height_included { if self.shards_mgr.cares_about_shard_this_or_next_epoch( Some(&me), - &block.header.prev_hash(), + &block.header().prev_hash(), shard_id, true, ) { @@ -164,18 +164,18 @@ impl Client { } } } - for challenge in block.challenges.iter() { + for challenge in block.challenges().iter() { self.challenges.remove(&challenge.hash); } } pub fn reintroduce_transactions_for_block(&mut self, me: AccountId, block: &Block) { - for (shard_id, chunk_header) in block.chunks.iter().enumerate() { + for (shard_id, chunk_header) in block.chunks().iter().enumerate() { let shard_id = shard_id as ShardId; - if block.header.height() == chunk_header.height_included { + if block.header().height() == chunk_header.height_included { if self.shards_mgr.cares_about_shard_this_or_next_epoch( Some(&me), - &block.header.prev_hash(), + &block.header().prev_hash(), shard_id, false, ) { @@ -187,7 +187,7 @@ impl Client { } } } - for challenge in block.challenges.iter() { + for challenge in block.challenges().iter() { self.challenges.insert(challenge.hash, challenge.clone()); } } @@ -372,7 +372,7 @@ impl Client { let block_merkle_root = block_merkle_tree.root(); let prev_block_extra = self.chain.get_block_extra(&prev_hash)?.clone(); let prev_block = self.chain.get_block(&prev_hash)?; - let mut chunks = prev_block.chunks.clone(); + let mut chunks = prev_block.chunks().clone(); // Collect new chunks. for (shard_id, mut chunk_header) in new_chunks { @@ -380,7 +380,7 @@ impl Client { chunks[shard_id as usize] = chunk_header; } - let prev_header = &prev_block.header; + let prev_header = &prev_block.header(); let next_epoch_id = self.runtime_adapter.get_next_epoch_id_from_prev_block(&head.last_block_hash)?; @@ -774,7 +774,7 @@ impl Client { .unwrap_or_default(); let skips = self .pending_approvals - .cache_remove(&ApprovalInner::Skip(block.header.height())) + .cache_remove(&ApprovalInner::Skip(block.header().height())) .unwrap_or_default(); for (_account_id, approval) in endorsements.into_iter().chain(skips.into_iter()) { @@ -785,7 +785,7 @@ impl Client { } if status.is_new_head() { - self.shards_mgr.update_largest_seen_height(block.header.height()); + self.shards_mgr.update_largest_seen_height(block.header().height()); if !self.config.archive { if let Err(err) = self.chain.clear_data(self.runtime_adapter.get_tries()) { error!(target: "client", "Can't clear old data, {:?}", err); @@ -815,7 +815,7 @@ impl Client { // remove transactions from the new chain let mut reintroduce_head = self.chain.get_block_header(&prev_head).unwrap().clone(); - let mut remove_head = block.header.clone(); + let mut remove_head = block.header().clone(); assert_ne!(remove_head.hash(), reintroduce_head.hash()); let mut to_remove = vec![]; @@ -870,19 +870,19 @@ impl Client { for shard_id in 0..self.runtime_adapter.num_shards() { let epoch_id = self .runtime_adapter - .get_epoch_id_from_prev_block(&block.header.hash()) + .get_epoch_id_from_prev_block(&block.header().hash()) .unwrap(); let chunk_proposer = self .runtime_adapter - .get_chunk_producer(&epoch_id, block.header.height() + 1, shard_id) + .get_chunk_producer(&epoch_id, block.header().height() + 1, shard_id) .unwrap(); if chunk_proposer == *validator_signer.validator_id() { match self.produce_chunk( *block.hash(), &epoch_id, - block.chunks[shard_id as usize].clone(), - block.header.height() + 1, + block.chunks()[shard_id as usize].clone(), + block.header().height() + 1, shard_id, ) { Ok(Some((encoded_chunk, merkle_paths, receipts))) => self @@ -905,7 +905,7 @@ impl Client { } // Process stored partial encoded chunks - let next_height = block.header.height() + 1; + let next_height = block.header().height() + 1; let mut partial_encoded_chunks = self.shards_mgr.get_stored_partial_encoded_chunks(next_height); for (_shard_id, partial_encoded_chunk) in partial_encoded_chunks.drain() { diff --git a/chain/client/src/client_actor.rs b/chain/client/src/client_actor.rs index 57ac3878e62..add7d2f45f8 100644 --- a/chain/client/src/client_actor.rs +++ b/chain/client/src/client_actor.rs @@ -285,7 +285,7 @@ impl Handler for ClientActor { .client .chain .mut_store() - .get_all_block_hashes_by_height(block.header.height()); + .get_all_block_hashes_by_height(block.header().height()); if was_requested || !blocks_at_height.is_ok() { if let SyncStatus::StateSync(sync_hash, _) = &mut self.client.sync_status { if let Ok(header) = self.client.chain.get_block_header(sync_hash) { @@ -305,12 +305,12 @@ impl Handler for ClientActor { match self .client .runtime_adapter - .get_epoch_id_from_prev_block(block.header.prev_hash()) + .get_epoch_id_from_prev_block(block.header().prev_hash()) { Ok(epoch_id) => { if let Some(hashes) = blocks_at_height.unwrap().get(&epoch_id) { - if !hashes.contains(block.header.hash()) { - warn!(target: "client", "Rejecting unrequested block {}, height {}", block.header.hash(), block.header.height()); + if !hashes.contains(block.header().hash()) { + warn!(target: "client", "Rejecting unrequested block {}, height {}", block.header().hash(), block.header().height()); } } } @@ -729,10 +729,10 @@ impl ClientActor { accepted_block.provenance, ); let block = self.client.chain.get_block(&accepted_block.hash).unwrap(); - let gas_used = Block::compute_gas_used(&block.chunks, block.header.height()); - let gas_limit = Block::compute_gas_limit(&block.chunks, block.header.height()); + let gas_used = Block::compute_gas_used(&block.chunks(), block.header().height()); + let gas_limit = Block::compute_gas_limit(&block.chunks(), block.header().height()); - let last_final_hash = *block.header.last_final_block(); + let last_final_hash = *block.header().last_final_block(); self.info_helper.block_processed(gas_used, gas_limit); self.check_send_announce_account(last_final_hash); @@ -753,10 +753,11 @@ impl ClientActor { } else if provenance == Provenance::NONE { // Don't care about challenge here since it will be handled when we actually process // the block. - if self.client.chain.process_block_header(&block.header, |_| {}).is_ok() { + if self.client.chain.process_block_header(&block.header(), |_| {}).is_ok() { let head = self.client.chain.head()?; // do not broadcast blocks that are too far back. - if head.height < block.header.height() || &head.epoch_id == block.header.epoch_id() + if head.height < block.header().height() + || &head.epoch_id == block.header().epoch_id() { self.client.rebroadcast_block(block.clone()); } @@ -775,14 +776,14 @@ impl ClientActor { was_requested: bool, ) -> NetworkClientResponses { let hash = *block.hash(); - debug!(target: "client", "{:?} Received block {} <- {} at {} from {}, requested: {}", self.client.validator_signer.as_ref().map(|vs| vs.validator_id()), hash, block.header.prev_hash(), block.header.height(), peer_id, was_requested); + debug!(target: "client", "{:?} Received block {} <- {} at {} from {}, requested: {}", self.client.validator_signer.as_ref().map(|vs| vs.validator_id()), hash, block.header().prev_hash(), block.header().height(), peer_id, was_requested); // drop the block if it is too far ahead let head = unwrap_or_return!(self.client.chain.head(), NetworkClientResponses::NoResponse); - if block.header.height() >= head.height + BLOCK_HORIZON { - debug!(target: "client", "dropping block {} that is too far ahead. Block height {} current head height {}", block.hash(), block.header.height(), head.height); + if block.header().height() >= head.height + BLOCK_HORIZON { + debug!(target: "client", "dropping block {} that is too far ahead. Block height {} current head height {}", block.hash(), block.header().height(), head.height); return NetworkClientResponses::NoResponse; } - let prev_hash = *block.header.prev_hash(); + let prev_hash = *block.header().prev_hash(); let provenance = if was_requested { near_chain::Provenance::SYNC } else { near_chain::Provenance::NONE }; match self.process_block(block, provenance) { diff --git a/chain/client/src/sync.rs b/chain/client/src/sync.rs index 39dd15ab5ce..97aee8ea984 100644 --- a/chain/client/src/sync.rs +++ b/chain/client/src/sync.rs @@ -1022,7 +1022,7 @@ mod test { ); Approval::new( *last_block.hash(), - last_block.header.height(), + last_block.header().height(), current_height, &signer, ) @@ -1030,18 +1030,20 @@ mod test { }) }) .collect(); - let (epoch_id, next_epoch_id) = if last_block.header.prev_hash() - == &CryptoHash::default() - { - (last_block.header.next_epoch_id().clone(), EpochId(*last_block.hash())) - } else { - (last_block.header.epoch_id().clone(), last_block.header.next_epoch_id().clone()) - }; + let (epoch_id, next_epoch_id) = + if last_block.header().prev_hash() == &CryptoHash::default() { + (last_block.header().next_epoch_id().clone(), EpochId(*last_block.hash())) + } else { + ( + last_block.header().epoch_id().clone(), + last_block.header().next_epoch_id().clone(), + ) + }; let block = Block::produce( PROTOCOL_VERSION, - &last_block.header, + &last_block.header(), current_height, - last_block.chunks.clone(), + last_block.chunks().clone(), epoch_id, next_epoch_id, approvals, @@ -1051,7 +1053,7 @@ mod test { vec![], vec![], &*signers[3], - last_block.header.next_bp_hash().clone(), + last_block.header().next_bp_hash().clone(), block_merkle_tree.root(), ); block_merkle_tree.insert(*block.hash()); @@ -1066,11 +1068,11 @@ mod test { // banned for _iter in 0..12 { let block = &all_blocks[last_added_block_ord]; - let current_height = block.header.height(); + let current_height = block.header().height(); set_syncing_peer(&mut header_sync); header_sync.header_sync_due( &SyncStatus::HeaderSync { current_height, highest_height }, - &Tip::from_header(&block.header), + &Tip::from_header(&block.header()), ); last_added_block_ord += 3; @@ -1083,11 +1085,11 @@ mod test { // Now the same, but only 20 heights / sec for _iter in 0..12 { let block = &all_blocks[last_added_block_ord]; - let current_height = block.header.height(); + let current_height = block.header().height(); set_syncing_peer(&mut header_sync); header_sync.header_sync_due( &SyncStatus::HeaderSync { current_height, highest_height }, - &Tip::from_header(&block.header), + &Tip::from_header(&block.header()), ); last_added_block_ord += 2; diff --git a/chain/client/src/test_utils.rs b/chain/client/src/test_utils.rs index 26c8bb648b9..85669e50000 100644 --- a/chain/client/src/test_utils.rs +++ b/chain/client/src/test_utils.rs @@ -354,12 +354,12 @@ pub fn setup_mock_all_validators( let my_height = &mut last_height1[my_ord]; - *my_height = max(*my_height, block.header.height()); + *my_height = max(*my_height, block.header().height()); hash_to_height1 .write() .unwrap() - .insert(*block.header.hash(), block.header.height()); + .insert(*block.header().hash(), block.header().height()); } NetworkRequests::PartialEncodedChunkRequest { account_id: their_account_id, @@ -688,7 +688,7 @@ pub fn setup_mock_all_validators( hash_to_height .write() .unwrap() - .insert(*genesis_block.read().unwrap().as_ref().unwrap().header.clone().hash(), 0); + .insert(*genesis_block.read().unwrap().as_ref().unwrap().header().clone().hash(), 0); *locked_connectors = ret.clone(); let value = genesis_block.read().unwrap(); (value.clone().unwrap(), ret) @@ -895,11 +895,11 @@ impl TestEnv { .runtime_adapter .query( 0, - &last_block.chunks[0].inner.prev_state_root, - last_block.header.height(), - last_block.header.raw_timestamp(), - last_block.header.hash(), - last_block.header.epoch_id(), + &last_block.chunks()[0].inner.prev_state_root, + last_block.header().height(), + last_block.header().raw_timestamp(), + last_block.header().hash(), + last_block.header().epoch_id(), &QueryRequest::ViewAccount { account_id }, ) .unwrap(); diff --git a/chain/client/src/view_client.rs b/chain/client/src/view_client.rs index 071580cd885..d015bf822c8 100644 --- a/chain/client/src/view_client.rs +++ b/chain/client/src/view_client.rs @@ -388,7 +388,7 @@ impl Handler for ViewClientActor { } .and_then(|block| { self.runtime_adapter - .get_block_producer(&block.header.epoch_id(), block.header.height()) + .get_block_producer(&block.header().epoch_id(), block.header().height()) .map(|author| BlockView::from_author_block(author, block)) }) .map_err(|err| err.to_string()) @@ -417,7 +417,7 @@ impl Handler for ViewClientActor { GetChunk::BlockHash(block_hash, shard_id) => { self.chain.get_block(&block_hash).map(Clone::clone).and_then(|block| { let chunk_hash = block - .chunks + .chunks() .get(shard_id as usize) .ok_or_else(|| { near_chain::Error::from(ErrorKind::InvalidShardId(shard_id)) @@ -429,7 +429,7 @@ impl Handler for ViewClientActor { GetChunk::Height(height, shard_id) => { self.chain.get_block_by_height(height).map(Clone::clone).and_then(|block| { let chunk_hash = block - .chunks + .chunks() .get(shard_id as usize) .ok_or_else(|| { near_chain::Error::from(ErrorKind::InvalidShardId(shard_id)) @@ -442,7 +442,7 @@ impl Handler for ViewClientActor { .and_then(|chunk| { self.chain .get_block_by_height(chunk.header.height_included) - .map(|block| (block.header.epoch_id().clone(), chunk)) + .map(|block| (block.header().epoch_id().clone(), chunk)) }) .and_then(|(epoch_id, chunk)| { self.runtime_adapter @@ -638,9 +638,9 @@ impl Handler for ViewClientActor { self.chain.get_next_block_hash_with_new_chunk(&block_hash, shard_id) { if let Ok(block) = self.chain.get_block(&next_block_hash) { - if shard_id < block.chunks.len() as u64 { + if shard_id < block.chunks().len() as u64 { if verify_path( - block.chunks[shard_id as usize].inner.outcome_root, + block.chunks()[shard_id as usize].inner.outcome_root, &response.proof, &response.outcome_with_id.to_hashes(), ) { diff --git a/chain/client/tests/bug_repros.rs b/chain/client/tests/bug_repros.rs index 5d05c833dd4..b1a91c4a9b8 100644 --- a/chain/client/tests/bug_repros.rs +++ b/chain/client/tests/bug_repros.rs @@ -92,12 +92,12 @@ fn repro_1183() { .0 .do_send(NetworkClientMessages::Transaction { transaction: SignedTransaction::send_money( - block.header.height() * 16 + nonce_delta, + block.header().height() * 16 + nonce_delta, from.to_string(), to.to_string(), &InMemorySigner::from_seed(from, KeyType::ED25519, from), 1, - *block.header.prev_hash(), + *block.header().prev_hash(), ), is_forwarded: false, check_only: false, @@ -109,7 +109,7 @@ fn repro_1183() { *last_block = Some(block.clone()); *delayed_one_parts = vec![]; - if block.header.height() >= 25 { + if block.header().height() >= 25 { System::current().stop(); } (NetworkResponses::NoResponse, false) @@ -167,7 +167,7 @@ fn test_sync_from_achival_node() { Box::new(move |_: String, msg: &NetworkRequests| -> (NetworkResponses, bool) { if let NetworkRequests::Block { block } = msg { let mut largest_height = largest_height.write().unwrap(); - *largest_height = max(block.header.height(), *largest_height); + *largest_height = max(block.header().height(), *largest_height); } if *largest_height.read().unwrap() >= 50 { System::current().stop(); @@ -184,7 +184,7 @@ fn test_sync_from_achival_node() { )) } } - if block.header.height() <= 10 { + if block.header().height() <= 10 { blocks.write().unwrap().insert(*block.hash(), block.clone()); } (NetworkResponses::NoResponse, false) @@ -215,7 +215,7 @@ fn test_sync_from_achival_node() { } match msg { NetworkRequests::Block { block } => { - if block.header.height() <= 10 { + if block.header().height() <= 10 { block_counter += 1; } (NetworkResponses::NoResponse, true) diff --git a/chain/client/tests/catching_up.rs b/chain/client/tests/catching_up.rs index 12c169c431b..10b42c5be92 100644 --- a/chain/client/tests/catching_up.rs +++ b/chain/client/tests/catching_up.rs @@ -160,7 +160,7 @@ mod tests { match *phase { ReceiptsSyncPhases::WaitingForFirstBlock => { if let NetworkRequests::Block { block } = msg { - assert!(block.header.height() <= send); + assert!(block.header().height() <= send); // This tx is rather fragile, specifically it's important that // 1. the `from` and `to` account are not in the same shard; // 2. ideally the producer of the chunk at height 3 for the shard @@ -170,7 +170,7 @@ mod tests { // for height 1, because such block producer will produce // the chunk for height 2 right away, before we manage to send // the transaction. - if block.header.height() == send { + if block.header().height() == send { println!( "From shard: {}, to shard: {}", source_shard_id, destination_shard_id, @@ -182,7 +182,7 @@ mod tests { account_to.clone(), 111, 1, - *block.header.prev_hash(), + *block.header().prev_hash(), ); } *phase = ReceiptsSyncPhases::WaitingForSecondBlock; @@ -192,8 +192,8 @@ mod tests { ReceiptsSyncPhases::WaitingForSecondBlock => { // This block now contains a chunk with the transaction sent above. if let NetworkRequests::Block { block } = msg { - assert!(block.header.height() <= send + 1); - if block.header.height() == send + 1 { + assert!(block.header().height() <= send + 1); + if block.header().height() == send + 1 { *phase = ReceiptsSyncPhases::WaitingForDistantEpoch; } } @@ -201,9 +201,9 @@ mod tests { ReceiptsSyncPhases::WaitingForDistantEpoch => { // This block now contains a chunk with the transaction sent above. if let NetworkRequests::Block { block } = msg { - assert!(block.header.height() >= send + 1); - assert!(block.header.height() <= wait_till); - if block.header.height() == wait_till { + assert!(block.header().height() >= send + 1); + assert!(block.header().height() <= wait_till); + if block.header().height() == wait_till { *phase = ReceiptsSyncPhases::VerifyingOutgoingReceipts; } } @@ -303,12 +303,12 @@ mod tests { ReceiptsSyncPhases::WaitingForValidate => { // This block now contains a chunk with the transaction sent above. if let NetworkRequests::Block { block } = msg { - assert!(block.header.height() >= wait_till); - assert!(block.header.height() <= wait_till + 20); - if block.header.height() == wait_till + 20 { + assert!(block.header().height() >= wait_till); + assert!(block.header().height() <= wait_till + 20); + if block.header().height() == wait_till + 20 { System::current().stop(); } - if block.header.height() == wait_till + 10 { + if block.header().height() == wait_till + 10 { for i in 0..16 { actix::spawn( connectors1.write().unwrap()[i] @@ -450,19 +450,20 @@ mod tests { match *phase { RandomSinglePartPhases::WaitingForFirstBlock => { if let NetworkRequests::Block { block } = msg { - assert_eq!(block.header.height(), 1); + assert_eq!(block.header().height(), 1); *phase = RandomSinglePartPhases::WaitingForThirdEpoch; } } RandomSinglePartPhases::WaitingForThirdEpoch => { if let NetworkRequests::Block { block } = msg { - if block.header.height() == 1 { + if block.header().height() == 1 { return (NetworkResponses::NoResponse, false); } - assert!(block.header.height() >= 2); - assert!(block.header.height() <= height); + assert!(block.header().height() >= 2); + assert!(block.header().height() <= height); let mut tx_count = 0; - if block.header.height() == height && block.header.height() >= 2 + if block.header().height() == height + && block.header().height() >= 2 { for (i, validator1) in flat_validators.iter().enumerate() { for (j, validator2) in @@ -490,7 +491,7 @@ mod tests { validator2.to_string(), amount, (12345 + tx_count) as u64, - *block.header.prev_hash(), + *block.header().prev_hash(), ); } tx_count += 1; @@ -503,11 +504,11 @@ mod tests { } RandomSinglePartPhases::WaitingForSixEpoch => { if let NetworkRequests::Block { block } = msg { - assert!(block.header.height() >= height); - assert!(block.header.height() <= 32); + assert!(block.header().height() >= height); + assert!(block.header().height() <= 32); let check_height = if skip_15 { 28 } else { 26 }; - if block.header.height() >= check_height { - println!("BLOCK HEIGHT {:?}", block.header.height()); + if block.header().height() >= check_height { + println!("BLOCK HEIGHT {:?}", block.header().height()); for i in 0..16 { for j in 0..16 { let amounts1 = amounts.clone(); @@ -544,7 +545,7 @@ mod tests { } } } - if block.header.height() == 32 { + if block.header().height() == 32 { println!( "SEEN HEIGHTS SAME BLOCK {:?}", seen_heights_same_block.len() @@ -644,10 +645,10 @@ mod tests { Arc::new(RwLock::new(Box::new( move |_account_id: String, msg: &NetworkRequests| { if let NetworkRequests::Block { block } = msg { - check_height(*block.hash(), block.header.height()); - check_height(*block.header.prev_hash(), block.header.height() - 1); + check_height(*block.hash(), block.header().height()); + check_height(*block.header().prev_hash(), block.header().height() - 1); - if block.header.height() >= 25 { + if block.header().height() >= 25 { System::current().stop(); } } @@ -704,20 +705,26 @@ mod tests { Arc::new(RwLock::new(Box::new( move |_account_id: String, msg: &NetworkRequests| { let propagate = if let NetworkRequests::Block { block } = msg { - check_height(*block.hash(), block.header.height()); + check_height(*block.hash(), block.header().height()); - if block.header.height() % 10 == 5 { - check_height(*block.header.prev_hash(), block.header.height() - 2); + if block.header().height() % 10 == 5 { + check_height( + *block.header().prev_hash(), + block.header().height() - 2, + ); } else { - check_height(*block.header.prev_hash(), block.header.height() - 1); + check_height( + *block.header().prev_hash(), + block.header().height() - 1, + ); } - if block.header.height() >= 25 { + if block.header().height() >= 25 { System::current().stop(); } // Do not propagate blocks at heights %10=4 - block.header.height() % 10 != 4 + block.header().height() % 10 != 4 } else { true }; @@ -801,10 +808,10 @@ mod tests { } } if let NetworkRequests::Block { block } = msg { - if block.header.height() == 12 { + if block.header().height() == 12 { println!("BLOCK {:?}", block); - *unaccepted_block_hash = *block.header.hash(); - assert_eq!(4, block.header.chunks_included()); + *unaccepted_block_hash = *block.header().hash(); + assert_eq!(4, block.header().chunks_included()); *phase = ChunkGrievingPhases::SecondAttack; } } @@ -852,11 +859,11 @@ mod tests { } } if let NetworkRequests::Block { block } = msg { - if block.header.height() == 42 { + if block.header().height() == 42 { println!("BLOCK {:?}", block,); // This is the main assert of the test // Chunk from malicious node shouldn't be accepted at all - assert_eq!(3, block.header.chunks_included()); + assert_eq!(3, block.header().chunks_included()); System::current().stop(); } } @@ -988,12 +995,12 @@ mod tests { } if let NetworkRequests::Block { block } = msg { // There is no chunks at height 1 - if block.header.height() > 1 { + if block.header().height() > 1 { println!("BLOCK {:?}", block,); - if block.header.height() % epoch_length != 1 { - assert_eq!(4, block.header.chunks_included()); + if block.header().height() % epoch_length != 1 { + assert_eq!(4, block.header().chunks_included()); } - if block.header.height() == last_height { + if block.header().height() == last_height { System::current().stop(); } } diff --git a/chain/client/tests/challenges.rs b/chain/client/tests/challenges.rs index bc7a80bedfb..98266a11fca 100644 --- a/chain/client/tests/challenges.rs +++ b/chain/client/tests/challenges.rs @@ -49,11 +49,11 @@ fn test_verify_block_double_sign_challenge() { block_merkle_tree.insert(*genesis.hash()); let b2 = Block::produce( PROTOCOL_VERSION, - &genesis.header, + genesis.header(), 2, - genesis.chunks.clone(), - b1.header.epoch_id().clone(), - b1.header.next_epoch_id().clone(), + genesis.chunks().clone(), + b1.header().epoch_id().clone(), + b1.header().next_epoch_id().clone(), vec![], Rational::from_integer(0), 0, @@ -61,14 +61,14 @@ fn test_verify_block_double_sign_challenge() { vec![], vec![], &signer, - b1.header.next_bp_hash().clone(), + b1.header().next_bp_hash().clone(), block_merkle_tree.root(), ); - let epoch_id = b1.header.epoch_id().clone(); + let epoch_id = b1.header().epoch_id().clone(); let valid_challenge = Challenge::produce( ChallengeBody::BlockDoubleSign(BlockDoubleSign { - left_block_header: b2.header.try_to_vec().unwrap(), - right_block_header: b1.header.try_to_vec().unwrap(), + left_block_header: b2.header().try_to_vec().unwrap(), + right_block_header: b1.header().try_to_vec().unwrap(), }), &signer, ); @@ -81,8 +81,8 @@ fn test_verify_block_double_sign_challenge() { ); let invalid_challenge = Challenge::produce( ChallengeBody::BlockDoubleSign(BlockDoubleSign { - left_block_header: b1.header.try_to_vec().unwrap(), - right_block_header: b1.header.try_to_vec().unwrap(), + left_block_header: b1.header().try_to_vec().unwrap(), + right_block_header: b1.header().try_to_vec().unwrap(), }), &signer, ); @@ -92,8 +92,8 @@ fn test_verify_block_double_sign_challenge() { let b3 = env.clients[0].produce_block(3).unwrap().unwrap(); let invalid_challenge = Challenge::produce( ChallengeBody::BlockDoubleSign(BlockDoubleSign { - left_block_header: b1.header.try_to_vec().unwrap(), - right_block_header: b3.header.try_to_vec().unwrap(), + left_block_header: b1.header().try_to_vec().unwrap(), + right_block_header: b3.header().try_to_vec().unwrap(), }), &signer, ); @@ -141,8 +141,8 @@ fn create_chunk( let (mut chunk, mut merkle_paths, receipts) = client .produce_chunk( *last_block.hash(), - last_block.header.epoch_id(), - last_block.chunks[0].clone(), + last_block.header().epoch_id(), + last_block.chunks()[0].clone(), 2, 0, ) @@ -192,11 +192,11 @@ fn create_chunk( block_merkle_tree.insert(*last_block.hash()); let block = Block::produce( PROTOCOL_VERSION, - &last_block.header, + &last_block.header(), 2, vec![chunk.header.clone()], - last_block.header.epoch_id().clone(), - last_block.header.next_epoch_id().clone(), + last_block.header().epoch_id().clone(), + last_block.header().next_epoch_id().clone(), vec![], Rational::from_integer(0), 0, @@ -204,7 +204,7 @@ fn create_chunk( vec![], vec![], &*client.validator_signer.as_ref().unwrap().clone(), - *last_block.header.next_bp_hash(), + *last_block.header().next_bp_hash(), block_merkle_tree.root(), ); (chunk, merkle_paths, receipts, block) @@ -342,10 +342,10 @@ fn challenge( chunk: MaybeEncodedShardChunk, block: &Block, ) -> Result<(CryptoHash, Vec), Error> { - let merkle_paths = Block::compute_chunk_headers_root(&block.chunks).1; + let merkle_paths = Block::compute_chunk_headers_root(&block.chunks()).1; let valid_challenge = Challenge::produce( ChallengeBody::ChunkProofs(ChunkProofs { - block_header: block.header.try_to_vec().unwrap(), + block_header: block.header().try_to_vec().unwrap(), chunk, merkle_proof: merkle_paths[shard_id].clone(), }), @@ -354,8 +354,8 @@ fn challenge( let runtime_adapter = env.clients[0].chain.runtime_adapter.clone(); validate_challenge( &*runtime_adapter, - &block.header.epoch_id(), - &block.header.prev_hash(), + &block.header().epoch_id(), + &block.header().prev_hash(), &valid_challenge, ) } @@ -403,7 +403,7 @@ fn test_verify_chunk_invalid_state_challenge() { *last_block.hash(), StateRoot::default(), CryptoHash::default(), - last_block.header.height() + 1, + last_block.header().height() + 1, 0, 0, 1_000, @@ -411,7 +411,7 @@ fn test_verify_chunk_invalid_state_challenge() { vec![], vec![], &vec![], - last_block.chunks[0].inner.outgoing_receipts_root, + last_block.chunks()[0].inner.outgoing_receipts_root, CryptoHash::default(), &validator_signer, &mut rs, @@ -431,17 +431,17 @@ fn test_verify_chunk_invalid_state_challenge() { ) .unwrap(); - invalid_chunk.header.height_included = last_block.header.height() + 1; + invalid_chunk.header.height_included = last_block.header().height() + 1; let mut block_merkle_tree = client.chain.mut_store().get_block_merkle_tree(&last_block.hash()).unwrap().clone(); block_merkle_tree.insert(*last_block.hash()); let block = Block::produce( PROTOCOL_VERSION, - &last_block.header, - last_block.header.height() + 1, + &last_block.header(), + last_block.header().height() + 1, vec![invalid_chunk.header.clone()], - last_block.header.epoch_id().clone(), - last_block.header.next_epoch_id().clone(), + last_block.header().epoch_id().clone(), + last_block.header().next_epoch_id().clone(), vec![], Rational::from_integer(0), 0, @@ -449,7 +449,7 @@ fn test_verify_chunk_invalid_state_challenge() { vec![], vec![], &validator_signer, - *last_block.header.next_bp_hash(), + *last_block.header().next_bp_hash(), block_merkle_tree.root(), ); @@ -475,12 +475,12 @@ fn test_verify_chunk_invalid_state_challenge() { ); chain_update - .create_chunk_state_challenge(&last_block, &block, &block.chunks[0].clone()) + .create_chunk_state_challenge(&last_block, &block, &block.chunks()[0].clone()) .unwrap() }; { - let prev_merkle_proofs = Block::compute_chunk_headers_root(&last_block.chunks).1; - let merkle_proofs = Block::compute_chunk_headers_root(&block.chunks).1; + let prev_merkle_proofs = Block::compute_chunk_headers_root(&last_block.chunks()).1; + let merkle_proofs = Block::compute_chunk_headers_root(&block.chunks()).1; assert_eq!(prev_merkle_proofs[0], challenge_body.prev_merkle_proof); assert_eq!(merkle_proofs[0], challenge_body.merkle_proof); assert_eq!( @@ -507,8 +507,8 @@ fn test_verify_chunk_invalid_state_challenge() { assert_eq!( validate_challenge( &*runtime_adapter, - &block.header.epoch_id(), - &block.header.prev_hash(), + &block.header().epoch_id(), + &block.header().prev_hash(), &challenge, ) .unwrap(), @@ -614,10 +614,10 @@ fn test_block_challenge() { env.produce_block(0, 1); let (chunk, _merkle_paths, _receipts, block) = create_invalid_proofs_chunk(&mut env.clients[0]); - let merkle_paths = Block::compute_chunk_headers_root(&block.chunks).1; + let merkle_paths = Block::compute_chunk_headers_root(&block.chunks()).1; let challenge = Challenge::produce( ChallengeBody::ChunkProofs(ChunkProofs { - block_header: block.header.try_to_vec().unwrap(), + block_header: block.header().try_to_vec().unwrap(), chunk: MaybeEncodedShardChunk::Encoded(chunk.clone()), merkle_proof: merkle_paths[chunk.header.inner.shard_id as usize].clone(), }), @@ -625,7 +625,7 @@ fn test_block_challenge() { ); env.clients[0].process_challenge(challenge.clone()).unwrap(); env.produce_block(0, 2); - assert_eq!(env.clients[0].chain.get_block_by_height(2).unwrap().challenges, vec![challenge]); + assert_eq!(env.clients[0].chain.get_block_by_height(2).unwrap().challenges(), &[challenge]); assert!(env.clients[0].chain.mut_store().is_block_challenged(&block.hash()).unwrap()); } @@ -670,9 +670,9 @@ fn test_fishermen_challenge() { let (chunk, _merkle_paths, _receipts, block) = create_invalid_proofs_chunk(&mut env.clients[0]); - let merkle_paths = Block::compute_chunk_headers_root(&block.chunks).1; + let merkle_paths = Block::compute_chunk_headers_root(&block.chunks()).1; let challenge_body = ChallengeBody::ChunkProofs(ChunkProofs { - block_header: block.header.try_to_vec().unwrap(), + block_header: block.header().try_to_vec().unwrap(), chunk: MaybeEncodedShardChunk::Encoded(chunk.clone()), merkle_proof: merkle_paths[chunk.header.inner.shard_id as usize].clone(), }); @@ -687,7 +687,7 @@ fn test_fishermen_challenge() { assert!(env.clients[0].process_challenge(challenge1).is_err()); env.clients[0].process_challenge(challenge.clone()).unwrap(); env.produce_block(0, 12); - assert_eq!(env.clients[0].chain.get_block_by_height(12).unwrap().challenges, vec![challenge]); + assert_eq!(env.clients[0].chain.get_block_by_height(12).unwrap().challenges(), &[challenge]); assert!(env.clients[0].chain.mut_store().is_block_challenged(&block.hash()).unwrap()); } @@ -736,7 +736,7 @@ fn test_challenge_in_different_epoch() { let fork2_block = env.clients[1].produce_block(9).unwrap().unwrap(); fork_blocks.push(fork2_block); for block in fork_blocks { - let height = block.header.height(); + let height = block.header().height(); let (_, result) = env.clients[0].process_block(block, Provenance::NONE); match env.clients[0].run_catchup(&vec![]) { Ok(accepted_blocks) => { diff --git a/chain/client/tests/chunks_management.rs b/chain/client/tests/chunks_management.rs index 1dd208dfe45..9f494502c37 100644 --- a/chain/client/tests/chunks_management.rs +++ b/chain/client/tests/chunks_management.rs @@ -122,63 +122,63 @@ fn chunks_produced_and_distributed_common( Arc::new(RwLock::new(Box::new(move |from_whom: String, msg: &NetworkRequests| { match msg { NetworkRequests::Block { block } => { - check_height(*block.hash(), block.header.height()); - check_height(*block.header.prev_hash(), block.header.height() - 1); + check_height(*block.hash(), block.header().height()); + check_height(*block.header().prev_hash(), block.header().height() - 1); - let h = block.header.height(); + let h = block.header().height(); let mut height_to_hash = height_to_hash.write().unwrap(); height_to_hash.insert(h, *block.hash()); let mut height_to_epoch = height_to_epoch.write().unwrap(); - height_to_epoch.insert(h, block.header.epoch_id().clone()); + height_to_epoch.insert(h, block.header().epoch_id().clone()); println!( "[{:?}]: BLOCK {} HEIGHT {}; HEADER HEIGHTS: {} / {} / {} / {};\nAPPROVALS: {:?}", Instant::now(), block.hash(), - block.header.height(), - block.chunks[0].inner.height_created, - block.chunks[1].inner.height_created, - block.chunks[2].inner.height_created, - block.chunks[3].inner.height_created, - block.header.approvals(), + block.header().height(), + block.chunks()[0].inner.height_created, + block.chunks()[1].inner.height_created, + block.chunks()[2].inner.height_created, + block.chunks()[3].inner.height_created, + block.header().approvals(), ); if h > 1 { // Make sure doomslug finality is computed correctly. - assert_eq!(block.header.last_ds_final_block(), height_to_hash.get(&(h - 1)).unwrap()); + assert_eq!(block.header().last_ds_final_block(), height_to_hash.get(&(h - 1)).unwrap()); // Make sure epoch length actually corresponds to the desired epoch length // The switches are expected at 0->1, 5->6 and 10->11 let prev_epoch_id = height_to_epoch.get(&(h - 1)).unwrap().clone(); - assert_eq!(block.header.epoch_id() == &prev_epoch_id, h % 5 != 1); + assert_eq!(block.header().epoch_id() == &prev_epoch_id, h % 5 != 1); // Make sure that the blocks leading to the epoch switch have twice as // many approval slots - assert_eq!(block.header.approvals().len() == 8, h % 5 == 0 || h % 5 == 4); + assert_eq!(block.header().approvals().len() == 8, h % 5 == 0 || h % 5 == 4); } if h > 2 { // Make sure BFT finality is computed correctly - assert_eq!(block.header.last_final_block(), height_to_hash.get(&(h - 2)).unwrap()); + assert_eq!(block.header().last_final_block(), height_to_hash.get(&(h - 2)).unwrap()); } - if block.header.height() > 1 { + if block.header().height() > 1 { for shard_id in 0..4 { // If messages from 1 to 4 are dropped, 4 at their heights will // receive the block significantly later than the chunks, and // thus would discard the chunks - if !drop_from_1_to_4 || block.header.height() % 4 != 3 { + if !drop_from_1_to_4 || block.header().height() % 4 != 3 { assert_eq!( - block.header.height(), - block.chunks[shard_id].inner.height_created + block.header().height(), + block.chunks()[shard_id].inner.height_created ); } } } - if block.header.height() >= 12 { - println!("PREV BLOCK HASH: {}", block.header.prev_hash()); + if block.header().height() >= 12 { + println!("PREV BLOCK HASH: {}", block.header().prev_hash()); println!( "STATS: responses: {} requests: {}", partial_chunk_msgs, partial_chunk_request_msgs @@ -252,7 +252,7 @@ fn test_request_chunk_restart() { } let block1 = env.clients[0].chain.get_block_by_height(3).unwrap().clone(); let request = PartialEncodedChunkRequestMsg { - chunk_hash: block1.chunks[0].chunk_hash(), + chunk_hash: block1.chunks()[0].chunk_hash(), part_ords: vec![0], tracking_shards: HashSet::default(), }; @@ -273,7 +273,7 @@ fn test_request_chunk_restart() { ); let response = env.network_adapters[0].pop().unwrap(); if let NetworkRequests::PartialEncodedChunkResponse { response: response_body, .. } = response { - assert_eq!(response_body.chunk_hash, block1.chunks[0].chunk_hash()); + assert_eq!(response_body.chunk_hash, block1.chunks()[0].chunk_hash()); } else { println!("{:?}", response); assert!(false); @@ -310,7 +310,7 @@ fn store_partial_encoded_chunk_sanity() { assert_eq!(env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(1).len(), 0); env.clients[0] .shards_mgr - .store_partial_encoded_chunk(&block.header, partial_encoded_chunk.clone()); + .store_partial_encoded_chunk(&block.header(), partial_encoded_chunk.clone()); assert_eq!(env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(1).len(), 1); assert_eq!( env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(1)[&0], @@ -321,7 +321,7 @@ fn store_partial_encoded_chunk_sanity() { partial_encoded_chunk.header.hash.0 = hash(&[123]); env.clients[0] .shards_mgr - .store_partial_encoded_chunk(&block.header, partial_encoded_chunk.clone()); + .store_partial_encoded_chunk(&block.header(), partial_encoded_chunk.clone()); assert_eq!(env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(1).len(), 1); assert_eq!( env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(1)[&0], @@ -350,7 +350,7 @@ fn store_partial_encoded_chunk_sanity() { assert_eq!(env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(1).len(), 1); env.clients[0] .shards_mgr - .store_partial_encoded_chunk(&block.header, partial_encoded_chunk2.clone()); + .store_partial_encoded_chunk(&block.header(), partial_encoded_chunk2.clone()); assert_eq!(env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(1).len(), 2); assert_eq!( env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(1)[&0], @@ -383,18 +383,18 @@ fn store_partial_encoded_chunk_sanity() { partial_encoded_chunk3.header = h.clone(); env.clients[0] .shards_mgr - .store_partial_encoded_chunk(&block.header, partial_encoded_chunk3.clone()); + .store_partial_encoded_chunk(&block.header(), partial_encoded_chunk3.clone()); assert_eq!(env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(2).len(), 0); h.inner.height_created = 9; partial_encoded_chunk3.header = h.clone(); env.clients[0] .shards_mgr - .store_partial_encoded_chunk(&block.header, partial_encoded_chunk3.clone()); + .store_partial_encoded_chunk(&block.header(), partial_encoded_chunk3.clone()); assert_eq!(env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(9).len(), 0); h.inner.height_created = 5; partial_encoded_chunk3.header = h.clone(); env.clients[0] .shards_mgr - .store_partial_encoded_chunk(&block.header, partial_encoded_chunk3.clone()); + .store_partial_encoded_chunk(&block.header(), partial_encoded_chunk3.clone()); assert_eq!(env.clients[0].shards_mgr.get_stored_partial_encoded_chunks(5).len(), 1); } diff --git a/chain/client/tests/consensus.rs b/chain/client/tests/consensus.rs index 0aa5a97243c..2a9b9d765df 100644 --- a/chain/client/tests/consensus.rs +++ b/chain/client/tests/consensus.rs @@ -82,31 +82,31 @@ mod tests { match msg { NetworkRequests::Block { block } => { - if !all_blocks.contains_key(&block.header.height()) { + if !all_blocks.contains_key(&block.header().height()) { println!( "BLOCK @{} EPOCH: {:?}, APPROVALS: {:?}", - block.header.height(), - block.header.epoch_id(), + block.header().height(), + block.header().epoch_id(), block - .header + .header() .approvals() .iter() .map(|x| if x.is_some() { 1 } else { 0 }) .collect::>() ); } - all_blocks.insert(block.header.height(), block.clone()); - block_to_prev_block.insert(*block.hash(), *block.header.prev_hash()); - block_to_height.insert(*block.hash(), block.header.height()); + all_blocks.insert(block.header().height(), block.clone()); + block_to_prev_block.insert(*block.hash(), *block.header().prev_hash()); + block_to_height.insert(*block.hash(), block.header().height()); - if *largest_block_height / 20 < block.header.height() / 20 { + if *largest_block_height / 20 < block.header().height() / 20 { // Periodically verify the finality println!("VERIFYING FINALITY CONDITIONS"); for block in all_blocks.values() { if let Some(prev_hash) = block_to_prev_block.get(&block.hash()) { if let Some(prev_height) = block_to_height.get(prev_hash) { - let cur_height = block.header.height(); + let cur_height = block.header().height(); for f in final_block_heights.iter() { if f < &cur_height && f > prev_height { assert!( @@ -125,22 +125,22 @@ mod tests { } } - if block.header.height() > *largest_block_height + 3 { - *largest_block_height = block.header.height(); + if block.header().height() > *largest_block_height + 3 { + *largest_block_height = block.header().height(); if delayed_blocks.len() < 2 { delayed_blocks.push(block.clone()); return (NetworkResponses::NoResponse, false); } } *largest_block_height = - std::cmp::max(block.header.height(), *largest_block_height); + std::cmp::max(block.header().height(), *largest_block_height); let mut new_delayed_blocks = vec![]; for delayed_block in delayed_blocks.iter() { if delayed_block.hash() == block.hash() { return (NetworkResponses::NoResponse, false); } - if delayed_block.header.height() <= block.header.height() + 2 { + if delayed_block.header().height() <= block.header().height() + 2 { for target_ord in 0..24 { connectors1.write().unwrap()[target_ord].0.do_send( NetworkClientMessages::Block( @@ -173,7 +173,7 @@ mod tests { is_final, delayed_blocks .iter() - .map(|x| x.header.height()) + .map(|x| x.header().height()) .collect::>(), block.hash(), heights, diff --git a/chain/client/tests/process_blocks.rs b/chain/client/tests/process_blocks.rs index 553bdd051ba..807a002afcd 100644 --- a/chain/client/tests/process_blocks.rs +++ b/chain/client/tests/process_blocks.rs @@ -209,15 +209,15 @@ fn produce_block_with_approvals() { // test1 will only create their approval for height 10 after their doomslug timer // runs 10 iterations, which is way further in the future than them producing the // block - if block.header.num_approvals() == validators.len() as u64 - 2 { + if block.header().num_approvals() == validators.len() as u64 - 2 { System::current().stop(); - } else if block.header.height() == 10 { - println!("{}", block.header.height()); + } else if block.header().height() == 10 { + println!("{}", block.header().height()); println!( "{} != {} -2 (height: {})", - block.header.num_approvals(), + block.header().num_approvals(), validators.len(), - block.header.height() + block.header().height() ); assert!(false); @@ -262,7 +262,7 @@ fn produce_block_with_approvals() { let signer = InMemoryValidatorSigner::from_seed(&s, KeyType::ED25519, &s); let approval = Approval::new( *block.hash(), - block.header.height(), + block.header().height(), 10, // the height at which "test1" is producing &signer, ); @@ -309,7 +309,7 @@ fn produce_block_with_approvals_arrived_early() { Box::new(move |_: String, msg: &NetworkRequests| -> (NetworkResponses, bool) { match msg { NetworkRequests::Block { block } => { - if block.header.height() == 3 { + if block.header().height() == 3 { for (i, (client, _)) in conns.clone().into_iter().enumerate() { if i > 0 { client.do_send(NetworkClientMessages::Block( @@ -321,7 +321,7 @@ fn produce_block_with_approvals_arrived_early() { } *block_holder.write().unwrap() = Some(block.clone()); return (NetworkResponses::NoResponse, false); - } else if block.header.height() == 4 { + } else if block.header().height() == 4 { System::current().stop(); } (NetworkResponses::NoResponse, true) @@ -364,9 +364,9 @@ fn invalid_blocks() { Box::new(move |msg, _ctx, _client_actor| { match msg { NetworkRequests::Block { block } => { - assert_eq!(block.header.height(), 1); + assert_eq!(block.header().height(), 1); assert_eq!( - block.header.prev_state_root(), + block.header().prev_state_root(), &merklize(&vec![MerkleHash::default()]).0 ); System::current().stop(); @@ -401,7 +401,7 @@ fn invalid_blocks() { last_block.header.next_bp_hash, CryptoHash::default(), ); - block.header.mut_header().inner_rest.chunk_mask = vec![]; + block.mut_header().get_mut().inner_rest.chunk_mask = vec![]; client.do_send(NetworkClientMessages::Block( block.clone(), PeerInfo::random().id, @@ -453,7 +453,7 @@ fn skip_block_production() { Box::new(move |msg, _ctx, _client_actor| { match msg { NetworkRequests::Block { block } => { - if block.header.height() > 3 { + if block.header().height() > 3 { System::current().stop(); } } @@ -609,9 +609,9 @@ fn test_time_attack() { let signer = InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1"); let genesis = client.chain.get_block_by_height(0).unwrap(); let mut b1 = Block::empty_with_height(genesis, 1, &signer); - b1.header.mut_header().inner_lite.timestamp = - to_timestamp(b1.header.timestamp() + chrono::Duration::seconds(60)); - b1.header.resign(&signer); + b1.mut_header().get_mut().inner_lite.timestamp = + to_timestamp(b1.header().timestamp() + chrono::Duration::seconds(60)); + b1.mut_header().resign(&signer); let _ = client.process_block(b1, Provenance::NONE); @@ -640,7 +640,7 @@ fn test_invalid_approvals() { let signer = InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1"); let genesis = client.chain.get_block_by_height(0).unwrap(); let mut b1 = Block::empty_with_height(genesis, 1, &signer); - b1.header.mut_header().inner_rest.approvals = (0..100) + b1.mut_header().get_mut().inner_rest.approvals = (0..100) .map(|i| { Some( InMemoryValidatorSigner::from_seed( @@ -652,7 +652,7 @@ fn test_invalid_approvals() { ) }) .collect(); - b1.header.resign(&signer); + b1.mut_header().resign(&signer); let (_, tip) = client.process_block(b1, Provenance::NONE); match tip { @@ -692,8 +692,8 @@ fn test_invalid_gas_price() { let signer = InMemoryValidatorSigner::from_seed("test1", KeyType::ED25519, "test1"); let genesis = client.chain.get_block_by_height(0).unwrap(); let mut b1 = Block::empty_with_height(genesis, 1, &signer); - b1.header.mut_header().inner_rest.gas_price = 0; - b1.header.resign(&signer); + b1.mut_header().get_mut().inner_rest.gas_price = 0; + b1.mut_header().resign(&signer); let (_, result) = client.process_block(b1, Provenance::NONE); match result { @@ -733,7 +733,7 @@ fn test_minimum_gas_price() { env.produce_block(0, i); } let block = env.clients[0].chain.get_block_by_height(100).unwrap(); - assert!(block.header.gas_price() >= min_gas_price); + assert!(block.header().gas_price() >= min_gas_price); } fn test_gc_with_epoch_length_common(epoch_length: NumBlocks) { @@ -839,7 +839,7 @@ fn test_gc_long_epoch() { assert!(env.clients[0] .chain .mut_store() - .get_all_block_hashes_by_height(block.header.height()) + .get_all_block_hashes_by_height(block.header().height()) .is_ok()); } assert!(check_refcount_map(&mut env.clients[0].chain).is_ok()); @@ -1023,7 +1023,7 @@ fn test_gc_tail_update() { env.process_block(0, block.clone(), Provenance::PRODUCED); blocks.push(block); } - let headers = blocks.clone().into_iter().map(|b| b.header).collect::>(); + let headers = blocks.iter().map(|b| b.header().clone()).collect::>(); env.clients[1].sync_block_headers(headers).unwrap(); // simulate save sync hash block let prev_sync_block = blocks[blocks.len() - 3].clone(); @@ -1035,7 +1035,7 @@ fn test_gc_tail_update() { .reset_heads_post_state_sync(&None, *sync_block.hash(), |_| {}, |_| {}, |_| {}) .unwrap(); env.process_block(1, blocks.pop().unwrap(), Provenance::NONE); - assert_eq!(env.clients[1].chain.store().tail().unwrap(), prev_sync_block.header.height()); + assert_eq!(env.clients[1].chain.store().tail().unwrap(), prev_sync_block.header().height()); assert!(check_refcount_map(&mut env.clients[0].chain).is_ok()); assert!(check_refcount_map(&mut env.clients[1].chain).is_ok()); } @@ -1119,8 +1119,8 @@ fn test_invalid_block_root() { let mut env = TestEnv::new(ChainGenesis::test(), 1, 1); let mut b1 = env.clients[0].produce_block(1).unwrap().unwrap(); let signer = InMemoryValidatorSigner::from_seed("test0", KeyType::ED25519, "test0"); - b1.header.mut_header().inner_lite.block_merkle_root = CryptoHash::default(); - b1.header.resign(&signer); + b1.mut_header().get_mut().inner_lite.block_merkle_root = CryptoHash::default(); + b1.mut_header().resign(&signer); let (_, tip) = env.clients[0].process_block(b1, Provenance::NONE); match tip { Err(e) => match e.kind() { diff --git a/chain/client/tests/query_client.rs b/chain/client/tests/query_client.rs index 23b9211aabc..733148ee0c4 100644 --- a/chain/client/tests/query_client.rs +++ b/chain/client/tests/query_client.rs @@ -68,9 +68,9 @@ fn query_status_not_crash() { block.header.next_bp_hash, block_merkle_tree.root(), ); - next_block.header.mut_header().inner_lite.timestamp = - to_timestamp(next_block.header.timestamp() + chrono::Duration::seconds(60)); - next_block.header.resign(&signer); + next_block.mut_header().get_mut().inner_lite.timestamp = + to_timestamp(next_block.header().timestamp() + chrono::Duration::seconds(60)); + next_block.mut_header().resign(&signer); actix::spawn( client diff --git a/chain/network/src/peer.rs b/chain/network/src/peer.rs index bfedc354f9d..ea6067beee3 100644 --- a/chain/network/src/peer.rs +++ b/chain/network/src/peer.rs @@ -413,7 +413,7 @@ impl Peer { near_metrics::inc_counter(&metrics::PEER_BLOCK_RECEIVED_TOTAL); let block_hash = *block.hash(); self.tracker.push_received(block_hash); - self.chain_info.height = max(self.chain_info.height, block.header.height()); + self.chain_info.height = max(self.chain_info.height, block.header().height()); NetworkClientMessages::Block(block, peer_id, self.tracker.has_request(&block_hash)) } PeerMessage::Transaction(transaction) => { diff --git a/core/primitives/benches/serialization.rs b/core/primitives/benches/serialization.rs index e97033c01ef..7639c177552 100644 --- a/core/primitives/benches/serialization.rs +++ b/core/primitives/benches/serialization.rs @@ -48,9 +48,9 @@ fn create_block() -> Block { let signer = InMemoryValidatorSigner::from_random("".to_string(), KeyType::ED25519); Block::produce( PROTOCOL_VERSION, - &genesis.header, + genesis.header(), 10, - vec![genesis.chunks[0].clone()], + vec![genesis.chunks()[0].clone()], EpochId::default(), EpochId::default(), vec![], diff --git a/core/primitives/src/block.rs b/core/primitives/src/block.rs index 74e5f22f2a9..0e0365991fc 100644 --- a/core/primitives/src/block.rs +++ b/core/primitives/src/block.rs @@ -19,8 +19,16 @@ use crate::utils::to_timestamp; use crate::validator_signer::{EmptyValidatorSigner, ValidatorSigner}; use crate::version::ProtocolVersion; +#[derive(BorshSerialize, BorshDeserialize, Serialize, Clone, Debug, Eq, PartialEq, Default)] +pub struct GenesisId { + /// Chain Id + pub chain_id: String, + /// Hash of genesis block + pub hash: CryptoHash, +} + #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct Block { +pub struct BlockV1 { pub header: BlockHeader, pub chunks: Vec, pub challenges: Challenges, @@ -30,6 +38,12 @@ pub struct Block { pub vrf_proof: near_crypto::vrf::Proof, } +/// Versioned Block data structure. +#[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +pub enum Block { + BlockV1(BlockV1), +} + pub fn genesis_chunks( state_roots: Vec, num_shards: NumShards, @@ -78,7 +92,7 @@ impl Block { next_bp_hash: CryptoHash, ) -> Self { let challenges = vec![]; - Block { + Block::BlockV1(BlockV1 { header: BlockHeader::genesis( genesis_protocol_version, height, @@ -98,7 +112,7 @@ impl Block { vrf_value: near_crypto::vrf::Value([0; 32]), vrf_proof: near_crypto::vrf::Proof([0; 64]), - } + }) } /// Produces new block from header of previous block, current state root and set of transactions. @@ -163,7 +177,7 @@ impl Block { prev.last_final_block() }; - Block { + Block::BlockV1(BlockV1 { header: BlockHeader::new( protocol_version, height, @@ -196,7 +210,7 @@ impl Block { vrf_value, vrf_proof, - } + }) } pub fn verify_gas_price( @@ -205,15 +219,15 @@ impl Block { min_gas_price: Balance, gas_price_adjustment_rate: Rational, ) -> bool { - let gas_used = Self::compute_gas_used(&self.chunks, self.header.height()); - let gas_limit = Self::compute_gas_limit(&self.chunks, self.header.height()); + let gas_used = Self::compute_gas_used(self.chunks(), self.header().height()); + let gas_limit = Self::compute_gas_limit(self.chunks(), self.header().height()); let expected_price = Self::compute_new_gas_price( prev_gas_price, gas_used, gas_limit, gas_price_adjustment_rate, ); - self.header.gas_price() == max(expected_price, min_gas_price) + self.header().gas_price() == max(expected_price, min_gas_price) } pub fn compute_new_gas_price( @@ -234,14 +248,14 @@ impl Block { } } - pub fn compute_state_root(chunks: &Vec) -> CryptoHash { + pub fn compute_state_root(chunks: &[ShardChunkHeader]) -> CryptoHash { merklize( &chunks.iter().map(|chunk| chunk.inner.prev_state_root).collect::>(), ) .0 } - pub fn compute_chunk_receipts_root(chunks: &Vec) -> CryptoHash { + pub fn compute_chunk_receipts_root(chunks: &[ShardChunkHeader]) -> CryptoHash { merklize( &chunks .iter() @@ -252,7 +266,7 @@ impl Block { } pub fn compute_chunk_headers_root( - chunks: &Vec, + chunks: &[ShardChunkHeader], ) -> (CryptoHash, Vec) { merklize( &chunks @@ -262,15 +276,15 @@ impl Block { ) } - pub fn compute_chunk_tx_root(chunks: &Vec) -> CryptoHash { + pub fn compute_chunk_tx_root(chunks: &[ShardChunkHeader]) -> CryptoHash { merklize(&chunks.iter().map(|chunk| chunk.inner.tx_root).collect::>()).0 } - pub fn compute_chunks_included(chunks: &Vec, height: BlockHeight) -> u64 { + pub fn compute_chunks_included(chunks: &[ShardChunkHeader], height: BlockHeight) -> u64 { chunks.iter().filter(|chunk| chunk.height_included == height).count() as u64 } - pub fn compute_outcome_root(chunks: &Vec) -> CryptoHash { + pub fn compute_outcome_root(chunks: &[ShardChunkHeader]) -> CryptoHash { merklize(&chunks.iter().map(|chunk| chunk.inner.outcome_root).collect::>()) .0 } @@ -311,56 +325,78 @@ impl Block { ) } + pub fn header(&self) -> &BlockHeader { + match self { + Block::BlockV1(block) => &block.header, + } + } + + pub fn chunks(&self) -> &Vec { + match self { + Block::BlockV1(block) => &block.chunks, + } + } + + pub fn challenges(&self) -> &Challenges { + match self { + Block::BlockV1(block) => &block.challenges, + } + } + + pub fn vrf_value(&self) -> &near_crypto::vrf::Value { + match self { + Block::BlockV1(block) => &block.vrf_value, + } + } + + pub fn vrf_proof(&self) -> &near_crypto::vrf::Proof { + match self { + Block::BlockV1(block) => &block.vrf_proof, + } + } + pub fn hash(&self) -> &CryptoHash { - self.header.hash() + self.header().hash() } pub fn check_validity(&self) -> bool { // Check that state root stored in the header matches the state root of the chunks - let state_root = Block::compute_state_root(&self.chunks); - if self.header.prev_state_root() != &state_root { + let state_root = Block::compute_state_root(self.chunks()); + if self.header().prev_state_root() != &state_root { return false; } // Check that chunk receipts root stored in the header matches the state root of the chunks - let chunk_receipts_root = Block::compute_chunk_receipts_root(&self.chunks); - if self.header.chunk_receipts_root() != &chunk_receipts_root { + let chunk_receipts_root = Block::compute_chunk_receipts_root(self.chunks()); + if self.header().chunk_receipts_root() != &chunk_receipts_root { return false; } // Check that chunk headers root stored in the header matches the chunk headers root of the chunks - let chunk_headers_root = Block::compute_chunk_headers_root(&self.chunks).0; - if self.header.chunk_headers_root() != &chunk_headers_root { + let chunk_headers_root = Block::compute_chunk_headers_root(self.chunks()).0; + if self.header().chunk_headers_root() != &chunk_headers_root { return false; } // Check that chunk tx root stored in the header matches the tx root of the chunks - let chunk_tx_root = Block::compute_chunk_tx_root(&self.chunks); - if self.header.chunk_tx_root() != &chunk_tx_root { + let chunk_tx_root = Block::compute_chunk_tx_root(self.chunks()); + if self.header().chunk_tx_root() != &chunk_tx_root { return false; } // Check that chunk included root stored in the header matches the chunk included root of the chunks let chunks_included_root = - Block::compute_chunks_included(&self.chunks, self.header.height()); - if self.header.chunks_included() != chunks_included_root { + Block::compute_chunks_included(self.chunks(), self.header().height()); + if self.header().chunks_included() != chunks_included_root { return false; } // Check that challenges root stored in the header matches the challenges root of the challenges - let challenges_root = Block::compute_challenges_root(&self.challenges); - if self.header.challenges_root() != &challenges_root { + let challenges_root = Block::compute_challenges_root(&self.challenges()); + if self.header().challenges_root() != &challenges_root { return false; } true } } - -#[derive(BorshSerialize, BorshDeserialize, Serialize, Clone, Debug, Eq, PartialEq, Default)] -pub struct GenesisId { - /// Chain Id - pub chain_id: String, - /// Hash of genesis block - pub hash: CryptoHash, -} diff --git a/core/primitives/src/test_utils.rs b/core/primitives/src/test_utils.rs index bd710722d88..0b4fbbf7f4d 100644 --- a/core/primitives/src/test_utils.rs +++ b/core/primitives/src/test_utils.rs @@ -243,7 +243,7 @@ impl SignedTransaction { } impl BlockHeader { - pub fn mut_header(&mut self) -> &mut BlockHeaderV1 { + pub fn get_mut(&mut self) -> &mut BlockHeaderV1 { match self { BlockHeader::BlockHeaderV1(header) => header, } @@ -255,13 +255,19 @@ impl BlockHeader { &self.inner_lite_bytes(), &self.inner_rest_bytes(), ); - let mut header = self.mut_header(); + let mut header = self.get_mut(); header.hash = hash; header.signature = signature; } } impl Block { + pub fn mut_header(&mut self) -> &mut BlockHeader { + match self { + Block::BlockV1(block) => &mut block.header, + } + } + pub fn empty_with_epoch( prev: &Block, height: BlockHeight, @@ -306,13 +312,13 @@ impl Block { Self::empty_with_epoch( prev, height, - prev.header.epoch_id().clone(), - if prev.header.prev_hash() == &CryptoHash::default() { + prev.header().epoch_id().clone(), + if prev.header().prev_hash() == &CryptoHash::default() { EpochId(*prev.hash()) } else { - prev.header.next_epoch_id().clone() + prev.header().next_epoch_id().clone() }, - *prev.header.next_bp_hash(), + *prev.header().next_bp_hash(), signer, block_merkle_tree, ) @@ -325,7 +331,7 @@ impl Block { ) -> Self { Self::empty_with_height_and_block_merkle_tree( prev, - prev.header.height() + 1, + prev.header().height() + 1, signer, block_merkle_tree, ) @@ -349,9 +355,9 @@ impl Block { ) -> Self { Block::produce( PROTOCOL_VERSION, - &prev.header, + prev.header(), height, - prev.chunks.clone(), + prev.chunks().clone(), epoch_id, next_epoch_id, approvals, diff --git a/core/primitives/src/views.rs b/core/primitives/src/views.rs index dda52736d85..1e0b472b3ee 100644 --- a/core/primitives/src/views.rs +++ b/core/primitives/src/views.rs @@ -539,8 +539,8 @@ impl BlockView { pub fn from_author_block(author: AccountId, block: Block) -> Self { BlockView { author, - header: block.header.into(), - chunks: block.chunks.into_iter().map(Into::into).collect(), + header: block.header().clone().into(), + chunks: block.chunks().iter().cloned().map(Into::into).collect(), } } } diff --git a/genesis-tools/genesis-populate/src/lib.rs b/genesis-tools/genesis-populate/src/lib.rs index 2fc515b4b0e..b40b1eb827e 100644 --- a/genesis-tools/genesis-populate/src/lib.rs +++ b/genesis-tools/genesis-populate/src/lib.rs @@ -201,13 +201,13 @@ impl GenesisBuilder { let mut store = ChainStore::new(self.store.clone(), self.genesis.config.genesis_height); let mut store_update = store.store_update(); - self.runtime.add_validator_proposals(BlockHeaderInfo::new(&genesis.header, 0)).unwrap(); + self.runtime.add_validator_proposals(BlockHeaderInfo::new(&genesis.header(), 0)).unwrap(); store_update - .save_block_header(genesis.header.clone()) + .save_block_header(genesis.header().clone()) .expect("save genesis block header shouldn't fail"); store_update.save_block(genesis.clone()); - for (chunk_header, state_root) in genesis.chunks.iter().zip(self.roots.values()) { + for (chunk_header, state_root) in genesis.chunks().iter().zip(self.roots.values()) { store_update.save_chunk_extra( &genesis.hash(), chunk_header.inner.shard_id, @@ -222,7 +222,7 @@ impl GenesisBuilder { ); } - let head = Tip::from_header(&genesis.header); + let head = Tip::from_header(&genesis.header()); store_update.save_head(&head).unwrap(); store_update.save_sync_head(&head); store_update.commit().unwrap(); diff --git a/neard/src/runtime.rs b/neard/src/runtime.rs index d49711d1386..ffdbafb4c39 100644 --- a/neard/src/runtime.rs +++ b/neard/src/runtime.rs @@ -486,8 +486,8 @@ impl RuntimeAdapter for NightshadeRuntime { epoch_id: &EpochId, block_height: BlockHeight, prev_random_value: &CryptoHash, - vrf_value: near_crypto::vrf::Value, - vrf_proof: near_crypto::vrf::Proof, + vrf_value: &near_crypto::vrf::Value, + vrf_proof: &near_crypto::vrf::Proof, ) -> Result<(), Error> { let mut epoch_manager = self.epoch_manager.as_ref().write().expect(POISONED_LOCK_ERR); let validator = epoch_manager.get_block_producer_info(&epoch_id, block_height)?; @@ -496,7 +496,7 @@ impl RuntimeAdapter for NightshadeRuntime { ) .unwrap(); - if !public_key.is_vrf_valid(&prev_random_value.as_ref(), &vrf_value, &vrf_proof) { + if !public_key.is_vrf_valid(&prev_random_value.as_ref(), vrf_value, vrf_proof) { return Err(ErrorKind::InvalidRandomnessBeaconOutput.into()); } Ok(()) diff --git a/neard/tests/economics.rs b/neard/tests/economics.rs index c57b6728425..39cbdd467e9 100644 --- a/neard/tests/economics.rs +++ b/neard/tests/economics.rs @@ -105,15 +105,15 @@ fn test_burn_mint() { // We burn half of the cost when tx executed and the other half in the next block for the receipt processing. let half_transfer_cost = fee_helper.transfer_cost() / 2; assert_eq!( - block3.header.total_supply(), + block3.header().total_supply(), // supply + 1% of protocol rewards + 3/4 * 9% of validator rewards. initial_total_supply * 10775 / 10000 - half_transfer_cost ); - assert_eq!(block3.chunks[0].inner.balance_burnt, half_transfer_cost); + assert_eq!(block3.chunks()[0].inner.balance_burnt, half_transfer_cost); // Block 4: subtract 2nd part of transfer. let block4 = env.clients[0].chain.get_block_by_height(4).unwrap().clone(); - assert_eq!(block4.header.total_supply(), block3.header.total_supply() - half_transfer_cost); - assert_eq!(block4.chunks[0].inner.balance_burnt, half_transfer_cost); + assert_eq!(block4.header().total_supply(), block3.header().total_supply() - half_transfer_cost); + assert_eq!(block4.chunks()[0].inner.balance_burnt, half_transfer_cost); // Check that Protocol Treasury account got it's 1% as well. assert_eq!( env.query_balance("near".to_string()), @@ -122,8 +122,8 @@ fn test_burn_mint() { // Block 5: reward from previous block. let block5 = env.clients[0].chain.get_block_by_height(5).unwrap().clone(); assert_eq!( - block5.header.total_supply(), + block5.header().total_supply(), // previous supply + 10% - block4.header.total_supply() * 110 / 100 + block4.header().total_supply() * 110 / 100 ); } diff --git a/neard/tests/sync_nodes.rs b/neard/tests/sync_nodes.rs index 61b706f964e..5441b72deaf 100644 --- a/neard/tests/sync_nodes.rs +++ b/neard/tests/sync_nodes.rs @@ -37,25 +37,30 @@ fn add_blocks( block_merkle_tree.insert(*block.hash()); } for _ in 0..num { - let epoch_id = match prev.header.height() + 1 { + let epoch_id = match prev.header().height() + 1 { height if height <= epoch_length => EpochId::default(), height => { EpochId(*blocks[(((height - 1) / epoch_length - 1) * epoch_length) as usize].hash()) } }; let next_epoch_id = EpochId( - *blocks[(((prev.header.height()) / epoch_length) * epoch_length) as usize].hash(), + *blocks[(((prev.header().height()) / epoch_length) * epoch_length) as usize].hash(), ); let block = Block::produce( PROTOCOL_VERSION, - &prev.header, - prev.header.height() + 1, - blocks[0].chunks.clone(), + &prev.header(), + prev.header().height() + 1, + blocks[0].chunks().clone(), epoch_id, next_epoch_id, vec![Some( - Approval::new(*prev.hash(), prev.header.height(), prev.header.height() + 1, signer) - .signature, + Approval::new( + *prev.hash(), + prev.header().height(), + prev.header().height() + 1, + signer, + ) + .signature, )], Rational::from_integer(0), 0, diff --git a/test-utils/state-viewer/src/main.rs b/test-utils/state-viewer/src/main.rs index e21522b9aa9..249585bde32 100644 --- a/test-utils/state-viewer/src/main.rs +++ b/test-utils/state-viewer/src/main.rs @@ -63,7 +63,7 @@ fn load_trie_stop_at_height( let last_final_block_hash = *chain_store.get_block_header(&cur_block_hash).unwrap().last_final_block(); let last_final_block = chain_store.get_block(&last_final_block_hash).unwrap(); - if last_final_block.header.height() >= height { + if last_final_block.header().height() >= height { break last_final_block.clone(); } else { cur_height += 1; @@ -73,8 +73,8 @@ fn load_trie_stop_at_height( } None => chain_store.get_block(&head.last_block_hash).unwrap().clone(), }; - let state_roots = last_block.chunks.iter().map(|chunk| chunk.inner.prev_state_root).collect(); - (runtime, state_roots, last_block.header) + let state_roots = last_block.chunks().iter().map(|chunk| chunk.inner.prev_state_root).collect(); + (runtime, state_roots, last_block.header().clone()) } pub fn format_hash(h: CryptoHash) -> String { diff --git a/test-utils/state-viewer/src/state_dump.rs b/test-utils/state-viewer/src/state_dump.rs index 0aaf2c27561..2db5a60263e 100644 --- a/test-utils/state-viewer/src/state_dump.rs +++ b/test-utils/state-viewer/src/state_dump.rs @@ -137,7 +137,7 @@ mod test { ); let last_block = env.clients[0].chain.get_block(&head.last_block_hash).unwrap().clone(); let state_roots = - last_block.chunks.iter().map(|chunk| chunk.inner.prev_state_root).collect(); + last_block.chunks().iter().map(|chunk| chunk.inner.prev_state_root).collect(); let runtime = NightshadeRuntime::new( Path::new("."), store.clone(), @@ -145,7 +145,8 @@ mod test { vec![], vec![], ); - let new_genesis = state_dump(runtime, state_roots, last_block.header, &genesis.config); + let new_genesis = + state_dump(runtime, state_roots, last_block.header().clone(), &genesis.config); assert_eq!(new_genesis.config.validators.len(), 2); validate_genesis(&new_genesis); } @@ -172,7 +173,7 @@ mod test { let head = env.clients[0].chain.head().unwrap(); let last_block = env.clients[0].chain.get_block(&head.last_block_hash).unwrap().clone(); let state_roots = - last_block.chunks.iter().map(|chunk| chunk.inner.prev_state_root).collect(); + last_block.chunks().iter().map(|chunk| chunk.inner.prev_state_root).collect(); let runtime = NightshadeRuntime::new( Path::new("."), store.clone(), @@ -180,7 +181,8 @@ mod test { vec![], vec![], ); - let new_genesis = state_dump(runtime, state_roots, last_block.header, &genesis.config); + let new_genesis = + state_dump(runtime, state_roots, last_block.header().clone(), &genesis.config); assert_eq!( new_genesis .config @@ -239,11 +241,11 @@ mod test { } let last_block = blocks.pop().unwrap(); let state_roots = - last_block.chunks.iter().map(|chunk| chunk.inner.prev_state_root).collect::>(); + last_block.chunks().iter().map(|chunk| chunk.inner.prev_state_root).collect::>(); let runtime2 = create_runtime(store2); let _ = - state_dump(runtime2, state_roots.clone(), last_block.header.clone(), &genesis.config); + state_dump(runtime2, state_roots.clone(), last_block.header().clone(), &genesis.config); } #[test] @@ -292,7 +294,7 @@ mod test { ); let last_block = env.clients[0].chain.get_block(&head.last_block_hash).unwrap().clone(); let state_roots = - last_block.chunks.iter().map(|chunk| chunk.inner.prev_state_root).collect(); + last_block.chunks().iter().map(|chunk| chunk.inner.prev_state_root).collect(); let runtime = NightshadeRuntime::new( Path::new("."), store.clone(), @@ -300,7 +302,8 @@ mod test { vec![], vec![], ); - let new_genesis = state_dump(runtime, state_roots, last_block.header, &genesis.config); + let new_genesis = + state_dump(runtime, state_roots, last_block.header().clone(), &genesis.config); assert_eq!(new_genesis.config.validators.len(), 2); validate_genesis(&new_genesis); } diff --git a/test-utils/store-validator/src/validate.rs b/test-utils/store-validator/src/validate.rs index 0121a7366b4..b97fcbbb2c4 100644 --- a/test-utils/store-validator/src/validate.rs +++ b/test-utils/store-validator/src/validate.rs @@ -146,7 +146,7 @@ pub(crate) fn block_of_chunk_exists( for block_hash in set { match sv.store.get_ser::(ColBlock, block_hash.as_ref()) { Ok(Some(block)) => { - if block.chunks.contains(&shard_chunk.header) { + if block.chunks().contains(&shard_chunk.header) { // Block for ShardChunk is found return Ok(()); } @@ -176,8 +176,12 @@ pub(crate) fn block_height_cmp_tail( ) .unwrap_or(sv.config.genesis_height); let block = unwrap_or_err!(Block::try_from_slice(value), "Can't deserialize Block"); - if block.header.height() < tail && block.header.height() != sv.config.genesis_height { - return err!("Invalid block height stored: {}, tail: {:?}", (block.header.height()), tail); + if block.header().height() < tail && block.header().height() != sv.config.genesis_height { + return err!( + "Invalid block height stored: {}, tail: {:?}", + (block.header().height()), + tail + ); } Ok(()) } From 1ef4addb3787624e3f44d581bf541db01b7be234 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Fri, 29 May 2020 15:18:00 -0700 Subject: [PATCH 14/21] Version tracking in the epoch manager --- chain/epoch_manager/src/lib.rs | 396 ++++++++------------------ chain/epoch_manager/src/proposals.rs | 20 +- chain/epoch_manager/src/test_utils.rs | 29 ++ chain/epoch_manager/src/types.rs | 34 ++- neard/src/runtime.rs | 1 + neard/src/shard_tracker.rs | 1 + 6 files changed, 185 insertions(+), 296 deletions(-) diff --git a/chain/epoch_manager/src/lib.rs b/chain/epoch_manager/src/lib.rs index d5abdff677f..c7a90c0617f 100644 --- a/chain/epoch_manager/src/lib.rs +++ b/chain/epoch_manager/src/lib.rs @@ -12,6 +12,7 @@ use near_primitives::types::{ AccountId, ApprovalStake, Balance, BlockChunkValidatorStats, BlockHeight, EpochId, ShardId, ValidatorId, ValidatorKickoutReason, ValidatorStake, ValidatorStats, }; +use near_primitives::version::ProtocolVersion; use near_primitives::views::{ CurrentEpochValidatorInfo, EpochValidatorInfo, NextEpochValidatorInfo, ValidatorKickoutView, }; @@ -51,6 +52,7 @@ impl EpochManager { pub fn new( store: Arc, config: EpochConfig, + genesis_protocol_version: ProtocolVersion, reward_calculator: RewardCalculator, validators: Vec, ) -> Result { @@ -76,6 +78,7 @@ impl EpochManager { HashMap::default(), validator_reward, 0, + genesis_protocol_version, )?; // Dummy block info. // Artificial block we add to simplify implementation: dummy block is the @@ -199,6 +202,39 @@ impl EpochManager { let block_validator_tracker = last_block_info.block_tracker.clone(); let chunk_validator_tracker = last_block_info.shard_tracker.clone(); + // Next protocol version calculation. + // Implements https://github.com/nearprotocol/NEPs/pull/64/files#diff-45f773511fe4321b446c3c4226324873R76 + let mut versions = HashMap::new(); + for (validator_id, version) in last_block_info.version_tracker.iter() { + let stake = epoch_info.validators[*validator_id as usize].stake; + if let Some(value) = versions.get_mut(version) { + *value += stake + } else { + versions.insert(version, stake); + } + } + let total_block_producer_stake: u128 = epoch_info + .block_producers_settlement + .iter() + .map(|id| epoch_info.validators[*id as usize].stake) + .sum(); + + let next_version = if let Some((&version, stake)) = + versions.into_iter().max_by(|left, right| left.1.cmp(&right.1)) + { + if stake + > (total_block_producer_stake + * *self.config.protocol_upgrade_stake_threshold.numer() as u128) + / *self.config.protocol_upgrade_stake_threshold.denom() as u128 + { + version + } else { + epoch_info.protocol_version + } + } else { + epoch_info.protocol_version + }; + // Gather slashed validators and add them to kick out first. let slashed_validators = last_block_info.slashed.clone(); for (account_id, _) in slashed_validators.iter() { @@ -247,6 +283,7 @@ impl EpochManager { all_proposals, validator_kickout, validator_block_chunk_stats, + next_version, }) } @@ -284,6 +321,7 @@ impl EpochManager { all_proposals, validator_kickout, validator_block_chunk_stats, + next_version, } = self.collect_blocks_info(&block_info, last_block_hash)?; let epoch_id = self.get_epoch_id(last_block_hash)?; let epoch_info = self.get_epoch_info(&epoch_id)?; @@ -308,6 +346,7 @@ impl EpochManager { validator_kickout, validator_reward, minted_amount, + next_version, ) { Ok(next_next_epoch_info) => next_next_epoch_info, Err(EpochError::ThresholdError { stake_sum, num_seats }) => { @@ -397,8 +436,13 @@ impl EpochManager { } } - let BlockInfo { block_tracker, mut all_proposals, shard_tracker, .. } = - prev_block_info; + let BlockInfo { + block_tracker, + mut all_proposals, + shard_tracker, + version_tracker, + .. + } = prev_block_info; // Update block produced/expected tracker. block_info.update_block_tracker( @@ -411,6 +455,10 @@ impl EpochManager { prev_block_info.height, if is_epoch_start { HashMap::default() } else { shard_tracker }, ); + block_info.update_version_tracker( + &epoch_info, + if is_epoch_start { HashMap::default() } else { version_tracker }, + ); // accumulate values if is_epoch_start { block_info.all_proposals = block_info.proposals.clone(); @@ -896,7 +944,10 @@ impl EpochManager { Ok(false) } - fn block_producer_from_info(epoch_info: &EpochInfo, height: BlockHeight) -> ValidatorId { + pub(crate) fn block_producer_from_info( + epoch_info: &EpochInfo, + height: BlockHeight, + ) -> ValidatorId { epoch_info.block_producers_settlement [(height as u64 % (epoch_info.block_producers_settlement.len() as u64)) as usize] } @@ -1065,7 +1116,7 @@ mod tests { use near_store::test_utils::create_test_store; use crate::test_utils::{ - change_stake, default_reward_calculator, epoch_config, epoch_info, hash_range, + block_info, change_stake, default_reward_calculator, epoch_config, epoch_info, hash_range, record_block, reward, setup_default_epoch_manager, setup_epoch_manager, stake, DEFAULT_TOTAL_SUPPLY, }; @@ -1129,6 +1180,7 @@ mod tests { let mut epoch_manager2 = EpochManager::new( epoch_manager.store.clone(), epoch_manager.config.clone(), + PROTOCOL_VERSION, epoch_manager.reward_calculator, validators.iter().map(|(account_id, balance)| stake(*account_id, *balance)).collect(), ) @@ -1297,17 +1349,9 @@ mod tests { /// of kickout for this epoch and last epoch equals the entire validator set. #[test] fn test_validator_kickout() { - let store = create_test_store(); - let config = epoch_config(4, 1, 2, 0, 90, 60, 0); let amount_staked = 1_000_000; - let validators = vec![stake("test1", amount_staked), stake("test2", amount_staked)]; - let mut epoch_manager = EpochManager::new( - store.clone(), - config.clone(), - default_reward_calculator(), - validators.clone(), - ) - .unwrap(); + let validators = vec![("test1", amount_staked), ("test2", amount_staked)]; + let mut epoch_manager = setup_default_epoch_manager(validators, 4, 1, 2, 0, 90, 60); let h = hash_range(12); record_block(&mut epoch_manager, CryptoHash::default(), h[0], 0, vec![]); @@ -1355,6 +1399,7 @@ mod tests { let mut epoch_manager = EpochManager::new( store.clone(), config.clone(), + PROTOCOL_VERSION, default_reward_calculator(), validators.clone(), ) @@ -1429,6 +1474,7 @@ mod tests { let mut epoch_manager = EpochManager::new( store.clone(), config.clone(), + PROTOCOL_VERSION, default_reward_calculator(), validators.clone(), ) @@ -1515,6 +1561,7 @@ mod tests { let mut epoch_manager = EpochManager::new( store.clone(), config.clone(), + PROTOCOL_VERSION, default_reward_calculator(), validators.clone(), ) @@ -1599,17 +1646,9 @@ mod tests { /// Test that two double sign challenge in two epochs works #[test] fn test_double_sign_slashing2() { - let store = create_test_store(); - let config = epoch_config(2, 1, 2, 0, 90, 60, 0); let amount_staked = 1_000_000; - let validators = vec![stake("test1", amount_staked), stake("test2", amount_staked)]; - let mut epoch_manager = EpochManager::new( - store.clone(), - config.clone(), - default_reward_calculator(), - validators.clone(), - ) - .unwrap(); + let validators = vec![("test1", amount_staked), ("test2", amount_staked)]; + let mut epoch_manager = setup_default_epoch_manager(validators, 2, 1, 2, 0, 90, 60); let h = hash_range(10); record_block(&mut epoch_manager, CryptoHash::default(), h[0], 0, vec![]); @@ -1725,63 +1764,21 @@ mod tests { epoch_manager .record_block_info( &h[0], - BlockInfo { - height: 0, - last_finalized_height: 0, - prev_hash: Default::default(), - epoch_first_block: h[0], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(0, 0, Default::default(), h[0], vec![true], total_supply), rng_seed, ) .unwrap(); epoch_manager .record_block_info( &h[1], - BlockInfo { - height: 1, - last_finalized_height: 1, - prev_hash: h[0], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(1, 1, h[0], h[1], vec![true], total_supply), rng_seed, ) .unwrap(); epoch_manager .record_block_info( &h[2], - BlockInfo { - height: 2, - last_finalized_height: 2, - prev_hash: h[1], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(2, 2, h[1], h[1], vec![true], total_supply), rng_seed, ) .unwrap(); @@ -1852,63 +1849,21 @@ mod tests { epoch_manager .record_block_info( &h[0], - BlockInfo { - height: 0, - last_finalized_height: 0, - prev_hash: Default::default(), - epoch_first_block: h[0], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(0, 0, Default::default(), h[0], vec![true], total_supply), rng_seed, ) .unwrap(); epoch_manager .record_block_info( &h[1], - BlockInfo { - height: 1, - last_finalized_height: 1, - prev_hash: h[0], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(1, 1, h[0], h[1], vec![true], total_supply), rng_seed, ) .unwrap(); epoch_manager .record_block_info( &h[2], - BlockInfo { - height: 2, - last_finalized_height: 2, - prev_hash: h[1], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(2, 2, h[1], h[1], vec![true], total_supply), rng_seed, ) .unwrap(); @@ -1998,63 +1953,21 @@ mod tests { epoch_manager .record_block_info( &h[0], - BlockInfo { - height: 0, - last_finalized_height: 0, - prev_hash: Default::default(), - epoch_first_block: h[0], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(0, 0, Default::default(), h[0], vec![true], total_supply), rng_seed, ) .unwrap(); epoch_manager .record_block_info( &h[1], - BlockInfo { - height: 1, - last_finalized_height: 1, - prev_hash: h[0], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true, false], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(1, 1, h[0], h[1], vec![true, false], total_supply), rng_seed, ) .unwrap(); epoch_manager .record_block_info( &h[2], - BlockInfo { - height: 2, - last_finalized_height: 2, - prev_hash: h[1], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true, true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(2, 2, h[1], h[1], vec![true, true], total_supply), rng_seed, ) .unwrap(); @@ -2098,17 +2011,9 @@ mod tests { #[test] fn test_unstake_and_then_change_stake() { - let store = create_test_store(); - let config = epoch_config(2, 1, 2, 0, 90, 60, 0); let amount_staked = 1_000_000; - let validators = vec![stake("test1", amount_staked), stake("test2", amount_staked)]; - let mut epoch_manager = EpochManager::new( - store.clone(), - config.clone(), - default_reward_calculator(), - validators.clone(), - ) - .unwrap(); + let validators = vec![("test1", amount_staked), ("test2", amount_staked)]; + let mut epoch_manager = setup_default_epoch_manager(validators, 2, 1, 2, 0, 90, 60); let h = hash_range(8); record_block(&mut epoch_manager, CryptoHash::default(), h[0], 0, vec![]); // test1 unstakes in epoch 1, and should be kicked out in epoch 3 (validators stored at h2). @@ -2159,63 +2064,21 @@ mod tests { epoch_manager .record_block_info( &h[0], - BlockInfo { - height: 0, - last_finalized_height: 0, - prev_hash: Default::default(), - epoch_first_block: h[0], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(0, 0, Default::default(), h[0], vec![], total_supply), rng_seed, ) .unwrap(); epoch_manager .record_block_info( &h[1], - BlockInfo { - height: 1, - last_finalized_height: 1, - prev_hash: h[0], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true, true, true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(1, 1, h[0], h[1], vec![true, true, true], total_supply), rng_seed, ) .unwrap(); epoch_manager .record_block_info( &h[3], - BlockInfo { - height: 3, - last_finalized_height: 3, - prev_hash: h[1], - epoch_first_block: h[2], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true, true, true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(3, 3, h[1], h[2], vec![true, true, true], total_supply), rng_seed, ) .unwrap(); @@ -2265,21 +2128,7 @@ mod tests { epoch_manager .record_block_info( &h[3], - BlockInfo { - height: 3, - last_finalized_height: 1, - prev_hash: h[1], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![false], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(3, 1, h[1], h[1], vec![false], total_supply), rng_seed, ) .unwrap(); @@ -2423,61 +2272,19 @@ mod tests { record_block(&mut em, Default::default(), h[0], 0, vec![]); em.record_block_info( &h[1], - BlockInfo { - height: 1, - last_finalized_height: 1, - prev_hash: h[0], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true, true, true, false], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(1, 1, h[0], h[1], vec![true, true, true, false], total_supply), rng_seed, ) .unwrap(); em.record_block_info( &h[2], - BlockInfo { - height: 2, - last_finalized_height: 2, - prev_hash: h[1], - epoch_first_block: h[1], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true, true, true, false], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(2, 2, h[1], h[1], vec![true, true, true, false], total_supply), rng_seed, ) .unwrap(); em.record_block_info( &h[3], - BlockInfo { - height: 3, - last_finalized_height: 3, - prev_hash: h[2], - epoch_first_block: h[3], - epoch_id: Default::default(), - proposals: vec![], - chunk_mask: vec![true, true, true, true], - slashed: Default::default(), - total_supply, - block_tracker: Default::default(), - shard_tracker: Default::default(), - all_proposals: vec![], - latest_protocol_version: PROTOCOL_VERSION, - }, + block_info(3, 3, h[2], h[3], vec![true, true, true, true], total_supply), rng_seed, ) .unwrap(); @@ -2503,17 +2310,9 @@ mod tests { #[test] fn test_compare_epoch_id() { - let store = create_test_store(); - let config = epoch_config(2, 1, 2, 0, 90, 60, 0); let amount_staked = 1_000_000; - let validators = vec![stake("test1", amount_staked), stake("test2", amount_staked)]; - let mut epoch_manager = EpochManager::new( - store.clone(), - config.clone(), - default_reward_calculator(), - validators.clone(), - ) - .unwrap(); + let validators = vec![("test1", amount_staked), ("test2", amount_staked)]; + let mut epoch_manager = setup_default_epoch_manager(validators, 2, 1, 2, 0, 90, 60); let h = hash_range(8); record_block(&mut epoch_manager, CryptoHash::default(), h[0], 0, vec![]); // test1 unstakes in epoch 1, and should be kicked out in epoch 3 (validators stored at h2). @@ -2851,4 +2650,33 @@ mod tests { ) ); } + + #[test] + fn test_protocol_version_switch() { + let store = create_test_store(); + let config = epoch_config(2, 1, 2, 0, 90, 60, 0); + let amount_staked = 1_000_000; + let validators = vec![stake("test1", amount_staked), stake("test2", amount_staked)]; + let mut epoch_manager = EpochManager::new( + store.clone(), + config.clone(), + 0, + default_reward_calculator(), + validators.clone(), + ) + .unwrap(); + let h = hash_range(8); + record_block(&mut epoch_manager, CryptoHash::default(), h[0], 0, vec![]); + let mut block_info1 = block_info(1, 1, h[0], h[0], vec![], DEFAULT_TOTAL_SUPPLY); + block_info1.latest_protocol_version = 0; + epoch_manager.record_block_info(&h[1], block_info1, [0; 32]).unwrap(); + for i in 2..6 { + record_block(&mut epoch_manager, h[i - 1], h[i], i as u64, vec![]); + } + assert_eq!(epoch_manager.get_epoch_info(&EpochId(h[2])).unwrap().protocol_version, 0); + assert_eq!( + epoch_manager.get_epoch_info(&EpochId(h[4])).unwrap().protocol_version, + PROTOCOL_VERSION + ); + } } diff --git a/chain/epoch_manager/src/proposals.rs b/chain/epoch_manager/src/proposals.rs index 20e1f9446c0..8242afa5097 100644 --- a/chain/epoch_manager/src/proposals.rs +++ b/chain/epoch_manager/src/proposals.rs @@ -5,6 +5,7 @@ use near_primitives::errors::EpochError; use near_primitives::types::{ AccountId, Balance, NumSeats, ValidatorId, ValidatorKickoutReason, ValidatorStake, }; +use near_primitives::version::ProtocolVersion; use crate::types::{EpochConfig, EpochInfo, RngSeed}; @@ -41,6 +42,7 @@ pub fn proposals_to_epoch_info( mut validator_kickout: HashMap, validator_reward: HashMap, minted_amount: Balance, + next_version: ProtocolVersion, ) -> Result { // Combine proposals with rollovers. let mut ordered_proposals = BTreeMap::new(); @@ -201,7 +203,7 @@ pub fn proposals_to_epoch_info( validator_kickout, fishermen_to_index, minted_amount, - protocol_version: epoch_info.protocol_version, + protocol_version: next_version, }) } @@ -209,6 +211,8 @@ pub fn proposals_to_epoch_info( mod tests { use num_rational::Rational; + use near_primitives::version::PROTOCOL_VERSION; + use crate::test_utils::{change_stake, epoch_config, epoch_info, stake}; use super::*; @@ -232,7 +236,8 @@ mod tests { vec![stake("test1", 1_000_000)], HashMap::default(), HashMap::default(), - 0 + 0, + PROTOCOL_VERSION, ) .unwrap(), epoch_info( @@ -261,6 +266,8 @@ mod tests { fishermen_threshold: 10, online_min_threshold: Rational::new(90, 100), online_max_threshold: Rational::new(99, 100), + protocol_upgrade_stake_threshold: Rational::new(80, 100), + protocol_upgrade_num_epochs: 2, }, [0; 32], &EpochInfo::default(), @@ -272,7 +279,8 @@ mod tests { ], HashMap::default(), HashMap::default(), - 0 + 0, + PROTOCOL_VERSION ) .unwrap(), epoch_info( @@ -318,7 +326,8 @@ mod tests { ], HashMap::default(), HashMap::default(), - 0 + 0, + PROTOCOL_VERSION ) .unwrap(), epoch_info( @@ -357,7 +366,8 @@ mod tests { vec![stake("test1", 9), stake("test2", 9), stake("test3", 9), stake("test4", 9)], HashMap::default(), HashMap::default(), - 0 + 0, + PROTOCOL_VERSION ) .unwrap(), epoch_info diff --git a/chain/epoch_manager/src/test_utils.rs b/chain/epoch_manager/src/test_utils.rs index 9f8489aa547..d2966f012c7 100644 --- a/chain/epoch_manager/src/test_utils.rs +++ b/chain/epoch_manager/src/test_utils.rs @@ -108,6 +108,8 @@ pub fn epoch_config( fishermen_threshold, online_min_threshold: Rational::new(90, 100), online_max_threshold: Rational::new(99, 100), + protocol_upgrade_stake_threshold: Rational::new(80, 100), + protocol_upgrade_num_epochs: 2, } } @@ -157,6 +159,7 @@ pub fn setup_epoch_manager( EpochManager::new( store, config, + PROTOCOL_VERSION, reward_calculator, validators.iter().map(|(account_id, balance)| stake(*account_id, *balance)).collect(), ) @@ -222,3 +225,29 @@ pub fn record_block( ) { record_block_with_slashes(epoch_manager, prev_h, cur_h, height, proposals, vec![]); } + +pub fn block_info( + height: BlockHeight, + last_finalized_height: BlockHeight, + prev_hash: CryptoHash, + epoch_first_block: CryptoHash, + chunk_mask: Vec, + total_supply: Balance, +) -> BlockInfo { + BlockInfo { + height, + last_finalized_height, + prev_hash, + epoch_first_block, + epoch_id: Default::default(), + proposals: vec![], + chunk_mask, + latest_protocol_version: PROTOCOL_VERSION, + slashed: Default::default(), + total_supply, + block_tracker: Default::default(), + shard_tracker: Default::default(), + all_proposals: vec![], + version_tracker: Default::default(), + } +} diff --git a/chain/epoch_manager/src/types.rs b/chain/epoch_manager/src/types.rs index 35f7d186ff6..c63f60ee61f 100644 --- a/chain/epoch_manager/src/types.rs +++ b/chain/epoch_manager/src/types.rs @@ -40,6 +40,10 @@ pub struct EpochConfig { pub online_max_threshold: Rational, /// Stake threshold for becoming a fisherman. pub fishermen_threshold: Balance, + /// Threshold of stake that needs to indicate that they ready for upgrade. + pub protocol_upgrade_stake_threshold: Rational, + /// Number of epochs after stake threshold was achieved to start next prtocol version. + pub protocol_upgrade_num_epochs: EpochHeight, } #[derive(Default, BorshSerialize, BorshDeserialize, Serialize, Clone, Debug, PartialEq, Eq)] @@ -88,6 +92,8 @@ pub struct BlockInfo { pub epoch_id: EpochId, pub proposals: Vec, pub chunk_mask: Vec, + /// Latest protocol version this validator observes. + pub latest_protocol_version: ProtocolVersion, /// Validators slashed since the start of epoch or in previous epoch. pub slashed: HashMap, /// Total supply at this block. @@ -98,8 +104,8 @@ pub struct BlockInfo { pub shard_tracker: HashMap>, /// All proposals in this epoch up to this block. pub all_proposals: Vec, - /// Latest protocol version this validator observes. - pub latest_protocol_version: ProtocolVersion, + /// Protocol versions per validator. + pub version_tracker: HashMap, } impl BlockInfo { @@ -128,13 +134,15 @@ impl BlockInfo { }) .collect(), total_supply, - // These values are not set. This code is suboptimal + latest_protocol_version, + // TODO(2610): These values are "tip" and maintain latest in the current chain. + // Current implementation is suboptimal and should be improved. epoch_first_block: CryptoHash::default(), epoch_id: EpochId::default(), block_tracker: HashMap::default(), shard_tracker: HashMap::default(), all_proposals: vec![], - latest_protocol_version, + version_tracker: HashMap::default(), } } @@ -193,16 +201,28 @@ impl BlockInfo { } self.shard_tracker = prev_shard_tracker; } + + pub fn update_version_tracker( + &mut self, + epoch_info: &EpochInfo, + mut prev_version_tracker: HashMap, + ) { + let block_producer_id = EpochManager::block_producer_from_info(epoch_info, self.height); + prev_version_tracker.insert(block_producer_id, self.latest_protocol_version); + self.version_tracker = prev_version_tracker; + } } pub struct EpochSummary { pub prev_epoch_last_block_hash: CryptoHash, - // Proposals from the epoch, only the latest one per account + /// Proposals from the epoch, only the latest one per account pub all_proposals: Vec, - // Kickout set, includes slashed + /// Kickout set, includes slashed pub validator_kickout: HashMap, - // Only for validators who met the threshold and didn't get slashed + /// Only for validators who met the threshold and didn't get slashed pub validator_block_chunk_stats: HashMap, + /// Protocol version for next epoch. + pub next_version: ProtocolVersion, } /// State that a slashed validator can be in. diff --git a/neard/src/runtime.rs b/neard/src/runtime.rs index ffdbafb4c39..3847e944892 100644 --- a/neard/src/runtime.rs +++ b/neard/src/runtime.rs @@ -159,6 +159,7 @@ impl NightshadeRuntime { EpochManager::new( store.clone(), initial_epoch_config, + genesis.config.protocol_version, reward_calculator, genesis .config diff --git a/neard/src/shard_tracker.rs b/neard/src/shard_tracker.rs index a7451b432cb..27a150eb3af 100644 --- a/neard/src/shard_tracker.rs +++ b/neard/src/shard_tracker.rs @@ -269,6 +269,7 @@ mod tests { EpochManager::new( store, initial_epoch_config, + PROTOCOL_VERSION, reward_calculator, vec![ValidatorStake { account_id: "test".to_string(), From 5b758d1b19e033d3083462b57613d4171abd3410 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Fri, 29 May 2020 15:37:41 -0700 Subject: [PATCH 15/21] Bump protocol version after merge --- core/primitives/src/version.rs | 2 +- neard/res/genesis_config.json | 4 ++-- .../{18-protocol-upgrade.py => 19-protocol-upgrade.py} | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) rename scripts/migrations/{18-protocol-upgrade.py => 19-protocol-upgrade.py} (91%) diff --git a/core/primitives/src/version.rs b/core/primitives/src/version.rs index 4c1a24bb945..5dd878452f6 100644 --- a/core/primitives/src/version.rs +++ b/core/primitives/src/version.rs @@ -17,6 +17,6 @@ pub const DB_VERSION: DbVersion = 1; pub type ProtocolVersion = u32; /// Current latest version of the protocol. -pub const PROTOCOL_VERSION: ProtocolVersion = 18; +pub const PROTOCOL_VERSION: ProtocolVersion = 19; pub const FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION: ProtocolVersion = PROTOCOL_VERSION; diff --git a/neard/res/genesis_config.json b/neard/res/genesis_config.json index 2650a3460a6..ee5b815f7ef 100644 --- a/neard/res/genesis_config.json +++ b/neard/res/genesis_config.json @@ -1,5 +1,5 @@ { - "protocol_version": 18, + "protocol_version": 19, "genesis_time": "1970-01-01T00:00:00.000000000Z", "chain_id": "sample", "genesis_height": 0, @@ -228,4 +228,4 @@ "protocol_treasury_account": "test.near", "fishermen_threshold": "10000000000000000000000000", "records": [] -} \ No newline at end of file +} diff --git a/scripts/migrations/18-protocol-upgrade.py b/scripts/migrations/19-protocol-upgrade.py similarity index 91% rename from scripts/migrations/18-protocol-upgrade.py rename to scripts/migrations/19-protocol-upgrade.py index 00ad0ac8c20..6ef45f9c6e1 100644 --- a/scripts/migrations/18-protocol-upgrade.py +++ b/scripts/migrations/19-protocol-upgrade.py @@ -16,9 +16,9 @@ config = json.load(open(os.path.join(home, 'output.json')), object_pairs_hook=OrderedDict) -assert config['protocol_version'] == 17 +assert config['protocol_version'] == 18 -config['protocol_version'] = 18 +config['protocol_version'] = 19 config.pop('config_version') config['protocol_upgrade_stake_threshold'] = [4, 5] From 9a45898d4bfe12838d27797da9368fbfe6d10658 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Mon, 1 Jun 2020 03:53:37 -0700 Subject: [PATCH 16/21] Current protocol version in status request --- chain/client/src/client_actor.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/chain/client/src/client_actor.rs b/chain/client/src/client_actor.rs index add7d2f45f8..1a0e3533919 100644 --- a/chain/client/src/client_actor.rs +++ b/chain/client/src/client_actor.rs @@ -511,10 +511,14 @@ impl Handler for ClientActor { is_slashed, }) .collect(); + let protocol_version = self + .client + .runtime_adapter + .get_epoch_protocol_version(&head.epoch_id) + .map_err(|err| err.to_string())?; Ok(StatusResponse { version: self.client.config.version.clone(), - // TODO: update this with current one from epoch manager. - protocol_version: PROTOCOL_VERSION, + protocol_version, latest_protocol_version: PROTOCOL_VERSION, chain_id: self.client.config.chain_id.clone(), rpc_addr: self.client.config.rpc_addr.clone(), From 11cd57880581fcc9417e723394382b9259735c20 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Wed, 3 Jun 2020 10:23:36 -0700 Subject: [PATCH 17/21] Bump 0.6.2 & use Box --- Cargo.lock | 16 ++++----- chain/chain/Cargo.toml | 2 +- chain/chunks/Cargo.toml | 2 +- chain/client/Cargo.toml | 2 +- chain/epoch_manager/Cargo.toml | 2 +- chain/jsonrpc/Cargo.toml | 2 +- chain/network/Cargo.toml | 2 +- chain/pool/Cargo.toml | 2 +- core/crypto/Cargo.toml | 2 +- core/primitives/Cargo.toml | 2 +- core/primitives/src/block.rs | 10 +++--- core/primitives/src/block_header.rs | 37 ++++++++++++--------- core/primitives/src/version.rs | 2 +- core/primitives/src/views.rs | 6 ++-- core/store/Cargo.toml | 2 +- genesis-tools/genesis-populate/Cargo.toml | 2 +- neard/Cargo.toml | 2 +- neard/src/lib.rs | 13 +++----- pytest/empty-contract-rs/Cargo.toml | 2 +- runtime/near-vm-errors/Cargo.toml | 2 +- runtime/runtime-params-estimator/Cargo.toml | 2 +- runtime/runtime/Cargo.toml | 2 +- test-utils/loadtester/Cargo.toml | 2 +- test-utils/testlib/Cargo.toml | 2 +- 24 files changed, 61 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba21554145f..f03fce3adab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -554,18 +554,18 @@ dependencies = [ [[package]] name = "borsh" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f9dada4c07fa726bc195503048581e7b1719407f7fbef82741f7b149d3921b3" +checksum = "c7769f8f6fdc6ac7617bbc8bc7ef9dc263cd459d99d21cf2ab4afc3bc8d7d70d" dependencies = [ "borsh-derive", ] [[package]] name = "borsh-derive" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47c6bed3dd7695230e85bd51b6a4e4e4dc7550c1974a79c11e98a8a055211a61" +checksum = "d2689a82a5fe57f9e71997b16bea340da338c7fb8db400b8d9d55b59010540d8" dependencies = [ "borsh-derive-internal", "borsh-schema-derive-internal", @@ -574,9 +574,9 @@ dependencies = [ [[package]] name = "borsh-derive-internal" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f80970434cd6524ae676b277d024b87dd93ecdd3f53bf470d61730dc6cb80" +checksum = "39b621f19e9891a34f679034fa2238260e27c0eddfe2804e9fb282061cf9b294" dependencies = [ "proc-macro2", "quote", @@ -585,9 +585,9 @@ dependencies = [ [[package]] name = "borsh-schema-derive-internal" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3b93230d3769ea99ac75a8a7fee2a229defbc56fe8816c9cde8ed78c848aa33" +checksum = "befebdb9e223ae4528b3d597dbbfb5c68566822d2a3de3e260f235360773ba29" dependencies = [ "proc-macro2", "quote", diff --git a/chain/chain/Cargo.toml b/chain/chain/Cargo.toml index cb71eb3ccfb..71aef5c2497 100644 --- a/chain/chain/Cargo.toml +++ b/chain/chain/Cargo.toml @@ -17,7 +17,7 @@ lazy_static = "1.4" num-rational = "0.2.4" tracing = "0.1.13" -borsh = "0.6.1" +borsh = "0.6.2" near-chain-configs = { path = "../../core/chain-configs" } near-crypto = { path = "../../core/crypto" } diff --git a/chain/chunks/Cargo.toml b/chain/chunks/Cargo.toml index 4798a999a65..b38f60a367b 100644 --- a/chain/chunks/Cargo.toml +++ b/chain/chunks/Cargo.toml @@ -10,7 +10,7 @@ futures = "0.3" rand = "0.7" chrono = "0.4.6" log = "0.4" -borsh = "0.6.1" +borsh = "0.6.2" serde = { version = "1", features = [ "derive" ] } cached = "0.12" reed-solomon-erasure = "4" diff --git a/chain/client/Cargo.toml b/chain/client/Cargo.toml index 2e45a9ba8cb..f66690c8f80 100644 --- a/chain/client/Cargo.toml +++ b/chain/client/Cargo.toml @@ -19,7 +19,7 @@ sysinfo = { git = "https://github.com/near/sysinfo", rev = "3cb97ee79a02754407d2 strum = { version = "0.18", features = ["derive"] } cached = "0.12" lazy_static = "1.4" -borsh = "0.6.1" +borsh = "0.6.2" reed-solomon-erasure = "4" num-rational = "0.2.4" diff --git a/chain/epoch_manager/Cargo.toml b/chain/epoch_manager/Cargo.toml index 99cea9baaee..b13949e1930 100644 --- a/chain/epoch_manager/Cargo.toml +++ b/chain/epoch_manager/Cargo.toml @@ -10,7 +10,7 @@ edition = "2018" protocol_defining_rand = { package = "rand", version = "0.6.5", default-features = false } log = "0.4" cached = "0.12" -borsh = "0.6.1" +borsh = "0.6.2" rand = "0.7" serde = { version = "1", features = [ "derive" ] } serde_json = "1" diff --git a/chain/jsonrpc/Cargo.toml b/chain/jsonrpc/Cargo.toml index 5ba074c9bb0..49aee88dfdc 100644 --- a/chain/jsonrpc/Cargo.toml +++ b/chain/jsonrpc/Cargo.toml @@ -15,7 +15,7 @@ prometheus = "0.8" serde = { version = "1", features = ["derive"] } serde_json = "1" validator = "0.10" -borsh = "0.6.1" +borsh = "0.6.2" near-chain-configs = { path = "../../core/chain-configs" } near-crypto = { path = "../../core/crypto" } diff --git a/chain/network/Cargo.toml b/chain/network/Cargo.toml index 1c912266360..c9084823490 100644 --- a/chain/network/Cargo.toml +++ b/chain/network/Cargo.toml @@ -19,7 +19,7 @@ byteorder = "1.2" lazy_static = "1.4" tracing = "0.1.13" -borsh = "0.6.1" +borsh = "0.6.2" cached = "0.12" near-chain-configs = { path = "../../core/chain-configs" } diff --git a/chain/pool/Cargo.toml b/chain/pool/Cargo.toml index 48a071ce42d..f7949446a6c 100644 --- a/chain/pool/Cargo.toml +++ b/chain/pool/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] rand = "0.7" -borsh = "0.6.1" +borsh = "0.6.2" near-crypto = { path = "../../core/crypto" } near-primitives = { path = "../../core/primitives" } diff --git a/core/crypto/Cargo.toml b/core/crypto/Cargo.toml index 9c8b3ae5a3b..26594dda394 100644 --- a/core/crypto/Cargo.toml +++ b/core/crypto/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] arrayref = "0.3" blake2 = "0.8" -borsh = "0.6.1" +borsh = "0.6.2" bs58 = "0.3" c2-chacha = "0.2" curve25519-dalek = "2" diff --git a/core/primitives/Cargo.toml b/core/primitives/Cargo.toml index af76a846139..54498258fcb 100644 --- a/core/primitives/Cargo.toml +++ b/core/primitives/Cargo.toml @@ -25,7 +25,7 @@ jemallocator = { version = "0.3", optional = true } hex = "0.4" num-rational = "0.2.4" -borsh = "0.6.1" +borsh = "0.6.2" near-crypto = { path = "../crypto" } near-vm-errors = { path = "../../runtime/near-vm-errors" } diff --git a/core/primitives/src/block.rs b/core/primitives/src/block.rs index 24cbf401858..32e4918e2ae 100644 --- a/core/primitives/src/block.rs +++ b/core/primitives/src/block.rs @@ -41,7 +41,7 @@ pub struct BlockV1 { /// Versioned Block data structure. #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] pub enum Block { - BlockV1(BlockV1), + BlockV1(Box), } pub fn genesis_chunks( @@ -92,7 +92,7 @@ impl Block { next_bp_hash: CryptoHash, ) -> Self { let challenges = vec![]; - Block::BlockV1(BlockV1 { + Block::BlockV1(Box::new(BlockV1 { header: BlockHeader::genesis( genesis_protocol_version, height, @@ -112,7 +112,7 @@ impl Block { vrf_value: near_crypto::vrf::Value([0; 32]), vrf_proof: near_crypto::vrf::Proof([0; 64]), - }) + })) } /// Produces new block from header of previous block, current state root and set of transactions. @@ -177,7 +177,7 @@ impl Block { prev.last_final_block() }; - Block::BlockV1(BlockV1 { + Block::BlockV1(Box::new(BlockV1 { header: BlockHeader::new( protocol_version, height, @@ -210,7 +210,7 @@ impl Block { vrf_value, vrf_proof, - }) + })) } pub fn verify_gas_price( diff --git a/core/primitives/src/block_header.rs b/core/primitives/src/block_header.rs index 33dff231f8c..7ba340d92a3 100644 --- a/core/primitives/src/block_header.rs +++ b/core/primitives/src/block_header.rs @@ -130,6 +130,7 @@ impl ApprovalMessage { } #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] +#[borsh_init(init)] pub struct BlockHeaderV1 { pub prev_hash: CryptoHash, @@ -146,10 +147,19 @@ pub struct BlockHeaderV1 { pub hash: CryptoHash, } +impl BlockHeaderV1 { + pub fn init(&mut self) { + self.hash = BlockHeader::compute_hash( + self.prev_hash, + &self.inner_lite.try_to_vec().expect("Failed to serialize"), + &self.inner_rest.try_to_vec().expect("Failed to serialize"), + ); + } +} + #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] -#[borsh_init(init)] pub enum BlockHeader { - BlockHeaderV1(BlockHeaderV1), + BlockHeaderV1(Box), } impl BlockHeader { @@ -165,17 +175,6 @@ impl BlockHeader { return combine_hash(hash_inner, prev_hash); } - pub fn init(&mut self) { - let hash = BlockHeader::compute_hash( - *self.prev_hash(), - &self.inner_lite_bytes(), - &self.inner_rest_bytes(), - ); - match self { - BlockHeader::BlockHeaderV1(header) => header.hash = hash, - } - } - pub fn new( _protocol_version: ProtocolVersion, height: BlockHeight, @@ -235,7 +234,13 @@ impl BlockHeader { &inner_lite.try_to_vec().expect("Failed to serialize"), &inner_rest.try_to_vec().expect("Failed to serialize"), ); - Self::BlockHeaderV1(BlockHeaderV1 { prev_hash, inner_lite, inner_rest, signature, hash }) + Self::BlockHeaderV1(Box::new(BlockHeaderV1 { + prev_hash, + inner_lite, + inner_rest, + signature, + hash, + })) } pub fn genesis( @@ -285,13 +290,13 @@ impl BlockHeader { &inner_rest.try_to_vec().expect("Failed to serialize"), ); // Genesis always has v1 of BlockHeader. - Self::BlockHeaderV1(BlockHeaderV1 { + Self::BlockHeaderV1(Box::new(BlockHeaderV1 { prev_hash: CryptoHash::default(), inner_lite, inner_rest, signature: Signature::empty(KeyType::ED25519), hash, - }) + })) } pub fn hash(&self) -> &CryptoHash { diff --git a/core/primitives/src/version.rs b/core/primitives/src/version.rs index 5dd878452f6..255cd739b80 100644 --- a/core/primitives/src/version.rs +++ b/core/primitives/src/version.rs @@ -17,6 +17,6 @@ pub const DB_VERSION: DbVersion = 1; pub type ProtocolVersion = u32; /// Current latest version of the protocol. -pub const PROTOCOL_VERSION: ProtocolVersion = 19; +pub const PROTOCOL_VERSION: ProtocolVersion = 22; pub const FIRST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION: ProtocolVersion = PROTOCOL_VERSION; diff --git a/core/primitives/src/views.rs b/core/primitives/src/views.rs index f603b735aac..f0c3f6666ca 100644 --- a/core/primitives/src/views.rs +++ b/core/primitives/src/views.rs @@ -391,7 +391,7 @@ impl From for BlockHeaderView { impl From for BlockHeader { fn from(view: BlockHeaderView) -> Self { - let mut header = BlockHeader::BlockHeaderV1(BlockHeaderV1 { + let mut header = BlockHeaderV1 { prev_hash: view.prev_hash, inner_lite: BlockHeaderInnerLite { height: view.height, @@ -426,9 +426,9 @@ impl From for BlockHeader { }, signature: view.signature, hash: CryptoHash::default(), - }); + }; header.init(); - header + BlockHeader::BlockHeaderV1(Box::new(header)) } } diff --git a/core/store/Cargo.toml b/core/store/Cargo.toml index 374035ad466..3452eedd681 100644 --- a/core/store/Cargo.toml +++ b/core/store/Cargo.toml @@ -15,7 +15,7 @@ cached = "0.12" num_cpus = "1.11" rand = "0.7.2" -borsh = "0.6.1" +borsh = "0.6.2" near-crypto = { path = "../crypto" } near-primitives = { path = "../primitives" } diff --git a/genesis-tools/genesis-populate/Cargo.toml b/genesis-tools/genesis-populate/Cargo.toml index e196733b7a4..69a2d521c2b 100644 --- a/genesis-tools/genesis-populate/Cargo.toml +++ b/genesis-tools/genesis-populate/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Near Inc "] edition = "2018" [dependencies] -borsh = "0.6.1" +borsh = "0.6.2" byteorder = "1.2" indicatif = "0.13.0" clap = "2.33.0" diff --git a/neard/Cargo.toml b/neard/Cargo.toml index 2e376a2b9c7..36bf83b387f 100644 --- a/neard/Cargo.toml +++ b/neard/Cargo.toml @@ -19,7 +19,7 @@ serde = { version = "1", features = [ "derive" ] } serde_json = "1" lazy_static = "1.4" dirs = "2.0.2" -borsh = "0.6.1" +borsh = "0.6.2" tracing = "0.1.13" tracing-subscriber = "0.2.4" num-rational = { version = "0.2.4", features = ["serde"] } diff --git a/neard/src/lib.rs b/neard/src/lib.rs index 2c1cb8408c1..408599d21c3 100644 --- a/neard/src/lib.rs +++ b/neard/src/lib.rs @@ -33,14 +33,11 @@ pub fn store_path_exists(path: &String) -> bool { pub fn get_store_path(base_path: &Path) -> String { let mut store_path = base_path.to_owned(); store_path.push(STORE_PATH); - match fs::canonicalize(store_path.clone()) { - Ok(path) => { - info!(target: "near", "Opening store database at {:?}", path); - } - _ => { - info!(target: "near", "Did not find {:?} path, will be creating new store database", store_path); - } - }; + if fs::canonicalize(store_path.clone()).is_ok() { + info!(target: "near", "Opening store database at {:?}", store_path); + } else { + info!(target: "near", "Did not find {:?} path, will be creating new store database", store_path); + } store_path.to_str().unwrap().to_owned() } diff --git a/pytest/empty-contract-rs/Cargo.toml b/pytest/empty-contract-rs/Cargo.toml index 93cad8fc598..cbd27caeeec 100644 --- a/pytest/empty-contract-rs/Cargo.toml +++ b/pytest/empty-contract-rs/Cargo.toml @@ -12,7 +12,7 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" wee_alloc = "0.4.5" -borsh = "0.6.1" +borsh = "0.6.2" near-sdk = { git = "https://github.com/near/near-sdk-rs", branch = "master"} diff --git a/runtime/near-vm-errors/Cargo.toml b/runtime/near-vm-errors/Cargo.toml index ec9952bbc93..2495b97ee43 100644 --- a/runtime/near-vm-errors/Cargo.toml +++ b/runtime/near-vm-errors/Cargo.toml @@ -15,7 +15,7 @@ Error that can occur inside Near Runtime encapsulated in a separate crate. Might [dependencies] serde = { version = "1", features = ["derive"] } -borsh = "0.6.1" +borsh = "0.6.2" near-rpc-error-macro = { path = "../../tools/rpctypegen/macro", version = "0.1.0" } diff --git a/runtime/runtime-params-estimator/Cargo.toml b/runtime/runtime-params-estimator/Cargo.toml index 9f12a66f4cb..c33ca8eb572 100644 --- a/runtime/runtime-params-estimator/Cargo.toml +++ b/runtime/runtime-params-estimator/Cargo.toml @@ -14,7 +14,7 @@ serde_json = "1" csv = "1.1.1" clap = "2.33" -borsh = "0.6.1" +borsh = "0.6.2" num-rational = "0.2.4" near-runtime-fees = { path = "../../runtime/near-runtime-fees" } diff --git a/runtime/runtime/Cargo.toml b/runtime/runtime/Cargo.toml index 527ddbb0d6a..b2de7098ae3 100644 --- a/runtime/runtime/Cargo.toml +++ b/runtime/runtime/Cargo.toml @@ -16,7 +16,7 @@ sha3 = "0.8" lazy_static = "1.4" num-rational = "0.2.4" -borsh = "0.6.1" +borsh = "0.6.2" cached = "0.12.0" near-crypto = { path = "../../core/crypto" } diff --git a/test-utils/loadtester/Cargo.toml b/test-utils/loadtester/Cargo.toml index 86c2c904270..bd344ce512d 100644 --- a/test-utils/loadtester/Cargo.toml +++ b/test-utils/loadtester/Cargo.toml @@ -16,7 +16,7 @@ reqwest = { version = "0.10", features = ["rustls-tls", "blocking", "json"] } git-version = "0.3.2" byteorder = "1.2" -borsh = "0.6.1" +borsh = "0.6.2" near-crypto = { path = "../../core/crypto" } near-primitives = { path = "../../core/primitives" } diff --git a/test-utils/testlib/Cargo.toml b/test-utils/testlib/Cargo.toml index 7e2a9ace42b..5925d8060af 100644 --- a/test-utils/testlib/Cargo.toml +++ b/test-utils/testlib/Cargo.toml @@ -20,7 +20,7 @@ tempfile = "3" assert_matches = "1.3" num-rational = "0.2.4" -borsh = "0.6.1" +borsh = "0.6.2" near-logger-utils = { path = "../../test-utils/logger" } near-chain-configs = { path = "../../core/chain-configs" } From a4019ada16b3bc9e85f8ff9c700ea782812a5825 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Wed, 3 Jun 2020 10:32:03 -0700 Subject: [PATCH 18/21] Move migration to the right place --- .../migrations/{19-protocol-upgrade.py => 22-protocol-upgrade.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/migrations/{19-protocol-upgrade.py => 22-protocol-upgrade.py} (100%) diff --git a/scripts/migrations/19-protocol-upgrade.py b/scripts/migrations/22-protocol-upgrade.py similarity index 100% rename from scripts/migrations/19-protocol-upgrade.py rename to scripts/migrations/22-protocol-upgrade.py From 16414144c4c788469006577a40aa979df5938903 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Wed, 3 Jun 2020 10:43:25 -0700 Subject: [PATCH 19/21] Fix up merge conflicts --- neard/res/genesis_config.json | 3 +-- scripts/migrations/22-protocol-upgrade.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/neard/res/genesis_config.json b/neard/res/genesis_config.json index d485ad4f779..b98ae21372b 100644 --- a/neard/res/genesis_config.json +++ b/neard/res/genesis_config.json @@ -1,5 +1,4 @@ { - "config_version": 1, "protocol_version": 22, "genesis_time": "1970-01-01T00:00:00.000000000Z", "chain_id": "sample", @@ -229,4 +228,4 @@ "protocol_treasury_account": "test.near", "fishermen_threshold": "10000000000000000000000000", "records": [] -} +} \ No newline at end of file diff --git a/scripts/migrations/22-protocol-upgrade.py b/scripts/migrations/22-protocol-upgrade.py index 6ef45f9c6e1..c2fb2df30ed 100644 --- a/scripts/migrations/22-protocol-upgrade.py +++ b/scripts/migrations/22-protocol-upgrade.py @@ -16,9 +16,9 @@ config = json.load(open(os.path.join(home, 'output.json')), object_pairs_hook=OrderedDict) -assert config['protocol_version'] == 18 +assert config['protocol_version'] == 21 -config['protocol_version'] = 19 +config['protocol_version'] = 22 config.pop('config_version') config['protocol_upgrade_stake_threshold'] = [4, 5] From 9ca849d681cd633ab198af7f220ab6ebdb694205 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Wed, 3 Jun 2020 23:16:15 -0700 Subject: [PATCH 20/21] Fix comments --- chain/epoch_manager/src/lib.rs | 6 +----- core/primitives/src/block.rs | 1 + neard/src/lib.rs | 9 +++------ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/chain/epoch_manager/src/lib.rs b/chain/epoch_manager/src/lib.rs index c7a90c0617f..5af36440b95 100644 --- a/chain/epoch_manager/src/lib.rs +++ b/chain/epoch_manager/src/lib.rs @@ -207,11 +207,7 @@ impl EpochManager { let mut versions = HashMap::new(); for (validator_id, version) in last_block_info.version_tracker.iter() { let stake = epoch_info.validators[*validator_id as usize].stake; - if let Some(value) = versions.get_mut(version) { - *value += stake - } else { - versions.insert(version, stake); - } + *versions.entry(version).or_insert(0) += stake; } let total_block_producer_stake: u128 = epoch_info .block_producers_settlement diff --git a/core/primitives/src/block.rs b/core/primitives/src/block.rs index 32e4918e2ae..8efb166a437 100644 --- a/core/primitives/src/block.rs +++ b/core/primitives/src/block.rs @@ -39,6 +39,7 @@ pub struct BlockV1 { } /// Versioned Block data structure. +/// For each next version, document what are the changes between versions. #[derive(BorshSerialize, BorshDeserialize, Serialize, Debug, Clone, Eq, PartialEq)] pub enum Block { BlockV1(Box), diff --git a/neard/src/lib.rs b/neard/src/lib.rs index 408599d21c3..1093c55a2f0 100644 --- a/neard/src/lib.rs +++ b/neard/src/lib.rs @@ -23,17 +23,14 @@ mod shard_tracker; const STORE_PATH: &str = "data"; -pub fn store_path_exists(path: &String) -> bool { - match fs::canonicalize(path) { - Ok(_) => true, - _ => false, - } +pub fn store_path_exists>(path: P) -> bool { + fs::canonicalize(path).is_ok() } pub fn get_store_path(base_path: &Path) -> String { let mut store_path = base_path.to_owned(); store_path.push(STORE_PATH); - if fs::canonicalize(store_path.clone()).is_ok() { + if store_path_exists(&store_path) { info!(target: "near", "Opening store database at {:?}", store_path); } else { info!(target: "near", "Did not find {:?} path, will be creating new store database", store_path); From 728a0043e8e3209f06229aadc8cf5f0b848614ea Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Fri, 5 Jun 2020 03:07:08 -0700 Subject: [PATCH 21/21] Reset Cargo.lock to master --- Cargo.lock | 3713 ++++++++++++++++++++++++++-------------------------- 1 file changed, 1858 insertions(+), 1855 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91a0ec241ce..8b9fc6efac6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,3634 +4,3341 @@ name = "actix" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4af87564ff659dee8f9981540cac9418c45e910c8072fdedd643a262a38fcaf" -dependencies = [ - "actix-http", - "actix-rt", - "actix_derive", - "bitflags", - "bytes", - "crossbeam-channel", - "derive_more", - "futures", - "lazy_static", - "log", - "parking_lot", - "pin-project", - "smallvec", - "tokio", - "tokio-util 0.2.0", - "trust-dns-proto", - "trust-dns-resolver", +dependencies = [ + "actix-http 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-resolver 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-codec" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e55f0a5c2ca15795035d90c46bd0e73a5123b72f68f12596d6ba5282051380" dependencies = [ - "bitflags", - "bytes", - "futures-core", - "futures-sink", - "log", - "tokio", - "tokio-util 0.2.0", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-connect" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95cc9569221e9802bf4c377f6c18b90ef10227d787611decf79fd47d2a8e76c" dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "derive_more", - "either", - "futures", - "http", - "log", - "openssl", - "tokio-openssl", - "trust-dns-proto", - "trust-dns-resolver", + "actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-openssl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-resolver 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-cors" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6206917d5c0fdd79d81cec9ef02d3e802df4abf276d96241e1f595d971e002" dependencies = [ - "actix-service", - "actix-web", - "derive_more", - "futures", + "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-http" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c16664cc4fdea8030837ad5a845eb231fb93fc3c5c171edfefb52fad92ce9019" -dependencies = [ - "actix-codec", - "actix-connect", - "actix-rt", - "actix-service", - "actix-threadpool", - "actix-tls", - "actix-utils", - "base64", - "bitflags", - "brotli2", - "bytes", - "chrono", - "copyless", - "derive_more", - "either", - "encoding_rs", - "failure", - "flate2", - "futures-channel", - "futures-core", - "futures-util", - "fxhash", - "h2", - "http", - "httparse", - "indexmap", - "language-tags", - "lazy_static", - "log", - "mime", - "percent-encoding", - "pin-project", - "rand 0.7.3", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "sha1", - "slab", - "time", +dependencies = [ + "actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-connect 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-threadpool 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-macros" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21705adc76bbe4bc98434890e73a89cd00c6015e5704a60bb6eea6c3b72316b6" dependencies = [ - "quote", - "syn", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-router" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d7a10ca4d94e8c8e7a87c5173aba1b97ba9a6563ca02b0e1cd23531093d3ec8" dependencies = [ - "bytestring", - "http", - "log", - "regex", - "serde", + "bytestring 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-rt" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" dependencies = [ - "actix-macros", - "actix-threadpool", - "copyless", - "futures-channel", - "futures-util", - "smallvec", - "tokio", + "actix-macros 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-threadpool 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-server" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "582a7173c281a4f46b5aa168a11e7f37183dcb71177a39312cc2264da7a632c9" dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "futures", - "log", - "mio", - "mio-uds", - "net2", - "num_cpus", - "slab", + "actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-service" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e4fc95dfa7e24171b2d0bb46b85f8ab0e8499e4e3caec691fc4ea65c287564" dependencies = [ - "futures-util", - "pin-project", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-testing" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48494745b72d0ea8ff0cf874aaf9b622a3ee03d7081ee0c04edea4f26d32c911" dependencies = [ - "actix-macros", - "actix-rt", - "actix-server", - "actix-service", - "futures", - "log", - "net2", + "actix-macros 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-server 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-threadpool" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4082192601de5f303013709ff84d81ca6a1bc4af7fb24f367a500a23c6e84e" dependencies = [ - "derive_more", - "futures-channel", - "lazy_static", - "log", - "num_cpus", - "parking_lot", - "threadpool", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "threadpool 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-tls" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e5b4faaf105e9a6d389c606c298dcdb033061b00d532af9df56ff3a54995a8" dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "actix-utils", - "derive_more", - "either", - "futures", - "log", - "openssl", - "tokio-openssl", + "actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-openssl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-utils" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf8f5631bf01adec2267808f00e228b761c60c0584cc9fa0b5364f41d147f4e" dependencies = [ - "actix-codec", - "actix-rt", - "actix-service", - "bitflags", - "bytes", - "either", - "futures", - "log", - "pin-project", - "slab", + "actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-web" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3158e822461040822f0dbf1735b9c2ce1f95f93b651d7a7aded00b1efbb1f635" -dependencies = [ - "actix-codec", - "actix-http", - "actix-macros", - "actix-router", - "actix-rt", - "actix-server", - "actix-service", - "actix-testing", - "actix-threadpool", - "actix-tls", - "actix-utils", - "actix-web-codegen", - "awc", - "bytes", - "derive_more", - "encoding_rs", - "futures", - "fxhash", - "log", - "mime", - "net2", - "openssl", - "pin-project", - "regex", - "serde", - "serde_json", - "serde_urlencoded", - "time", - "url", +dependencies = [ + "actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-http 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-macros 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-router 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-server 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-testing 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-threadpool 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web-codegen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-web-codegen" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f00371942083469785f7e28c540164af1913ee7c96a4534acb9cea92c39f057" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix_derive" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "adler32" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" [[package]] name = "aho-corasick" version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" dependencies = [ - "memchr", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "arc-swap" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" [[package]] name = "arrayref" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" [[package]] name = "arrayvec" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" [[package]] name = "assert_matches" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" [[package]] name = "async-trait" version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da71fef07bc806586090247e971229289f64c210a278ee5ae419314eb386b31d" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.8", + "hermit-abi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" [[package]] name = "autocfg" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "awc" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7601d4d1d7ef2335d6597a41b5fe069f6ab799b85f53565ab390e7b7065aac5" dependencies = [ - "actix-codec", - "actix-http", - "actix-rt", - "actix-service", - "base64", - "bytes", - "derive_more", - "futures-core", - "log", - "mime", - "openssl", - "percent-encoding", - "rand 0.7.3", - "serde", - "serde_json", - "serde_urlencoded", + "actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-http 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace" version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" dependencies = [ - "backtrace-sys", - "cfg-if", - "libc", - "rustc-demangle", + "backtrace-sys 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78848718ee1255a2485d1309ad9cdecfc2e7d0362dd11c6829364c6b35ae1bc7" dependencies = [ - "cc", - "libc", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "base64" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" [[package]] name = "bencher" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdb4953a096c551ce9ace855a604d702e6e62d77fac690575ae347571717f5" [[package]] name = "bincode" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf" dependencies = [ - "byteorder", - "serde", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bindgen" version = "0.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb26d6a69a335b8cb0e7c7e9775cd5666611dc50a37177c3f2cedcfc040e8c8" dependencies = [ - "bitflags", - "cexpr", - "cfg-if", - "clang-sys", - "clap", - "env_logger", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "which", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cexpr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "clang-sys 0.29.3 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "which 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake2" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" dependencies = [ - "byte-tools", - "crypto-mac", - "digest", - "opaque-debug", + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "blake2b_simd" version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", + "arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "blake3" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "423897d97e11b810c9da22458400b28ec866991c711409073662eb34dc44bfff" dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", - "crypto-mac", - "digest", + "arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "block-buffer" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array", + "block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "block-padding" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" dependencies = [ - "byte-tools", + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "borsh" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7769f8f6fdc6ac7617bbc8bc7ef9dc263cd459d99d21cf2ab4afc3bc8d7d70d" dependencies = [ - "borsh-derive", + "borsh-derive 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "borsh-derive" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2689a82a5fe57f9e71997b16bea340da338c7fb8db400b8d9d55b59010540d8" dependencies = [ - "borsh-derive-internal", - "borsh-schema-derive-internal", - "syn", + "borsh-derive-internal 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh-schema-derive-internal 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "borsh-derive-internal" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b621f19e9891a34f679034fa2238260e27c0eddfe2804e9fb282061cf9b294" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "borsh-schema-derive-internal" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "befebdb9e223ae4528b3d597dbbfb5c68566822d2a3de3e260f235360773ba29" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "brotli-sys" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" dependencies = [ - "cc", - "libc", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "brotli2" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" dependencies = [ - "brotli-sys", - "libc", + "brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bs58" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" [[package]] name = "bstr" version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2889e6d50f394968c8bf4240dc3f2a7eb4680844d27308f798229ac9d4725f41" dependencies = [ - "lazy_static", - "memchr", - "regex-automata", - "serde", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bumpalo" version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" [[package]] name = "byte-tools" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "bytes" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" [[package]] name = "bytestring" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7c05fa5172da78a62d9949d662d2ac89d4cc7355d7b49adee5163f1fb3f363" dependencies = [ - "bytes", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "c2-chacha" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" dependencies = [ - "byteorder", - "ppv-lite86", - "stream-cipher", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "stream-cipher 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cached" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "083dc50149e37dfaab1ffe2c3af03576b79550f1e419a5091b28a7191db1c45b" dependencies = [ - "once_cell", + "once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d" dependencies = [ - "jobserver", + "jobserver 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cexpr" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" dependencies = [ - "nom", + "nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cfg-if" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chrono" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" dependencies = [ - "num-integer", - "num-traits", - "serde", - "time", + "num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clang-sys" version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" dependencies = [ - "glob 0.3.0", - "libc", - "libloading", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clap" version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clear_on_drop" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" dependencies = [ - "cc", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "clicolors-control" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" dependencies = [ - "atty", - "lazy_static", - "libc", - "winapi 0.3.8", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cmake" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" dependencies = [ - "cc", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "console" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6728a28023f207181b193262711102bfbaf47cc9d13bc71d0736607ef8efe88c" dependencies = [ - "clicolors-control", - "encode_unicode", - "lazy_static", - "libc", - "regex", - "termios", - "unicode-width", - "winapi 0.3.8", + "clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "constant_time_eq" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "copyless" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127" [[package]] name = "core-foundation" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" dependencies = [ - "core-foundation-sys", - "libc", + "core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "core-foundation-sys" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" [[package]] name = "crc32fast" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" dependencies = [ - "cfg-if", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-channel" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061" dependencies = [ - "crossbeam-utils", - "maybe-uninit", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-deque" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", - "maybe-uninit", + "crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" dependencies = [ - "autocfg 1.0.0", - "cfg-if", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-queue" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db" dependencies = [ - "cfg-if", - "crossbeam-utils", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" dependencies = [ - "autocfg 1.0.0", - "cfg-if", - "lazy_static", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crunchy" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-mac" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" dependencies = [ - "generic-array", - "subtle 1.0.0", + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" dependencies = [ - "bstr", - "csv-core", - "itoa", - "ryu", - "serde", + "bstr 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "csv-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" dependencies = [ - "memchr", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ct-logs" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d3686f5fa27dbc1d76c751300376e167c5a43387f44bb451fd1c24776e49113" dependencies = [ - "sct", + "sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "curve25519-dalek" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26778518a7f6cffa1d25a44b602b62b979bd88adb9e99ffec546998cf3404839" dependencies = [ - "byteorder", - "digest", - "rand_core 0.5.1", - "subtle 2.2.2", - "zeroize", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "derive_more" version = "0.99.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "digest" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array", + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dirs" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" dependencies = [ - "cfg-if", - "dirs-sys", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dirs-sys" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" dependencies = [ - "cfg-if", - "libc", - "redox_users", - "winapi 0.3.8", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "doc-comment" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dtoa" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3" [[package]] name = "dynasm" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a814e1edeb85dd2a3c6fc0d6bf76d02ca5695d438c70ecee3d90774f3259c5" dependencies = [ - "bitflags", - "byteorder", - "lazy_static", - "owning_ref", - "proc-macro2", - "quote", - "syn", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "owning_ref 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dynasmrt" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a393aaeb4441a48bcf47b5b6155971f82cc1eb77e22855403ccc0415ac8328d" dependencies = [ - "byteorder", - "memmap", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "easy-ext" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2a9b11b96248fc9efa0c093e6406fea7e55a7e893c932dbdf47074f34ec52e7" dependencies = [ - "quote", - "syn", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ed25519-dalek" version = "1.0.0-pre.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978710b352437433c97b2bff193f2fb1dfd58a093f863dd95e225a19baa599a2" dependencies = [ - "clear_on_drop", - "curve25519-dalek", - "rand 0.7.3", - "sha2", + "clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "either" version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" [[package]] name = "elastic-array" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d63720ea2bc2e1b79f7aa044d9dc0b825f9ccb6930b32120f8fb9e873aa84bc" dependencies = [ - "heapsize", + "heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "encode_unicode" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28" dependencies = [ - "cfg-if", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "enum-as-inner" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc4bfcfacb61d231109d1d55202c1f33263319668b168843e02ad4652725ec9c" dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "env_logger" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", + "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "errno" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b480f641ccf0faf324e20c1d3e53d81b7484c698b42ea677f6907ae4db195371" dependencies = [ - "errno-dragonfly", - "libc", - "winapi 0.3.8", + "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "errno-dragonfly" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" dependencies = [ - "gcc", - "libc", + "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b" dependencies = [ - "backtrace", - "failure_derive", + "backtrace 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "failure_derive" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fake-simd" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fixed-hash" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32529fc42e86ec06e5047092082aab9ad459b070c5d2a76b14f4f5ce70bf2e84" dependencies = [ - "static_assertions", + "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "flate2" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" dependencies = [ - "cfg-if", - "crc32fast", - "libc", - "miniz_oxide", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fnv" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared", + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "foreign-types-shared" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "fs_extra" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" [[package]] name = "fuchsia-zircon" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" dependencies = [ - "bitflags", - "fuchsia-zircon-sys", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fuchsia-zircon-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-channel" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" dependencies = [ - "futures-core", - "futures-sink", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-core" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" [[package]] name = "futures-executor" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" dependencies = [ - "futures-core", - "futures-task", - "futures-util", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-io" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" [[package]] name = "futures-macro" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", + "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "futures-sink" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" [[package]] name = "futures-task" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" [[package]] name = "futures-util" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-utils", - "proc-macro-hack", - "proc-macro-nested", - "slab", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-nested 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "fxhash" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" dependencies = [ - "byteorder", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gcc" version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" [[package]] name = "generic-array" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" dependencies = [ - "typenum", + "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "genesis-csv-to-json" version = "0.1.0" dependencies = [ - "chrono", - "clap", - "csv", - "near-chain-configs", - "near-crypto", - "near-network", - "near-primitives", - "neard", - "node-runtime", - "serde", - "serde_json", - "tempfile", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain-configs 0.1.0", + "near-crypto 0.1.0", + "near-network 0.1.0", + "near-primitives 0.1.0", + "neard 1.0.0", + "node-runtime 0.9.0", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "genesis-populate" version = "0.1.0" dependencies = [ - "borsh", - "byteorder", - "clap", - "indicatif 0.13.0", - "near-chain", - "near-chain-configs", - "near-client", - "near-crypto", - "near-epoch-manager", - "near-jsonrpc", - "near-network", - "near-pool", - "near-primitives", - "near-store", - "near-telemetry", - "neard", - "tempfile", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "indicatif 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain 0.1.0", + "near-chain-configs 0.1.0", + "near-client 0.1.0", + "near-crypto 0.1.0", + "near-epoch-manager 0.0.1", + "near-jsonrpc 0.1.0", + "near-network 0.1.0", + "near-pool 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "near-telemetry 0.1.0", + "neard 1.0.0", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "getrandom" version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" dependencies = [ - "cfg-if", - "libc", - "wasi", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "git-version" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94918e83f1e01dedc2e361d00ce9487b14c58c7f40bab148026fa39d42cb41e2" dependencies = [ - "git-version-macro", - "proc-macro-hack", + "git-version-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "git-version-macro" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34a97a52fdee1870a34fa6e4b77570cba531b27d1838874fef4429a791a3d657" dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "syn", + "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glob" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" [[package]] name = "glob" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "gnuplot" version = "0.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32fc2314e75d4e1a2aa0c2ec5b95f7facb106eb575b621bbb9493e49beea2da7" dependencies = [ - "byteorder", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "h2" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42" dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "log", - "slab", - "tokio", - "tokio-util 0.3.1", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heapsize" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "heck" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" dependencies = [ - "unicode-segmentation", + "unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hermit-abi" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d737e0f947a1864e93d33fdef4af8445a00d1ed8dc0c8ddb73139ea6abf15" dependencies = [ - "libc", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" [[package]] name = "hex-literal" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "961de220ec9a91af2e1e5bd80d02109155695e516771762381ef8581317066e0" dependencies = [ - "hex-literal-impl", - "proc-macro-hack", + "hex-literal-impl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hex-literal-impl" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4c5c844e2fee0bf673d54c2c177f1713b3d2af2ff6e666b49cb7572e6cf42d" dependencies = [ - "proc-macro-hack", + "proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hostname" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ - "libc", - "match_cfg", - "winapi 0.3.8", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "http" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" dependencies = [ - "bytes", - "fnv", - "itoa", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "http-body" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" dependencies = [ - "bytes", - "http", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "httparse" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] name = "humantime" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" dependencies = [ - "quick-error", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hyper" version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "log", - "net2", - "pin-project", - "time", - "tokio", - "tower-service", - "want", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hyper-rustls" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac965ea399ec3a25ac7d13b8affd4b8f39325cca00858ddf5eb29b79e6b14b08" dependencies = [ - "bytes", - "ct-logs", - "futures-util", - "hyper", - "log", - "rustls", - "rustls-native-certs", - "tokio", - "tokio-rustls", - "webpki", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ct-logs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rustls 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustls-native-certs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-rustls 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "hyper-tls" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3adcd308402b9553630734e9c36b77a7e48b3821251ca2493e8cd596763aafaa" dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-tls", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "idna" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "if_chain" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3360c7b59e5ffa2653671fb74b4741a5d343c03f331c0a4aeda42b5c2b0ec7d" [[package]] name = "indexmap" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" dependencies = [ - "autocfg 1.0.0", - "serde", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "indicatif" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8572bccfb0665e70b7faf44ee28841b8e0823450cd4ad562a76b5a3c4bf48487" dependencies = [ - "console", - "lazy_static", - "number_prefix", - "rayon", - "regex", + "console 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "indicatif" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a68371cf417889c9d7f98235b7102ea7c54fc59bcbd22f3dea785be9d27e40" dependencies = [ - "console", - "lazy_static", - "number_prefix", - "regex", + "console 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "number_prefix 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "iovec" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" dependencies = [ - "libc", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ipconfig" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa79fa216fbe60834a9c0737d7fcd30425b32d1c58854663e24d4c4b328ed83f" dependencies = [ - "socket2", - "widestring", - "winapi 0.3.8", - "winreg", + "socket2 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", + "widestring 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" [[package]] name = "jemalloc-sys" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" dependencies = [ - "cc", - "fs_extra", - "libc", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jemallocator" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" dependencies = [ - "jemalloc-sys", - "libc", + "jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "jobserver" version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" dependencies = [ - "libc", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "js-sys" version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" dependencies = [ - "wasm-bindgen", + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "keccak" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" [[package]] name = "kernel32-sys" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "keypair-generator" version = "0.1.0" dependencies = [ - "clap", - "near-crypto", - "neard", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto 0.1.0", + "neard 1.0.0", ] [[package]] name = "language-tags" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lazycell" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" [[package]] name = "libc" version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" [[package]] name = "libloading" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" dependencies = [ - "cc", - "winapi 0.3.8", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "librocksdb-sys" version = "6.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "883213ae3d09bfc3d104aefe94b25ebb183b6f4d3a515b23b14817e1f4854005" dependencies = [ - "bindgen", - "cc", - "glob 0.3.0", - "libc", + "bindgen 0.53.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "linked-hash-map" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" [[package]] name = "loadtester" version = "0.1.0" dependencies = [ - "borsh", - "byteorder", - "clap", - "env_logger", - "futures", - "git-version", - "log", - "near-crypto", - "near-jsonrpc", - "near-primitives", - "near-store", - "neard", - "node-runtime", - "rand 0.7.3", - "reqwest", - "serde_json", - "testlib", - "tokio", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "git-version 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto 0.1.0", + "near-jsonrpc 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "neard 1.0.0", + "node-runtime 0.9.0", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "reqwest 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "testlib 0.1.0", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lock_api" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" dependencies = [ - "scopeguard", + "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "log" version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" dependencies = [ - "cfg-if", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lru-cache" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" dependencies = [ - "linked-hash-map", + "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "match_cfg" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "matchers" version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata", + "regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "matches" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "maybe-uninit" version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "memmap" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" dependencies = [ - "libc", - "winapi 0.3.8", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memoffset" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mime" version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] name = "mime_guess" version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" dependencies = [ - "mime", - "unicase", + "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miniz_oxide" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5" dependencies = [ - "adler32", + "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mio" version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" dependencies = [ - "cfg-if", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow 0.2.1", - "net2", - "slab", - "winapi 0.2.8", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mio-named-pipes" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" dependencies = [ - "log", - "mio", - "miow 0.3.3", - "winapi 0.3.8", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mio-uds" version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" dependencies = [ - "iovec", - "libc", - "mio", + "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miow" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miow" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" dependencies = [ - "socket2", - "winapi 0.3.8", + "socket2 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "native-tls" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.55 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-actix-utils" version = "0.1.0" dependencies = [ - "actix", + "actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-chain" version = "0.1.0" dependencies = [ - "borsh", - "cached", - "chrono", - "failure", - "failure_derive", - "lazy_static", - "log", - "near-chain-configs", - "near-crypto", - "near-logger-utils", - "near-metrics", - "near-pool", - "near-primitives", - "near-store", - "num-rational", - "rand 0.7.3", - "rocksdb", - "serde", - "tracing", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cached 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain-configs 0.1.0", + "near-crypto 0.1.0", + "near-logger-utils 0.1.0", + "near-metrics 0.1.0", + "near-pool 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rocksdb 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-chain-configs" version = "0.1.0" dependencies = [ - "chrono", - "derive_more", - "near-crypto", - "near-primitives", - "near-runtime-configs", - "num-rational", - "serde", - "serde_json", - "smart-default", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto 0.1.0", + "near-primitives 0.1.0", + "near-runtime-configs 0.1.0", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "smart-default 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-chunks" version = "0.1.0" dependencies = [ - "actix", - "borsh", - "cached", - "chrono", - "futures", - "log", - "near-chain", - "near-crypto", - "near-logger-utils", - "near-network", - "near-pool", - "near-primitives", - "near-store", - "rand 0.7.3", - "reed-solomon-erasure", - "serde", + "actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cached 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain 0.1.0", + "near-crypto 0.1.0", + "near-logger-utils 0.1.0", + "near-network 0.1.0", + "near-pool 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "reed-solomon-erasure 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-client" version = "0.1.0" dependencies = [ - "actix", - "ansi_term", - "borsh", - "cached", - "chrono", - "futures", - "lazy_static", - "log", - "near-chain", - "near-chain-configs", - "near-chunks", - "near-crypto", - "near-logger-utils", - "near-metrics", - "near-network", - "near-pool", - "near-primitives", - "near-store", - "near-telemetry", - "neard", - "num-rational", - "rand 0.7.3", - "reed-solomon-erasure", - "rocksdb", - "serde", - "serde_json", - "strum", - "sysinfo", - "testlib", + "actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cached 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain 0.1.0", + "near-chain-configs 0.1.0", + "near-chunks 0.1.0", + "near-crypto 0.1.0", + "near-logger-utils 0.1.0", + "near-metrics 0.1.0", + "near-network 0.1.0", + "near-pool 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "near-telemetry 0.1.0", + "neard 1.0.0", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "reed-solomon-erasure 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rocksdb 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "strum 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sysinfo 0.14.3 (git+https://github.com/near/sysinfo?rev=3cb97ee79a02754407d2f0f63628f247d7c65e7b)", + "testlib 0.1.0", ] [[package]] name = "near-crypto" version = "0.1.0" dependencies = [ - "arrayref", - "blake2", - "borsh", - "bs58", - "c2-chacha", - "curve25519-dalek", - "digest", - "ed25519-dalek", - "hex-literal", - "lazy_static", - "libc", - "parity-secp256k1", - "rand 0.7.3", - "rand_core 0.5.1", - "serde", - "serde_json", - "sha2", - "subtle 2.2.2", + "arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bs58 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "curve25519-dalek 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ed25519-dalek 1.0.0-pre.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-secp256k1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-epoch-manager" version = "0.0.1" dependencies = [ - "borsh", - "cached", - "log", - "near-chain", - "near-crypto", - "near-primitives", - "near-store", - "num-rational", - "primitive-types", - "rand 0.6.5", - "rand 0.7.3", - "serde", - "serde_json", - "smart-default", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cached 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain 0.1.0", + "near-crypto 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "primitive-types 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "smart-default 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-jsonrpc" version = "0.1.0" dependencies = [ - "actix", - "actix-cors", - "actix-web", - "borsh", - "futures", - "lazy_static", - "near-chain-configs", - "near-client", - "near-crypto", - "near-jsonrpc-client", - "near-logger-utils", - "near-metrics", - "near-network", - "near-primitives", - "near-rpc-error-macro", - "prometheus", - "serde", - "serde_json", - "tokio", - "validator", + "actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-cors 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain-configs 0.1.0", + "near-client 0.1.0", + "near-crypto 0.1.0", + "near-jsonrpc-client 0.1.0", + "near-logger-utils 0.1.0", + "near-metrics 0.1.0", + "near-network 0.1.0", + "near-primitives 0.1.0", + "near-rpc-error-macro 0.1.0", + "prometheus 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "validator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-jsonrpc-client" version = "0.1.0" dependencies = [ - "actix-web", - "futures", - "near-primitives", - "serde", - "serde_json", - "uuid", + "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "near-primitives 0.1.0", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-logger-utils" version = "0.1.0" dependencies = [ - "near-actix-utils", - "tracing-subscriber", + "near-actix-utils 0.1.0", + "tracing-subscriber 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-metrics" version = "0.1.0" dependencies = [ - "lazy_static", - "log", - "prometheus", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "prometheus 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-network" version = "0.1.0" dependencies = [ - "actix", - "bencher", - "borsh", - "byteorder", - "bytes", - "cached", - "chrono", - "futures", - "lazy_static", - "log", - "near-chain", - "near-chain-configs", - "near-client", - "near-crypto", - "near-logger-utils", - "near-metrics", - "near-primitives", - "near-store", - "near-telemetry", - "num-rational", - "rand 0.7.3", - "serde", - "serde_json", - "tempfile", - "tokio", - "tokio-util 0.2.0", - "tracing", + "actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cached 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain 0.1.0", + "near-chain-configs 0.1.0", + "near-client 0.1.0", + "near-crypto 0.1.0", + "near-logger-utils 0.1.0", + "near-metrics 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "near-telemetry 0.1.0", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-pool" version = "0.1.0" dependencies = [ - "borsh", - "near-crypto", - "near-primitives", - "rand 0.7.3", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto 0.1.0", + "near-primitives 0.1.0", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-primitives" version = "0.1.0" dependencies = [ - "base64", - "bencher", - "borsh", - "bs58", - "byteorder", - "chrono", - "derive_more", - "easy-ext", - "hex", - "jemallocator", - "lazy_static", - "near-crypto", - "near-rpc-error-macro", - "near-vm-errors", - "num-rational", - "rand 0.7.3", - "reed-solomon-erasure", - "regex", - "serde", - "serde_json", - "sha2", - "smart-default", - "validator", - "validator_derive", + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bs58 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "easy-ext 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto 0.1.0", + "near-rpc-error-macro 0.1.0", + "near-vm-errors 0.9.1", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "reed-solomon-erasure 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smart-default 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "validator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "validator_derive 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-rpc-error-core" version = "0.1.0" dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-rpc-error-macro" version = "0.1.0" dependencies = [ - "near-rpc-error-core", - "proc-macro2", - "quote", - "serde", - "serde_json", - "syn", + "near-rpc-error-core 0.1.0", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-runtime-configs" version = "0.1.0" dependencies = [ - "near-primitives", - "near-runtime-fees", - "near-vm-logic", - "serde", + "near-primitives 0.1.0", + "near-runtime-fees 0.9.1", + "near-vm-logic 0.9.1", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-runtime-fees" version = "0.9.1" dependencies = [ - "num-rational", - "serde", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-runtime-standalone" version = "0.9.1" dependencies = [ - "near-crypto", - "near-pool", - "near-primitives", - "near-runtime-configs", - "near-store", - "node-runtime", + "near-crypto 0.1.0", + "near-pool 0.1.0", + "near-primitives 0.1.0", + "near-runtime-configs 0.1.0", + "near-store 0.1.0", + "node-runtime 0.9.0", ] [[package]] name = "near-store" version = "0.1.0" dependencies = [ - "bencher", - "borsh", - "byteorder", - "cached", - "derive_more", - "elastic-array", - "near-crypto", - "near-primitives", - "num_cpus", - "rand 0.7.3", - "rocksdb", - "serde", - "serde_json", - "tempfile", + "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cached 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)", + "elastic-array 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto 0.1.0", + "near-primitives 0.1.0", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rocksdb 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-telemetry" version = "0.1.0" dependencies = [ - "actix", - "actix-web", - "futures", - "openssl", - "openssl-probe", - "serde", - "serde_json", - "tracing", + "actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-vm-errors" version = "0.9.1" dependencies = [ - "borsh", - "near-rpc-error-macro", - "serde", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "near-rpc-error-macro 0.1.0", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-vm-logic" version = "0.9.1" dependencies = [ - "base64", - "bs58", - "byteorder", - "near-runtime-fees", - "near-vm-errors", - "serde", - "serde_json", - "sha2", - "sha3", + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bs58 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "near-runtime-fees 0.9.1", + "near-vm-errors 0.9.1", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-vm-runner" version = "0.9.1" dependencies = [ - "assert_matches", - "bencher", - "cached", - "near-runtime-fees", - "near-vm-errors", - "near-vm-logic", - "parity-wasm", - "pwasm-utils", - "wabt", - "wasmer-runtime", - "wasmer-runtime-core", + "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cached 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-runtime-fees 0.9.1", + "near-vm-errors 0.9.1", + "near-vm-logic 0.9.1", + "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pwasm-utils 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmer-runtime 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmer-runtime-core 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "near-vm-runner-standalone" version = "0.9.1" dependencies = [ - "base64", - "clap", - "near-runtime-fees", - "near-vm-logic", - "near-vm-runner", - "serde", - "serde_json", + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-runtime-fees 0.9.1", + "near-vm-logic 0.9.1", + "near-vm-runner 0.9.1", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nearcore" version = "0.1.0" dependencies = [ - "actix", - "actix-rt", - "futures", - "lazy_static", - "log", - "near-chain-configs", - "near-crypto", - "near-jsonrpc", - "near-logger-utils", - "near-network", - "near-primitives", - "near-store", - "neard", - "node-runtime", - "rand 0.7.3", - "serde_json", - "testlib", + "actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain-configs 0.1.0", + "near-crypto 0.1.0", + "near-jsonrpc 0.1.0", + "near-logger-utils 0.1.0", + "near-network 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "neard 1.0.0", + "node-runtime 0.9.0", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "testlib 0.1.0", ] [[package]] name = "neard" version = "1.0.0" dependencies = [ - "actix", - "borsh", - "byteorder", - "chrono", - "clap", - "dirs", - "easy-ext", - "futures", - "git-version", - "lazy_static", - "log", - "near-actix-utils", - "near-chain", - "near-chain-configs", - "near-chunks", - "near-client", - "near-crypto", - "near-epoch-manager", - "near-jsonrpc", - "near-logger-utils", - "near-network", - "near-pool", - "near-primitives", - "near-runtime-configs", - "near-store", - "near-telemetry", - "node-runtime", - "num-rational", - "rand 0.7.3", - "rocksdb", - "serde", - "serde_json", - "tempfile", - "testlib", - "tracing", - "tracing-subscriber", + "actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "easy-ext 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "git-version 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-actix-utils 0.1.0", + "near-chain 0.1.0", + "near-chain-configs 0.1.0", + "near-chunks 0.1.0", + "near-client 0.1.0", + "near-crypto 0.1.0", + "near-epoch-manager 0.0.1", + "near-jsonrpc 0.1.0", + "near-logger-utils 0.1.0", + "near-network 0.1.0", + "near-pool 0.1.0", + "near-primitives 0.1.0", + "near-runtime-configs 0.1.0", + "near-store 0.1.0", + "near-telemetry 0.1.0", + "node-runtime 0.9.0", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rocksdb 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "testlib 0.1.0", + "tracing 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-subscriber 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "net2" version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" dependencies = [ - "cfg-if", - "libc", - "winapi 0.3.8", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "nix" version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" dependencies = [ - "bitflags", - "cc", - "cfg-if", - "libc", - "void", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "node-runtime" version = "0.9.0" dependencies = [ - "assert_matches", - "base64", - "borsh", - "byteorder", - "cached", - "indicatif 0.13.0", - "lazy_static", - "log", - "near-crypto", - "near-metrics", - "near-primitives", - "near-runtime-configs", - "near-runtime-fees", - "near-store", - "near-vm-errors", - "near-vm-logic", - "near-vm-runner", - "num-rational", - "rand 0.7.3", - "rayon", - "rocksdb", - "serde", - "serde_json", - "sha2", - "sha3", - "tempfile", - "testlib", + "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cached 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "indicatif 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto 0.1.0", + "near-metrics 0.1.0", + "near-primitives 0.1.0", + "near-runtime-configs 0.1.0", + "near-runtime-fees 0.9.1", + "near-store 0.1.0", + "near-vm-errors 0.9.1", + "near-vm-logic 0.9.1", + "near-vm-runner 0.9.1", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rocksdb 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "testlib 0.1.0", ] [[package]] name = "nom" version = "5.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6" dependencies = [ - "memchr", - "version_check", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ntapi" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26e041cd983acbc087e30fcba770380cfa352d0e392e175b2344ebaf7ea0602" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-bigint" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" dependencies = [ - "autocfg 1.0.0", - "num-integer", - "num-traits", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-integer" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" dependencies = [ - "autocfg 1.0.0", - "num-traits", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-rational" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ - "autocfg 1.0.0", - "num-bigint", - "num-integer", - "num-traits", - "serde", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num_cpus" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "hermit-abi", - "libc", + "hermit-abi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "number_prefix" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" [[package]] name = "once_cell" version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b" [[package]] name = "opaque-debug" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "openssl" version = "0.10.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee6d85f4cb4c4f59a6a85d5b68a233d280c82e29e822913b9c8b129fbf20bdd" dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "lazy_static", - "libc", - "openssl-sys", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-probe" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" [[package]] name = "openssl-src" version = "111.9.0+1.1.1g" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2dbe10ddd1eb335aba3780eb2eaa13e1b7b441d2562fd962398740927f39ec4" dependencies = [ - "cc", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "openssl-sys" version = "0.9.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7717097d810a0f2e2323f9e5d11e71608355e24828410b55b9d4f18aa5f9a5d8" dependencies = [ - "autocfg 1.0.0", - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", + "autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-src 111.9.0+1.1.1g (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)", + "vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "owning_ref" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" dependencies = [ - "stable_deref_trait", + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "page_size" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd" dependencies = [ - "libc", - "winapi 0.3.8", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-secp256k1" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fca4f82fccae37e8bbdaeb949a4a218a1bbc485d11598f193d2a908042e5fc1" dependencies = [ - "arrayvec", - "cc", - "cfg-if", - "rand 0.7.3", + "arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parity-wasm" version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" [[package]] name = "parking_lot" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" dependencies = [ - "lock_api", - "parking_lot_core", + "lock_api 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parking_lot_core" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" dependencies = [ - "cfg-if", - "cloudabi", - "libc", - "redox_syscall", - "smallvec", - "winapi 0.3.8", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "peeking_take_while" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2" dependencies = [ - "pin-project-internal", + "pin-project-internal 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pin-project-internal" version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pin-project-lite" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae" [[package]] name = "pin-utils" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" [[package]] name = "ppv-lite86" version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" [[package]] name = "primitive-types" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5e4b9943a2da369aec5e96f7c10ebc74fcf434d39590d974b0a3460e6f67fbb" dependencies = [ - "fixed-hash", - "uint", + "fixed-hash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "proc-macro-hack" version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" [[package]] name = "proc-macro-nested" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" [[package]] name = "proc-macro2" version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" dependencies = [ - "unicode-xid", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "prometheus" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0575e258dab62268e7236d7307caa38848acbda7ec7ab87bd9093791e999d20" dependencies = [ - "cfg-if", - "fnv", - "lazy_static", - "protobuf", - "spin", - "thiserror", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thiserror 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "protobuf" version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e86d370532557ae7573551a1ec8235a0f8d6cb276c7c9e6aa490b511c447485" [[package]] name = "pwasm-utils" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" dependencies = [ - "byteorder", - "log", - "parity-wasm", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" dependencies = [ - "autocfg 0.1.7", - "libc", - "rand_chacha 0.1.1", - "rand_core 0.4.2", - "rand_hc 0.1.0", - "rand_isaac", - "rand_jitter", - "rand_pcg", - "rand_xorshift 0.1.1", - "winapi 0.3.8", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc 0.2.0", + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" dependencies = [ - "autocfg 0.1.7", - "rand_core 0.3.1", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_chacha" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" dependencies = [ - "rand_core 0.4.2", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" dependencies = [ - "rand_core 0.3.1", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_hc" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_isaac" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" dependencies = [ - "rand_core 0.3.1", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_jitter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi 0.3.8", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" dependencies = [ - "autocfg 0.1.7", - "rand_core 0.4.2", + "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_xorshift" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" dependencies = [ - "rand_core 0.3.1", + "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_xorshift" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8" dependencies = [ - "rand_core 0.5.1", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098" dependencies = [ - "crossbeam-deque", - "either", - "rayon-core", + "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rayon-core" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9" dependencies = [ - "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils", - "lazy_static", - "num_cpus", + "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "redox_syscall" version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" [[package]] name = "redox_users" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" dependencies = [ - "getrandom", - "redox_syscall", - "rust-argon2", + "getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-argon2 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "reed-solomon-erasure" version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" dependencies = [ - "smallvec", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" version = "1.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692" dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", - "thread_local", + "aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-automata" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" dependencies = [ - "byteorder", - "regex-syntax", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" version = "0.6.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" [[package]] name = "remove_dir_all" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "reqwest" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b81e49ddec5109a9dcfc5f2a317ff53377c915e9ae9d4f2fb50914b85614e2" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "http", - "http-body", - "hyper", - "hyper-rustls", - "hyper-tls", - "js-sys", - "lazy_static", - "log", - "mime", - "mime_guess", - "native-tls", - "percent-encoding", - "pin-project-lite", - "rustls", - "serde", - "serde_json", - "serde_urlencoded", - "time", - "tokio", - "tokio-rustls", - "tokio-tls", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", +dependencies = [ + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper-rustls 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper-tls 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mime_guess 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustls 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-rustls 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki-roots 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "resolv-conf" version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11834e137f3b14e309437a8276714eed3a80d1ef894869e510f2c0c0b98b9f4a" dependencies = [ - "hostname", - "quick-error", + "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "restaked" version = "0.1.0" dependencies = [ - "clap", - "env_logger", - "log", - "near-crypto", - "near-jsonrpc-client", - "near-primitives", - "neard", - "testlib", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto 0.1.0", + "near-jsonrpc-client 0.1.0", + "near-primitives 0.1.0", + "neard 1.0.0", + "testlib 0.1.0", ] [[package]] name = "ring" version = "0.16.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" dependencies = [ - "cc", - "lazy_static", - "libc", - "spin", - "untrusted", - "web-sys", - "winapi 0.3.8", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rocksdb" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61aa17a99a2413cd71c1106691bf59dad7de0cd5099127f90e9d99c429c40d4a" dependencies = [ - "libc", - "librocksdb-sys", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "librocksdb-sys 6.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "runtime-params-estimator" version = "0.9.0" dependencies = [ - "borsh", - "clap", - "csv", - "gnuplot", - "indicatif 0.14.0", - "near-crypto", - "near-primitives", - "near-runtime-fees", - "near-store", - "near-vm-logic", - "near-vm-runner", - "neard", - "node-runtime", - "num-rational", - "rand 0.7.3", - "rand_xorshift 0.2.0", - "serde_json", - "tempfile", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gnuplot 0.0.32 (registry+https://github.com/rust-lang/crates.io-index)", + "indicatif 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-crypto 0.1.0", + "near-primitives 0.1.0", + "near-runtime-fees 0.9.1", + "near-store 0.1.0", + "near-vm-logic 0.9.1", + "near-vm-runner 0.9.1", + "neard 1.0.0", + "node-runtime 0.9.0", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rust-argon2" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" dependencies = [ - "base64", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-demangle" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" [[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hex" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] name = "rustc_version" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustls" version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1" dependencies = [ - "base64", - "log", - "ring", - "sct", - "webpki", + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)", + "sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustls-native-certs" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75ffeb84a6bd9d014713119542ce415db3a3e4748f0bfce1e1416cd224a23a5" dependencies = [ - "openssl-probe", - "rustls", - "schannel", - "security-framework", + "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustls 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "schannel 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ryu" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" [[package]] name = "schannel" version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" dependencies = [ - "lazy_static", - "winapi 0.3.8", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "sct" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" dependencies = [ - "ring", - "untrusted", + "ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "security-framework" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f331b9025654145cd425b9ded0caf8f5ae0df80d418b326e2dc1c3dc5eb0620" dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "security-framework-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "security-framework-sys" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" dependencies = [ - "core-foundation-sys", - "libc", + "core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" dependencies = [ - "semver-parser", + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" dependencies = [ - "serde_derive", + "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde-bench" version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d733da87e79faaac25616e33d26299a41143fd4cd42746cbb0e91d8feea243fd" dependencies = [ - "byteorder", - "serde", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_bytes" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325a073952621257820e7a3469f55ba4726d8b28657e7e36653d1c36dc2c84ae" dependencies = [ - "serde", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" dependencies = [ - "indexmap", - "itoa", - "ryu", - "serde", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_urlencoded" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" dependencies = [ - "dtoa", - "itoa", - "serde", - "url", + "dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha1" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0" dependencies = [ - "block-buffer", - "digest", - "fake-simd", - "opaque-debug", + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sha3" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" dependencies = [ - "block-buffer", - "byte-tools", - "digest", - "keccak", - "opaque-debug", + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "sharded-slab" version = "0.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" dependencies = [ - "lazy_static", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "shlex" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "signal-hook-registry" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" dependencies = [ - "arc-swap", - "libc", + "arc-swap 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "slab" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" [[package]] name = "smart-default" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "socket2" version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "winapi 0.3.8", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "stable_deref_trait" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" [[package]] name = "state-viewer" version = "0.1.0" dependencies = [ - "ansi_term", - "borsh", - "clap", - "near-chain", - "near-chain-configs", - "near-client", - "near-crypto", - "near-logger-utils", - "near-network", - "near-primitives", - "near-store", - "neard", - "node-runtime", - "serde_json", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain 0.1.0", + "near-chain-configs 0.1.0", + "near-client 0.1.0", + "near-crypto 0.1.0", + "near-logger-utils 0.1.0", + "near-network 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "neard 1.0.0", + "node-runtime 0.9.0", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "store-validator" version = "0.1.0" dependencies = [ - "ansi_term", - "clap", - "near-chain", - "near-chain-configs", - "near-client", - "near-logger-utils", - "near-primitives", - "near-store", - "neard", - "serde_json", - "testlib", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain 0.1.0", + "near-chain-configs 0.1.0", + "near-client 0.1.0", + "near-logger-utils 0.1.0", + "near-primitives 0.1.0", + "near-store 0.1.0", + "neard 1.0.0", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "testlib 0.1.0", ] [[package]] name = "stream-cipher" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" dependencies = [ - "generic-array", + "generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "strum" version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" dependencies = [ - "strum_macros", + "strum_macros 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "strum_macros" version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "subtle" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" [[package]] name = "subtle" version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c65d530b10ccaeac294f349038a597e435b18fb456aadd0840a623f83b9e941" [[package]] name = "syn" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "410a7488c0a728c7ceb4ad59b9567eb4053d02e8cc7f5c0e0eeeb39518369213" dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "synstructure" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3639,785 +3346,1081 @@ name = "sysinfo" version = "0.14.3" source = "git+https://github.com/near/sysinfo?rev=3cb97ee79a02754407d2f0f63628f247d7c65e7b#3cb97ee79a02754407d2f0f63628f247d7c65e7b" dependencies = [ - "cfg-if", - "doc-comment", - "libc", - "ntapi", - "once_cell", - "rayon", - "winapi 0.3.8", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "ntapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "target-lexicon" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" [[package]] name = "tempfile" version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if", - "libc", - "rand 0.7.3", - "redox_syscall", - "remove_dir_all", - "winapi 0.3.8", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termcolor" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" dependencies = [ - "winapi-util", + "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termios" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2" dependencies = [ - "libc", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "testlib" version = "0.1.0" dependencies = [ - "actix", - "assert_matches", - "borsh", - "byteorder", - "clap", - "futures", - "lazy_static", - "log", - "near-chain", - "near-chain-configs", - "near-client", - "near-crypto", - "near-jsonrpc", - "near-jsonrpc-client", - "near-logger-utils", - "near-network", - "near-primitives", - "near-runtime-fees", - "near-store", - "near-vm-errors", - "neard", - "node-runtime", - "num-rational", - "rand 0.7.3", - "serde_json", - "tempfile", + "actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "near-chain 0.1.0", + "near-chain-configs 0.1.0", + "near-client 0.1.0", + "near-crypto 0.1.0", + "near-jsonrpc 0.1.0", + "near-jsonrpc-client 0.1.0", + "near-logger-utils 0.1.0", + "near-network 0.1.0", + "near-primitives 0.1.0", + "near-runtime-fees 0.9.1", + "near-store 0.1.0", + "near-vm-errors 0.9.1", + "neard 1.0.0", + "node-runtime 0.9.0", + "num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width", + "unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b3d3d2ff68104100ab257bb6bb0cb26c901abe4bd4ba15961f3bf867924012" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thiserror-impl" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "thread_local" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" dependencies = [ - "lazy_static", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "threadpool" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8dae184447c15d5a6916d973c642aec485105a13cd238192a6927ae3e077d66" dependencies = [ - "num_cpus", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "time" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" dependencies = [ - "libc", - "winapi 0.3.8", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio" version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713" dependencies = [ - "bytes", - "fnv", - "futures-core", - "iovec", - "lazy_static", - "libc", - "memchr", - "mio", - "mio-named-pipes", - "mio-uds", - "num_cpus", - "pin-project-lite", - "signal-hook-registry", - "slab", - "tokio-macros", - "winapi 0.3.8", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-macros" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-openssl" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c4b08c5f4208e699ede3df2520aca2e82401b2de33f45e96696a074480be594" dependencies = [ - "openssl", - "tokio", + "openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-rustls" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4adb8b3e5f86b707f1b54e7c15b6de52617a823608ccda98a15d3a24222f265a" dependencies = [ - "futures-core", - "rustls", - "tokio", - "webpki", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "rustls 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-tls" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bde02a3a5291395f59b06ec6945a3077602fac2b07eeeaf0dee2122f3619828" dependencies = [ - "native-tls", - "tokio", + "native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-util" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-util" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", + "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tower-service" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1721cc8cf7d770cc4257872507180f35a4797272f5962f24c806af9e7faf52ab" dependencies = [ - "cfg-if", - "tracing-attributes", - "tracing-core", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-attributes 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tracing-attributes" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" dependencies = [ - "quote", - "syn", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tracing-core" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" dependencies = [ - "lazy_static", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tracing-log" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" dependencies = [ - "lazy_static", - "log", - "tracing-core", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tracing-serde" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ccba2f8f16e0ed268fc765d9b7ff22e965e7185d32f8f1ec8294fe17d86e79" dependencies = [ - "serde", - "tracing-core", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tracing-subscriber" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d53c40489aa69c9aed21ff483f26886ca8403df33bdc2d2f87c60c1617826d2" dependencies = [ - "ansi_term", - "chrono", - "lazy_static", - "matchers", - "regex", - "serde", - "serde_json", - "sharded-slab", - "smallvec", - "tracing-core", - "tracing-log", - "tracing-serde", + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "matchers 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "sharded-slab 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-log 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "trust-dns-proto" version = "0.18.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a7f3a2ab8a919f5eca52a468866a67ed7d3efa265d48a652a9a3452272b413f" dependencies = [ - "async-trait", - "enum-as-inner", - "failure", - "futures", - "idna", - "lazy_static", - "log", - "rand 0.7.3", - "smallvec", - "socket2", - "tokio", - "url", + "async-trait 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", + "enum-as-inner 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "trust-dns-resolver" version = "0.18.0-alpha.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f90b1502b226f8b2514c6d5b37bafa8c200d7ca4102d57dc36ee0f3b7a04a2f" dependencies = [ - "cfg-if", - "failure", - "futures", - "ipconfig", - "lazy_static", - "log", - "lru-cache", - "resolv-conf", - "smallvec", - "tokio", - "trust-dns-proto", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ipconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "resolv-conf 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "try-lock" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" [[package]] name = "typenum" version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" [[package]] name = "uint" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75a4cdd7b87b28840dba13c483b9a88ee6bbf16ba5c951ee1ecfcf723078e0d" dependencies = [ - "byteorder", - "crunchy", - "rustc-hex", - "static_assertions", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicase" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" dependencies = [ - "version_check", + "version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicode-bidi" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" dependencies = [ - "matches", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicode-normalization" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" dependencies = [ - "smallvec", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicode-segmentation" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" [[package]] name = "unicode-width" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" [[package]] name = "unicode-xid" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" [[package]] name = "untrusted" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60369ef7a31de49bcb3f6ca728d4ba7300d9a1658f94c727d4cab8c8d9f4aece" [[package]] name = "url" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" dependencies = [ - "idna", - "matches", - "percent-encoding", + "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "uuid" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" dependencies = [ - "rand 0.7.3", + "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "validator" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab5990ba09102e1ddc954d294f09b9ea00fc7831a5813bbe84bfdbcae44051e" dependencies = [ - "idna", - "lazy_static", - "regex", - "serde", - "serde_derive", - "serde_json", - "url", + "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "validator_derive" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e668e9cd05c5009b833833aa1147e5727b5396ea401f22dd1167618eed4a10c9" dependencies = [ - "if_chain", - "lazy_static", - "proc-macro2", - "quote", - "regex", - "syn", - "validator", + "if_chain 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "validator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "vcpkg" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" [[package]] name = "vec_map" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" [[package]] name = "version_check" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" [[package]] name = "wabt" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5c5c1286c6e578416982609f47594265f9d489f9b836157d403ad605a46693" dependencies = [ - "serde", - "serde_derive", - "serde_json", - "wabt-sys", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "wabt-sys 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wabt-sys" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d7043ebb3e5d96fad7a8d3ca22ee9880748ff8c3e18092cfb2a49d3b8f9084" dependencies = [ - "cc", - "cmake", - "glob 0.2.11", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "want" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "log", - "try-lock", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" dependencies = [ - "cfg-if", - "serde", - "serde_json", - "wasm-bindgen-macro", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", + "bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-futures" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7add542ea1ac7fdaa9dc25e031a6af33b7d63376292bd24140c637d00d1c312a" dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", + "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" dependencies = [ - "quote", - "wasm-bindgen-macro-support", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", + "proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" [[package]] name = "wasmer-runtime" version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30259003902716aa4fb86fd66a2de555116adef545cbc5ab70afb74e74b44fc3" dependencies = [ - "lazy_static", - "memmap", - "serde", - "serde_derive", - "wasmer-runtime-core", - "wasmer-singlepass-backend", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmer-runtime-core 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmer-singlepass-backend 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasmer-runtime-core" version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45d4253f097502423d8b19d54cb18745f61b984b9dbce32424cba7945cfef367" -dependencies = [ - "bincode", - "blake3", - "cc", - "digest", - "errno", - "hex", - "indexmap", - "lazy_static", - "libc", - "nix", - "page_size", - "parking_lot", - "rustc_version", - "serde", - "serde-bench", - "serde_bytes", - "serde_derive", - "smallvec", - "target-lexicon", - "wasmparser", - "winapi 0.3.8", +dependencies = [ + "bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "blake3 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "errno 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "page_size 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_bytes 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "target-lexicon 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmparser 0.51.4 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasmer-singlepass-backend" version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37cf84179dd5e92b784f7bc190b237f1184916a6d6d3f87d4dd94ca371a2cc25" dependencies = [ - "bincode", - "byteorder", - "dynasm", - "dynasmrt", - "lazy_static", - "libc", - "nix", - "serde", - "serde_derive", - "smallvec", - "wasmer-runtime-core", + "bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dynasm 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dynasmrt 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmer-runtime-core 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasmparser" version = "0.51.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a" [[package]] name = "web-sys" version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" dependencies = [ - "js-sys", - "wasm-bindgen", + "js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "webpki" version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f50e1972865d6b1adb54167d1c8ed48606004c2c9d0ea5f1eeb34d95e863ef" dependencies = [ - "ring", - "untrusted", + "ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "webpki-roots" version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" dependencies = [ - "webpki", + "webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "which" version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" dependencies = [ - "libc", + "libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "widestring" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "effc0e4ff8085673ea7b9b2e3c73f6bd4d118810c9009ed8f1e16bd96c331db6" [[package]] name = "winapi" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" [[package]] name = "winapi" version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-build" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winreg" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" dependencies = [ - "winapi 0.3.8", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "ws2_32-sys" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zeroize" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" + +[metadata] +"checksum actix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4af87564ff659dee8f9981540cac9418c45e910c8072fdedd643a262a38fcaf" +"checksum actix-codec 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "09e55f0a5c2ca15795035d90c46bd0e73a5123b72f68f12596d6ba5282051380" +"checksum actix-connect 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c95cc9569221e9802bf4c377f6c18b90ef10227d787611decf79fd47d2a8e76c" +"checksum actix-cors 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6206917d5c0fdd79d81cec9ef02d3e802df4abf276d96241e1f595d971e002" +"checksum actix-http 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c16664cc4fdea8030837ad5a845eb231fb93fc3c5c171edfefb52fad92ce9019" +"checksum actix-macros 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "21705adc76bbe4bc98434890e73a89cd00c6015e5704a60bb6eea6c3b72316b6" +"checksum actix-router 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9d7a10ca4d94e8c8e7a87c5173aba1b97ba9a6563ca02b0e1cd23531093d3ec8" +"checksum actix-rt 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227" +"checksum actix-server 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "582a7173c281a4f46b5aa168a11e7f37183dcb71177a39312cc2264da7a632c9" +"checksum actix-service 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3e4fc95dfa7e24171b2d0bb46b85f8ab0e8499e4e3caec691fc4ea65c287564" +"checksum actix-testing 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48494745b72d0ea8ff0cf874aaf9b622a3ee03d7081ee0c04edea4f26d32c911" +"checksum actix-threadpool 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf4082192601de5f303013709ff84d81ca6a1bc4af7fb24f367a500a23c6e84e" +"checksum actix-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4e5b4faaf105e9a6d389c606c298dcdb033061b00d532af9df56ff3a54995a8" +"checksum actix-utils 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fcf8f5631bf01adec2267808f00e228b761c60c0584cc9fa0b5364f41d147f4e" +"checksum actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3158e822461040822f0dbf1735b9c2ce1f95f93b651d7a7aded00b1efbb1f635" +"checksum actix-web-codegen 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4f00371942083469785f7e28c540164af1913ee7c96a4534acb9cea92c39f057" +"checksum actix_derive 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b95aceadaf327f18f0df5962fedc1bde2f870566a0b9f65c89508a3b1f79334c" +"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2" +"checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum arc-swap 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b585a98a234c46fc563103e9278c9391fde1f4e6850334da895d27edb9580f62" +"checksum arrayref 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +"checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" +"checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" +"checksum async-trait 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "da71fef07bc806586090247e971229289f64c210a278ee5ae419314eb386b31d" +"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" +"checksum autocfg 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +"checksum awc 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d7601d4d1d7ef2335d6597a41b5fe069f6ab799b85f53565ab390e7b7065aac5" +"checksum backtrace 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" +"checksum backtrace-sys 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "78848718ee1255a2485d1309ad9cdecfc2e7d0362dd11c6829364c6b35ae1bc7" +"checksum base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" +"checksum bencher 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7dfdb4953a096c551ce9ace855a604d702e6e62d77fac690575ae347571717f5" +"checksum bincode 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5753e2a71534719bf3f4e57006c3a4f0d2c672a4b676eec84161f763eca87dbf" +"checksum bindgen 0.53.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6bb26d6a69a335b8cb0e7c7e9775cd5666611dc50a37177c3f2cedcfc040e8c8" +"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" +"checksum blake2b_simd 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" +"checksum blake3 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "423897d97e11b810c9da22458400b28ec866991c711409073662eb34dc44bfff" +"checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +"checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +"checksum borsh 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c7769f8f6fdc6ac7617bbc8bc7ef9dc263cd459d99d21cf2ab4afc3bc8d7d70d" +"checksum borsh-derive 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d2689a82a5fe57f9e71997b16bea340da338c7fb8db400b8d9d55b59010540d8" +"checksum borsh-derive-internal 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "39b621f19e9891a34f679034fa2238260e27c0eddfe2804e9fb282061cf9b294" +"checksum borsh-schema-derive-internal 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "befebdb9e223ae4528b3d597dbbfb5c68566822d2a3de3e260f235360773ba29" +"checksum brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +"checksum brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +"checksum bs58 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb" +"checksum bstr 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "2889e6d50f394968c8bf4240dc3f2a7eb4680844d27308f798229ac9d4725f41" +"checksum bumpalo 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12ae9db68ad7fac5fe51304d20f016c911539251075a214f8e663babefa35187" +"checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +"checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" +"checksum bytestring 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fc7c05fa5172da78a62d9949d662d2ac89d4cc7355d7b49adee5163f1fb3f363" +"checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" +"checksum cached 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "083dc50149e37dfaab1ffe2c3af03576b79550f1e419a5091b28a7191db1c45b" +"checksum cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d" +"checksum cexpr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" +"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2" +"checksum clang-sys 0.29.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" +"checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" +"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" +"checksum console 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6728a28023f207181b193262711102bfbaf47cc9d13bc71d0736607ef8efe88c" +"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +"checksum copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127" +"checksum core-foundation 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +"checksum core-foundation-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +"checksum crossbeam-channel 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "cced8691919c02aac3cb0a1bc2e9b73d89e832bf9a06fc579d4e71b68a2da061" +"checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +"checksum crossbeam-queue 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c695eeca1e7173472a32221542ae469b3e9aac3a4fc81f7696bcad82029493db" +"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +"checksum crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +"checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +"checksum csv 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "00affe7f6ab566df61b4be3ce8cf16bc2576bca0963ceb0955e45d514bf9a279" +"checksum csv-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90" +"checksum ct-logs 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4d3686f5fa27dbc1d76c751300376e167c5a43387f44bb451fd1c24776e49113" +"checksum curve25519-dalek 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26778518a7f6cffa1d25a44b602b62b979bd88adb9e99ffec546998cf3404839" +"checksum derive_more 0.99.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e2323f3f47db9a0e77ce7a300605d8d2098597fc451ed1a97bb1f6411bb550a7" +"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b" +"checksum doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +"checksum dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3" +"checksum dynasm 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "42a814e1edeb85dd2a3c6fc0d6bf76d02ca5695d438c70ecee3d90774f3259c5" +"checksum dynasmrt 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a393aaeb4441a48bcf47b5b6155971f82cc1eb77e22855403ccc0415ac8328d" +"checksum easy-ext 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2a9b11b96248fc9efa0c093e6406fea7e55a7e893c932dbdf47074f34ec52e7" +"checksum ed25519-dalek 1.0.0-pre.3 (registry+https://github.com/rust-lang/crates.io-index)" = "978710b352437433c97b2bff193f2fb1dfd58a093f863dd95e225a19baa599a2" +"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +"checksum elastic-array 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d63720ea2bc2e1b79f7aa044d9dc0b825f9ccb6930b32120f8fb9e873aa84bc" +"checksum encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +"checksum encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)" = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28" +"checksum enum-as-inner 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bc4bfcfacb61d231109d1d55202c1f33263319668b168843e02ad4652725ec9c" +"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +"checksum errno 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b480f641ccf0faf324e20c1d3e53d81b7484c698b42ea677f6907ae4db195371" +"checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" +"checksum failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b8529c2421efa3066a5cbd8063d2244603824daccb6936b079010bb2aa89464b" +"checksum failure_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231" +"checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +"checksum fixed-hash 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32529fc42e86ec06e5047092082aab9ad459b070c5d2a76b14f4f5ce70bf2e84" +"checksum flate2 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fs_extra 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5f2a4a2034423744d2cc7ca2068453168dcdb82c438419e639a26bd87839c674" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum futures 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" +"checksum futures-channel 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" +"checksum futures-core 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" +"checksum futures-executor 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" +"checksum futures-io 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" +"checksum futures-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" +"checksum futures-sink 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" +"checksum futures-task 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" +"checksum futures-util 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" +"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +"checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" +"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +"checksum git-version 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "94918e83f1e01dedc2e361d00ce9487b14c58c7f40bab148026fa39d42cb41e2" +"checksum git-version-macro 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "34a97a52fdee1870a34fa6e4b77570cba531b27d1838874fef4429a791a3d657" +"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" +"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +"checksum gnuplot 0.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "32fc2314e75d4e1a2aa0c2ec5b95f7facb106eb575b621bbb9493e49beea2da7" +"checksum h2 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42" +"checksum heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1679e6ea370dee694f91f1dc469bf94cf8f52051d147aec3e1f9497c6fc22461" +"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +"checksum hermit-abi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8a0d737e0f947a1864e93d33fdef4af8445a00d1ed8dc0c8ddb73139ea6abf15" +"checksum hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" +"checksum hex-literal 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "961de220ec9a91af2e1e5bd80d02109155695e516771762381ef8581317066e0" +"checksum hex-literal-impl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9d4c5c844e2fee0bf673d54c2c177f1713b3d2af2ff6e666b49cb7572e6cf42d" +"checksum hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +"checksum http 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +"checksum http-body 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +"checksum hyper 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14" +"checksum hyper-rustls 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac965ea399ec3a25ac7d13b8affd4b8f39325cca00858ddf5eb29b79e6b14b08" +"checksum hyper-tls 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3adcd308402b9553630734e9c36b77a7e48b3821251ca2493e8cd596763aafaa" +"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +"checksum if_chain 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c3360c7b59e5ffa2653671fb74b4741a5d343c03f331c0a4aeda42b5c2b0ec7d" +"checksum indexmap 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "076f042c5b7b98f31d205f1249267e12a6518c1481e9dae9764af19b707d2292" +"checksum indicatif 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8572bccfb0665e70b7faf44ee28841b8e0823450cd4ad562a76b5a3c4bf48487" +"checksum indicatif 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a68371cf417889c9d7f98235b7102ea7c54fc59bcbd22f3dea785be9d27e40" +"checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +"checksum ipconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa79fa216fbe60834a9c0737d7fcd30425b32d1c58854663e24d4c4b328ed83f" +"checksum itoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e" +"checksum jemalloc-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0d3b9f3f5c9b31aa0f5ed3260385ac205db665baa41d49bb8338008ae94ede45" +"checksum jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "43ae63fcfc45e99ab3d1b29a46782ad679e98436c3169d15a167a1108a724b69" +"checksum jobserver 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" +"checksum js-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "6a27d435371a2fa5b6d2b028a74bbdb1234f308da363226a2854ca3ff8ba7055" +"checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" +"checksum libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005" +"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +"checksum librocksdb-sys 6.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "883213ae3d09bfc3d104aefe94b25ebb183b6f4d3a515b23b14817e1f4854005" +"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" +"checksum lock_api 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +"checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +"checksum match_cfg 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" +"checksum matchers 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" +"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +"checksum memoffset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" +"checksum mime 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +"checksum mime_guess 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +"checksum miniz_oxide 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5" +"checksum mio 0.6.21 (registry+https://github.com/rust-lang/crates.io-index)" = "302dec22bcf6bae6dfb69c647187f4b4d0fb6f535521f7bc022430ce8e12008f" +"checksum mio-named-pipes 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3" +"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" +"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +"checksum miow 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226" +"checksum native-tls 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" +"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" +"checksum nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" +"checksum nom 5.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b471253da97532da4b61552249c521e01e736071f71c1a4f7ebbfbf0a06aad6" +"checksum ntapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f26e041cd983acbc087e30fcba770380cfa352d0e392e175b2344ebaf7ea0602" +"checksum num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +"checksum num-integer 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba" +"checksum num-rational 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +"checksum num-traits 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096" +"checksum num_cpus 1.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +"checksum number_prefix 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" +"checksum once_cell 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b" +"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +"checksum openssl 0.10.29 (registry+https://github.com/rust-lang/crates.io-index)" = "cee6d85f4cb4c4f59a6a85d5b68a233d280c82e29e822913b9c8b129fbf20bdd" +"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +"checksum openssl-src 111.9.0+1.1.1g (registry+https://github.com/rust-lang/crates.io-index)" = "a2dbe10ddd1eb335aba3780eb2eaa13e1b7b441d2562fd962398740927f39ec4" +"checksum openssl-sys 0.9.55 (registry+https://github.com/rust-lang/crates.io-index)" = "7717097d810a0f2e2323f9e5d11e71608355e24828410b55b9d4f18aa5f9a5d8" +"checksum owning_ref 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" +"checksum page_size 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd" +"checksum parity-secp256k1 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4fca4f82fccae37e8bbdaeb949a4a218a1bbc485d11598f193d2a908042e5fc1" +"checksum parity-wasm 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" +"checksum parking_lot 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +"checksum parking_lot_core 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" +"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +"checksum pin-project 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6f6a7f5eee6292c559c793430c55c00aea9d3b3d1905e855806ca4d7253426a2" +"checksum pin-project-internal 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "8988430ce790d8682672117bc06dda364c0be32d3abd738234f19f3240bad99a" +"checksum pin-project-lite 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae" +"checksum pin-utils 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +"checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" +"checksum primitive-types 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5e4b9943a2da369aec5e96f7c10ebc74fcf434d39590d974b0a3460e6f67fbb" +"checksum proc-macro-hack 0.5.15 (registry+https://github.com/rust-lang/crates.io-index)" = "0d659fe7c6d27f25e9d80a1a094c223f5246f6a6596453e09d7229bf42750b63" +"checksum proc-macro-nested 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8e946095f9d3ed29ec38de908c22f95d9ac008e424c7bcae54c75a79c527c694" +"checksum proc-macro2 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "df246d292ff63439fea9bc8c0a270bed0e390d5ebd4db4ba15aba81111b5abe3" +"checksum prometheus 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b0575e258dab62268e7236d7307caa38848acbda7ec7ab87bd9093791e999d20" +"checksum protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e86d370532557ae7573551a1ec8235a0f8d6cb276c7c9e6aa490b511c447485" +"checksum pwasm-utils 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f7a12f176deee919f4ba55326ee17491c8b707d0987aed822682c821b660192" +"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f" +"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +"checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +"checksum rand_xorshift 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "77d416b86801d23dde1aa643023b775c3a462efc0ed96443add11546cdf1dca8" +"checksum rayon 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "db6ce3297f9c85e16621bb8cca38a06779ffc31bb8184e1be4bed2be4678a098" +"checksum rayon-core 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08a89b46efaf957e52b18062fb2f4660f8b8a4dde1807ca002690868ef2c85a9" +"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +"checksum redox_users 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" +"checksum reed-solomon-erasure 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a415a013dd7c5d4221382329a5a3482566da675737494935cbbbcdec04662f9d" +"checksum regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a6020f034922e3194c711b82a627453881bc4682166cabb07134a10c26ba7692" +"checksum regex-automata 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ae1ded71d66a4a97f5e961fd0cb25a5f366a42a41570d16a763a69c092c26ae4" +"checksum regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae" +"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" +"checksum reqwest 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "02b81e49ddec5109a9dcfc5f2a317ff53377c915e9ae9d4f2fb50914b85614e2" +"checksum resolv-conf 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "11834e137f3b14e309437a8276714eed3a80d1ef894869e510f2c0c0b98b9f4a" +"checksum ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" +"checksum rocksdb 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "61aa17a99a2413cd71c1106691bf59dad7de0cd5099127f90e9d99c429c40d4a" +"checksum rust-argon2 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum rustc-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +"checksum rustc-hex 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum rustls 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d4a31f5d68413404705d6982529b0e11a9aacd4839d1d6222ee3b8cb4015e1" +"checksum rustls-native-certs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a75ffeb84a6bd9d014713119542ce415db3a3e4748f0bfce1e1416cd224a23a5" +"checksum ryu 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ed3d612bc64430efeb3f7ee6ef26d590dce0c43249217bddc62112540c7941e1" +"checksum schannel 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "039c25b130bd8c1321ee2d7de7fde2659fa9c2744e4bb29711cfc852ea53cd19" +"checksum scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +"checksum sct 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +"checksum security-framework 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3f331b9025654145cd425b9ded0caf8f5ae0df80d418b326e2dc1c3dc5eb0620" +"checksum security-framework-sys 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)" = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" +"checksum serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "d733da87e79faaac25616e33d26299a41143fd4cd42746cbb0e91d8feea243fd" +"checksum serde_bytes 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "325a073952621257820e7a3469f55ba4726d8b28657e7e36653d1c36dc2c84ae" +"checksum serde_derive 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)" = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" +"checksum serde_json 1.0.51 (registry+https://github.com/rust-lang/crates.io-index)" = "da07b57ee2623368351e9a0488bb0b261322a15a6e0ae53e243cbdc0f4208da9" +"checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +"checksum sha2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "27044adfd2e1f077f649f59deb9490d3941d674002f7d062870a60ebe9bd47a0" +"checksum sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" +"checksum sharded-slab 0.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" +"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +"checksum signal-hook-registry 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" +"checksum smallvec 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" +"checksum smart-default 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" +"checksum socket2 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +"checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum static_assertions 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +"checksum stream-cipher 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum strum 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" +"checksum strum_macros 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" +"checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" +"checksum subtle 2.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c65d530b10ccaeac294f349038a597e435b18fb456aadd0840a623f83b9e941" +"checksum syn 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "410a7488c0a728c7ceb4ad59b9567eb4053d02e8cc7f5c0e0eeeb39518369213" +"checksum synstructure 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545" +"checksum sysinfo 0.14.3 (git+https://github.com/near/sysinfo?rev=3cb97ee79a02754407d2f0f63628f247d7c65e7b)" = "" +"checksum target-lexicon 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +"checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" +"checksum termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +"checksum thiserror 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "54b3d3d2ff68104100ab257bb6bb0cb26c901abe4bd4ba15961f3bf867924012" +"checksum thiserror-impl 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972988113b7715266f91250ddb98070d033c62a011fa0fcc57434a649310dd" +"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14" +"checksum threadpool 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e8dae184447c15d5a6916d973c642aec485105a13cd238192a6927ae3e077d66" +"checksum time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +"checksum tokio 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713" +"checksum tokio-macros 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +"checksum tokio-openssl 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c4b08c5f4208e699ede3df2520aca2e82401b2de33f45e96696a074480be594" +"checksum tokio-rustls 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4adb8b3e5f86b707f1b54e7c15b6de52617a823608ccda98a15d3a24222f265a" +"checksum tokio-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7bde02a3a5291395f59b06ec6945a3077602fac2b07eeeaf0dee2122f3619828" +"checksum tokio-util 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930" +"checksum tokio-util 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +"checksum tower-service 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" +"checksum tracing 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1721cc8cf7d770cc4257872507180f35a4797272f5962f24c806af9e7faf52ab" +"checksum tracing-attributes 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "7fbad39da2f9af1cae3016339ad7f2c7a9e870f12e8fd04c4fd7ef35b30c0d2b" +"checksum tracing-core 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715" +"checksum tracing-log 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e0f8c7178e13481ff6765bd169b33e8d554c5d2bbede5e32c356194be02b9b9" +"checksum tracing-serde 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b6ccba2f8f16e0ed268fc765d9b7ff22e965e7185d32f8f1ec8294fe17d86e79" +"checksum tracing-subscriber 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1d53c40489aa69c9aed21ff483f26886ca8403df33bdc2d2f87c60c1617826d2" +"checksum trust-dns-proto 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2a7f3a2ab8a919f5eca52a468866a67ed7d3efa265d48a652a9a3452272b413f" +"checksum trust-dns-resolver 0.18.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f90b1502b226f8b2514c6d5b37bafa8c200d7ca4102d57dc36ee0f3b7a04a2f" +"checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" +"checksum typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +"checksum uint 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e75a4cdd7b87b28840dba13c483b9a88ee6bbf16ba5c951ee1ecfcf723078e0d" +"checksum unicase 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5479532badd04e128284890390c1e876ef7a993d0570b3597ae43dfa1d59afa4" +"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" +"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +"checksum untrusted 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60369ef7a31de49bcb3f6ca728d4ba7300d9a1658f94c727d4cab8c8d9f4aece" +"checksum url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +"checksum uuid 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" +"checksum validator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ab5990ba09102e1ddc954d294f09b9ea00fc7831a5813bbe84bfdbcae44051e" +"checksum validator_derive 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e668e9cd05c5009b833833aa1147e5727b5396ea401f22dd1167618eed4a10c9" +"checksum vcpkg 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3fc439f2794e98976c88a2a2dafce96b930fe8010b0a256b3c2199a773933168" +"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum version_check 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "078775d0255232fb988e6fccf26ddc9d1ac274299aaedcedce21c6f72cc533ce" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3c5c5c1286c6e578416982609f47594265f9d489f9b836157d403ad605a46693" +"checksum wabt-sys 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23d7043ebb3e5d96fad7a8d3ca22ee9880748ff8c3e18092cfb2a49d3b8f9084" +"checksum want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +"checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +"checksum wasm-bindgen 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "2cc57ce05287f8376e998cbddfb4c8cb43b84a7ec55cf4551d7c00eef317a47f" +"checksum wasm-bindgen-backend 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d967d37bf6c16cca2973ca3af071d0a2523392e4a594548155d89a678f4237cd" +"checksum wasm-bindgen-futures 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7add542ea1ac7fdaa9dc25e031a6af33b7d63376292bd24140c637d00d1c312a" +"checksum wasm-bindgen-macro 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "8bd151b63e1ea881bb742cd20e1d6127cef28399558f3b5d415289bc41eee3a4" +"checksum wasm-bindgen-macro-support 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931" +"checksum wasm-bindgen-shared 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "daf76fe7d25ac79748a37538b7daeed1c7a6867c92d3245c12c6222e4a20d639" +"checksum wasmer-runtime 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30259003902716aa4fb86fd66a2de555116adef545cbc5ab70afb74e74b44fc3" +"checksum wasmer-runtime-core 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "45d4253f097502423d8b19d54cb18745f61b984b9dbce32424cba7945cfef367" +"checksum wasmer-singlepass-backend 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37cf84179dd5e92b784f7bc190b237f1184916a6d6d3f87d4dd94ca371a2cc25" +"checksum wasmparser 0.51.4 (registry+https://github.com/rust-lang/crates.io-index)" = "aeb1956b19469d1c5e63e459d29e7b5aa0f558d9f16fcef09736f8a265e6c10a" +"checksum web-sys 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6f51648d8c56c366144378a33290049eafdd784071077f6fe37dae64c1c4cb" +"checksum webpki 0.21.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1f50e1972865d6b1adb54167d1c8ed48606004c2c9d0ea5f1eeb34d95e863ef" +"checksum webpki-roots 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" +"checksum which 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" +"checksum widestring 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effc0e4ff8085673ea7b9b2e3c73f6bd4d118810c9009ed8f1e16bd96c331db6" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum winreg 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +"checksum zeroize 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8"