mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
Strip out old XCMP primitives (#823)
* WIP * WIp * Mostly get tests to compile * Fix adder collator * Remove more stuff * Revert some changes to av store * Fix av store tests * Nitpicks * Restore some things * Small changes * Remvoe unused error variants
This commit is contained in:
@@ -24,9 +24,7 @@ use sp_core::Pair;
|
||||
use codec::{Encode, Decode};
|
||||
use primitives::{
|
||||
Hash,
|
||||
parachain::{
|
||||
HeadData, BlockData, Id as ParaId, Message, OutgoingMessages, Status as ParachainStatus,
|
||||
},
|
||||
parachain::{HeadData, BlockData, Id as ParaId, Status as ParachainStatus},
|
||||
};
|
||||
use collator::{
|
||||
InvalidHead, ParachainContext, Network, BuildParachainContext, load_spec, Configuration,
|
||||
@@ -57,13 +55,12 @@ struct AdderContext {
|
||||
|
||||
/// The parachain context.
|
||||
impl ParachainContext for AdderContext {
|
||||
type ProduceCandidate = Ready<Result<(BlockData, HeadData, OutgoingMessages), InvalidHead>>;
|
||||
type ProduceCandidate = Ready<Result<(BlockData, HeadData), InvalidHead>>;
|
||||
|
||||
fn produce_candidate<I: IntoIterator<Item=(ParaId, Message)>>(
|
||||
fn produce_candidate(
|
||||
&mut self,
|
||||
_relay_parent: Hash,
|
||||
status: ParachainStatus,
|
||||
ingress: I,
|
||||
) -> Self::ProduceCandidate
|
||||
{
|
||||
let adder_head = match AdderHead::decode(&mut &status.head_data.0[..]) {
|
||||
@@ -86,11 +83,7 @@ impl ParachainContext for AdderContext {
|
||||
add: adder_head.number % 100,
|
||||
};
|
||||
|
||||
let from_messages = ::adder::process_messages(
|
||||
ingress.into_iter().map(|(_, msg)| msg.0)
|
||||
);
|
||||
|
||||
let next_head = ::adder::execute(adder_head.hash(), adder_head, &next_body, from_messages)
|
||||
let next_head = ::adder::execute(adder_head.hash(), adder_head, &next_body)
|
||||
.expect("good execution params; qed");
|
||||
|
||||
let encoded_head = HeadData(next_head.encode());
|
||||
@@ -100,7 +93,7 @@ impl ParachainContext for AdderContext {
|
||||
next_head.number, next_body.state.overflowing_add(next_body.add).0);
|
||||
|
||||
db.insert(next_head.clone(), next_body);
|
||||
ok((encoded_body, encoded_head, OutgoingMessages { outgoing_messages: Vec::new() }))
|
||||
ok((encoded_body, encoded_head))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,6 @@ pub fn execute(
|
||||
parent_hash: [u8; 32],
|
||||
parent_head: HeadData,
|
||||
block_data: &BlockData,
|
||||
from_messages: u64,
|
||||
) -> Result<HeadData, StateMismatch> {
|
||||
debug_assert_eq!(parent_hash, parent_head.hash());
|
||||
|
||||
@@ -99,7 +98,6 @@ pub fn execute(
|
||||
}
|
||||
|
||||
let new_state = block_data.state.overflowing_add(block_data.add).0;
|
||||
let new_state = new_state.overflowing_add(from_messages).0;
|
||||
|
||||
Ok(HeadData {
|
||||
number: parent_head.number + 1,
|
||||
|
||||
@@ -48,13 +48,7 @@ pub extern fn validate_block(params: *const u8, len: usize) -> u64 {
|
||||
|
||||
let parent_hash = tiny_keccak::keccak256(¶ms.parent_head[..]);
|
||||
|
||||
// we also add based on incoming data from messages. ignoring unknown message
|
||||
// kinds.
|
||||
let from_messages = crate::process_messages(
|
||||
params.ingress.iter().map(|incoming| &incoming.data[..])
|
||||
);
|
||||
|
||||
match crate::execute(parent_hash, parent_head, &block_data, from_messages) {
|
||||
match crate::execute(parent_hash, parent_head, &block_data) {
|
||||
Ok(new_head) => parachain::write_result(
|
||||
&ValidationResult { head_data: new_head.encode() }
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user