Merge pull request #3662 from ethcore/strict-rpc

Strict deserialization
This commit is contained in:
Gav Wood 2016-11-29 12:10:31 +01:00 committed by GitHub
commit 1166013c2b
7 changed files with 9 additions and 1 deletions

View File

@ -17,6 +17,7 @@
use endpoint::EndpointInfo; use endpoint::EndpointInfo;
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] #[derive(Debug, PartialEq, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct App { pub struct App {
pub id: String, pub id: String,
pub name: String, pub name: String,
@ -54,6 +55,7 @@ impl Into<EndpointInfo> for App {
} }
#[derive(Debug, PartialEq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct ApiError { pub struct ApiError {
pub code: String, pub code: String,
pub title: String, pub title: String,

View File

@ -19,6 +19,7 @@ use v1::types::{Bytes, H160, U256};
/// Call request /// Call request
#[derive(Debug, Default, PartialEq, Deserialize)] #[derive(Debug, Default, PartialEq, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct CallRequest { pub struct CallRequest {
/// From /// From
pub from: Option<H160>, pub from: Option<H160>,

View File

@ -137,6 +137,7 @@ impl From<helpers::ConfirmationPayload> for ConfirmationPayload {
/// Possible modifications to the confirmed transaction sent by `Trusted Signer` /// Possible modifications to the confirmed transaction sent by `Trusted Signer`
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct TransactionModification { pub struct TransactionModification {
/// Modified gas price /// Modified gas price
#[serde(rename="gasPrice")] #[serde(rename="gasPrice")]

View File

@ -21,6 +21,7 @@ use util::stats;
/// Values of RPC settings. /// Values of RPC settings.
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Histogram { pub struct Histogram {
/// Gas prices for bucket edges. /// Gas prices for bucket edges.
#[serde(rename="bucketBounds")] #[serde(rename="bucketBounds")]

View File

@ -18,6 +18,7 @@
/// Values of RPC settings. /// Values of RPC settings.
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct RpcSettings { pub struct RpcSettings {
/// Whether RPC is enabled. /// Whether RPC is enabled.
pub enabled: bool, pub enabled: bool,
@ -25,4 +26,4 @@ pub struct RpcSettings {
pub interface: String, pub interface: String,
/// The port being listened on. /// The port being listened on.
pub port: u64, pub port: u64,
} }

View File

@ -22,6 +22,7 @@ use v1::types::{BlockNumber, H160};
/// Trace filter /// Trace filter
#[derive(Debug, PartialEq, Deserialize)] #[derive(Debug, PartialEq, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct TraceFilter { pub struct TraceFilter {
/// From block /// From block
#[serde(rename="fromBlock")] #[serde(rename="fromBlock")]

View File

@ -21,6 +21,7 @@ use v1::helpers;
/// Transaction request coming from RPC /// Transaction request coming from RPC
#[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Serialize, Deserialize)] #[derive(Debug, Clone, Default, Eq, PartialEq, Hash, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct TransactionRequest { pub struct TransactionRequest {
/// Sender /// Sender
pub from: H160, pub from: H160,