Skip to content
Snippets Groups Projects
Commit 0ceebe66 authored by Tomasz Drwięga's avatar Tomasz Drwięga Committed by asynchronous rob
Browse files

camel case and deny (#20)

parent 3dfafb5e
Branches
No related merge requests found
...@@ -24,12 +24,12 @@ pub type HeaderHash = H256; ...@@ -24,12 +24,12 @@ pub type HeaderHash = H256;
/// A relay chain block header. /// A relay chain block header.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct Header { pub struct Header {
/// Block parent's hash. /// Block parent's hash.
#[serde(rename="parentHash")]
pub parent_hash: HeaderHash, pub parent_hash: HeaderHash,
/// State root after this transition. /// State root after this transition.
#[serde(rename="stateRoot")]
pub state_root: H256, pub state_root: H256,
/// Unix time at which this header was produced. /// Unix time at which this header was produced.
pub timestamp: u64, pub timestamp: u64,
...@@ -42,9 +42,10 @@ pub struct Header { ...@@ -42,9 +42,10 @@ pub struct Header {
/// Included candidates should be sorted by parachain ID, and without duplicate /// Included candidates should be sorted by parachain ID, and without duplicate
/// IDs. /// IDs.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct Body { pub struct Body {
/// Parachain proposal blocks. /// Parachain proposal blocks.
#[serde(rename="paraBlocks")]
pub para_blocks: Vec<parachain::Proposal>, pub para_blocks: Vec<parachain::Proposal>,
} }
......
...@@ -32,13 +32,14 @@ impl From<u64> for Id { ...@@ -32,13 +32,14 @@ impl From<u64> for Id {
/// A parachain block proposal. /// A parachain block proposal.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub struct Proposal { pub struct Proposal {
/// The ID of the parachain this is a proposal for. /// The ID of the parachain this is a proposal for.
pub parachain: Id, pub parachain: Id,
/// Parachain block header bytes. /// Parachain block header bytes.
pub header: Header, pub header: Header,
/// Hash of data necessary to prove validity of the header. /// Hash of data necessary to prove validity of the header.
#[serde(rename="proofHash")]
pub proof_hash: ProofHash, pub proof_hash: ProofHash,
} }
......
...@@ -33,11 +33,11 @@ pub struct EgressPosts(#[serde(with="bytes")] pub Vec<u8>); ...@@ -33,11 +33,11 @@ pub struct EgressPosts(#[serde(with="bytes")] pub Vec<u8>);
/// Validity result of particular proof and ingress queue. /// Validity result of particular proof and ingress queue.
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(tag="type", content="data")] #[serde(tag="type", content="data")]
#[serde(rename_all = "camelCase")]
#[serde(deny_unknown_fields)]
pub enum ProofValidity { pub enum ProofValidity {
/// The proof is invalid. /// The proof is invalid.
#[serde(rename="invalid")]
Invalid, Invalid,
#[serde(rename="valid")]
/// The proof is processed and new egress queue is created. /// The proof is processed and new egress queue is created.
/// Also includes current ingress queue delta. /// Also includes current ingress queue delta.
Valid(IngressPostsDelta, EgressPosts), Valid(IngressPostsDelta, EgressPosts),
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment