use basic_account in snapshot
This commit is contained in:
parent
eb2b1ad5da
commit
5d2cf22ef4
@ -17,16 +17,17 @@
|
|||||||
//! Account state encoding and decoding
|
//! Account state encoding and decoding
|
||||||
|
|
||||||
use account_db::{AccountDB, AccountDBMut};
|
use account_db::{AccountDB, AccountDBMut};
|
||||||
|
use basic_account::BasicAccount;
|
||||||
use snapshot::Error;
|
use snapshot::Error;
|
||||||
|
|
||||||
use util::{U256, FixedHash, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP};
|
use util::{U256, FixedHash, H256, Bytes, HashDB, SHA3_EMPTY, SHA3_NULL_RLP};
|
||||||
use util::trie::{TrieDB, Trie};
|
use util::trie::{TrieDB, Trie};
|
||||||
use rlp::{Rlp, RlpStream, Stream, UntrustedRlp, View};
|
use rlp::{RlpStream, Stream, UntrustedRlp, View};
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
// An empty account -- these are replaced with RLP null data for a space optimization.
|
// An empty account -- these are replaced with RLP null data for a space optimization.
|
||||||
const ACC_EMPTY: Account = Account {
|
const ACC_EMPTY: BasicAccount = BasicAccount {
|
||||||
nonce: U256([0, 0, 0, 0]),
|
nonce: U256([0, 0, 0, 0]),
|
||||||
balance: U256([0, 0, 0, 0]),
|
balance: U256([0, 0, 0, 0]),
|
||||||
storage_root: SHA3_NULL_RLP,
|
storage_root: SHA3_NULL_RLP,
|
||||||
@ -59,48 +60,14 @@ impl CodeState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// An alternate account structure from ::account::Account.
|
|
||||||
#[derive(PartialEq, Clone, Debug)]
|
|
||||||
pub struct Account {
|
|
||||||
nonce: U256,
|
|
||||||
balance: U256,
|
|
||||||
storage_root: H256,
|
|
||||||
code_hash: H256,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Account {
|
|
||||||
// decode the account from rlp.
|
|
||||||
pub fn from_thin_rlp(rlp: &[u8]) -> Self {
|
|
||||||
let r: Rlp = Rlp::new(rlp);
|
|
||||||
|
|
||||||
Account {
|
|
||||||
nonce: r.val_at(0),
|
|
||||||
balance: r.val_at(1),
|
|
||||||
storage_root: r.val_at(2),
|
|
||||||
code_hash: r.val_at(3),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// encode the account to a standard rlp.
|
|
||||||
pub fn to_thin_rlp(&self) -> Bytes {
|
|
||||||
let mut stream = RlpStream::new_list(4);
|
|
||||||
stream
|
|
||||||
.append(&self.nonce)
|
|
||||||
.append(&self.balance)
|
|
||||||
.append(&self.storage_root)
|
|
||||||
.append(&self.code_hash);
|
|
||||||
|
|
||||||
stream.out()
|
|
||||||
}
|
|
||||||
|
|
||||||
// walk the account's storage trie, returning an RLP item containing the
|
// walk the account's storage trie, returning an RLP item containing the
|
||||||
// account properties and the storage.
|
// account properties and the storage.
|
||||||
pub fn to_fat_rlp(&self, acct_db: &AccountDB, used_code: &mut HashSet<H256>) -> Result<Bytes, Error> {
|
pub fn to_fat_rlp(acc: &BasicAccount, acct_db: &AccountDB, used_code: &mut HashSet<H256>) -> Result<Bytes, Error> {
|
||||||
if self == &ACC_EMPTY {
|
if acc == &ACC_EMPTY {
|
||||||
return Ok(::rlp::NULL_RLP.to_vec());
|
return Ok(::rlp::NULL_RLP.to_vec());
|
||||||
}
|
}
|
||||||
|
|
||||||
let db = TrieDB::new(acct_db, &self.storage_root)?;
|
let db = TrieDB::new(acct_db, &acc.storage_root)?;
|
||||||
|
|
||||||
let mut pairs = Vec::new();
|
let mut pairs = Vec::new();
|
||||||
|
|
||||||
@ -118,18 +85,18 @@ impl Account {
|
|||||||
let pairs_rlp = stream.out();
|
let pairs_rlp = stream.out();
|
||||||
|
|
||||||
let mut account_stream = RlpStream::new_list(5);
|
let mut account_stream = RlpStream::new_list(5);
|
||||||
account_stream.append(&self.nonce)
|
account_stream.append(&acc.nonce)
|
||||||
.append(&self.balance);
|
.append(&acc.balance);
|
||||||
|
|
||||||
// [has_code, code_hash].
|
// [has_code, code_hash].
|
||||||
if self.code_hash == SHA3_EMPTY {
|
if acc.code_hash == SHA3_EMPTY {
|
||||||
account_stream.append(&CodeState::Empty.raw()).append_empty_data();
|
account_stream.append(&CodeState::Empty.raw()).append_empty_data();
|
||||||
} else if used_code.contains(&self.code_hash) {
|
} else if used_code.contains(&acc.code_hash) {
|
||||||
account_stream.append(&CodeState::Hash.raw()).append(&self.code_hash);
|
account_stream.append(&CodeState::Hash.raw()).append(&acc.code_hash);
|
||||||
} else {
|
} else {
|
||||||
match acct_db.get(&self.code_hash) {
|
match acct_db.get(&acc.code_hash) {
|
||||||
Some(c) => {
|
Some(c) => {
|
||||||
used_code.insert(self.code_hash.clone());
|
used_code.insert(acc.code_hash.clone());
|
||||||
account_stream.append(&CodeState::Inline.raw()).append(&&*c);
|
account_stream.append(&CodeState::Inline.raw()).append(&&*c);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
@ -150,7 +117,7 @@ impl Account {
|
|||||||
pub fn from_fat_rlp(
|
pub fn from_fat_rlp(
|
||||||
acct_db: &mut AccountDBMut,
|
acct_db: &mut AccountDBMut,
|
||||||
rlp: UntrustedRlp,
|
rlp: UntrustedRlp,
|
||||||
) -> Result<(Self, Option<Bytes>), Error> {
|
) -> Result<(BasicAccount, Option<Bytes>), Error> {
|
||||||
use util::{TrieDBMut, TrieMut};
|
use util::{TrieDBMut, TrieMut};
|
||||||
|
|
||||||
// check for special case of empty account.
|
// check for special case of empty account.
|
||||||
@ -194,7 +161,7 @@ impl Account {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let acc = Account {
|
let acc = BasicAccount {
|
||||||
nonce: nonce,
|
nonce: nonce,
|
||||||
balance: balance,
|
balance: balance,
|
||||||
storage_root: storage_root,
|
storage_root: storage_root,
|
||||||
@ -204,20 +171,10 @@ impl Account {
|
|||||||
Ok((acc, new_code))
|
Ok((acc, new_code))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the account's code hash.
|
|
||||||
pub fn code_hash(&self) -> &H256 {
|
|
||||||
&self.code_hash
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
pub fn storage_root_mut(&mut self) -> &mut H256 {
|
|
||||||
&mut self.storage_root
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use account_db::{AccountDB, AccountDBMut};
|
use account_db::{AccountDB, AccountDBMut};
|
||||||
|
use basic_account::BasicAccount;
|
||||||
use tests::helpers::get_temp_state_db;
|
use tests::helpers::get_temp_state_db;
|
||||||
use snapshot::tests::helpers::fill_storage;
|
use snapshot::tests::helpers::fill_storage;
|
||||||
|
|
||||||
@ -227,26 +184,26 @@ mod tests {
|
|||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use super::{ACC_EMPTY, Account};
|
use super::{ACC_EMPTY, to_fat_rlp, from_fat_rlp};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn encoding_basic() {
|
fn encoding_basic() {
|
||||||
let mut db = get_temp_state_db();
|
let mut db = get_temp_state_db();
|
||||||
let addr = Address::random();
|
let addr = Address::random();
|
||||||
|
|
||||||
let account = Account {
|
let account = BasicAccount {
|
||||||
nonce: 50.into(),
|
nonce: 50.into(),
|
||||||
balance: 123456789.into(),
|
balance: 123456789.into(),
|
||||||
storage_root: SHA3_NULL_RLP,
|
storage_root: SHA3_NULL_RLP,
|
||||||
code_hash: SHA3_EMPTY,
|
code_hash: SHA3_EMPTY,
|
||||||
};
|
};
|
||||||
|
|
||||||
let thin_rlp = account.to_thin_rlp();
|
let thin_rlp = ::rlp::encode(&account);
|
||||||
assert_eq!(Account::from_thin_rlp(&thin_rlp), account);
|
assert_eq!(::rlp::decode::<BasicAccount>(&thin_rlp), account);
|
||||||
|
|
||||||
let fat_rlp = account.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
let fat_rlp = to_fat_rlp(&account, &AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
||||||
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
||||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp).unwrap().0, account);
|
assert_eq!(from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp).unwrap().0, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -258,7 +215,7 @@ mod tests {
|
|||||||
let acct_db = AccountDBMut::new(db.as_hashdb_mut(), &addr);
|
let acct_db = AccountDBMut::new(db.as_hashdb_mut(), &addr);
|
||||||
let mut root = SHA3_NULL_RLP;
|
let mut root = SHA3_NULL_RLP;
|
||||||
fill_storage(acct_db, &mut root, &mut H256::zero());
|
fill_storage(acct_db, &mut root, &mut H256::zero());
|
||||||
Account {
|
BasicAccount {
|
||||||
nonce: 25.into(),
|
nonce: 25.into(),
|
||||||
balance: 987654321.into(),
|
balance: 987654321.into(),
|
||||||
storage_root: root,
|
storage_root: root,
|
||||||
@ -266,12 +223,12 @@ mod tests {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let thin_rlp = account.to_thin_rlp();
|
let thin_rlp = ::rlp::encode(&account);
|
||||||
assert_eq!(Account::from_thin_rlp(&thin_rlp), account);
|
assert_eq!(::rlp::decode::<BasicAccount>(&thin_rlp), account);
|
||||||
|
|
||||||
let fat_rlp = account.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
let fat_rlp = to_fat_rlp(&account, &AccountDB::new(db.as_hashdb(), &addr), &mut Default::default()).unwrap();
|
||||||
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
let fat_rlp = UntrustedRlp::new(&fat_rlp);
|
||||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp).unwrap().0, account);
|
assert_eq!(from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr), fat_rlp).unwrap().0, account);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -291,14 +248,14 @@ mod tests {
|
|||||||
acct_db.emplace(code_hash.clone(), DBValue::from_slice(b"this is definitely code"));
|
acct_db.emplace(code_hash.clone(), DBValue::from_slice(b"this is definitely code"));
|
||||||
}
|
}
|
||||||
|
|
||||||
let account1 = Account {
|
let account1 = BasicAccount {
|
||||||
nonce: 50.into(),
|
nonce: 50.into(),
|
||||||
balance: 123456789.into(),
|
balance: 123456789.into(),
|
||||||
storage_root: SHA3_NULL_RLP,
|
storage_root: SHA3_NULL_RLP,
|
||||||
code_hash: code_hash,
|
code_hash: code_hash,
|
||||||
};
|
};
|
||||||
|
|
||||||
let account2 = Account {
|
let account2 = BasicAccount {
|
||||||
nonce: 400.into(),
|
nonce: 400.into(),
|
||||||
balance: 98765432123456789usize.into(),
|
balance: 98765432123456789usize.into(),
|
||||||
storage_root: SHA3_NULL_RLP,
|
storage_root: SHA3_NULL_RLP,
|
||||||
@ -307,18 +264,18 @@ mod tests {
|
|||||||
|
|
||||||
let mut used_code = HashSet::new();
|
let mut used_code = HashSet::new();
|
||||||
|
|
||||||
let fat_rlp1 = account1.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr1), &mut used_code).unwrap();
|
let fat_rlp1 = to_fat_rlp(&account1, &AccountDB::new(db.as_hashdb(), &addr1), &mut used_code).unwrap();
|
||||||
let fat_rlp2 = account2.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &addr2), &mut used_code).unwrap();
|
let fat_rlp2 = to_fat_rlp(&account2, &AccountDB::new(db.as_hashdb(), &addr2), &mut used_code).unwrap();
|
||||||
assert_eq!(used_code.len(), 1);
|
assert_eq!(used_code.len(), 1);
|
||||||
|
|
||||||
let fat_rlp1 = UntrustedRlp::new(&fat_rlp1);
|
let fat_rlp1 = UntrustedRlp::new(&fat_rlp1);
|
||||||
let fat_rlp2 = UntrustedRlp::new(&fat_rlp2);
|
let fat_rlp2 = UntrustedRlp::new(&fat_rlp2);
|
||||||
|
|
||||||
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr2), fat_rlp2).unwrap();
|
let (acc, maybe_code) = from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr2), fat_rlp2).unwrap();
|
||||||
assert!(maybe_code.is_none());
|
assert!(maybe_code.is_none());
|
||||||
assert_eq!(acc, account2);
|
assert_eq!(acc, account2);
|
||||||
|
|
||||||
let (acc, maybe_code) = Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr1), fat_rlp1).unwrap();
|
let (acc, maybe_code) = from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &addr1), fat_rlp1).unwrap();
|
||||||
assert_eq!(maybe_code, Some(b"this is definitely code".to_vec()));
|
assert_eq!(maybe_code, Some(b"this is definitely code".to_vec()));
|
||||||
assert_eq!(acc, account1);
|
assert_eq!(acc, account1);
|
||||||
}
|
}
|
||||||
@ -328,7 +285,7 @@ mod tests {
|
|||||||
let mut db = get_temp_state_db();
|
let mut db = get_temp_state_db();
|
||||||
let mut used_code = HashSet::new();
|
let mut used_code = HashSet::new();
|
||||||
|
|
||||||
assert_eq!(ACC_EMPTY.to_fat_rlp(&AccountDB::new(db.as_hashdb(), &Address::default()), &mut used_code).unwrap(), ::rlp::NULL_RLP.to_vec());
|
assert_eq!(to_fat_rlp(&ACC_EMPTY, &AccountDB::new(db.as_hashdb(), &Address::default()), &mut used_code).unwrap(), ::rlp::NULL_RLP.to_vec());
|
||||||
assert_eq!(Account::from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &Address::default()), UntrustedRlp::new(&::rlp::NULL_RLP)).unwrap(), (ACC_EMPTY, None));
|
assert_eq!(from_fat_rlp(&mut AccountDBMut::new(db.as_hashdb_mut(), &Address::default()), UntrustedRlp::new(&::rlp::NULL_RLP)).unwrap(), (ACC_EMPTY, None));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,6 @@ use util::sha3::SHA3_NULL_RLP;
|
|||||||
use rlp::{RlpStream, Stream, UntrustedRlp, View};
|
use rlp::{RlpStream, Stream, UntrustedRlp, View};
|
||||||
use bloom_journal::Bloom;
|
use bloom_journal::Bloom;
|
||||||
|
|
||||||
use self::account::Account;
|
|
||||||
use self::block::AbridgedBlock;
|
use self::block::AbridgedBlock;
|
||||||
use self::io::SnapshotWriter;
|
use self::io::SnapshotWriter;
|
||||||
|
|
||||||
@ -368,12 +367,12 @@ pub fn chunk_state<'a>(db: &HashDB, root: &H256, writer: &Mutex<SnapshotWriter +
|
|||||||
// account_key here is the address' hash.
|
// account_key here is the address' hash.
|
||||||
for item in account_trie.iter()? {
|
for item in account_trie.iter()? {
|
||||||
let (account_key, account_data) = item?;
|
let (account_key, account_data) = item?;
|
||||||
let account = Account::from_thin_rlp(&*account_data);
|
let account = ::rlp::decode(&*account_data);
|
||||||
let account_key_hash = H256::from_slice(&account_key);
|
let account_key_hash = H256::from_slice(&account_key);
|
||||||
|
|
||||||
let account_db = AccountDB::from_hash(db, account_key_hash);
|
let account_db = AccountDB::from_hash(db, account_key_hash);
|
||||||
|
|
||||||
let fat_rlp = account.to_fat_rlp(&account_db, &mut used_code)?;
|
let fat_rlp = account::to_fat_rlp(&account, &account_db, &mut used_code)?;
|
||||||
chunker.push(account_key, fat_rlp)?;
|
chunker.push(account_key, fat_rlp)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,10 +506,10 @@ fn rebuild_accounts(
|
|||||||
// fill out the storage trie and code while decoding.
|
// fill out the storage trie and code while decoding.
|
||||||
let (acc, maybe_code) = {
|
let (acc, maybe_code) = {
|
||||||
let mut acct_db = AccountDBMut::from_hash(db, hash);
|
let mut acct_db = AccountDBMut::from_hash(db, hash);
|
||||||
Account::from_fat_rlp(&mut acct_db, fat_rlp)?
|
account::from_fat_rlp(&mut acct_db, fat_rlp)?
|
||||||
};
|
};
|
||||||
|
|
||||||
let code_hash = acc.code_hash().clone();
|
let code_hash = acc.code_hash.clone();
|
||||||
match maybe_code {
|
match maybe_code {
|
||||||
// new inline code
|
// new inline code
|
||||||
Some(code) => status.new_code.push((code_hash, code, hash)),
|
Some(code) => status.new_code.push((code_hash, code, hash)),
|
||||||
@ -534,7 +533,7 @@ fn rebuild_accounts(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
acc.to_thin_rlp()
|
::rlp::encode(&acc).to_vec()
|
||||||
};
|
};
|
||||||
|
|
||||||
*out = (hash, thin_rlp);
|
*out = (hash, thin_rlp);
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
//! Snapshot test helpers. These are used to build blockchains and state tries
|
//! Snapshot test helpers. These are used to build blockchains and state tries
|
||||||
//! which can be queried before and after a full snapshot/restore cycle.
|
//! which can be queried before and after a full snapshot/restore cycle.
|
||||||
|
|
||||||
|
use basic_account::BasicAccount;
|
||||||
use account_db::AccountDBMut;
|
use account_db::AccountDBMut;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use snapshot::account::Account;
|
|
||||||
|
|
||||||
use util::DBValue;
|
use util::DBValue;
|
||||||
use util::hash::{FixedHash, H256};
|
use util::hash::{FixedHash, H256};
|
||||||
@ -64,10 +64,10 @@ impl StateProducer {
|
|||||||
|
|
||||||
// sweep once to alter storage tries.
|
// sweep once to alter storage tries.
|
||||||
for &mut (ref mut address_hash, ref mut account_data) in &mut accounts_to_modify {
|
for &mut (ref mut address_hash, ref mut account_data) in &mut accounts_to_modify {
|
||||||
let mut account = Account::from_thin_rlp(&*account_data);
|
let mut account: BasicAccount = ::rlp::decode(&*account_data);
|
||||||
let acct_db = AccountDBMut::from_hash(db, *address_hash);
|
let acct_db = AccountDBMut::from_hash(db, *address_hash);
|
||||||
fill_storage(acct_db, account.storage_root_mut(), &mut self.storage_seed);
|
fill_storage(acct_db, &mut account.storage_root, &mut self.storage_seed);
|
||||||
*account_data = DBValue::from_vec(account.to_thin_rlp());
|
*account_data = DBValue::from_vec(::rlp::encode(&account).to_vec());
|
||||||
}
|
}
|
||||||
|
|
||||||
// sweep again to alter account trie.
|
// sweep again to alter account trie.
|
||||||
|
@ -16,8 +16,9 @@
|
|||||||
|
|
||||||
//! State snapshotting tests.
|
//! State snapshotting tests.
|
||||||
|
|
||||||
|
use basic_account::BasicAccount;
|
||||||
|
use snapshot::account;
|
||||||
use snapshot::{chunk_state, Error as SnapshotError, Progress, StateRebuilder};
|
use snapshot::{chunk_state, Error as SnapshotError, Progress, StateRebuilder};
|
||||||
use snapshot::account::Account;
|
|
||||||
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
use snapshot::io::{PackedReader, PackedWriter, SnapshotReader, SnapshotWriter};
|
||||||
use super::helpers::{compare_dbs, StateProducer};
|
use super::helpers::{compare_dbs, StateProducer};
|
||||||
|
|
||||||
@ -113,22 +114,21 @@ fn get_code_from_prev_chunk() {
|
|||||||
// first one will have code inlined,
|
// first one will have code inlined,
|
||||||
// second will just have its hash.
|
// second will just have its hash.
|
||||||
let thin_rlp = acc_stream.out();
|
let thin_rlp = acc_stream.out();
|
||||||
let acc1 = Account::from_thin_rlp(&thin_rlp);
|
let acc: BasicAccount = ::rlp::decode(&thin_rlp);
|
||||||
let acc2 = Account::from_thin_rlp(&thin_rlp);
|
|
||||||
|
|
||||||
let mut make_chunk = |acc: Account, hash| {
|
let mut make_chunk = |acc, hash| {
|
||||||
let mut db = MemoryDB::new();
|
let mut db = MemoryDB::new();
|
||||||
AccountDBMut::from_hash(&mut db, hash).insert(&code[..]);
|
AccountDBMut::from_hash(&mut db, hash).insert(&code[..]);
|
||||||
|
|
||||||
let fat_rlp = acc.to_fat_rlp(&AccountDB::from_hash(&db, hash), &mut used_code).unwrap();
|
let fat_rlp = account::to_fat_rlp(&acc, &AccountDB::from_hash(&db, hash), &mut used_code).unwrap();
|
||||||
|
|
||||||
let mut stream = RlpStream::new_list(1);
|
let mut stream = RlpStream::new_list(1);
|
||||||
stream.begin_list(2).append(&hash).append_raw(&fat_rlp, 1);
|
stream.begin_list(2).append(&hash).append_raw(&fat_rlp, 1);
|
||||||
stream.out()
|
stream.out()
|
||||||
};
|
};
|
||||||
|
|
||||||
let chunk1 = make_chunk(acc1, h1);
|
let chunk1 = make_chunk(acc.clone(), h1);
|
||||||
let chunk2 = make_chunk(acc2, h2);
|
let chunk2 = make_chunk(acc, h2);
|
||||||
|
|
||||||
let db_path = RandomTempPath::create_dir();
|
let db_path = RandomTempPath::create_dir();
|
||||||
let db_cfg = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
let db_cfg = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||||
|
Loading…
Reference in New Issue
Block a user