[stable] Backports (#8352)
* Update musicoin spec in line with gmc v2.6.2 (#8242) * Supress TemporaryInvalid verification failures. (#8256) * Include suicided accounts in state diff (#8297) * Include suicided accounts in state diff * Shorten form match -> if let * Test suicide trace diff in State * replace_home for password_files, reserved_peers and log_file (#8324) * replace_home for password_files, reserved_peers and log_file * typo: arg_log_file is Option * Bump version in util/version
This commit is contained in:
parent
e6273039c8
commit
fdacb9b649
@ -10,9 +10,9 @@
|
||||
"homesteadTransition":"0x118c30",
|
||||
"eip100bTransition":"0x21e88e",
|
||||
"eip150Transition":"0x21e88e",
|
||||
"eip160Transition":"0x7fffffffffffff",
|
||||
"eip161abcTransition":"0x7fffffffffffff",
|
||||
"eip161dTransition":"0x7fffffffffffff",
|
||||
"eip160Transition":"0x21e88e",
|
||||
"eip161abcTransition":"0x21e88e",
|
||||
"eip161dTransition":"0x21e88e",
|
||||
"eip649Transition":"0x21e88e",
|
||||
"blockReward":"0x1105a0185b50a80000",
|
||||
"mcip3Transition":"0x124f81",
|
||||
@ -40,8 +40,7 @@
|
||||
"eip211Transition":"0x21e88e",
|
||||
"eip214Transition":"0x21e88e",
|
||||
"eip658Transition":"0x21e88e",
|
||||
"maxCodeSize":"0x6000",
|
||||
"maxCodeSizeTransition": "0x7fffffffffffff"
|
||||
"maxCodeSize":"0x6000"
|
||||
},
|
||||
"genesis":{
|
||||
"seal":{
|
||||
|
@ -833,16 +833,26 @@ impl<B: Backend> State<B> {
|
||||
}))
|
||||
}
|
||||
|
||||
fn query_pod(&mut self, query: &PodState) -> trie::Result<()> {
|
||||
for (address, pod_account) in query.get() {
|
||||
// Return a list of all touched addresses in cache.
|
||||
fn touched_addresses(&self) -> Vec<Address> {
|
||||
assert!(self.checkpoints.borrow().is_empty());
|
||||
self.cache.borrow().iter().map(|(add, _)| *add).collect()
|
||||
}
|
||||
|
||||
fn query_pod(&mut self, query: &PodState, touched_addresses: &[Address]) -> trie::Result<()> {
|
||||
let pod = query.get();
|
||||
|
||||
for address in touched_addresses {
|
||||
if !self.ensure_cached(address, RequireCache::Code, true, |a| a.is_some())? {
|
||||
continue
|
||||
}
|
||||
|
||||
// needs to be split into two parts for the refcell code here
|
||||
// to work.
|
||||
for key in pod_account.storage.keys() {
|
||||
self.storage_at(address, key)?;
|
||||
if let Some(pod_account) = pod.get(address) {
|
||||
// needs to be split into two parts for the refcell code here
|
||||
// to work.
|
||||
for key in pod_account.storage.keys() {
|
||||
self.storage_at(address, key)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -852,9 +862,10 @@ impl<B: Backend> State<B> {
|
||||
/// Returns a `StateDiff` describing the difference from `orig` to `self`.
|
||||
/// Consumes self.
|
||||
pub fn diff_from<X: Backend>(&self, orig: State<X>) -> trie::Result<StateDiff> {
|
||||
let addresses_post = self.touched_addresses();
|
||||
let pod_state_post = self.to_pod();
|
||||
let mut state_pre = orig;
|
||||
state_pre.query_pod(&pod_state_post)?;
|
||||
state_pre.query_pod(&pod_state_post, &addresses_post)?;
|
||||
Ok(pod_state::diff_pod(&state_pre.to_pod(), &pod_state_post))
|
||||
}
|
||||
|
||||
@ -2182,4 +2193,37 @@ mod tests {
|
||||
assert!(state.exists(&d).unwrap());
|
||||
assert!(!state.exists(&e).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_trace_diff_suicided_accounts() {
|
||||
use pod_account;
|
||||
|
||||
let a = 10.into();
|
||||
let db = get_temp_state_db();
|
||||
let (root, db) = {
|
||||
let mut state = State::new(db, U256::from(0), Default::default());
|
||||
state.add_balance(&a, &100.into(), CleanupMode::ForceCreate).unwrap();
|
||||
state.commit().unwrap();
|
||||
state.drop()
|
||||
};
|
||||
|
||||
let mut state = State::from_existing(db, root, U256::from(0u8), Default::default()).unwrap();
|
||||
let original = state.clone();
|
||||
state.kill_account(&a);
|
||||
|
||||
assert_eq!(original.touched_addresses(), vec![]);
|
||||
assert_eq!(state.touched_addresses(), vec![a]);
|
||||
|
||||
let diff = state.diff_from(original).unwrap();
|
||||
let diff_map = diff.get();
|
||||
assert_eq!(diff_map.len(), 1);
|
||||
assert!(diff_map.get(&a).is_some());
|
||||
assert_eq!(diff_map.get(&a),
|
||||
pod_account::diff_pod(Some(&PodAccount {
|
||||
balance: U256::from(100),
|
||||
nonce: U256::zero(),
|
||||
code: Some(Default::default()),
|
||||
storage: Default::default()
|
||||
}), None).as_ref());
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ pub mod blocks {
|
||||
use super::{Kind, BlockLike};
|
||||
|
||||
use engines::EthEngine;
|
||||
use error::Error;
|
||||
use error::{Error, BlockError};
|
||||
use header::Header;
|
||||
use verification::{PreverifiedBlock, verify_block_basic, verify_block_unordered};
|
||||
|
||||
@ -90,6 +90,10 @@ pub mod blocks {
|
||||
fn create(input: Self::Input, engine: &EthEngine) -> Result<Self::Unverified, Error> {
|
||||
match verify_block_basic(&input.header, &input.bytes, engine) {
|
||||
Ok(()) => Ok(input),
|
||||
Err(Error::Block(BlockError::TemporarilyInvalid(oob))) => {
|
||||
debug!(target: "client", "Block received too early {}: {:?}", input.hash(), oob);
|
||||
Err(BlockError::TemporarilyInvalid(oob).into())
|
||||
},
|
||||
Err(e) => {
|
||||
warn!(target: "client", "Stage 1 block verification failed for {}: {:?}", input.hash(), e);
|
||||
Err(e)
|
||||
|
@ -145,7 +145,7 @@ impl Configuration {
|
||||
if self.args.cmd_signer_new_token {
|
||||
Cmd::SignerToken(ws_conf, ui_conf, logger_config.clone())
|
||||
} else if self.args.cmd_signer_sign {
|
||||
let pwfile = self.args.arg_password.first().map(|pwfile| {
|
||||
let pwfile = self.accounts_config()?.password_files.first().map(|pwfile| {
|
||||
PathBuf::from(pwfile)
|
||||
});
|
||||
Cmd::SignerSign {
|
||||
@ -182,7 +182,7 @@ impl Configuration {
|
||||
iterations: self.args.arg_keys_iterations,
|
||||
path: dirs.keys,
|
||||
spec: spec,
|
||||
password_file: self.args.arg_password.first().map(|x| x.to_owned()),
|
||||
password_file: self.accounts_config()?.password_files.first().map(|x| x.to_owned()),
|
||||
};
|
||||
AccountCmd::New(new_acc)
|
||||
} else if self.args.cmd_account_list {
|
||||
@ -216,8 +216,8 @@ impl Configuration {
|
||||
iterations: self.args.arg_keys_iterations,
|
||||
path: dirs.keys,
|
||||
spec: spec,
|
||||
wallet_path: self.args.arg_wallet_import_path.unwrap().clone(),
|
||||
password_file: self.args.arg_password.first().map(|x| x.to_owned()),
|
||||
wallet_path: self.args.arg_wallet_import_path.clone().unwrap(),
|
||||
password_file: self.accounts_config()?.password_files.first().map(|x| x.to_owned()),
|
||||
};
|
||||
Cmd::ImportPresaleWallet(presale_cmd)
|
||||
} else if self.args.cmd_import {
|
||||
@ -440,7 +440,7 @@ impl Configuration {
|
||||
LogConfig {
|
||||
mode: self.args.arg_logging.clone(),
|
||||
color: !self.args.flag_no_color && !cfg!(windows),
|
||||
file: self.args.arg_log_file.clone(),
|
||||
file: self.args.arg_log_file.as_ref().map(|log_file| replace_home(&self.directories().base, log_file)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ impl Configuration {
|
||||
iterations: self.args.arg_keys_iterations,
|
||||
refresh_time: self.args.arg_accounts_refresh,
|
||||
testnet: self.args.flag_testnet,
|
||||
password_files: self.args.arg_password.clone(),
|
||||
password_files: self.args.arg_password.iter().map(|s| replace_home(&self.directories().base, s)).collect(),
|
||||
unlocked_accounts: to_addresses(&self.args.arg_unlock)?,
|
||||
enable_hardware_wallets: !self.args.flag_no_hardware_wallets,
|
||||
enable_fast_unlock: self.args.flag_fast_unlock,
|
||||
@ -704,8 +704,10 @@ impl Configuration {
|
||||
|
||||
match self.args.arg_reserved_peers {
|
||||
Some(ref path) => {
|
||||
let path = replace_home(&self.directories().base, path);
|
||||
|
||||
let mut buffer = String::new();
|
||||
let mut node_file = File::open(path).map_err(|e| format!("Error opening reserved nodes file: {}", e))?;
|
||||
let mut node_file = File::open(&path).map_err(|e| format!("Error opening reserved nodes file: {}", e))?;
|
||||
node_file.read_to_string(&mut buffer).map_err(|_| "Error reading reserved node file")?;
|
||||
let lines = buffer.lines().map(|s| s.trim().to_owned()).filter(|s| !s.is_empty() && !s.starts_with("#")).collect::<Vec<_>>();
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
[package]
|
||||
name = "parity-version"
|
||||
# NOTE: this value is used for Parity version string.
|
||||
version = "1.9.5"
|
||||
version = "1.9.6"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
build = "build.rs"
|
||||
|
||||
@ -13,7 +13,7 @@ build = "build.rs"
|
||||
track = "stable"
|
||||
|
||||
# Indicates a critical release in this track (i.e. consensus issue)
|
||||
critical = true
|
||||
critical = false
|
||||
|
||||
# Latest supported fork blocks for various networks. Used ONLY by auto-updater.
|
||||
[package.metadata.forks]
|
||||
|
Loading…
Reference in New Issue
Block a user