Rearrange fork CLI options. (#1476)
* Rearrange fork CLI options. * Fixed compilation
This commit is contained in:
parent
91aee536ca
commit
e3214c63c6
@ -42,14 +42,12 @@ Protocol Options:
|
|||||||
--keys-path PATH Specify the path for JSON key files to be found
|
--keys-path PATH Specify the path for JSON key files to be found
|
||||||
[default: $HOME/.parity/keys].
|
[default: $HOME/.parity/keys].
|
||||||
--identity NAME Specify your node's name.
|
--identity NAME Specify your node's name.
|
||||||
|
--fork POLICY Specifies the client's fork policy. POLICY must be
|
||||||
DAO-Rescue Soft-fork Options:
|
one of:
|
||||||
--help-rescue-dao Does nothing - on by default.
|
dogmatic - sticks rigidly to the standard chain.
|
||||||
--dont-help-rescue-dao Votes against the DAO-rescue soft-fork, but supports
|
dao-soft - votes for the DAO-rescue soft-fork.
|
||||||
it if it is triggered anyway.
|
normal - goes with whatever fork is decided but
|
||||||
Equivalent to --gas-floor-target=3141592.
|
votes for none. [default: normal].
|
||||||
--dogmatic Ignores all DAO-rescue soft-fork behaviour. Even if
|
|
||||||
it means losing mining rewards.
|
|
||||||
|
|
||||||
Account Options:
|
Account Options:
|
||||||
--unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution.
|
--unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution.
|
||||||
@ -157,9 +155,9 @@ Sealing/Mining Options:
|
|||||||
web service in turn and fallback on the last known
|
web service in turn and fallback on the last known
|
||||||
good value [default: auto].
|
good value [default: auto].
|
||||||
--gas-floor-target GAS Amount of gas per block to target when sealing a new
|
--gas-floor-target GAS Amount of gas per block to target when sealing a new
|
||||||
block [default: 3141592].
|
block [default: 4700000].
|
||||||
--gas-cap GAS A cap on how large we will raise the gas limit per
|
--gas-cap GAS A cap on how large we will raise the gas limit per
|
||||||
block due to transaction volume [default: 3141592].
|
block due to transaction volume [default: 6283184].
|
||||||
--extra-data STRING Specify a custom extra-data for authored blocks, no
|
--extra-data STRING Specify a custom extra-data for authored blocks, no
|
||||||
more than 32 characters.
|
more than 32 characters.
|
||||||
--tx-queue-size LIMIT Maximum amount of transactions in the queue (waiting
|
--tx-queue-size LIMIT Maximum amount of transactions in the queue (waiting
|
||||||
@ -262,8 +260,7 @@ pub struct Args {
|
|||||||
pub flag_chain: String,
|
pub flag_chain: String,
|
||||||
pub flag_db_path: String,
|
pub flag_db_path: String,
|
||||||
pub flag_identity: String,
|
pub flag_identity: String,
|
||||||
pub flag_dont_help_rescue_dao: bool,
|
pub flag_fork: String,
|
||||||
pub flag_dogmatic: bool,
|
|
||||||
pub flag_unlock: Option<String>,
|
pub flag_unlock: Option<String>,
|
||||||
pub flag_password: Vec<String>,
|
pub flag_password: Vec<String>,
|
||||||
pub flag_cache: Option<usize>,
|
pub flag_cache: Option<usize>,
|
||||||
|
@ -45,6 +45,13 @@ pub struct Directories {
|
|||||||
pub signer: String,
|
pub signer: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Eq, PartialEq, Debug)]
|
||||||
|
pub enum Policy {
|
||||||
|
DaoSoft,
|
||||||
|
Normal,
|
||||||
|
Dogmatic,
|
||||||
|
}
|
||||||
|
|
||||||
impl Configuration {
|
impl Configuration {
|
||||||
pub fn parse() -> Self {
|
pub fn parse() -> Self {
|
||||||
Configuration {
|
Configuration {
|
||||||
@ -107,9 +114,18 @@ impl Configuration {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn policy(&self) -> Policy {
|
||||||
|
match self.args.flag_fork.as_str() {
|
||||||
|
"dao-soft" => Policy::DaoSoft,
|
||||||
|
"normal" => Policy::Normal,
|
||||||
|
"dogmatic" => Policy::Dogmatic,
|
||||||
|
x => die!("{}: Invalid value given for --policy option. Use --help for more info.", x)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn gas_floor_target(&self) -> U256 {
|
pub fn gas_floor_target(&self) -> U256 {
|
||||||
if self.args.flag_dont_help_rescue_dao || self.args.flag_dogmatic {
|
if self.policy() == Policy::DaoSoft {
|
||||||
4_700_000.into()
|
3_141_592.into()
|
||||||
} else {
|
} else {
|
||||||
let d = &self.args.flag_gas_floor_target;
|
let d = &self.args.flag_gas_floor_target;
|
||||||
U256::from_dec_str(d).unwrap_or_else(|_| {
|
U256::from_dec_str(d).unwrap_or_else(|_| {
|
||||||
@ -119,8 +135,8 @@ impl Configuration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn gas_ceil_target(&self) -> U256 {
|
pub fn gas_ceil_target(&self) -> U256 {
|
||||||
if self.args.flag_dont_help_rescue_dao || self.args.flag_dogmatic {
|
if self.policy() == Policy::DaoSoft {
|
||||||
10_000_000.into()
|
3_141_592.into()
|
||||||
} else {
|
} else {
|
||||||
let d = &self.args.flag_gas_cap;
|
let d = &self.args.flag_gas_cap;
|
||||||
U256::from_dec_str(d).unwrap_or_else(|_| {
|
U256::from_dec_str(d).unwrap_or_else(|_| {
|
||||||
@ -172,7 +188,7 @@ impl Configuration {
|
|||||||
|
|
||||||
pub fn spec(&self) -> Spec {
|
pub fn spec(&self) -> Spec {
|
||||||
match self.chain().as_str() {
|
match self.chain().as_str() {
|
||||||
"frontier" | "homestead" | "mainnet" => ethereum::new_frontier(!self.args.flag_dogmatic),
|
"frontier" | "homestead" | "mainnet" => ethereum::new_frontier(self.policy() != Policy::Dogmatic),
|
||||||
"morden" | "testnet" => ethereum::new_morden(),
|
"morden" | "testnet" => ethereum::new_morden(),
|
||||||
"olympic" => ethereum::new_olympic(),
|
"olympic" => ethereum::new_olympic(),
|
||||||
f => Spec::load(contents(f).unwrap_or_else(|_| {
|
f => Spec::load(contents(f).unwrap_or_else(|_| {
|
||||||
|
Loading…
Reference in New Issue
Block a user