mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 21:21:11 +00:00
Full native build with new structure.
No tests yet. Wasm build still pulls in std.
This commit is contained in:
@@ -20,7 +20,7 @@ use std::ops::Range;
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::collections::hash_map::Entry;
|
||||
use network::PeerId;
|
||||
use primitives::relay::BlockNumber;
|
||||
use primitives::block::Number as BlockNumber;
|
||||
use message;
|
||||
|
||||
const MAX_PARALLEL_DOWNLOADS: u32 = 1;
|
||||
@@ -190,7 +190,7 @@ impl BlockCollection {
|
||||
mod test {
|
||||
use super::{BlockCollection, BlockData};
|
||||
use message;
|
||||
use primitives::relay::{HeaderHash};
|
||||
use primitives::HeaderHash;
|
||||
|
||||
fn is_empty(bc: &BlockCollection) -> bool {
|
||||
bc.blocks.is_empty() &&
|
||||
@@ -260,4 +260,3 @@ mod test {
|
||||
assert_eq!(drained[40..], blocks[121..150].iter().map(|b| BlockData { block: b.clone(), origin: 1 }).collect::<Vec<_>>()[..]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use client::{self, Client as PolkadotClient, ImportResult, ClientInfo, BlockStatus};
|
||||
use client::error::Error;
|
||||
use state_machine;
|
||||
use primitives::relay::block;
|
||||
use primitives::block;
|
||||
|
||||
pub trait Client : Send + Sync {
|
||||
/// Given a hash return a header
|
||||
@@ -55,5 +55,3 @@ impl<B, E> Client for PolkadotClient<B, E> where
|
||||
(self as &Client).block_hash(block_number)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,11 +28,14 @@ extern crate parking_lot;
|
||||
extern crate smallvec;
|
||||
extern crate ipnetwork;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate polkadot_client as client;
|
||||
extern crate substrate_state_machine as state_machine;
|
||||
extern crate substrate_serializer as ser;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
// TODO: remove these two; split off dependent logic into polkadot-network and rename this crate
|
||||
// to substrate-network.
|
||||
extern crate polkadot_primitives as polkadot_primitives;
|
||||
extern crate polkadot_client as client;
|
||||
#[macro_use] extern crate serde_derive;
|
||||
#[macro_use] extern crate log;
|
||||
#[macro_use] extern crate bitflags;
|
||||
@@ -56,7 +59,6 @@ pub use protocol::{ProtocolStatus};
|
||||
pub use network::{NonReservedPeerMode, ConnectionFilter, ConnectionDirection, NetworkConfiguration};
|
||||
|
||||
// TODO: move it elsewhere
|
||||
fn header_hash(header: &primitives::relay::Header) -> primitives::relay::HeaderHash {
|
||||
fn header_hash(header: &primitives::Header) -> primitives::block::HeaderHash {
|
||||
primitives::hashing::blake2_256(&ser::to_vec(header)).into()
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
//! Network packet message types. These get serialized and put into the lower level protocol payload.
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use primitives::parachain::Id as ParachainId;
|
||||
use primitives::relay::{AccountId, BlockNumber, HeaderHash, Header, Body};
|
||||
use primitives::AuthorityId;
|
||||
use primitives::block::{Number as BlockNumber, HeaderHash, Header, Body};
|
||||
use service::Role as RoleFlags;
|
||||
use polkadot_primitives::parachain::Id as ParachainId;
|
||||
|
||||
pub type RequestId = u64;
|
||||
type Bytes = Vec<u8>;
|
||||
@@ -149,7 +150,7 @@ pub struct Status {
|
||||
/// Signatue of `best_hash` made with validator address. Required for the validator role.
|
||||
pub validator_signature: Option<Signature>,
|
||||
/// Validator address. Required for the validator role.
|
||||
pub validator_id: Option<AccountId>,
|
||||
pub validator_id: Option<AuthorityId>,
|
||||
/// Parachain id. Required for the collator role.
|
||||
pub parachain_id: Option<ParachainId>,
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ use std::sync::Arc;
|
||||
use parking_lot::RwLock;
|
||||
use serde_json;
|
||||
use std::time;
|
||||
use primitives::relay::{HeaderHash, TransactionHash, BlockNumber, Header};
|
||||
use primitives::block::{HeaderHash, TransactionHash, Number as BlockNumber, Header};
|
||||
use network::{PeerId, NodeId};
|
||||
|
||||
use message::{self, Message};
|
||||
@@ -342,6 +342,3 @@ impl Protocol {
|
||||
&*self.chain
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ use std::collections::{BTreeMap};
|
||||
use std::io;
|
||||
use network::{NetworkProtocolHandler, NetworkService, NetworkContext, HostInfo, PeerId, ProtocolId,
|
||||
NetworkConfiguration , NonReservedPeerMode, ErrorKind};
|
||||
use primitives::relay::{TransactionHash, Header};
|
||||
use primitives::block::{TransactionHash, Header};
|
||||
use core_io::{TimerToken};
|
||||
use io::NetSyncIo;
|
||||
use protocol::{Protocol, ProtocolStatus, PeerInfo as ProtocolPeerInfo, TransactionStats};
|
||||
|
||||
@@ -19,7 +19,7 @@ use io::SyncIo;
|
||||
use protocol::Protocol;
|
||||
use network::PeerId;
|
||||
use client::{ImportResult, BlockStatus, ClientInfo};
|
||||
use primitives::relay::{HeaderHash, BlockNumber, Header};
|
||||
use primitives::block::{HeaderHash, Number as BlockNumber, Header};
|
||||
use blocks::{self, BlockCollection};
|
||||
use message::{self, Message};
|
||||
use super::header_hash;
|
||||
@@ -366,7 +366,3 @@ impl ChainSync {
|
||||
protocol.send_message(io, peer_id, Message::BlockRequest(request));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user