Skip to content

Commit

Permalink
Use rename_all for RichBlock and RichHeader serialization (openethere…
Browse files Browse the repository at this point in the history
…um#8471)

* typo: fix a resolved TODO comment

* Use rename_all instead of individual renames
  • Loading branch information
sorpaas authored and VladLupashevskyi committed May 23, 2018
1 parent 1b48864 commit c1a534b
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions rpc/src/v1/types/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ impl Serialize for BlockTransactions {

/// Block representation
#[derive(Debug, Serialize)]
#[serde(rename_all="camelCase")]
pub struct Block {
/// Hash of the block
pub hash: Option<H256>,
/// Hash of the parent
#[serde(rename="parentHash")]
pub parent_hash: H256,
/// Hash of the uncles
#[serde(rename="sha3Uncles")]
Expand All @@ -58,37 +58,28 @@ pub struct Block {
/// Alias of `author`
pub miner: H160,
/// State root hash
#[serde(rename="stateRoot")]
pub state_root: H256,
/// Transactions root hash
#[serde(rename="transactionsRoot")]
pub transactions_root: H256,
/// Transactions receipts root hash
#[serde(rename="receiptsRoot")]
pub receipts_root: H256,
/// Block number
pub number: Option<U256>,
/// Gas Used
#[serde(rename="gasUsed")]
pub gas_used: U256,
/// Gas Limit
#[serde(rename="gasLimit")]
pub gas_limit: U256,
/// Extra data
#[serde(rename="extraData")]
pub extra_data: Bytes,
/// Logs bloom
#[serde(rename="logsBloom")]
pub logs_bloom: Option<H2048>,
/// Timestamp
pub timestamp: U256,
/// Difficulty
pub difficulty: U256,
/// Total difficulty
#[serde(rename="totalDifficulty")]
pub total_difficulty: Option<U256>,
/// Seal fields
#[serde(rename="sealFields")]
pub seal_fields: Vec<Bytes>,
/// Uncles' hashes
pub uncles: Vec<H256>,
Expand All @@ -100,49 +91,40 @@ pub struct Block {

/// Block header representation.
#[derive(Debug, Clone, Serialize, PartialEq, Eq)]
#[serde(rename_all="camelCase")]
pub struct Header {
/// Hash of the block
pub hash: Option<H256>,
/// Hash of the parent
#[serde(rename="parentHash")]
pub parent_hash: H256,
/// Hash of the uncles
#[serde(rename="sha3Uncles")]
pub uncles_hash: H256,
/// Authors address
pub author: H160,
// TODO: get rid of this one
/// ?
/// Alias of `author`
pub miner: H160,
/// State root hash
#[serde(rename="stateRoot")]
pub state_root: H256,
/// Transactions root hash
#[serde(rename="transactionsRoot")]
pub transactions_root: H256,
/// Transactions receipts root hash
#[serde(rename="receiptsRoot")]
pub receipts_root: H256,
/// Block number
pub number: Option<U256>,
/// Gas Used
#[serde(rename="gasUsed")]
pub gas_used: U256,
/// Gas Limit
#[serde(rename="gasLimit")]
pub gas_limit: U256,
/// Extra data
#[serde(rename="extraData")]
pub extra_data: Bytes,
/// Logs bloom
#[serde(rename="logsBloom")]
pub logs_bloom: H2048,
/// Timestamp
pub timestamp: U256,
/// Difficulty
pub difficulty: U256,
/// Seal fields
#[serde(rename="sealFields")]
pub seal_fields: Vec<Bytes>,
/// Size in bytes
pub size: Option<U256>,
Expand Down

0 comments on commit c1a534b

Please sign in to comment.