Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 5 additions & 15 deletions Cargo.lock

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

8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,20 +292,16 @@ Caching, Importing Blocks, and Block Information
```bash
parity-rpc
```
* Parity Ethereum (EthCore) Secret Store
```bash
ethcore-secretstore
```
* Parity Updater Service
```bash
parity-updater parity-hash-fetch
```
* Parity Core Libraries (Parity Util)
```bash
ethcore-bloom-journal blooms-db dir eip-712 fake-fetch fastmap fetch ethcore-io
journaldb keccak-hasher len-caching-lock macros memory-cache memzero
journaldb keccak-hasher len-caching-lock memory-cache memzero
migration-rocksdb ethcore-network ethcore-network-devp2p panic_hook
patricia-trie-ethereum registrar rlp_compress rlp_derive parity-runtime stats
patricia-trie-ethereum registrar rlp_compress parity-runtime stats
time-utils triehash-ethereum unexpected parity-version
```

Expand Down
5 changes: 1 addition & 4 deletions ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ kvdb-memorydb = { version = "0.4.0", optional = true }
kvdb-rocksdb = { version = "0.5.0", optional = true }
lazy_static = { version = "1.3", optional = true }
log = "0.4"
macros = { path = "../util/macros", optional = true }
machine = { path = "./machine" }
memory-cache = { path = "../util/memory-cache" }
parity-bytes = "0.1"
Expand Down Expand Up @@ -82,7 +81,6 @@ kvdb-memorydb = "0.4.0"
kvdb-rocksdb = "0.5.0"
lazy_static = "1.3"
machine = { path = "./machine", features = ["test-helpers"] }
macros = { path = "../util/macros" }
parity-runtime = "0.1.1"
serde_json = "1.0"
stats = { path = "../util/stats" }
Expand All @@ -91,7 +89,7 @@ tempdir = "0.3"
trie-standardmap = "0.15.0"

[features]
parity = ["work-notify", "price-info", "stratum", "macros"]
parity = ["work-notify", "price-info", "stratum"]
# Large optional features that are enabled by default for Parity,
# but might be omitted for other dependent crates.
work-notify = ["ethcore-miner/work-notify"]
Expand Down Expand Up @@ -127,7 +125,6 @@ test-helpers = [
"parity-crypto",
"kvdb-memorydb",
"kvdb-rocksdb",
"macros",
"pod",
"tempdir",
"basic-authority/test-helpers"
Expand Down
2 changes: 1 addition & 1 deletion ethcore/builtin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ parity-crypto = { version = "0.5.0", features = ["publickey"] }

[dev-dependencies]
hex-literal = "0.2.1"
macros = { path = "../../util/macros" }
maplit = "1.0.2"
32 changes: 16 additions & 16 deletions ethcore/builtin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,18 +759,18 @@ mod tests {
PricingAt, AltBn128Pairing as JsonAltBn128PairingPricing, Pricing as JsonPricing,
};
use hex_literal::hex;
use macros::map;
use maplit::btreemap;
use num::{BigUint, Zero, One};
use parity_bytes::BytesRef;
use super::{
BTreeMap, Builtin, EthereumBuiltin, FromStr, Implementation, Linear,
Builtin, EthereumBuiltin, FromStr, Implementation, Linear,
ModexpPricer, modexp as me, Pricing
};

#[test]
fn blake2f_cost() {
let f = Builtin {
pricer: map![0 => Pricing::Blake2F(123)],
pricer: btreemap![0 => Pricing::Blake2F(123)],
native: EthereumBuiltin::from_str("blake2_f").unwrap(),
};
// 5 rounds
Expand All @@ -784,7 +784,7 @@ mod tests {
#[test]
fn blake2f_cost_on_invalid_length() {
let f = Builtin {
pricer: map![0 => Pricing::Blake2F(123)],
pricer: btreemap![0 => Pricing::Blake2F(123)],
native: EthereumBuiltin::from_str("blake2_f").expect("known builtin"),
};
// invalid input (too short)
Expand Down Expand Up @@ -1031,7 +1031,7 @@ mod tests {
#[test]
fn modexp() {
let f = Builtin {
pricer: map![0 => Pricing::Modexp(ModexpPricer { divisor: 20 })],
pricer: btreemap![0 => Pricing::Modexp(ModexpPricer { divisor: 20 })],
native: EthereumBuiltin::from_str("modexp").unwrap(),
};

Expand Down Expand Up @@ -1141,7 +1141,7 @@ mod tests {
fn bn128_add() {

let f = Builtin {
pricer: map![0 => Pricing::Linear(Linear { base: 0, word: 0 })],
pricer: btreemap![0 => Pricing::Linear(Linear { base: 0, word: 0 })],
native: EthereumBuiltin::from_str("alt_bn128_add").unwrap(),
};

Expand Down Expand Up @@ -1199,7 +1199,7 @@ mod tests {
fn bn128_mul() {

let f = Builtin {
pricer: map![0 => Pricing::Linear(Linear { base: 0, word: 0 })],
pricer: btreemap![0 => Pricing::Linear(Linear { base: 0, word: 0 })],
native: EthereumBuiltin::from_str("alt_bn128_mul").unwrap(),
};

Expand Down Expand Up @@ -1238,7 +1238,7 @@ mod tests {

fn builtin_pairing() -> Builtin {
Builtin {
pricer: map![0 => Pricing::Linear(Linear { base: 0, word: 0 })],
pricer: btreemap![0 => Pricing::Linear(Linear { base: 0, word: 0 })],
native: EthereumBuiltin::from_str("alt_bn128_pairing").unwrap(),
}
}
Expand Down Expand Up @@ -1317,7 +1317,7 @@ mod tests {
fn is_active() {
let pricer = Pricing::Linear(Linear { base: 10, word: 20 });
let b = Builtin {
pricer: map![100_000 => pricer],
pricer: btreemap![100_000 => pricer],
native: EthereumBuiltin::from_str("identity").unwrap(),
};

Expand All @@ -1330,7 +1330,7 @@ mod tests {
fn from_named_linear() {
let pricer = Pricing::Linear(Linear { base: 10, word: 20 });
let b = Builtin {
pricer: map![0 => pricer],
pricer: btreemap![0 => pricer],
native: EthereumBuiltin::from_str("identity").unwrap(),
};

Expand All @@ -1349,7 +1349,7 @@ mod tests {
fn from_json() {
let b = Builtin::try_from(ethjson::spec::Builtin {
name: "identity".to_owned(),
pricing: map![
pricing: btreemap![
0 => PricingAt {
info: None,
price: JsonPricing::Linear(JsonLinearPricing { base: 10, word: 20 })
Expand All @@ -1372,7 +1372,7 @@ mod tests {
fn bn128_pairing_eip1108_transition() {
let b = Builtin::try_from(JsonBuiltin {
name: "alt_bn128_pairing".to_owned(),
pricing: map![
pricing: btreemap![
10 => PricingAt {
info: None,
price: JsonPricing::AltBn128Pairing(JsonAltBn128PairingPricing {
Expand All @@ -1398,7 +1398,7 @@ mod tests {
fn bn128_add_eip1108_transition() {
let b = Builtin::try_from(JsonBuiltin {
name: "alt_bn128_add".to_owned(),
pricing: map![
pricing: btreemap![
10 => PricingAt {
info: None,
price: JsonPricing::Linear(JsonLinearPricing {
Expand All @@ -1424,7 +1424,7 @@ mod tests {
fn bn128_mul_eip1108_transition() {
let b = Builtin::try_from(JsonBuiltin {
name: "alt_bn128_mul".to_owned(),
pricing: map![
pricing: btreemap![
10 => PricingAt {
info: None,
price: JsonPricing::Linear(JsonLinearPricing {
Expand All @@ -1451,7 +1451,7 @@ mod tests {
fn multimap_use_most_recent_on_activate() {
let b = Builtin::try_from(JsonBuiltin {
name: "alt_bn128_mul".to_owned(),
pricing: map![
pricing: btreemap![
10 => PricingAt {
info: None,
price: JsonPricing::Linear(JsonLinearPricing {
Expand Down Expand Up @@ -1489,7 +1489,7 @@ mod tests {
fn multimap_use_last_with_same_activate_at() {
let b = Builtin::try_from(JsonBuiltin {
name: "alt_bn128_mul".to_owned(),
pricing: map![
pricing: btreemap![
1 => PricingAt {
info: None,
price: JsonPricing::Linear(JsonLinearPricing {
Expand Down
1 change: 0 additions & 1 deletion ethcore/engines/authority-round/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ lazy_static = "1.3.0"
log = "0.4"
lru-cache = "0.1"
machine = { path = "../../machine" }
macros = { path = "../../../util/macros" }
parity-bytes = "0.1"
parking_lot = "0.10.0"
rand = "0.7"
Expand Down
28 changes: 12 additions & 16 deletions ethcore/engines/authority-round/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,10 @@ use client_traits::{EngineClient, ForceUpdateSealing, TransactionRequest};
use engine::{Engine, ConstructedVerifier};
use block_gas_limit::block_gas_limit;
use block_reward::{self, BlockRewardContract, RewardKind};
use ethjson;
use machine::{
ExecutedBlock,
Machine,
};
use macros::map;
use keccak_hash::keccak;
use log::{info, debug, error, trace, warn};
use lru_cache::LruCache;
Expand Down Expand Up @@ -1277,22 +1275,20 @@ impl Engine for AuthorityRound {
.map(ToString::to_string)
.unwrap_or_default();

let mut info = map![
"step".into() => step,
"signature".into() => signature
];
let mut info = BTreeMap::new();
info.insert("step".into(), step);
info.insert("signature".into(), signature);

if header.number() >= self.empty_steps_transition {
let empty_steps =
if let Ok(empty_steps) = header_empty_steps(header).as_ref() {
format!("[{}]",
empty_steps.iter().fold(
"".to_string(),
|acc, e| if acc.len() > 0 { acc + ","} else { acc } + &e.to_string()))

} else {
"".into()
};
let empty_steps = header_empty_steps(header).as_ref().map_or(String::new(), |empty_steps| {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is also unrelated, I found this piece very hard to read especially the fold

format!("[{}]", empty_steps.iter().fold(String::new(), |mut acc, e| {
if !acc.is_empty() {
acc.push(',');
}
acc.push_str(&e.to_string());
acc
}))
});

info.insert("emptySteps".into(), empty_steps);
}
Expand Down
1 change: 0 additions & 1 deletion ethcore/engines/clique/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ lazy_static = "1.3.0"
log = "0.4"
lru-cache = "0.1"
machine = { path = "../../machine" }
macros = { path = "../../../util/macros" }
rand = "0.7"
parking_lot = "0.10.0"
rlp = "0.4.0"
Expand Down
12 changes: 5 additions & 7 deletions ethcore/engines/clique/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ use machine::{
ExecutedBlock,
Machine,
};
use macros::map;
use parking_lot::RwLock;
use rand::Rng;
use unexpected::{Mismatch, OutOfBounds};
Expand Down Expand Up @@ -379,13 +378,12 @@ impl Engine for Clique {

fn extra_info(&self, header: &Header) -> BTreeMap<String, String> {
// clique engine seal fields are the same as ethash seal fields
match EthashSeal::parse_seal(header.seal()) {
Ok(seal) => map![
"nonce".to_owned() => format!("{:#x}", seal.nonce),
"mixHash".to_owned() => format!("{:#x}", seal.mix_hash)
],
_ => BTreeMap::default()
let mut engine_info = BTreeMap::new();
if let Ok(seal) = EthashSeal::parse_seal(header.seal()) {
engine_info.insert("nonce".to_string(), format!("{:#x}", seal.nonce));
engine_info.insert("mixHash".to_string(), format!("{:#x}", seal.mix_hash));
}
engine_info
}

fn maximum_uncle_count(&self, _block: BlockNumber) -> usize { 0 }
Expand Down
Loading