Merge branch 'master' into optional-spec
This commit is contained in:
@@ -32,8 +32,10 @@ pub struct Account {
|
||||
pub nonce: Option<Uint>,
|
||||
/// Code.
|
||||
pub code: Option<Bytes>,
|
||||
/// Storage
|
||||
/// Storage.
|
||||
pub storage: Option<BTreeMap<Uint, Uint>>,
|
||||
/// Constructor.
|
||||
pub constructor: Option<Bytes>,
|
||||
}
|
||||
|
||||
impl Account {
|
||||
|
||||
@@ -35,6 +35,10 @@ pub struct Params {
|
||||
/// Network id.
|
||||
#[serde(rename="networkID")]
|
||||
pub network_id: Uint,
|
||||
/// Chain id.
|
||||
#[serde(rename="chainID")]
|
||||
pub chain_id: Option<Uint>,
|
||||
|
||||
/// Name of the main ("eth") subprotocol.
|
||||
#[serde(rename="subprotocolName")]
|
||||
pub subprotocol_name: Option<String>,
|
||||
@@ -58,6 +62,7 @@ mod tests {
|
||||
"homesteadTransition": "0x118c30",
|
||||
"maximumExtraDataSize": "0x20",
|
||||
"networkID" : "0x1",
|
||||
"chainID" : "0x15",
|
||||
"subprotocolName" : "exp",
|
||||
"minGasLimit": "0x1388",
|
||||
"accountStartNonce": "0x00"
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use hash::Address;
|
||||
use bytes::Bytes;
|
||||
use spec::{Account, Builtin};
|
||||
|
||||
/// Blockchain test state deserializer.
|
||||
@@ -29,7 +30,15 @@ impl State {
|
||||
pub fn builtins(&self) -> BTreeMap<Address, Builtin> {
|
||||
self.0
|
||||
.iter()
|
||||
.filter_map(|ref pair| pair.1.builtin.clone().map(|b| (pair.0.clone(), b.clone())))
|
||||
.filter_map(|(add, ref acc)| acc.builtin.clone().map(|b| (add.clone(), b)))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Returns all constructors.
|
||||
pub fn constructors(&self) -> BTreeMap<Address, Bytes> {
|
||||
self.0
|
||||
.iter()
|
||||
.filter_map(|(add, ref acc)| acc.constructor.clone().map(|b| (add.clone(), b)))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user