Use rename_all for RichBlock and RichHeader serialization (#8471)

* typo: fix a resolved TODO comment

* Use rename_all instead of individual renames
This commit is contained in:
Wei Tang 2018-04-25 16:00:58 +08:00 committed by Afri Schoedon
parent baeda93474
commit 7fdb87ad38

View File

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