Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into dp/fix/impl-MaybeEmpty-only-where-needed
Browse files Browse the repository at this point in the history
* master:
  Revert "Install llvm-tools-preview component (#643)" (#644)
  Revert "fix wasm executor compile error (#631)" (#642)
  Fetch parity-common dependencies from crates (#617)
  limit retry count in OnDemand (#513)
  Minor refactor for staking module (#659)
  • Loading branch information
dvdplm committed Sep 5, 2018
2 parents 1023518 + 5a480d9 commit c320bf1
Show file tree
Hide file tree
Showing 27 changed files with 424 additions and 465 deletions.
275 changes: 119 additions & 156 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ build it. Ensure you have Rust and the support software installed:
curl https://sh.rustup.rs -sSf | sh
rustup update nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup component add llvm-tools-preview --toolchain=nightly
rustup update stable
cargo install --git https://github.com/alexcrichton/wasm-gc
sudo apt install cmake pkg-config libssl-dev git
Expand Down
2 changes: 1 addition & 1 deletion demo/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ error-chain = "0.12"
hex-literal = "0.1"
log = "0.3"
tokio = "0.1.7"
triehash = "0.1"
triehash = "0.2"
substrate-client = { path = "../../substrate/client" }
substrate-codec = { path = "../../substrate/codec" }
substrate-extrinsic-pool = { path = "../../substrate/extrinsic-pool" }
Expand Down
2 changes: 1 addition & 1 deletion demo/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Substrate Demo node implementation in Rust."

[dependencies]
hex-literal = "0.1"
triehash = { version = "0.1" }
triehash = "0.2"
ed25519 = { path = "../../substrate/ed25519" }
substrate-codec = { path = "../../substrate/codec" }
substrate-runtime-io = { path = "../../substrate/runtime-io" }
Expand Down
2 changes: 1 addition & 1 deletion demo/executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ mod tests {
UncheckedExtrinsic::new(extrinsic, signature)
}).collect::<Vec<_>>();

let extrinsics_root = ordered_trie_root(extrinsics.iter().map(Encode::encode)).0.into();
let extrinsics_root = ordered_trie_root::<KeccakHasher, _, _>(extrinsics.iter().map(Encode::encode)).0.into();

let header = Header {
parent_hash,
Expand Down
155 changes: 45 additions & 110 deletions demo/runtime/wasm/Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ if [ -z $CI_PROJECT_NAME ] ; then
fi

rustup target add wasm32-unknown-unknown --toolchain nightly
rustup component add llvm-tools-preview --toolchain=nightly

# Install wasm-gc. It's useful for stripping slimming down wasm binaries.
command -v wasm-gc || \
Expand Down
8 changes: 4 additions & 4 deletions substrate/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ error-chain = "0.12"
fnv = "1.0"
log = "0.3"
parking_lot = "0.4"
triehash = "0.2"
hex-literal = "0.1"
futures = "0.1.17"
ed25519 = { path = "../ed25519" }
Expand All @@ -23,10 +24,9 @@ substrate-runtime-primitives = { path = "../runtime/primitives" }
substrate-state-machine = { path = "../state-machine" }
substrate-keyring = { path = "../../substrate/keyring" }
substrate-telemetry = { path = "../telemetry" }
hashdb = { git = "https://github.com/paritytech/parity-common" }
patricia-trie = { git = "https://github.com/paritytech/parity-common" }
rlp = { git = "https://github.com/paritytech/parity-common" }
triehash = { git = "https://github.com/paritytech/parity-common" }
hashdb = "0.2.1"
patricia-trie = "0.2.1"
rlp = "0.2.4"

[dev-dependencies]
substrate-test-client = { path = "../test-client" }
10 changes: 5 additions & 5 deletions substrate/client/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
parking_lot = "0.4"
log = "0.3"
kvdb = { git = "https://github.com/paritytech/parity-common" }
kvdb-rocksdb = { git = "https://github.com/paritytech/parity-common" }
hashdb = { git = "https://github.com/paritytech/parity-common" }
memorydb = { git = "https://github.com/paritytech/parity-common" }
kvdb = "0.1"
kvdb-rocksdb = "0.1.3"
hashdb = "0.2.1"
memorydb = "0.2.1"
substrate-primitives = { path = "../../../substrate/primitives" }
substrate-runtime-primitives = { path = "../../../substrate/runtime/primitives" }
substrate-client = { path = "../../../substrate/client" }
Expand All @@ -21,4 +21,4 @@ substrate-executor = { path = "../../../substrate/executor" }
substrate-state-db = { path = "../../../substrate/state-db" }

[dev-dependencies]
kvdb-memorydb = { git = "https://github.com/paritytech/parity-common" }
kvdb-memorydb = "0.1"
1 change: 1 addition & 0 deletions substrate/client/src/light/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ impl<Block, S, F, H, C> StateBackend<H, C> for OnDemandState<Block, S, F>
block: self.block,
header: header.expect("if block above guarantees that header is_some(); qed"),
key: key.to_vec(),
retry_count: None,
})
.into_future().wait()
}
Expand Down
1 change: 1 addition & 0 deletions substrate/client/src/light/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl<S, F, Block> BlockchainHeaderBackend<Block> for Blockchain<S, F> where Bloc
.remote_header(RemoteHeaderRequest {
cht_root: self.storage.cht_root(cht::SIZE, number)?,
block: number,
retry_count: None,
})
.into_future().wait()
.map(Some)
Expand Down
2 changes: 2 additions & 0 deletions substrate/client/src/light/call_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ impl<B, F, Block> CallExecutor<Block, KeccakHasher, RlpCodec> for RemoteCallExec
header: block_header,
method: method.into(),
call_data: call_data.to_vec(),
retry_count: None,
}).into_future().wait()
}

Expand Down Expand Up @@ -168,6 +169,7 @@ mod tests {
},
method: "authorities".into(),
call_data: vec![],
retry_count: None,
}, remote_execution_proof).unwrap();
}
}
10 changes: 10 additions & 0 deletions substrate/client/src/light/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub struct RemoteCallRequest<Header: HeaderT> {
pub method: String,
/// Call data.
pub call_data: Vec<u8>,
/// Number of times to retry request. None means that default RETRY_COUNT is used.
pub retry_count: Option<usize>,
}

/// Remote canonical header request.
Expand All @@ -52,6 +54,8 @@ pub struct RemoteHeaderRequest<Header: HeaderT> {
pub cht_root: Header::Hash,
/// Number of the header to query.
pub block: Header::Number,
/// Number of times to retry request. None means that default RETRY_COUNT is used.
pub retry_count: Option<usize>,
}

/// Remote storage read request.
Expand All @@ -63,6 +67,8 @@ pub struct RemoteReadRequest<Header: HeaderT> {
pub header: Header,
/// Storage key to read.
pub key: Vec<u8>,
/// Number of times to retry request. None means that default RETRY_COUNT is used.
pub retry_count: Option<usize>,
}

/// Light client data fetcher. Implementations of this trait must check if remote data
Expand Down Expand Up @@ -264,6 +270,7 @@ pub mod tests {
block: remote_block_header.hash(),
header: remote_block_header,
key: b":auth:len".to_vec(),
retry_count: None,
}, remote_read_proof).unwrap().unwrap()[0], authorities_len as u8);
}

Expand All @@ -273,6 +280,7 @@ pub mod tests {
assert_eq!((&local_checker as &FetchChecker<Block>).check_header_proof(&RemoteHeaderRequest::<Header> {
cht_root: local_cht_root,
block: 1,
retry_count: None,
}, Some(remote_block_header.clone()), remote_header_proof).unwrap(), remote_block_header);
}

Expand All @@ -283,6 +291,7 @@ pub mod tests {
assert!((&local_checker as &FetchChecker<Block>).check_header_proof(&RemoteHeaderRequest::<Header> {
cht_root: Default::default(),
block: 1,
retry_count: None,
}, Some(remote_block_header.clone()), remote_header_proof).is_err());
}

Expand All @@ -293,6 +302,7 @@ pub mod tests {
assert!((&local_checker as &FetchChecker<Block>).check_header_proof(&RemoteHeaderRequest::<Header> {
cht_root: local_cht_root,
block: 1,
retry_count: None,
}, Some(remote_block_header.clone()), remote_header_proof).is_err());
}
}
4 changes: 2 additions & 2 deletions substrate/executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ serde = "1.0"
serde_derive = "1.0"
wasmi = "0.4"
byteorder = "1.1"
triehash = "0.1.0"
triehash = "0.2"
twox-hash = "1.1.0"
lazy_static = "1.0"
parking_lot = "*"
log = "0.3"
hashdb = { git = "https://github.com/paritytech/parity-common" }
hashdb = "0.2.1"
tiny-keccak = "1.4"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions substrate/executor/src/wasm_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl_function_executor!(this: FunctionExecutor<'e, E>,
.map_err(|_| UserError("Invalid attempt to get memory in ext_enumerated_trie_root"))
)
.collect::<::std::result::Result<Vec<_>, UserError>>()?;
let r = ordered_trie_root(values.into_iter());
let r = ordered_trie_root::<KeccakHasher, _, _>(values.into_iter());
this.memory.set(result, &r[..]).map_err(|_| UserError("Invalid attempt to set memory in ext_enumerated_trie_root"))?;
Ok(())
},
Expand Down Expand Up @@ -740,7 +740,7 @@ mod tests {
let test_code = include_bytes!("../wasm/target/wasm32-unknown-unknown/release/runtime_test.compact.wasm");
assert_eq!(
WasmExecutor::new().call(&mut ext, 8, &test_code[..], "test_enumerated_trie_root", &[]).unwrap(),
ordered_trie_root(vec![b"zero".to_vec(), b"one".to_vec(), b"two".to_vec()]).0.encode()
ordered_trie_root::<KeccakHasher, _, _>(vec![b"zero".to_vec(), b"one".to_vec(), b"two".to_vec()]).0.encode()
);
}

Expand Down
29 changes: 15 additions & 14 deletions substrate/executor/wasm/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 substrate/keystore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]

[dependencies]
parity-crypto = { git = "https://github.com/paritytech/parity-common.git", default_features = false }
parity-crypto = { version = "0.1", default_features = false }
ed25519 = { path = "../ed25519" }
error-chain = "0.12"
hex = "0.3"
Expand Down
2 changes: 1 addition & 1 deletion substrate/network-libp2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ unsigned-varint = { version = "0.2", features = ["codec"] }

[dev-dependencies]
assert_matches = "1.2"
parity-bytes = { git = "https://github.com/paritytech/parity-common.git" }
parity-bytes = "0.1"
ethcore-io = { git = "https://github.com/paritytech/parity.git" }
ethcore-logger = { git = "https://github.com/paritytech/parity.git" }
Loading

0 comments on commit c320bf1

Please sign in to comment.