Skip to content

Commit

Permalink
Merge pull request #1297 from nearprotocol/master-to-staging
Browse files Browse the repository at this point in the history
Merging master to staging
  • Loading branch information
ilblackdragon committed Sep 11, 2019
2 parents a1f0c61 + 7554e4a commit 3c89de3
Show file tree
Hide file tree
Showing 24 changed files with 129 additions and 69 deletions.
73 changes: 32 additions & 41 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion chain/chain/Cargo.toml
Expand Up @@ -14,7 +14,7 @@ serde = "1.0"
serde_derive = "1.0"
cached = "0.9.0"

borsh = { git = "https://github.com/nearprotocol/borsh.git" }
borsh = "0.2.2"

near-crypto = { path = "../../core/crypto" }
near-primitives = { path = "../../core/primitives" }
Expand Down
5 changes: 2 additions & 3 deletions chain/chunks/Cargo.toml
Expand Up @@ -13,15 +13,14 @@ rand = "0.6"
rand_xorshift = "0.1"
chrono = "0.4.6"
log = "0.4"
borsh = "0.2.2"
serde = "1.0"
serde_derive = "1.0"
elapsed = "0.1"
protobuf = "2.4"
reed-solomon-erasure = "3.1.1"
crossbeam = "0.3.0"
cached = { git = "https://github.com/nearprotocol/cached", rev = "7e472eddef68607e344d5a106a0e6705d92e55be" }

borsh = { git = "https://github.com/nearprotocol/borsh.git" }
cached = "0.9.0"

near-crypto = { path = "../../core/crypto" }
near-primitives = { path = "../../core/primitives" }
Expand Down
6 changes: 3 additions & 3 deletions chain/client/Cargo.toml
Expand Up @@ -12,13 +12,13 @@ chrono = { version = "0.4.4", features = ["serde"] }
kvdb = "0.1"
log = "0.4"
rand = "0.6.5"
serde_derive = "1.0"
borsh = "0.2.2"
serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0"
sysinfo = "0.9.0"
cached = { git = "https://github.com/nearprotocol/cached", rev = "7e472eddef68607e344d5a106a0e6705d92e55be" }
cached = "0.9.0"

borsh = { git = "https://github.com/nearprotocol/borsh.git" }

near-crypto = { path = "../../core/crypto" }
near-primitives = { path = "../../core/primitives" }
Expand Down
2 changes: 1 addition & 1 deletion chain/epoch_manager/Cargo.toml
Expand Up @@ -8,11 +8,11 @@ edition = "2018"
[dependencies]
rand = "0.6.5"
log = "0.4"
borsh = "0.2.2"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"

borsh = { git = "https://github.com/nearprotocol/borsh.git" }

near-crypto = { path = "../../core/crypto" }
near-primitives = { path = "../../core/primitives" }
Expand Down
2 changes: 1 addition & 1 deletion chain/jsonrpc/Cargo.toml
Expand Up @@ -21,7 +21,7 @@ serde = { version = "1.0", features = ["derive"] }
tokio = "0.1.15"
uuid = { version = "~0.6", features = ["v4"] }

borsh = { git = "https://github.com/nearprotocol/borsh.git" }
borsh = "0.2.2"

async-utils = { path = "../../async-utils" }
near-crypto = { path = "../../core/crypto" }
Expand Down
19 changes: 18 additions & 1 deletion chain/jsonrpc/tests/rpc_query.rs
Expand Up @@ -16,7 +16,24 @@ fn test_block() {

let mut client = new_client(&format!("http://{}", addr));
actix::spawn(client.block(0).then(|res| {
assert_eq!(res.unwrap().header.height, 0);
let res = res.unwrap();
assert_eq!(res.header.height, 0);
assert_eq!(res.header.epoch_id.0, &[0; 32]);
assert_eq!(res.header.hash.0.len(), 32);
assert_eq!(res.header.prev_hash.0, &[0; 32]);
assert_eq!(
res.header.prev_state_root.0,
&[
102, 104, 122, 173, 248, 98, 189, 119, 108, 143, 193, 139, 142, 159, 142, 32,
8, 151, 20, 133, 110, 226, 51, 179, 144, 42, 89, 29, 13, 95, 41, 37
]
);
assert_eq!(res.header.tx_root.0, &[0; 32]);
assert!(res.header.timestamp > 0);
assert_eq!(res.header.approval_mask.len(), 0);
assert_eq!(res.header.approval_sigs.len(), 0);
assert_eq!(res.header.total_weight, 0);
assert_eq!(res.header.validator_proposals.len(), 0);
System::current().stop();
future::result(Ok(()))
}));
Expand Down
2 changes: 1 addition & 1 deletion chain/network/Cargo.toml
Expand Up @@ -16,7 +16,7 @@ serde_derive = "1.0"
rand = "0.6.5"
reed-solomon-erasure = "3.1.1"

borsh = { git = "https://github.com/nearprotocol/borsh.git" }
borsh = "0.2.2"

near-crypto = { path = "../../core/crypto" }
near-primitives = { path = "../../core/primitives" }
Expand Down
3 changes: 1 addition & 2 deletions core/crypto/Cargo.toml
Expand Up @@ -9,8 +9,7 @@ sodiumoxide = "0.2.2"
eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1" }

bs58 = "0.2.4"

borsh = { git = "https://github.com/nearprotocol/borsh.git" }
borsh = "0.2.2"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion core/primitives/Cargo.toml
Expand Up @@ -25,7 +25,7 @@ log = "0.4"
reed-solomon-erasure = "3.1.1"
jemallocator = { version = "0.3.0", optional = true }

borsh = { git = "https://github.com/nearprotocol/borsh.git" }
borsh = "0.2.2"

near-crypto = { path = "../crypto" }

Expand Down
6 changes: 4 additions & 2 deletions core/primitives/src/merkle.rs
@@ -1,6 +1,7 @@
use borsh::{BorshDeserialize, BorshSerialize};

use crate::hash::hash;
use crate::types::MerkleHash;
use borsh::{BorshDeserialize, BorshSerialize};

#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
pub struct MerklePathItem {
Expand Down Expand Up @@ -98,10 +99,11 @@ pub fn verify_path<T: BorshSerialize>(root: MerkleHash, path: &MerklePath, item:

#[cfg(test)]
mod tests {
use super::*;
use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};

use super::*;

fn test_with_len(n: u32, rng: &mut StdRng) {
let mut arr: Vec<u32> = vec![];
for _ in 0..n {
Expand Down

0 comments on commit 3c89de3

Please sign in to comment.