Tracedb interface && cli (#997)

* traces cli and jsonrpc api

* missing if in docs

* adding traces to modules
This commit is contained in:
Marek Kotewicz
2016-05-02 12:17:30 +02:00
committed by Gav Wood
parent e22e4b9b8b
commit 7c2adc4137
15 changed files with 572 additions and 10 deletions

View File

@@ -69,7 +69,7 @@ API and Console Options:
--jsonrpc-apis APIS Specify the APIs available through the JSONRPC
interface. APIS is a comma-delimited list of API
name. Possible name are web3, eth and net.
[default: web3,eth,net,personal,ethcore].
[default: web3,eth,net,personal,ethcore,traces].
-w --webapp Enable the web applications server (e.g.
status page).
--webapp-port PORT Specify the port portion of the WebApps server
@@ -103,6 +103,11 @@ Sealing/Mining Options:
be included in next block) [default: 1024].
Footprint Options:
--tracing BOOL Indicates if full transaction tracing should be
enabled. Works only if client had been fully synced with
tracing enabled. BOOL may be one of auto, on, off.
auto uses last used value of this option (off if it does
not exist) [default: auto].
--pruning METHOD Configure pruning of the state/storage trie. METHOD
may be one of auto, archive, basic, fast, light:
archive - keep all state trie data. No pruning.
@@ -164,6 +169,7 @@ pub struct Args {
pub flag_bootnodes: Option<String>,
pub flag_network_id: Option<String>,
pub flag_pruning: String,
pub flag_tracing: String,
pub flag_port: u16,
pub flag_peers: usize,
pub flag_no_discovery: bool,

View File

@@ -26,7 +26,7 @@ use die::*;
use util::*;
use util::keys::store::AccountService;
use util::network_settings::NetworkSettings;
use ethcore::client::{append_path, get_db_path, ClientConfig};
use ethcore::client::{append_path, get_db_path, ClientConfig, Switch};
use ethcore::ethereum;
use ethcore::spec::Spec;
use ethsync::SyncConfig;
@@ -207,6 +207,12 @@ impl Configuration {
client_config.blockchain.max_cache_size = self.args.flag_cache_max_size;
}
}
client_config.tracing.enabled = match self.args.flag_tracing.as_str() {
"auto" => Switch::Auto,
"on" => Switch::On,
"off" => Switch::Off,
_ => { die!("Invalid tracing method given!") }
};
client_config.pruning = match self.args.flag_pruning.as_str() {
"archive" => journaldb::Algorithm::Archive,
"light" => journaldb::Algorithm::EarlyMerge,

View File

@@ -99,7 +99,7 @@ pub fn setup_rpc_server(
server.add_delegate(Web3Client::new().to_delegate());
},
"net" => {
modules.insert("web3".to_owned(), "1.0".to_owned());
modules.insert("net".to_owned(), "1.0".to_owned());
server.add_delegate(NetClient::new(&deps.sync).to_delegate());
},
"eth" => {
@@ -115,6 +115,10 @@ pub fn setup_rpc_server(
// not adding to modules, since `ethcore` is not supported in geth
server.add_delegate(EthcoreClient::new(&deps.miner, deps.logger.clone(), deps.settings.clone()).to_delegate())
},
"traces" => {
modules.insert("traces".to_owned(), "1.0".to_owned());
server.add_delegate(TracesClient::new(&deps.client).to_delegate())
},
_ => {
die!("{}: Invalid API name to be enabled.", api);
},