Clean up serde rename and use rename_all = camelCase when possible (#9823)

* Clean up serde rename and use rename_all = camelCase when possible

* snake_case for pricing

* Use camelcase for engine

* Use camel case for seal

* Use camel case for validator set

* Use camel case for confirmation payload

* Use camel case for consensus status

* Use camel case for nodekind

* Use kebab case for provenance

* Use camel case for pubsub

* Use lowercase and camelcase for trace

* Use camel case for whisper

* rename Ethash as irregular name
This commit is contained in:
Wei Tang
2018-10-29 23:49:04 +08:00
committed by GitHub
parent f8f8bf0fea
commit 05be4b5b0e
50 changed files with 140 additions and 311 deletions

View File

@@ -23,13 +23,13 @@ use maybe::MaybeEmpty;
/// Vm call deserialization.
#[derive(Debug, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Call {
/// Call data.
pub data: Bytes,
/// Call destination.
pub destination: MaybeEmpty<Address>,
/// Gas limit.
#[serde(rename="gasLimit")]
pub gas_limit: Uint,
/// Call value.
pub value: Uint,

View File

@@ -22,19 +22,19 @@ use uint::Uint;
#[derive(Debug, PartialEq, Deserialize)]
pub struct Env {
/// Address.
#[serde(rename="currentCoinbase")]
#[serde(rename = "currentCoinbase")]
pub author: Address,
/// Difficulty
#[serde(rename="currentDifficulty")]
#[serde(rename = "currentDifficulty")]
pub difficulty: Uint,
/// Gas limit.
#[serde(rename="currentGasLimit")]
#[serde(rename = "currentGasLimit")]
pub gas_limit: Uint,
/// Number.
#[serde(rename="currentNumber")]
#[serde(rename = "currentNumber")]
pub number: Uint,
/// Timestamp.
#[serde(rename="currentTimestamp")]
#[serde(rename = "currentTimestamp")]
pub timestamp: Uint,
}

View File

@@ -21,11 +21,12 @@ use bytes::Bytes;
/// Executed transaction.
#[derive(Debug, PartialEq, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Transaction {
/// Contract address.
pub address: Address,
/// Transaction sender.
#[serde(rename="caller")]
#[serde(rename = "caller")]
pub sender: Address,
/// Contract code.
pub code: Bytes,
@@ -34,7 +35,6 @@ pub struct Transaction {
/// Gas.
pub gas: Uint,
/// Gas price.
#[serde(rename="gasPrice")]
pub gas_price: Uint,
/// Transaction origin.
pub origin: Address,

View File

@@ -26,26 +26,26 @@ use vm::{Transaction, Call, Env};
#[derive(Debug, PartialEq, Deserialize)]
pub struct Vm {
/// Contract calls made internaly by executed transaction.
#[serde(rename="callcreates")]
#[serde(rename = "callcreates")]
pub calls: Option<Vec<Call>>,
/// Env info.
pub env: Env,
/// Executed transaction
#[serde(rename="exec")]
#[serde(rename = "exec")]
pub transaction: Transaction,
/// Gas left after transaction execution.
#[serde(rename="gas")]
#[serde(rename = "gas")]
pub gas_left: Option<Uint>,
/// Hash of logs created during execution of transaction.
pub logs: Option<H256>,
/// Transaction output.
#[serde(rename="out")]
#[serde(rename = "out")]
pub output: Option<Bytes>,
/// Post execution vm state.
#[serde(rename="post")]
#[serde(rename = "post")]
pub post_state: Option<State>,
/// Pre execution vm state.
#[serde(rename="pre")]
#[serde(rename = "pre")]
pub pre_state: State,
}