Backports for beta (#1628)

* Remove soft-fork stuff.

* Fix tests.

* Fix "pending" parameter on RPC block requests (#1602)

* Initial commit.

* Pending blocks work.

* Address grumbles.

* Fix up for new API.

* Fixed test
This commit is contained in:
Arkadiy Paronyan
2016-07-15 16:44:27 +02:00
committed by GitHub
parent b7caa24c2e
commit 68dfae8f06
31 changed files with 103 additions and 26871 deletions

View File

@@ -45,9 +45,8 @@ Protocol Options:
--fork POLICY Specifies the client's fork policy. POLICY must be
one of:
dogmatic - sticks rigidly to the standard chain.
dao-soft - votes for the DAO-rescue soft-fork.
normal - goes with whatever fork is decided but
votes for none. [default: normal].
none - goes with whatever fork is decided but
votes for none. [default: none].
Account Options:
--unlock ACCOUNTS Unlock ACCOUNTS for the duration of the execution.

View File

@@ -49,8 +49,7 @@ pub struct Directories {
#[derive(Eq, PartialEq, Debug)]
pub enum Policy {
DaoSoft,
Normal,
None,
Dogmatic,
}
@@ -126,33 +125,24 @@ impl Configuration {
pub fn policy(&self) -> Policy {
match self.args.flag_fork.as_str() {
"dao-soft" => Policy::DaoSoft,
"normal" => Policy::Normal,
"none" => Policy::None,
"dogmatic" => Policy::Dogmatic,
x => die!("{}: Invalid value given for --policy option. Use --help for more info.", x)
}
}
pub fn gas_floor_target(&self) -> U256 {
if self.policy() == Policy::DaoSoft {
3_141_592.into()
} else {
let d = &self.args.flag_gas_floor_target;
U256::from_dec_str(d).unwrap_or_else(|_| {
die!("{}: Invalid target gas floor given. Must be a decimal unsigned 256-bit number.", d)
})
}
let d = &self.args.flag_gas_floor_target;
U256::from_dec_str(d).unwrap_or_else(|_| {
die!("{}: Invalid target gas floor given. Must be a decimal unsigned 256-bit number.", d)
})
}
pub fn gas_ceil_target(&self) -> U256 {
if self.policy() == Policy::DaoSoft {
3_141_592.into()
} else {
let d = &self.args.flag_gas_cap;
U256::from_dec_str(d).unwrap_or_else(|_| {
die!("{}: Invalid target gas ceiling given. Must be a decimal unsigned 256-bit number.", d)
})
}
let d = &self.args.flag_gas_cap;
U256::from_dec_str(d).unwrap_or_else(|_| {
die!("{}: Invalid target gas ceiling given. Must be a decimal unsigned 256-bit number.", d)
})
}
pub fn gas_price(&self) -> U256 {
@@ -198,7 +188,7 @@ impl Configuration {
pub fn spec(&self) -> Spec {
match self.chain().as_str() {
"frontier" | "homestead" | "mainnet" => ethereum::new_frontier(self.policy() != Policy::Dogmatic),
"frontier" | "homestead" | "mainnet" => ethereum::new_frontier(),
"morden" | "testnet" => ethereum::new_morden(),
"olympic" => ethereum::new_olympic(),
f => Spec::load(contents(f).unwrap_or_else(|_| {

View File

@@ -97,7 +97,7 @@ use rpc::RpcServer;
use signer::{SignerServer, new_token};
use dapps::WebappServer;
use io_handler::ClientIoHandler;
use configuration::Configuration;
use configuration::{Policy, Configuration};
fn main() {
let conf = Configuration::parse();
@@ -206,6 +206,11 @@ fn execute_client(conf: Configuration, spec: Spec, client_config: ClientConfig)
warn!("NOTE that Signer will not ask you to confirm transactions from unlocked account.");
}
// Check fork settings.
if conf.policy() != Policy::None {
warn!("Value given for --policy, yet no proposed forks exist. Ignoring.");
}
// Secret Store
let account_service = Arc::new(conf.account_service());