mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-09 14:07:26 +00:00
Update some types and interfaces to match the spec (#24)
* Update primitives. * Fix validator interface.
This commit is contained in:
committed by
Robert Habermeier
parent
d17dcc1893
commit
55e74cd426
@@ -19,16 +19,29 @@ use std::fmt;
|
||||
use primitives::validator;
|
||||
use serde::de::DeserializeOwned;
|
||||
|
||||
use error::Result;
|
||||
|
||||
/// Parachain code implementation.
|
||||
pub trait ParachainCode: fmt::Debug {
|
||||
/// Deserialized messages type.
|
||||
type Messages: DeserializeOwned;
|
||||
/// Deserialized proof type.
|
||||
type Proof: DeserializeOwned;
|
||||
/// Deserialized message type.
|
||||
type Message: DeserializeOwned;
|
||||
/// Balance download.
|
||||
type Download: DeserializeOwned;
|
||||
/// Deserialized block data type.
|
||||
type BlockData: DeserializeOwned;
|
||||
/// Parachain head data.
|
||||
type HeadData: DeserializeOwned;
|
||||
/// Result
|
||||
type Result: Into<validator::ValidationResult>;
|
||||
|
||||
/// Given decoded messages and proof validate it and return egress posts.
|
||||
fn check(&self, messages: Self::Messages, proof: Self::Proof) ->
|
||||
Option<(validator::IngressPostsDelta, validator::EgressPosts)>;
|
||||
fn check(
|
||||
&self,
|
||||
messages: Vec<(u64, Vec<Self::Message>)>,
|
||||
downloads: Vec<Self::Download>,
|
||||
block_data: Self::BlockData,
|
||||
head_data: Self::HeadData,
|
||||
) -> Result<Self::Result>;
|
||||
}
|
||||
|
||||
/// Dummy implementation of the first parachain validation.
|
||||
@@ -36,11 +49,20 @@ pub trait ParachainCode: fmt::Debug {
|
||||
pub struct ParaChain1;
|
||||
|
||||
impl ParachainCode for ParaChain1 {
|
||||
type Messages = ();
|
||||
type Proof = ();
|
||||
type Message = ();
|
||||
type Download = ();
|
||||
type BlockData = ();
|
||||
type HeadData = ();
|
||||
type Result = validator::ValidationResult;
|
||||
|
||||
fn check(&self, _messages: Self::Messages, _proof: Self::Proof)
|
||||
-> Option<(validator::IngressPostsDelta, validator::EgressPosts)> {
|
||||
None
|
||||
fn check(
|
||||
&self,
|
||||
_messages: Vec<(u64, Vec<Self::Message>)>,
|
||||
_downloads: Vec<Self::Download>,
|
||||
_block_data: Self::BlockData,
|
||||
_head_data: Self::HeadData,
|
||||
) -> Result<Self::Result>
|
||||
{
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user