v2.5.10 stable (#11239)

* ropsten #6631425 foundation #8798209 (#11201)
* [stable] builtin, istanbul and mordor testnet backports (#11234)
  * ethcore-builtin (#10850)
  * [builtin]: support `multiple prices and activations` in chain spec (#11039)
  * [chain specs]: activate `Istanbul` on mainnet (#11228)
  * ethcore/res: add mordor testnet configuration (#11200)
* Update list of bootnodes for xDai chain (#11236)
* ethcore: remove `test-helper feat` from build (#11047)
* Secret store: fix Instant::now() related race in net_keep_alive (#11155) (#11159)
* [stable]: backport #10691 and #10683 (#11143)
  * Fix compiler warning (that will become an error) (#10683)
  * Refactor Clique stepping (#10691)
* Add Constantinople eips to the dev (instant_seal) config (#10809)
* Add cargo-remote dir to .gitignore (?)
* Insert explicit warning into the panic hook (#11225)
* Fix docker centos build (#11226)
* Update MIX bootnodes. (#11203)
* Use provided usd-per-eth value if an endpoint is specified (#11209)
* Add new line after writing block to hex file. (#10984)
* Type annotation for next_key() matching of json filter options (#11192) (but no `FilterOption` in 2.5 so…)
* Upgrade jsonrpc to latest (#11206)
* [CI] check evmbin build (#11096)
* Correct EIP-712 encoding (#11092)
* [client]: Fix for incorrectly dropped consensus messages (#11086)
* Fix block detail updating (#11015)
* Switching sccache from local to Redis (#10971)
* Made ecrecover implementation trait public (#11188)
* [dependencies]: jsonrpc `14.0.1` (#11183)
* [receipt]: add `sender` & `receiver` to `RichReceipts` (#11179)
* [ethcore/builtin]: do not panic in blake2pricer on short input (#11180)
* util Host: fix a double Read Lock bug in fn Host::session_readable() (#11175)
* ethcore client: fix a double Read Lock bug in fn Client::logs() (#11172)
* Change how RPCs eth_call and eth_estimateGas handle "Pending" (#11127)
* Cleanup stratum a bit (#11161)
* Upgrade to jsonrpc v14 (#11151)
* SecretStore: expose restore_key_public in HTTP API (#10241)
This commit is contained in:
Talha Cross
2019-11-11 21:57:38 +01:00
committed by s3krit
parent 5ee54b7298
commit f3cdd7bf21
159 changed files with 12295 additions and 3918 deletions

View File

@@ -35,6 +35,7 @@ use types::transaction::{SignedTransaction, LocalizedTransaction};
use types::BlockNumber as EthBlockNumber;
use types::encoded;
use types::filter::Filter as EthcoreFilter;
use types::header::Header;
use jsonrpc_core::{BoxFuture, Result};
use jsonrpc_core::futures::future;
@@ -432,23 +433,48 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> EthClient<C, SN, S
Ok(Some(block))
}
/// Get state for the given block number. Returns either the State or a block from which state
/// can be retrieved.
/// Note: When passing `BlockNumber::Pending` we fall back to the state of the current best block
/// if no state found for the best pending block.
fn get_state(&self, number: BlockNumber) -> StateOrBlock {
match number {
BlockNumber::Num(num) => BlockId::Number(num).into(),
BlockNumber::Earliest => BlockId::Earliest.into(),
BlockNumber::Latest => BlockId::Latest.into(),
BlockNumber::Pending => {
let info = self.client.chain_info();
self.miner
.pending_state(info.best_block_number)
.map(|s| Box::new(s) as Box<StateInfo>)
.unwrap_or(Box::new(self.client.latest_state()) as Box<StateInfo>)
.map(|s| Box::new(s) as Box<dyn StateInfo>)
.unwrap_or_else(|| {
warn!("Asked for best pending state, but none found. Falling back to latest state");
let (state, _) = self.client.latest_state_and_header();
Box::new(state) as Box<dyn StateInfo>
})
.into()
}
}
}
/// Get the state and header of best pending block. On failure, fall back to the best imported
/// blocks state&header.
fn pending_state_and_header_with_fallback(&self) -> (T, Header) {
let best_block_number = self.client.chain_info().best_block_number;
let (maybe_state, maybe_header) =
self.miner.pending_state(best_block_number).map_or_else(|| (None, None),|s| {
(Some(s), self.miner.pending_block_header(best_block_number))
});
match (maybe_state, maybe_header) {
(Some(state), Some(header)) => (state, header),
_ => {
warn!("Falling back to \"Latest\"");
self.client.latest_state_and_header()
}
}
}
}
pub fn pending_logs<M>(miner: &M, best_block: EthBlockNumber, filter: &EthcoreFilter) -> Vec<Log> where M: MinerService {
@@ -473,7 +499,6 @@ fn check_known<C>(client: &C, number: BlockNumber) -> Result<()> where C: BlockC
let id = match number {
BlockNumber::Pending => return Ok(()),
BlockNumber::Num(n) => BlockId::Number(n),
BlockNumber::Latest => BlockId::Latest,
BlockNumber::Earliest => BlockId::Earliest,
@@ -916,26 +941,26 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
let num = num.unwrap_or_default();
let (mut state, header) = if num == BlockNumber::Pending {
let info = self.client.chain_info();
let state = try_bf!(self.miner.pending_state(info.best_block_number).ok_or_else(errors::state_pruned));
let header = try_bf!(self.miner.pending_block_header(info.best_block_number).ok_or_else(errors::state_pruned));
let (mut state, header) =
if num == BlockNumber::Pending {
self.pending_state_and_header_with_fallback()
} else {
let id = match num {
BlockNumber::Num(num) => BlockId::Number(num),
BlockNumber::Earliest => BlockId::Earliest,
BlockNumber::Latest => BlockId::Latest,
BlockNumber::Pending => unreachable!(), // Already covered
};
(state, header)
} else {
let id = match num {
BlockNumber::Num(num) => BlockId::Number(num),
BlockNumber::Earliest => BlockId::Earliest,
BlockNumber::Latest => BlockId::Latest,
BlockNumber::Pending => unreachable!(), // Already covered
let state = try_bf!(self.client.state_at(id).ok_or_else(errors::state_pruned));
let header = try_bf!(
self.client.block_header(id).ok_or_else(errors::state_pruned)
.and_then(|h| h.decode().map_err(errors::decode))
);
(state, header)
};
let state = try_bf!(self.client.state_at(id).ok_or_else(errors::state_pruned));
let header = try_bf!(self.client.block_header(id).ok_or_else(errors::state_pruned).and_then(|h| h.decode().map_err(errors::decode)));
(state, header)
};
let result = self.client.call(&signed, Default::default(), &mut state, &header);
Box::new(future::done(result
@@ -956,13 +981,7 @@ impl<C, SN: ?Sized, S: ?Sized, M, EM, T: StateInfo + 'static> Eth for EthClient<
let num = num.unwrap_or_default();
let (state, header) = if num == BlockNumber::Pending {
let info = self.client.chain_info();
let state = try_bf!(self.miner.pending_state(info.best_block_number)
.ok_or_else(errors::state_pruned));
let header = try_bf!(self.miner.pending_block_header(info.best_block_number)
.ok_or_else(errors::state_pruned));
(state, header)
self.pending_state_and_header_with_fallback()
} else {
let id = match num {
BlockNumber::Num(num) => BlockId::Number(num),

View File

@@ -21,10 +21,11 @@ use std::collections::{BTreeMap, BTreeSet, HashMap};
use bytes::Bytes;
use ethcore::block::SealedBlock;
use ethcore::client::{Nonce, PrepareOpenBlock, StateClient, EngineInfo};
use ethcore::client::{Nonce, PrepareOpenBlock, StateClient, EngineInfo, traits::ForceUpdateSealing};
use ethcore::engines::{EthEngine, signer::EngineSigner};
use ethcore::error::Error;
use ethcore::miner::{self, MinerService, AuthoringParams};
use ethcore::client::test_client::TestState;
use ethereum_types::{H256, U256, Address};
use miner::pool::local_transactions::Status as LocalTransactionStatus;
use miner::pool::{verifier, VerifiedTransaction, QueueStatus};
@@ -87,14 +88,14 @@ impl TestMinerService {
impl StateClient for TestMinerService {
// State will not be used by test client anyway, since all methods that accept state are mocked
type State = ();
type State = TestState;
fn latest_state(&self) -> Self::State {
()
fn latest_state_and_header(&self) -> (Self::State, Header) {
(TestState, Header::default())
}
fn state_at(&self, _id: BlockId) -> Option<Self::State> {
Some(())
Some(TestState)
}
}
@@ -105,7 +106,7 @@ impl EngineInfo for TestMinerService {
}
impl MinerService for TestMinerService {
type State = ();
type State = TestState;
fn pending_state(&self, _latest_block_number: BlockNumber) -> Option<Self::State> {
None
@@ -185,7 +186,7 @@ impl MinerService for TestMinerService {
}
/// New chain head event. Restart mining operation.
fn update_sealing<C>(&self, _chain: &C) {
fn update_sealing<C>(&self, _chain: &C, _force: ForceUpdateSealing) {
unimplemented!();
}

View File

@@ -20,18 +20,21 @@ use std::sync::Arc;
use std::time::{Instant, Duration, SystemTime, UNIX_EPOCH};
use accounts::AccountProvider;
use ethcore::client::{BlockChainClient, BlockId, EachBlockWith, Executed, TestBlockChainClient, TransactionId};
use ethcore::client::{BlockChainClient, EachBlockWith, Executed, TestBlockChainClient};
use ethcore::miner::{self, MinerService};
use ethereum_types::{H160, H256, U256, Address};
use ethereum_types::{H160, H256, U256, Address, Bloom};
use miner::external::ExternalMiner;
use parity_runtime::Runtime;
use parking_lot::Mutex;
use rlp;
use rustc_hex::{FromHex, ToHex};
use sync::SyncState;
use types::transaction::{Transaction, Action};
use types::log_entry::{LocalizedLogEntry, LogEntry};
use types::receipt::{LocalizedReceipt, TransactionOutcome};
use types::{
ids::{BlockId, TransactionId},
transaction::{Transaction, Action},
log_entry::{LocalizedLogEntry, LogEntry},
receipt::{LocalizedReceipt, RichReceipt, TransactionOutcome},
};
use jsonrpc_core::IoHandler;
use v1::{Eth, EthClient, EthClientOptions, EthFilter, EthFilterClient};
@@ -100,13 +103,13 @@ impl EthTester {
EthTester {
runtime,
client: client,
sync: sync,
client,
sync,
accounts_provider: ap,
miner: miner,
snapshot: snapshot,
io: io,
hashrates: hashrates,
miner,
snapshot,
io,
hashrates,
}
}
@@ -653,6 +656,43 @@ fn rpc_eth_call_latest() {
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
}
#[test]
fn rpc_eth_call_pending() {
let tester = EthTester::default();
tester.client.set_execution_result(Ok(Executed {
exception: None,
gas: U256::zero(),
gas_used: U256::from(0xff30),
refunded: U256::from(0x5),
cumulative_gas_used: U256::zero(),
logs: vec![],
contracts_created: vec![],
output: vec![0x12, 0x34, 0xff],
trace: vec![],
vm_trace: None,
state_diff: None,
}));
let request = r#"{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
},
"pending"],
"id": 1
}"#;
// Falls back to "Latest" and gives the same result.
let response = r#"{"jsonrpc":"2.0","result":"0x1234ff","id":1}"#;
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
}
#[test]
fn rpc_eth_call() {
let tester = EthTester::default();
@@ -760,6 +800,43 @@ fn rpc_eth_estimate_gas() {
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
}
#[test]
fn rpc_eth_estimate_gas_pending() {
let tester = EthTester::default();
tester.client.set_execution_result(Ok(Executed {
exception: None,
gas: U256::zero(),
gas_used: U256::from(0xff30),
refunded: U256::from(0x5),
cumulative_gas_used: U256::zero(),
logs: vec![],
contracts_created: vec![],
output: vec![0x12, 0x34, 0xff],
trace: vec![],
vm_trace: None,
state_diff: None,
}));
let request = r#"{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"gas": "0x76c0",
"gasPrice": "0x9184e72a000",
"value": "0x9184e72a",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
},
"pending"],
"id": 1
}"#;
// Falls back to "Latest" so the result is the same
let response = r#"{"jsonrpc":"2.0","result":"0x5208","id":1}"#;
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
}
#[test]
fn rpc_eth_estimate_gas_default_block() {
let tester = EthTester::default();
@@ -887,7 +964,7 @@ fn rpc_eth_transaction_receipt() {
"params": ["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],
"id": 1
}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","contractAddress":null,"cumulativeGasUsed":"0x20","from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","gasUsed":"0x10","logs":[{"address":"0x33990122638b9132ca29c723bdf037f1a891a70c","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","data":"0x","logIndex":"0x1","removed":false,"topics":["0xa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc","0x4861736852656700000000000000000000000000000000000000000000000000"],"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"mined"}],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","root":"0x0000000000000000000000000000000000000000000000000000000000000000","status":null,"to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0"},"id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","contractAddress":null,"cumulativeGasUsed":"0x20","from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","gasUsed":"0x10","logs":[{"address":"0x33990122638b9132ca29c723bdf037f1a891a70c","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","data":"0x","logIndex":"0x1","removed":false,"topics":["0xa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc","0x4861736852656700000000000000000000000000000000000000000000000000"],"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"mined"}],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","root":"0x0000000000000000000000000000000000000000000000000000000000000000","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0"},"id":1}"#;
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
}
@@ -907,6 +984,34 @@ fn rpc_eth_transaction_receipt_null() {
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
}
#[test]
fn rpc_eth_pending_receipt() {
let pending = RichReceipt {
from: H160::from_str("b60e8dd61c5d32be8058bb8eb970870f07233155").unwrap(),
to: Some(H160::from_str("d46e8dd67c5d32be8058bb8eb970870f07244567").unwrap()),
transaction_hash: H256::from_str("b903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238").unwrap(),
transaction_index: 0,
cumulative_gas_used: U256::from(0x20),
gas_used: U256::from(0x10),
contract_address: None,
logs: Vec::new(),
log_bloom: Bloom::zero(),
outcome: TransactionOutcome::Unknown,
};
let tester = EthTester::default();
tester.miner.pending_receipts.lock().push(pending);
let request = r#"{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],
"id": 1
}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":null,"blockNumber":null,"contractAddress":null,"cumulativeGasUsed":"0x20","from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","gasUsed":"0x10","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionHash":"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238","transactionIndex":"0x0"},"id":1}"#;
assert_eq!(tester.io.handle_request_sync(request), Some(response.to_owned()));
}
// These tests are incorrect: their output is undefined as long as eth_getCompilers is [].
// Will ignore for now, but should probably be replaced by more substantial tests which check
// the output of eth_getCompilers to determine whether to test. CI systems can then be preinstalled

View File

@@ -506,7 +506,7 @@ fn rpc_parity_block_receipts() {
"params": [],
"id": 1
}"#;
let response = r#"{"jsonrpc":"2.0","result":[{"blockHash":"0x0000000000000000000000000000000000000000000000000000000000000003","blockNumber":"0x0","contractAddress":null,"cumulativeGasUsed":"0x5208","from":"0x0000000000000000000000000000000000000009","gasUsed":"0x5208","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001","root":null,"status":null,"to":null,"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000001","transactionIndex":"0x0"}],"id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":[{"blockHash":"0x0000000000000000000000000000000000000000000000000000000000000003","blockNumber":"0x0","contractAddress":null,"cumulativeGasUsed":"0x5208","from":"0x0000000000000000000000000000000000000009","gasUsed":"0x5208","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001","to":null,"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000001","transactionIndex":"0x0"}],"id":1}"#;
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
}

View File

@@ -22,7 +22,7 @@ use jsonrpc_derive::rpc;
use v1::types::RichBlock;
/// Debug RPC interface.
#[rpc]
#[rpc(server)]
pub trait Debug {
/// Returns recently seen bad blocks.
#[rpc(name = "debug_getBadBlocks")]

View File

@@ -23,7 +23,7 @@ use v1::types::{RichBlock, BlockNumber, Bytes, CallRequest, Filter, FilterChange
use v1::types::{Log, Receipt, SyncStatus, Transaction, Work};
/// Eth rpc interface.
#[rpc]
#[rpc(server)]
pub trait Eth {
/// RPC Metadata
type Metadata;
@@ -68,87 +68,87 @@ pub trait Eth {
/// Returns balance of the given account.
#[rpc(name = "eth_getBalance")]
fn balance(&self, H160, Option<BlockNumber>) -> BoxFuture<U256>;
fn balance(&self, _: H160, _: Option<BlockNumber>) -> BoxFuture<U256>;
/// Returns the account- and storage-values of the specified account including the Merkle-proof
#[rpc(name = "eth_getProof")]
fn proof(&self, H160, Vec<H256>, Option<BlockNumber>) -> BoxFuture<EthAccount>;
fn proof(&self, _: H160, _: Vec<H256>, _: Option<BlockNumber>) -> BoxFuture<EthAccount>;
/// Returns content of the storage at given address.
#[rpc(name = "eth_getStorageAt")]
fn storage_at(&self, H160, U256, Option<BlockNumber>) -> BoxFuture<H256>;
fn storage_at(&self, _: H160, _: U256, _: Option<BlockNumber>) -> BoxFuture<H256>;
/// Returns block with given hash.
#[rpc(name = "eth_getBlockByHash")]
fn block_by_hash(&self, H256, bool) -> BoxFuture<Option<RichBlock>>;
fn block_by_hash(&self, _: H256, _: bool) -> BoxFuture<Option<RichBlock>>;
/// Returns block with given number.
#[rpc(name = "eth_getBlockByNumber")]
fn block_by_number(&self, BlockNumber, bool) -> BoxFuture<Option<RichBlock>>;
fn block_by_number(&self, _: BlockNumber, _: bool) -> BoxFuture<Option<RichBlock>>;
/// Returns the number of transactions sent from given address at given time (block number).
#[rpc(name = "eth_getTransactionCount")]
fn transaction_count(&self, H160, Option<BlockNumber>) -> BoxFuture<U256>;
fn transaction_count(&self, _: H160, _: Option<BlockNumber>) -> BoxFuture<U256>;
/// Returns the number of transactions in a block with given hash.
#[rpc(name = "eth_getBlockTransactionCountByHash")]
fn block_transaction_count_by_hash(&self, H256) -> BoxFuture<Option<U256>>;
fn block_transaction_count_by_hash(&self, _: H256) -> BoxFuture<Option<U256>>;
/// Returns the number of transactions in a block with given block number.
#[rpc(name = "eth_getBlockTransactionCountByNumber")]
fn block_transaction_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>>;
fn block_transaction_count_by_number(&self, _: BlockNumber) -> BoxFuture<Option<U256>>;
/// Returns the number of uncles in a block with given hash.
#[rpc(name = "eth_getUncleCountByBlockHash")]
fn block_uncles_count_by_hash(&self, H256) -> BoxFuture<Option<U256>>;
fn block_uncles_count_by_hash(&self, _: H256) -> BoxFuture<Option<U256>>;
/// Returns the number of uncles in a block with given block number.
#[rpc(name = "eth_getUncleCountByBlockNumber")]
fn block_uncles_count_by_number(&self, BlockNumber) -> BoxFuture<Option<U256>>;
fn block_uncles_count_by_number(&self, _: BlockNumber) -> BoxFuture<Option<U256>>;
/// Returns the code at given address at given time (block number).
#[rpc(name = "eth_getCode")]
fn code_at(&self, H160, Option<BlockNumber>) -> BoxFuture<Bytes>;
fn code_at(&self, _: H160, _: Option<BlockNumber>) -> BoxFuture<Bytes>;
/// Sends signed transaction, returning its hash.
#[rpc(name = "eth_sendRawTransaction")]
fn send_raw_transaction(&self, Bytes) -> Result<H256>;
fn send_raw_transaction(&self, _: Bytes) -> Result<H256>;
/// @alias of `eth_sendRawTransaction`.
#[rpc(name = "eth_submitTransaction")]
fn submit_transaction(&self, Bytes) -> Result<H256>;
fn submit_transaction(&self, _: Bytes) -> Result<H256>;
/// Call contract, returning the output data.
#[rpc(name = "eth_call")]
fn call(&self, CallRequest, Option<BlockNumber>) -> BoxFuture<Bytes>;
fn call(&self, _: CallRequest, _: Option<BlockNumber>) -> BoxFuture<Bytes>;
/// Estimate gas needed for execution of given contract.
#[rpc(name = "eth_estimateGas")]
fn estimate_gas(&self, CallRequest, Option<BlockNumber>) -> BoxFuture<U256>;
fn estimate_gas(&self, _: CallRequest, _: Option<BlockNumber>) -> BoxFuture<U256>;
/// Get transaction by its hash.
#[rpc(name = "eth_getTransactionByHash")]
fn transaction_by_hash(&self, H256) -> BoxFuture<Option<Transaction>>;
fn transaction_by_hash(&self, _: H256) -> BoxFuture<Option<Transaction>>;
/// Returns transaction at given block hash and index.
#[rpc(name = "eth_getTransactionByBlockHashAndIndex")]
fn transaction_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<Transaction>>;
fn transaction_by_block_hash_and_index(&self, _: H256, _: Index) -> BoxFuture<Option<Transaction>>;
/// Returns transaction by given block number and index.
#[rpc(name = "eth_getTransactionByBlockNumberAndIndex")]
fn transaction_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<Transaction>>;
fn transaction_by_block_number_and_index(&self, _: BlockNumber, _: Index) -> BoxFuture<Option<Transaction>>;
/// Returns transaction receipt by transaction hash.
#[rpc(name = "eth_getTransactionReceipt")]
fn transaction_receipt(&self, H256) -> BoxFuture<Option<Receipt>>;
fn transaction_receipt(&self, _: H256) -> BoxFuture<Option<Receipt>>;
/// Returns an uncles at given block and index.
#[rpc(name = "eth_getUncleByBlockHashAndIndex")]
fn uncle_by_block_hash_and_index(&self, H256, Index) -> BoxFuture<Option<RichBlock>>;
fn uncle_by_block_hash_and_index(&self, _: H256, _: Index) -> BoxFuture<Option<RichBlock>>;
/// Returns an uncles at given block and index.
#[rpc(name = "eth_getUncleByBlockNumberAndIndex")]
fn uncle_by_block_number_and_index(&self, BlockNumber, Index) -> BoxFuture<Option<RichBlock>>;
fn uncle_by_block_number_and_index(&self, _: BlockNumber, _: Index) -> BoxFuture<Option<RichBlock>>;
/// Returns available compilers.
/// @deprecated
@@ -158,42 +158,42 @@ pub trait Eth {
/// Compiles lll code.
/// @deprecated
#[rpc(name = "eth_compileLLL")]
fn compile_lll(&self, String) -> Result<Bytes>;
fn compile_lll(&self, _: String) -> Result<Bytes>;
/// Compiles solidity.
/// @deprecated
#[rpc(name = "eth_compileSolidity")]
fn compile_solidity(&self, String) -> Result<Bytes>;
fn compile_solidity(&self, _: String) -> Result<Bytes>;
/// Compiles serpent.
/// @deprecated
#[rpc(name = "eth_compileSerpent")]
fn compile_serpent(&self, String) -> Result<Bytes>;
fn compile_serpent(&self, _: String) -> Result<Bytes>;
/// Returns logs matching given filter object.
#[rpc(name = "eth_getLogs")]
fn logs(&self, Filter) -> BoxFuture<Vec<Log>>;
fn logs(&self, _: Filter) -> BoxFuture<Vec<Log>>;
/// Returns the hash of the current block, the seedHash, and the boundary condition to be met.
#[rpc(name = "eth_getWork")]
fn work(&self, Option<u64>) -> Result<Work>;
fn work(&self, _: Option<u64>) -> Result<Work>;
/// Used for submitting a proof-of-work solution.
#[rpc(name = "eth_submitWork")]
fn submit_work(&self, H64, H256, H256) -> Result<bool>;
fn submit_work(&self, _: H64, _: H256, _: H256) -> Result<bool>;
/// Used for submitting mining hashrate.
#[rpc(name = "eth_submitHashrate")]
fn submit_hashrate(&self, U256, H256) -> Result<bool>;
fn submit_hashrate(&self, _: U256, _: H256) -> Result<bool>;
}
/// Eth filters rpc api (polling).
// TODO: do filters api properly
#[rpc]
#[rpc(server)]
pub trait EthFilter {
/// Returns id of new filter.
#[rpc(name = "eth_newFilter")]
fn new_filter(&self, Filter) -> Result<U256>;
fn new_filter(&self, _: Filter) -> Result<U256>;
/// Returns id of new block filter.
#[rpc(name = "eth_newBlockFilter")]
@@ -205,13 +205,13 @@ pub trait EthFilter {
/// Returns filter changes since last poll.
#[rpc(name = "eth_getFilterChanges")]
fn filter_changes(&self, Index) -> BoxFuture<FilterChanges>;
fn filter_changes(&self, _: Index) -> BoxFuture<FilterChanges>;
/// Returns all logs matching given filter (in a range 'from' - 'to').
#[rpc(name = "eth_getFilterLogs")]
fn filter_logs(&self, Index) -> BoxFuture<Vec<Log>>;
fn filter_logs(&self, _: Index) -> BoxFuture<Vec<Log>>;
/// Uninstalls filter.
#[rpc(name = "eth_uninstallFilter")]
fn uninstall_filter(&self, Index) -> Result<bool>;
fn uninstall_filter(&self, _: Index) -> Result<bool>;
}

View File

@@ -23,16 +23,16 @@ use jsonrpc_pubsub::{typed, SubscriptionId};
use v1::types::pubsub;
/// Eth PUB-SUB rpc interface.
#[rpc]
#[rpc(server)]
pub trait EthPubSub {
/// RPC Metadata
type Metadata;
/// Subscribe to Eth subscription.
#[pubsub(subscription = "eth_subscription", subscribe, name = "eth_subscribe")]
fn subscribe(&self, Self::Metadata, typed::Subscriber<pubsub::Result>, pubsub::Kind, Option<pubsub::Params>);
fn subscribe(&self, _: Self::Metadata, _: typed::Subscriber<pubsub::Result>, _: pubsub::Kind, _: Option<pubsub::Params>);
/// Unsubscribe from existing Eth subscription.
#[pubsub(subscription = "eth_subscription", unsubscribe, name = "eth_unsubscribe")]
fn unsubscribe(&self, Option<Self::Metadata>, SubscriptionId) -> Result<bool>;
fn unsubscribe(&self, _: Option<Self::Metadata>, _: SubscriptionId) -> Result<bool>;
}

View File

@@ -23,24 +23,24 @@ use ethereum_types::{H160, H256, H520};
use v1::types::{Bytes, TransactionRequest, RichRawTransaction};
/// Signing methods implementation relying on unlocked accounts.
#[rpc]
#[rpc(server)]
pub trait EthSigning {
/// RPC Metadata
type Metadata;
/// Signs the hash of data with given address signature.
#[rpc(meta, name = "eth_sign")]
fn sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<H520>;
fn sign(&self, _: Self::Metadata, _: H160, _: Bytes) -> BoxFuture<H520>;
/// Sends transaction; will block waiting for signer to return the
/// transaction hash.
/// If Signer is disable it will require the account to be unlocked.
#[rpc(meta, name = "eth_sendTransaction")]
fn send_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<H256>;
fn send_transaction(&self, _: Self::Metadata, _: TransactionRequest) -> BoxFuture<H256>;
/// Signs transactions without dispatching it to the network.
/// Returns signed transaction RLP representation and the transaction itself.
/// It can be later submitted using `eth_sendRawTransaction/eth_submitTransaction`.
#[rpc(meta, name = "eth_signTransaction")]
fn sign_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<RichRawTransaction>;
fn sign_transaction(&self, _: Self::Metadata, _: TransactionRequest) -> BoxFuture<RichRawTransaction>;
}

View File

@@ -19,7 +19,7 @@ use jsonrpc_core::Result;
use jsonrpc_derive::rpc;
/// Net rpc interface.
#[rpc]
#[rpc(server)]
pub trait Net {
/// Returns protocol version.
#[rpc(name = "net_version")]

View File

@@ -31,7 +31,7 @@ use v1::types::{
};
/// Parity-specific rpc interface.
#[rpc]
#[rpc(server)]
pub trait Parity {
/// RPC Metadata
type Metadata;
@@ -103,7 +103,7 @@ pub trait Parity {
/// Returns whatever address would be derived from the given phrase if it were to seed a brainwallet.
#[rpc(name = "parity_phraseToAddress")]
fn phrase_to_address(&self, String) -> Result<H160>;
fn phrase_to_address(&self, _: String) -> Result<H160>;
/// Returns the value of the registrar for this network.
#[rpc(name = "parity_registryAddress")]
@@ -111,21 +111,21 @@ pub trait Parity {
/// Returns all addresses if Fat DB is enabled (`--fat-db`), or null if not.
#[rpc(name = "parity_listAccounts")]
fn list_accounts(&self, u64, Option<H160>, Option<BlockNumber>) -> Result<Option<Vec<H160>>>;
fn list_accounts(&self, _: u64, _: Option<H160>, _: Option<BlockNumber>) -> Result<Option<Vec<H160>>>;
/// Returns all storage keys of the given address (first parameter) if Fat DB is enabled (`--fat-db`),
/// or null if not.
#[rpc(name = "parity_listStorageKeys")]
fn list_storage_keys(&self, H160, u64, Option<H256>, Option<BlockNumber>) -> Result<Option<Vec<H256>>>;
fn list_storage_keys(&self, _: H160, _: u64, _: Option<H256>, _: Option<BlockNumber>) -> Result<Option<Vec<H256>>>;
/// Encrypt some data with a public key under ECIES.
/// First parameter is the 512-byte destination public key, second is the message.
#[rpc(name = "parity_encryptMessage")]
fn encrypt_message(&self, H512, Bytes) -> Result<Bytes>;
fn encrypt_message(&self, _: H512, _: Bytes) -> Result<Bytes>;
/// Returns all pending transactions from transaction queue.
#[rpc(name = "parity_pendingTransactions")]
fn pending_transactions(&self, Option<usize>) -> Result<Vec<Transaction>>;
fn pending_transactions(&self, _: Option<usize>) -> Result<Vec<Transaction>>;
/// Returns all transactions from transaction queue.
///
@@ -155,7 +155,7 @@ pub trait Parity {
/// Returns next nonce for particular sender. Should include all transactions in the queue.
#[rpc(name = "parity_nextNonce")]
fn next_nonce(&self, H160) -> BoxFuture<U256>;
fn next_nonce(&self, _: H160) -> BoxFuture<U256>;
/// Get the mode. Returns one of: "active", "passive", "dark", "offline".
#[rpc(name = "parity_mode")]
@@ -192,26 +192,26 @@ pub trait Parity {
/// Get block header.
/// Same as `eth_getBlockByNumber` but without uncles and transactions.
#[rpc(name = "parity_getBlockHeaderByNumber")]
fn block_header(&self, Option<BlockNumber>) -> BoxFuture<RichHeader>;
fn block_header(&self, _: Option<BlockNumber>) -> BoxFuture<RichHeader>;
/// Get block receipts.
/// Allows you to fetch receipts from the entire block at once.
/// If no parameter is provided defaults to `latest`.
#[rpc(name = "parity_getBlockReceipts")]
fn block_receipts(&self, Option<BlockNumber>) -> BoxFuture<Vec<Receipt>>;
fn block_receipts(&self, _: Option<BlockNumber>) -> BoxFuture<Vec<Receipt>>;
/// Get IPFS CIDv0 given protobuf encoded bytes.
#[rpc(name = "parity_cidV0")]
fn ipfs_cid(&self, Bytes) -> Result<String>;
fn ipfs_cid(&self, _: Bytes) -> Result<String>;
/// Call contract, returning the output data.
#[rpc(name = "parity_call")]
fn call(&self, Vec<CallRequest>, Option<BlockNumber>) -> Result<Vec<Bytes>>;
fn call(&self, _: Vec<CallRequest>, _: Option<BlockNumber>) -> Result<Vec<Bytes>>;
/// Used for submitting a proof-of-work solution (similar to `eth_submitWork`,
/// but returns block hash on success, and returns an explicit error message on failure).
#[rpc(name = "parity_submitWorkDetail")]
fn submit_work_detail(&self, H64, H256, H256) -> Result<H256>;
fn submit_work_detail(&self, _: H64, _: H256, _: H256) -> Result<H256>;
/// Returns the status of the node. Used as the health endpoint.
///
@@ -226,10 +226,10 @@ pub trait Parity {
/// Extracts Address and public key from signature using the r, s and v params. Equivalent to Solidity erecover
/// as well as checks the signature for chain replay protection
#[rpc(name = "parity_verifySignature")]
fn verify_signature(&self, bool, Bytes, H256, H256, U64) -> Result<RecoveredAccount>;
fn verify_signature(&self, _: bool, _: Bytes, _: H256, _: H256, _: U64) -> Result<RecoveredAccount>;
/// Returns logs matching given filter object.
/// Is allowed to skip filling transaction hash for faster query.
#[rpc(name = "parity_getLogsNoTransactionHash")]
fn logs_no_tx_hash(&self, Filter) -> BoxFuture<Vec<Log>>;
fn logs_no_tx_hash(&self, _: Filter) -> BoxFuture<Vec<Log>>;
}

View File

@@ -26,7 +26,7 @@ use v1::types::{DeriveHash, DeriveHierarchical, ExtAccountInfo};
use v1::types::{AccountInfo, HwAccountInfo};
/// Parity-specific read-only accounts rpc interface.
#[rpc]
#[rpc(server)]
pub trait ParityAccountsInfo {
/// Returns accounts information.
#[rpc(name = "parity_accountsInfo")]
@@ -46,7 +46,7 @@ pub trait ParityAccountsInfo {
}
/// Personal Parity rpc interface.
#[rpc]
#[rpc(server)]
pub trait ParityAccounts {
/// Returns accounts information.
#[rpc(name = "parity_allAccountsInfo")]
@@ -55,49 +55,49 @@ pub trait ParityAccounts {
/// Creates new account from the given phrase using standard brainwallet mechanism.
/// Second parameter is password for the new account.
#[rpc(name = "parity_newAccountFromPhrase")]
fn new_account_from_phrase(&self, String, Password) -> Result<H160>;
fn new_account_from_phrase(&self, _: String, _: Password) -> Result<H160>;
/// Creates new account from the given JSON wallet.
/// Second parameter is password for the wallet and the new account.
#[rpc(name = "parity_newAccountFromWallet")]
fn new_account_from_wallet(&self, String, Password) -> Result<H160>;
fn new_account_from_wallet(&self, _: String, _: Password) -> Result<H160>;
/// Creates new account from the given raw secret.
/// Second parameter is password for the new account.
#[rpc(name = "parity_newAccountFromSecret")]
fn new_account_from_secret(&self, H256, Password) -> Result<H160>;
fn new_account_from_secret(&self, _: H256, _: Password) -> Result<H160>;
/// Returns true if given `password` would unlock given `account`.
/// Arguments: `account`, `password`.
#[rpc(name = "parity_testPassword")]
fn test_password(&self, H160, Password) -> Result<bool>;
fn test_password(&self, _: H160, _: Password) -> Result<bool>;
/// Changes an account's password.
/// Arguments: `account`, `password`, `new_password`.
#[rpc(name = "parity_changePassword")]
fn change_password(&self, H160, Password, Password) -> Result<bool>;
fn change_password(&self, _: H160, _: Password, _: Password) -> Result<bool>;
/// Permanently deletes an account.
/// Arguments: `account`, `password`.
#[rpc(name = "parity_killAccount")]
fn kill_account(&self, H160, Password) -> Result<bool>;
fn kill_account(&self, _: H160, _: Password) -> Result<bool>;
/// Permanently deletes an address from the addressbook
/// Arguments: `address`
#[rpc(name = "parity_removeAddress")]
fn remove_address(&self, H160) -> Result<bool>;
fn remove_address(&self, _: H160) -> Result<bool>;
/// Set an account's name.
#[rpc(name = "parity_setAccountName")]
fn set_account_name(&self, H160, String) -> Result<bool>;
fn set_account_name(&self, _: H160, _: String) -> Result<bool>;
/// Set an account's metadata string.
#[rpc(name = "parity_setAccountMeta")]
fn set_account_meta(&self, H160, String) -> Result<bool>;
fn set_account_meta(&self, _: H160, _: String) -> Result<bool>;
/// Imports a number of Geth accounts, with the list provided as the argument.
#[rpc(name = "parity_importGethAccounts")]
fn import_geth_accounts(&self, Vec<H160>) -> Result<Vec<H160>>;
fn import_geth_accounts(&self, _: Vec<H160>) -> Result<Vec<H160>>;
/// Returns the accounts available for importing from Geth.
#[rpc(name = "parity_listGethAccounts")]
@@ -105,15 +105,15 @@ pub trait ParityAccounts {
/// Create new vault.
#[rpc(name = "parity_newVault")]
fn create_vault(&self, String, Password) -> Result<bool>;
fn create_vault(&self, _: String, _: Password) -> Result<bool>;
/// Open existing vault.
#[rpc(name = "parity_openVault")]
fn open_vault(&self, String, Password) -> Result<bool>;
fn open_vault(&self, _: String, _: Password) -> Result<bool>;
/// Close previously opened vault.
#[rpc(name = "parity_closeVault")]
fn close_vault(&self, String) -> Result<bool>;
fn close_vault(&self, _: String) -> Result<bool>;
/// List all vaults.
#[rpc(name = "parity_listVaults")]
@@ -125,40 +125,40 @@ pub trait ParityAccounts {
/// Change vault password.
#[rpc(name = "parity_changeVaultPassword")]
fn change_vault_password(&self, String, Password) -> Result<bool>;
fn change_vault_password(&self, _: String, _: Password) -> Result<bool>;
/// Change vault of the given address.
#[rpc(name = "parity_changeVault")]
fn change_vault(&self, H160, String) -> Result<bool>;
fn change_vault(&self, _: H160, _: String) -> Result<bool>;
/// Get vault metadata string.
#[rpc(name = "parity_getVaultMeta")]
fn get_vault_meta(&self, String) -> Result<String>;
fn get_vault_meta(&self, _: String) -> Result<String>;
/// Set vault metadata string.
#[rpc(name = "parity_setVaultMeta")]
fn set_vault_meta(&self, String, String) -> Result<bool>;
fn set_vault_meta(&self, _: String, _: String) -> Result<bool>;
/// Derive new address from given account address using specific hash.
/// Resulting address can be either saved as a new account (with the same password).
#[rpc(name = "parity_deriveAddressHash")]
fn derive_key_hash(&self, H160, Password, DeriveHash, bool) -> Result<H160>;
fn derive_key_hash(&self, _: H160, _: Password, _: DeriveHash, _: bool) -> Result<H160>;
/// Derive new address from given account address using
/// hierarchical derivation (sequence of 32-bit integer indices).
/// Resulting address can be either saved as a new account (with the same password).
#[rpc(name = "parity_deriveAddressIndex")]
fn derive_key_index(&self, H160, Password, DeriveHierarchical, bool) -> Result<H160>;
fn derive_key_index(&self, _: H160, _: Password, _: DeriveHierarchical, _: bool) -> Result<H160>;
/// Exports an account with given address if provided password matches.
#[rpc(name = "parity_exportAccount")]
fn export_account(&self, H160, Password) -> Result<KeyFile>;
fn export_account(&self, _: H160, _: Password) -> Result<KeyFile>;
/// Sign raw hash with the key corresponding to address and password.
#[rpc(name = "parity_signMessage")]
fn sign_message(&self, H160, Password, H256) -> Result<H520>;
fn sign_message(&self, _: H160, _: Password, _: H256) -> Result<H520>;
/// Send a PinMatrixAck to a hardware wallet, unlocking it
#[rpc(name = "parity_hardwarePinMatrixAck")]
fn hardware_pin_matrix_ack(&self, String, String) -> Result<bool>;
fn hardware_pin_matrix_ack(&self, _: String, _: String) -> Result<bool>;
}

View File

@@ -23,55 +23,55 @@ use jsonrpc_derive::rpc;
use v1::types::{Bytes, ReleaseInfo, Transaction};
/// Parity-specific rpc interface for operations altering the account-related settings.
#[rpc]
#[rpc(server)]
pub trait ParitySetAccounts {
/// Sets account for signing consensus messages.
#[rpc(name = "parity_setEngineSigner")]
fn set_engine_signer(&self, H160, String) -> Result<bool>;
fn set_engine_signer(&self, _: H160, _: String) -> Result<bool>;
}
/// Parity-specific rpc interface for operations altering the settings.
#[rpc]
#[rpc(server)]
pub trait ParitySet {
/// Sets new minimal gas price for mined blocks.
#[rpc(name = "parity_setMinGasPrice")]
fn set_min_gas_price(&self, U256) -> Result<bool>;
fn set_min_gas_price(&self, _: U256) -> Result<bool>;
/// Sets new gas floor target for mined blocks.
#[rpc(name = "parity_setGasFloorTarget")]
fn set_gas_floor_target(&self, U256) -> Result<bool>;
fn set_gas_floor_target(&self, _: U256) -> Result<bool>;
/// Sets new gas ceiling target for mined blocks.
#[rpc(name = "parity_setGasCeilTarget")]
fn set_gas_ceil_target(&self, U256) -> Result<bool>;
fn set_gas_ceil_target(&self, _: U256) -> Result<bool>;
/// Sets new extra data for mined blocks.
#[rpc(name = "parity_setExtraData")]
fn set_extra_data(&self, Bytes) -> Result<bool>;
fn set_extra_data(&self, _: Bytes) -> Result<bool>;
/// Sets new author for mined block.
#[rpc(name = "parity_setAuthor")]
fn set_author(&self, H160) -> Result<bool>;
fn set_author(&self, _: H160) -> Result<bool>;
/// Sets the secret of engine signer account.
#[rpc(name = "parity_setEngineSignerSecret")]
fn set_engine_signer_secret(&self, H256) -> Result<bool>;
fn set_engine_signer_secret(&self, _: H256) -> Result<bool>;
/// Sets the limits for transaction queue.
#[rpc(name = "parity_setTransactionsLimit")]
fn set_transactions_limit(&self, usize) -> Result<bool>;
fn set_transactions_limit(&self, _: usize) -> Result<bool>;
/// Sets the maximum amount of gas a single transaction may consume.
#[rpc(name = "parity_setMaxTransactionGas")]
fn set_tx_gas_limit(&self, U256) -> Result<bool>;
fn set_tx_gas_limit(&self, _: U256) -> Result<bool>;
/// Add a reserved peer.
#[rpc(name = "parity_addReservedPeer")]
fn add_reserved_peer(&self, String) -> Result<bool>;
fn add_reserved_peer(&self, _: String) -> Result<bool>;
/// Remove a reserved peer.
#[rpc(name = "parity_removeReservedPeer")]
fn remove_reserved_peer(&self, String) -> Result<bool>;
fn remove_reserved_peer(&self, _: String) -> Result<bool>;
/// Drop all non-reserved peers.
#[rpc(name = "parity_dropNonReservedPeers")]
@@ -95,15 +95,15 @@ pub trait ParitySet {
/// Set the mode. Argument must be one of: "active", "passive", "dark", "offline".
#[rpc(name = "parity_setMode")]
fn set_mode(&self, String) -> Result<bool>;
fn set_mode(&self, _: String) -> Result<bool>;
/// Set the network spec. Argument must be one of pre-configured chains or a filename.
#[rpc(name = "parity_setChain")]
fn set_spec_name(&self, String) -> Result<bool>;
fn set_spec_name(&self, _: String) -> Result<bool>;
/// Hash a file content under given URL.
#[rpc(name = "parity_hashContent")]
fn hash_content(&self, String) -> BoxFuture<H256>;
fn hash_content(&self, _: String) -> BoxFuture<H256>;
/// Is there a release ready for install?
#[rpc(name = "parity_upgradeReady")]
@@ -120,5 +120,5 @@ pub trait ParitySet {
/// or excessive gas limit that are not accepted by other peers whp.
/// Returns `true` when transaction was removed, `false` if it was not found.
#[rpc(name = "parity_removeTransaction")]
fn remove_transaction(&self, H256) -> Result<Option<Transaction>>;
fn remove_transaction(&self, _: H256) -> Result<Option<Transaction>>;
}

View File

@@ -22,7 +22,7 @@ use ethereum_types::{H160, U256};
use v1::types::{Bytes, ConfirmationResponse, TransactionRequest, Either};
/// Signing methods implementation.
#[rpc]
#[rpc(server)]
pub trait ParitySigning {
/// RPC Metadata
type Metadata;
@@ -30,25 +30,25 @@ pub trait ParitySigning {
/// Given partial transaction request produces transaction with all fields filled in.
/// Such transaction can be then signed externally.
#[rpc(meta, name = "parity_composeTransaction")]
fn compose_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<TransactionRequest>;
fn compose_transaction(&self, _: Self::Metadata, _: TransactionRequest) -> BoxFuture<TransactionRequest>;
/// Posts sign request asynchronously.
/// Will return a confirmation ID for later use with check_transaction.
#[rpc(meta, name = "parity_postSign")]
fn post_sign(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Either<U256, ConfirmationResponse>>;
fn post_sign(&self, _: Self::Metadata, _: H160, _: Bytes) -> BoxFuture<Either<U256, ConfirmationResponse>>;
/// Posts transaction asynchronously.
/// Will return a transaction ID for later use with check_transaction.
#[rpc(meta, name = "parity_postTransaction")]
fn post_transaction(&self, Self::Metadata, TransactionRequest) -> BoxFuture<Either<U256, ConfirmationResponse>>;
fn post_transaction(&self, _: Self::Metadata, _: TransactionRequest) -> BoxFuture<Either<U256, ConfirmationResponse>>;
/// Checks the progress of a previously posted request (transaction/sign).
/// Should be given a valid send_transaction ID.
#[rpc(name = "parity_checkRequest")]
fn check_request(&self, U256) -> Result<Option<ConfirmationResponse>>;
fn check_request(&self, _: U256) -> Result<Option<ConfirmationResponse>>;
/// Decrypt some ECIES-encrypted message.
/// First parameter is the address with which it is encrypted, second is the ciphertext.
#[rpc(meta, name = "parity_decryptMessage")]
fn decrypt_message(&self, Self::Metadata, H160, Bytes) -> BoxFuture<Bytes>;
fn decrypt_message(&self, _: Self::Metadata, _: H160, _: Bytes) -> BoxFuture<Bytes>;
}

View File

@@ -23,7 +23,7 @@ use jsonrpc_derive::rpc;
use v1::types::{Bytes, TransactionRequest, RichRawTransaction as RpcRichRawTransaction, EIP191Version};
/// Personal rpc interface. Safe (read-only) functions.
#[rpc]
#[rpc(server)]
pub trait Personal {
/// RPC Metadata
type Metadata;
@@ -35,40 +35,40 @@ pub trait Personal {
/// Creates new account (it becomes new current unlocked account)
/// Param is the password for the account.
#[rpc(name = "personal_newAccount")]
fn new_account(&self, String) -> Result<H160>;
fn new_account(&self, _: String) -> Result<H160>;
/// Unlocks specified account for use (can only be one unlocked account at one moment)
#[rpc(name = "personal_unlockAccount")]
fn unlock_account(&self, H160, String, Option<U128>) -> Result<bool>;
fn unlock_account(&self, _: H160, _: String, _: Option<U128>) -> Result<bool>;
/// Signs the hash of data with given account signature using the given password to unlock the account during
/// the request.
#[rpc(name = "personal_sign")]
fn sign(&self, Bytes, H160, String) -> BoxFuture<H520>;
fn sign(&self, _: Bytes, _: H160, _: String) -> BoxFuture<H520>;
/// Produces an EIP-712 compliant signature with given account using the given password to unlock the
/// account during the request.
#[rpc(name = "personal_signTypedData")]
fn sign_typed_data(&self, EIP712, H160, String) -> BoxFuture<H520>;
fn sign_typed_data(&self, _: EIP712, _: H160, _: String) -> BoxFuture<H520>;
/// Signs an arbitrary message based on the version specified
#[rpc(name = "personal_sign191")]
fn sign_191(&self, EIP191Version, Value, H160, String) -> BoxFuture<H520>;
fn sign_191(&self, _: EIP191Version, _: Value, _: H160, _: String) -> BoxFuture<H520>;
/// Returns the account associated with the private key that was used to calculate the signature in
/// `personal_sign`.
#[rpc(name = "personal_ecRecover")]
fn ec_recover(&self, Bytes, H520) -> BoxFuture<H160>;
fn ec_recover(&self, _: Bytes, _: H520) -> BoxFuture<H160>;
/// Signs transaction. The account is not unlocked in such case.
#[rpc(meta, name = "personal_signTransaction")]
fn sign_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<RpcRichRawTransaction>;
fn sign_transaction(&self, _: Self::Metadata, _: TransactionRequest, _: String) -> BoxFuture<RpcRichRawTransaction>;
/// Sends transaction and signs it in single call. The account is not unlocked in such case.
#[rpc(meta, name = "personal_sendTransaction")]
fn send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256>;
fn send_transaction(&self, _: Self::Metadata, _: TransactionRequest, _: String) -> BoxFuture<H256>;
/// @deprecated alias for `personal_sendTransaction`.
#[rpc(meta, name = "personal_signAndSendTransaction")]
fn sign_and_send_transaction(&self, Self::Metadata, TransactionRequest, String) -> BoxFuture<H256>;
fn sign_and_send_transaction(&self, _: Self::Metadata, _: TransactionRequest, _: String) -> BoxFuture<H256>;
}

View File

@@ -24,24 +24,24 @@ use v1::types::{Bytes, PrivateTransactionReceipt, BlockNumber,
PrivateTransactionReceiptAndTransaction, CallRequest};
/// Private transaction management RPC interface.
#[rpc]
#[rpc(server)]
pub trait Private {
/// RPC Metadata
type Metadata;
/// Sends private transaction; Transaction will be added to the validation queue and sent out when ready.
#[rpc(name = "private_sendTransaction")]
fn send_transaction(&self, Bytes) -> Result<PrivateTransactionReceipt, Error>;
fn send_transaction(&self, _: Bytes) -> Result<PrivateTransactionReceipt, Error>;
/// Creates a transaction for contract's deployment from origin (signed transaction)
#[rpc(name = "private_composeDeploymentTransaction")]
fn compose_deployment_transaction(&self, BlockNumber, Bytes, Vec<H160>, U256) -> Result<PrivateTransactionReceiptAndTransaction, Error>;
fn compose_deployment_transaction(&self, _: BlockNumber, _: Bytes, _: Vec<H160>, _: U256) -> Result<PrivateTransactionReceiptAndTransaction, Error>;
/// Make a call to the private contract
#[rpc(name = "private_call")]
fn private_call(&self, BlockNumber, CallRequest) -> Result<Bytes, Error>;
fn private_call(&self, _: BlockNumber, _: CallRequest) -> Result<Bytes, Error>;
/// Retrieve the id of the key associated with the contract
#[rpc(name = "private_contractKey")]
fn private_contract_key(&self, H160) -> Result<H256, Error>;
fn private_contract_key(&self, _: H160) -> Result<H256, Error>;
}

View File

@@ -21,16 +21,16 @@ use jsonrpc_pubsub::{typed::Subscriber, SubscriptionId};
use jsonrpc_derive::rpc;
/// Parity-specific PUB-SUB rpc interface.
#[rpc]
#[rpc(server)]
pub trait PubSub {
/// Pub/Sub Metadata
type Metadata;
/// Subscribe to changes of any RPC method in Parity.
#[pubsub(subscription = "parity_subscription", subscribe, name = "parity_subscribe")]
fn parity_subscribe(&self, Self::Metadata, Subscriber<Value>, String, Option<Params>);
fn parity_subscribe(&self, _: Self::Metadata, _: Subscriber<Value>, _: String, _: Option<Params>);
/// Unsubscribe from existing Parity subscription.
#[pubsub(subscription = "parity_subscription", unsubscribe, name = "parity_unsubscribe")]
fn parity_unsubscribe(&self, Option<Self::Metadata>, SubscriptionId) -> Result<bool>;
fn parity_unsubscribe(&self, _: Option<Self::Metadata>, _: SubscriptionId) -> Result<bool>;
}

View File

@@ -22,7 +22,7 @@ use jsonrpc_core::Result;
use jsonrpc_derive::rpc;
/// RPC Interface.
#[rpc]
#[rpc(server)]
pub trait Rpc {
/// Returns supported modules for Geth 1.3.6
/// @ignore

View File

@@ -25,37 +25,37 @@ use ethkey::Password;
use v1::types::{Bytes, EncryptedDocumentKey};
/// Parity-specific rpc interface.
#[rpc]
#[rpc(server)]
pub trait SecretStore {
/// Generate document key to store in secret store.
/// Arguments: `account`, `password`, `server_key_public`.
#[rpc(name = "secretstore_generateDocumentKey")]
fn generate_document_key(&self, H160, Password, H512) -> Result<EncryptedDocumentKey>;
fn generate_document_key(&self, _: H160, _: Password, _: H512) -> Result<EncryptedDocumentKey>;
/// Encrypt data with key, received from secret store.
/// Arguments: `account`, `password`, `key`, `data`.
#[rpc(name = "secretstore_encrypt")]
fn encrypt(&self, H160, Password, Bytes, Bytes) -> Result<Bytes>;
fn encrypt(&self, _: H160, _: Password, _: Bytes, _: Bytes) -> Result<Bytes>;
/// Decrypt data with key, received from secret store.
/// Arguments: `account`, `password`, `key`, `data`.
#[rpc(name = "secretstore_decrypt")]
fn decrypt(&self, H160, Password, Bytes, Bytes) -> Result<Bytes>;
fn decrypt(&self, _: H160, _: Password, _: Bytes, _: Bytes) -> Result<Bytes>;
/// Decrypt data with shadow key, received from secret store.
/// Arguments: `account`, `password`, `decrypted_secret`, `common_point`, `decrypt_shadows`, `data`.
#[rpc(name = "secretstore_shadowDecrypt")]
fn shadow_decrypt(&self, H160, Password, H512, H512, Vec<Bytes>, Bytes) -> Result<Bytes>;
fn shadow_decrypt(&self, _: H160, _: Password, _: H512, _: H512, _: Vec<Bytes>, _: Bytes) -> Result<Bytes>;
/// Calculates the hash (keccak256) of servers set for using in ServersSetChange session.
/// Returned hash must be signed later by using `secretstore_signRawHash` method.
/// Arguments: `servers_set`.
#[rpc(name = "secretstore_serversSetHash")]
fn servers_set_hash(&self, BTreeSet<H512>) -> Result<H256>;
fn servers_set_hash(&self, _: BTreeSet<H512>) -> Result<H256>;
/// Generate recoverable ECDSA signature of raw hash.
/// Passed hash is treated as an input to the `sign` function (no prefixes added, no hash function is applied).
/// Arguments: `account`, `password`, `raw_hash`.
#[rpc(name = "secretstore_signRawHash")]
fn sign_raw_hash(&self, H160, Password, H256) -> Result<Bytes>;
fn sign_raw_hash(&self, _: H160, _: Password, _: H256) -> Result<Bytes>;
}

View File

@@ -24,7 +24,7 @@ use jsonrpc_derive::rpc;
use v1::types::{Bytes, TransactionModification, ConfirmationRequest, ConfirmationResponse, ConfirmationResponseWithToken};
/// Signer extension for confirmations rpc interface.
#[rpc]
#[rpc(server)]
pub trait Signer {
/// RPC Metadata
type Metadata;
@@ -35,19 +35,19 @@ pub trait Signer {
/// Confirm specific request.
#[rpc(name = "signer_confirmRequest")]
fn confirm_request(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponse>;
fn confirm_request(&self, _: U256, _: TransactionModification, _: String) -> BoxFuture<ConfirmationResponse>;
/// Confirm specific request with token.
#[rpc(name = "signer_confirmRequestWithToken")]
fn confirm_request_with_token(&self, U256, TransactionModification, String) -> BoxFuture<ConfirmationResponseWithToken>;
fn confirm_request_with_token(&self, _: U256, _: TransactionModification, _: String) -> BoxFuture<ConfirmationResponseWithToken>;
/// Confirm specific request with already signed data.
#[rpc(name = "signer_confirmRequestRaw")]
fn confirm_request_raw(&self, U256, Bytes) -> Result<ConfirmationResponse>;
fn confirm_request_raw(&self, _: U256, _: Bytes) -> Result<ConfirmationResponse>;
/// Reject the confirmation request.
#[rpc(name = "signer_rejectRequest")]
fn reject_request(&self, U256) -> Result<bool>;
fn reject_request(&self, _: U256) -> Result<bool>;
/// Generates new authorization token.
#[rpc(name = "signer_generateAuthorizationToken")]
@@ -55,9 +55,9 @@ pub trait Signer {
/// Subscribe to new pending requests on signer interface.
#[pubsub(subscription = "signer_pending", subscribe, name = "signer_subscribePending")]
fn subscribe_pending(&self, Self::Metadata, Subscriber<Vec<ConfirmationRequest>>);
fn subscribe_pending(&self, _: Self::Metadata, _: Subscriber<Vec<ConfirmationRequest>>);
/// Unsubscribe from pending requests subscription.
#[pubsub(subscription = "signer_pending", unsubscribe, name = "signer_unsubscribePending")]
fn unsubscribe_pending(&self, Option<Self::Metadata>, SubscriptionId) -> Result<bool>;
fn unsubscribe_pending(&self, _: Option<Self::Metadata>, _: SubscriptionId) -> Result<bool>;
}

View File

@@ -23,44 +23,44 @@ use v1::types::{TraceFilter, LocalizedTrace, BlockNumber, Index, CallRequest, By
TraceResultsWithTransactionHash, TraceOptions};
/// Traces specific rpc interface.
#[rpc]
#[rpc(server)]
pub trait Traces {
/// RPC Metadata
type Metadata;
/// Returns traces matching given filter.
#[rpc(name = "trace_filter")]
fn filter(&self, TraceFilter) -> Result<Option<Vec<LocalizedTrace>>>;
fn filter(&self, _: TraceFilter) -> Result<Option<Vec<LocalizedTrace>>>;
/// Returns transaction trace at given index.
#[rpc(name = "trace_get")]
fn trace(&self, H256, Vec<Index>) -> Result<Option<LocalizedTrace>>;
fn trace(&self, _: H256, _: Vec<Index>) -> Result<Option<LocalizedTrace>>;
/// Returns all traces of given transaction.
#[rpc(name = "trace_transaction")]
fn transaction_traces(&self, H256) -> Result<Option<Vec<LocalizedTrace>>>;
fn transaction_traces(&self, _: H256) -> Result<Option<Vec<LocalizedTrace>>>;
/// Returns all traces produced at given block.
#[rpc(name = "trace_block")]
fn block_traces(&self, BlockNumber) -> Result<Option<Vec<LocalizedTrace>>>;
fn block_traces(&self, _: BlockNumber) -> Result<Option<Vec<LocalizedTrace>>>;
/// Executes the given call and returns a number of possible traces for it.
#[rpc(name = "trace_call")]
fn call(&self, CallRequest, TraceOptions, Option<BlockNumber>) -> Result<TraceResults>;
fn call(&self, _: CallRequest, _: TraceOptions, _: Option<BlockNumber>) -> Result<TraceResults>;
/// Executes all given calls and returns a number of possible traces for each of it.
#[rpc(name = "trace_callMany")]
fn call_many(&self, Vec<(CallRequest, TraceOptions)>, Option<BlockNumber>) -> Result<Vec<TraceResults>>;
fn call_many(&self, _: Vec<(CallRequest, TraceOptions)>, _: Option<BlockNumber>) -> Result<Vec<TraceResults>>;
/// Executes the given raw transaction and returns a number of possible traces for it.
#[rpc(name = "trace_rawTransaction")]
fn raw_transaction(&self, Bytes, TraceOptions, Option<BlockNumber>) -> Result<TraceResults>;
fn raw_transaction(&self, _: Bytes, _: TraceOptions, _: Option<BlockNumber>) -> Result<TraceResults>;
/// Executes the transaction with the given hash and returns a number of possible traces for it.
#[rpc(name = "trace_replayTransaction")]
fn replay_transaction(&self, H256, TraceOptions) -> Result<TraceResults>;
fn replay_transaction(&self, _: H256, _: TraceOptions) -> Result<TraceResults>;
/// Executes all the transactions at the given block and returns a number of possible traces for each transaction.
#[rpc(name = "trace_replayBlockTransactions")]
fn replay_block_transactions(&self, BlockNumber, TraceOptions) -> Result<Vec<TraceResultsWithTransactionHash>>;
fn replay_block_transactions(&self, _: BlockNumber, _: TraceOptions) -> Result<Vec<TraceResultsWithTransactionHash>>;
}

View File

@@ -22,7 +22,7 @@ use jsonrpc_derive::rpc;
use v1::types::Bytes;
/// Web3 rpc interface.
#[rpc]
#[rpc(server)]
pub trait Web3 {
/// Returns current client version.
#[rpc(name = "web3_clientVersion")]
@@ -30,5 +30,5 @@ pub trait Web3 {
/// Returns sha3 of the given data
#[rpc(name = "web3_sha3")]
fn sha3(&self, Bytes) -> Result<H256>;
fn sha3(&self, _: Bytes) -> Result<H256>;
}

View File

@@ -43,12 +43,14 @@ pub struct Receipt {
/// Logs
pub logs: Vec<Log>,
/// State Root
#[serde(rename = "root")]
// NOTE(niklasad1): EIP98 makes this optional field, if it's missing then skip serializing it
#[serde(skip_serializing_if = "Option::is_none", rename = "root")]
pub state_root: Option<H256>,
/// Logs bloom
pub logs_bloom: H2048,
/// Status code
#[serde(rename = "status")]
// NOTE(niklasad1): Unknown after EIP98 rules, if it's missing then skip serializing it
#[serde(skip_serializing_if = "Option::is_none", rename = "status")]
pub status_code: Option<U64>,
}
@@ -91,8 +93,8 @@ impl From<LocalizedReceipt> for Receipt {
impl From<RichReceipt> for Receipt {
fn from(r: RichReceipt) -> Self {
Receipt {
from: None,
to: None,
from: Some(r.from),
to: r.to.map(Into::into),
transaction_hash: Some(r.transaction_hash),
transaction_index: Some(r.transaction_index.into()),
block_hash: None,