Skip to content
This repository was archived by the owner on Oct 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions benchmark/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,20 @@ fn main() {
.takes_value(true)
.default_value("1"),
)
.arg(Arg::with_name("v")
.short("v")
.multiple(true)
.help("Sets the level of verbosity"))
.get_matches();

// Initialize logger.
pretty_env_logger::formatted_builder()
.unwrap()
.filter(None, LevelFilter::Info)
.init();
.filter( None, match args.occurrences_of("v") {
0 => LevelFilter::Info,
1 => LevelFilter::Debug,
_ => LevelFilter::max(),
}).init();

let host = value_t!(args, "host", String).unwrap();
let port = value_t!(args, "port", String).unwrap();
Expand Down
12 changes: 11 additions & 1 deletion gateway/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,20 @@ fn main() {
.default_value("1")
.takes_value(true),
)
.arg(Arg::with_name("v")
.short("v")
.multiple(true)
.help("Sets the level of verbosity"))
.get_matches();

// reset max log level to Info after default_app macro sets it to Trace
log::set_max_level(LevelFilter::Info);
log::set_max_level(match args.occurrences_of("v") {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make sure that a corresponding change goes in to https://github.com/oasislabs/private-ops/blob/master/k8s/ekiden/templates/gateway.yaml to set the level to debug for testnet deployments.

0 => LevelFilter::Error,
1 => LevelFilter::Info,
2 => LevelFilter::Debug,
3 => LevelFilter::Trace,
_ => LevelFilter::max(),
});

// Initialize component container.
let container = known_components
Expand Down
8 changes: 7 additions & 1 deletion gateway/src/impls/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ use jsonrpc_core::futures::future;
use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_macros::Trailing;

use log;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes


use parity_rpc::v1::helpers::{errors, fake_sign, limit_logs};
use parity_rpc::v1::metadata::Metadata;
use parity_rpc::v1::traits::Eth;
Expand Down Expand Up @@ -575,7 +577,11 @@ impl Eth for EthClient {
fn send_raw_transaction(&self, raw: Bytes) -> Result<RpcH256> {
measure_counter_inc!("sendRawTransaction");
measure_histogram_timer!("sendRawTransaction_time");
info!("eth_sendRawTransaction(data: {:?})", raw);
if log_enabled!(log::Level::Debug) {
debug!("eth_sendRawTransaction(data: {:?})", raw);
} else {
info!("eth_sendRawTransaction(data: ...)");
}
self.client
.send_raw_transaction(raw.into())
.map(Into::into)
Expand Down
20 changes: 10 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ fn get_block_hash(id: &BlockId) -> Result<Option<H256>> {
}

fn get_block(id: &BlockId) -> Result<Option<Vec<u8>>> {
info!("get_block, id: {:?}", id);
debug!("get_block, id: {:?}", id);

let block = match *id {
BlockId::Hash(hash) => block_by_hash(hash),
Expand All @@ -157,42 +157,42 @@ fn get_block(id: &BlockId) -> Result<Option<Vec<u8>>> {
}

fn get_logs(filter: &Filter) -> Result<Vec<Log>> {
info!("get_logs, filter: {:?}", filter);
debug!("get_logs, filter: {:?}", filter);
Ok(state::get_logs(filter))
}

pub fn get_transaction(hash: &H256) -> Result<Option<Transaction>> {
info!("get_transaction, hash: {:?}", hash);
debug!("get_transaction, hash: {:?}", hash);
Ok(state::get_transaction(hash))
}

pub fn get_receipt(hash: &H256) -> Result<Option<Receipt>> {
info!("get_receipt, hash: {:?}", hash);
debug!("get_receipt, hash: {:?}", hash);
Ok(state::get_receipt(hash))
}

pub fn get_account_balance(address: &Address) -> Result<U256> {
info!("get_account_balance, address: {:?}", address);
debug!("get_account_balance, address: {:?}", address);
state::get_account_balance(address)
}

pub fn get_account_nonce(address: &Address) -> Result<U256> {
info!("get_account_nonce, address: {:?}", address);
debug!("get_account_nonce, address: {:?}", address);
state::get_account_nonce(address)
}

pub fn get_account_code(address: &Address) -> Result<Option<Vec<u8>>> {
info!("get_account_code, address: {:?}", address);
debug!("get_account_code, address: {:?}", address);
state::get_account_code(address)
}

pub fn get_storage_at(pair: &(Address, H256)) -> Result<H256> {
info!("get_storage_at, address: {:?}", pair);
debug!("get_storage_at, address: {:?}", pair);
state::get_account_storage(pair.0, pair.1)
}

pub fn execute_raw_transaction(request: &Vec<u8>) -> Result<ExecuteTransactionResponse> {
info!("execute_raw_transaction");
debug!("execute_raw_transaction");
let decoded: UnverifiedTransaction = match rlp::decode(request) {
Ok(t) => t,
Err(e) => {
Expand Down Expand Up @@ -256,7 +256,7 @@ fn make_unsigned_transaction(request: &TransactionRequest) -> Result<SignedTrans
}

pub fn simulate_transaction(request: &TransactionRequest) -> Result<SimulateTransactionResponse> {
info!("simulate_transaction");
debug!("simulate_transaction");
let tx = match make_unsigned_transaction(request) {
Ok(t) => t,
Err(e) => {
Expand Down
2 changes: 1 addition & 1 deletion src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub(crate) fn new_block() -> Result<OpenBlock<'static>> {
Ok(OpenBlock::new(
&*SPEC.engine,
Default::default(), /* factories */
false, /* tracing */
cfg!(debug_assertions), /* tracing */
get_backend(), /* state_db */
&parent, /* parent */
last_hashes(&parent.hash()), /* last hashes */
Expand Down
Loading