mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 10:01:17 +00:00
allow polkadot-primitives to compile on nightly
This commit is contained in:
Generated
+16
-10
@@ -400,7 +400,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "fixed-hash"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/paritytech/primitives.git#30f15bb3387faf40f519dd56a5768cb3d3fe3638"
|
||||
source = "git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature#18e2f90688b0d90b5f79761865e394595ce55079"
|
||||
dependencies = [
|
||||
"libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -1054,16 +1054,16 @@ dependencies = [
|
||||
"blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crunchy 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fixed-hash 0.1.2 (git+https://github.com/paritytech/primitives.git)",
|
||||
"fixed-hash 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature)",
|
||||
"polkadot-runtime-codec 0.1.0",
|
||||
"polkadot-serializer 0.1.0",
|
||||
"pretty_assertions 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ring 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-hex 2.0.0 (git+https://github.com/rphmeier/rustc-hex.git)",
|
||||
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uint 0.1.0 (git+https://github.com/paritytech/primitives.git)",
|
||||
"uint 0.1.1 (git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature)",
|
||||
"untrusted 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -1312,6 +1312,11 @@ name = "rustc-hex"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hex"
|
||||
version = "2.0.0"
|
||||
source = "git+https://github.com/rphmeier/rustc-hex.git#ee2ec40b9062ac7769ccb9dc891d6dc2cc9009d7"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-serialize"
|
||||
version = "0.3.24"
|
||||
@@ -1612,20 +1617,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
[[package]]
|
||||
name = "uint"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/paritytech/primitives.git#30f15bb3387faf40f519dd56a5768cb3d3fe3638"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uint"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature#18e2f90688b0d90b5f79761865e394595ce55079"
|
||||
dependencies = [
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@@ -1815,7 +1820,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum ethcrypto 0.1.0 (git+https://github.com/paritytech/parity.git)" = "<none>"
|
||||
"checksum ethereum-types 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2adaa5b8ceafcce0bc3a68ef116ca5702958cc97d70a6eb008aeddb569b092b3"
|
||||
"checksum ethkey 0.3.0 (git+https://github.com/paritytech/parity.git)" = "<none>"
|
||||
"checksum fixed-hash 0.1.2 (git+https://github.com/paritytech/primitives.git)" = "<none>"
|
||||
"checksum fixed-hash 0.1.2 (git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature)" = "<none>"
|
||||
"checksum fixed-hash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4b54d107faeb66084eca7c506aa50b6b7cb9eb9a1f1f633ae2ca3af55620c191"
|
||||
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
|
||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
@@ -1894,6 +1899,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a"
|
||||
"checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e"
|
||||
"checksum rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e"
|
||||
"checksum rustc-hex 2.0.0 (git+https://github.com/rphmeier/rustc-hex.git)" = "<none>"
|
||||
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
|
||||
"checksum rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9743a7670d88d5d52950408ecdb7c71d8986251ab604d4689dd2ca25c9bca69"
|
||||
"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"
|
||||
@@ -1933,8 +1939,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum triehash 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9291c7f0fae44858b5e087dd462afb382354120003778f1695b44aab98c7abd7"
|
||||
"checksum twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "475352206e7a290c5fccc27624a163e8d0d115f7bb60ca18a64fc9ce056d7435"
|
||||
"checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
|
||||
"checksum uint 0.1.0 (git+https://github.com/paritytech/primitives.git)" = "<none>"
|
||||
"checksum uint 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91ed1e25ded4e37e0967b1f12d5f910b32f979768d4f48e2f6ca7b6e7130b44e"
|
||||
"checksum uint 0.1.1 (git+https://github.com/rphmeier/primitives.git?branch=uint-asm-with-feature)" = "<none>"
|
||||
"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
|
||||
"checksum unicase 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "284b6d3db520d67fbe88fd778c21510d1b0ba4a551e5d0fbb023d33405f6de8a"
|
||||
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
||||
|
||||
@@ -5,11 +5,11 @@ authors = ["Parity Technologies <admin@parity.io>"]
|
||||
|
||||
[dependencies]
|
||||
crunchy = "0.1"
|
||||
fixed-hash = { git = "https://github.com/paritytech/primitives.git" }
|
||||
rustc-hex = "1.0"
|
||||
serde = "1.0"
|
||||
fixed-hash = { git = "https://github.com/rphmeier/primitives.git", branch = "uint-asm-with-feature" }
|
||||
rustc-hex = { git = "https://github.com/rphmeier/rustc-hex.git", version = "2.0", default_features = false }
|
||||
serde = { version = "1.0", default_features = false }
|
||||
serde_derive = "1.0"
|
||||
uint = { git = "https://github.com/paritytech/primitives.git" }
|
||||
uint = { git = "https://github.com/rphmeier/primitives.git", branch = "uint-asm-with-feature" }
|
||||
ring = "0.12"
|
||||
untrusted = "0.5"
|
||||
twox-hash = "1.1.0"
|
||||
@@ -23,4 +23,4 @@ pretty_assertions = "0.4"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = ["uint/std", "fixed-hash/std", "polkadot-runtime-codec/std"]
|
||||
std = ["uint/std", "fixed-hash/std", "polkadot-runtime-codec/std", "serde/std", "rustc-hex/std"]
|
||||
|
||||
@@ -14,15 +14,29 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt;
|
||||
use core::fmt;
|
||||
|
||||
use serde::{de, Serializer, Deserializer};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod alloc_types {
|
||||
pub use ::alloc::string::String;
|
||||
pub use ::alloc::vec::Vec;
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
mod alloc_types {
|
||||
pub use ::std::vec::Vec;
|
||||
pub use ::std::string::String;
|
||||
}
|
||||
|
||||
pub use self::alloc_types::*;
|
||||
|
||||
/// Serializes a slice of bytes.
|
||||
pub fn serialize<S>(bytes: &[u8], serializer: S) -> Result<S::Ok, S::Error> where
|
||||
S: Serializer,
|
||||
{
|
||||
let hex = ::rustc_hex::ToHex::to_hex(bytes);
|
||||
let hex: String = ::rustc_hex::ToHex::to_hex(bytes);
|
||||
serializer.serialize_str(&format!("0x{}", hex))
|
||||
}
|
||||
|
||||
@@ -38,7 +52,7 @@ pub fn serialize_uint<S>(bytes: &[u8], serializer: S) -> Result<S::Ok, S::Error>
|
||||
return serializer.serialize_str("0x0");
|
||||
}
|
||||
|
||||
let hex = ::rustc_hex::ToHex::to_hex(bytes);
|
||||
let hex: String = ::rustc_hex::ToHex::to_hex(bytes);
|
||||
let has_leading_zero = !hex.is_empty() && &hex[0..1] == "0";
|
||||
serializer.serialize_str(
|
||||
&format!("0x{}", if has_leading_zero { &hex[1..] } else { &hex })
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Contract execution data.
|
||||
|
||||
use bytes;
|
||||
use bytes::{self, Vec};
|
||||
|
||||
/// Contract call data.
|
||||
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
//! Simple Ed25519 API.
|
||||
|
||||
use bytes::Vec;
|
||||
use untrusted;
|
||||
use ring::{rand, signature};
|
||||
use rustc_hex::FromHex;
|
||||
@@ -108,14 +109,14 @@ impl Pair {
|
||||
}
|
||||
/// Make a new key pair from the raw secret.
|
||||
pub fn from_secret(secret: &[u8; 32]) -> Pair {
|
||||
let mut pkcs8_bytes = FromHex::from_hex("302e020100300506032b657004220420").unwrap();
|
||||
let mut pkcs8_bytes: Vec<u8> = FromHex::from_hex("302e020100300506032b657004220420").unwrap();
|
||||
pkcs8_bytes.extend_from_slice(&secret[..]);
|
||||
Pair(signature::Ed25519KeyPair::from_pkcs8_maybe_unchecked(untrusted::Input::from(&pkcs8_bytes)).unwrap())
|
||||
}
|
||||
/// Make a new key pair from the raw secret and public key (it will check to make sure
|
||||
/// they correspond to each other).
|
||||
pub fn from_both(secret_public: &[u8; 64]) -> Option<Pair> {
|
||||
let mut pkcs8_bytes = FromHex::from_hex("3053020101300506032b657004220420").unwrap();
|
||||
let mut pkcs8_bytes: Vec<u8> = FromHex::from_hex("3053020101300506032b657004220420").unwrap();
|
||||
pkcs8_bytes.extend_from_slice(&secret_public[0..32]);
|
||||
pkcs8_bytes.extend_from_slice(&[0xa1u8, 0x23, 0x03, 0x21, 0x00]);
|
||||
pkcs8_bytes.extend_from_slice(&secret_public[32..64]);
|
||||
@@ -151,13 +152,13 @@ impl Signature {
|
||||
impl From<&'static str> for Public {
|
||||
fn from(hex: &'static str) -> Self {
|
||||
let mut r = [0u8; 32];
|
||||
r.copy_from_slice(&FromHex::from_hex(hex).unwrap()[0..32]);
|
||||
r.copy_from_slice(&FromHex::from_hex::<Vec<_>>(hex).unwrap()[0..32]);
|
||||
Public(r)
|
||||
}
|
||||
}
|
||||
impl From<&'static str> for Pair {
|
||||
fn from(hex: &'static str) -> Self {
|
||||
let data = FromHex::from_hex(hex).expect("Key pair given is static so hex should be good.");
|
||||
let data = FromHex::from_hex::<Vec<_>>(hex).expect("Key pair given is static so hex should be good.");
|
||||
match data.len() {
|
||||
32 => {
|
||||
let mut r = [0u8; 32];
|
||||
@@ -178,7 +179,7 @@ impl From<&'static str> for Pair {
|
||||
impl From<&'static str> for Signature {
|
||||
fn from(hex: &'static str) -> Self {
|
||||
let mut r = [0u8; 64];
|
||||
r.copy_from_slice(&FromHex::from_hex(hex).unwrap()[0..64]);
|
||||
r.copy_from_slice(&FromHex::from_hex::<Vec<_>>(hex).unwrap()[0..64]);
|
||||
Signature(r)
|
||||
}
|
||||
}
|
||||
@@ -228,7 +229,7 @@ mod test {
|
||||
let pair = Pair::from_seed(b"12345678901234567890123456789012");
|
||||
let public = pair.public();
|
||||
assert_eq!(public, "2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee".into());
|
||||
let message = FromHex::from_hex("2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee00000000000000000228000000d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a4500000000000000").unwrap();
|
||||
let message: Vec<u8> = FromHex::from_hex("2f8c6129d816cf51c374bc7f08c3e63ed156cf78aefb4a6550d97b87997977ee00000000000000000228000000d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a4500000000000000").unwrap();
|
||||
let signature = pair.sign(&message[..]);
|
||||
assert!(signature.verify(&message[..], &public));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ impl<'a> HexDisplay<'a> {
|
||||
pub fn from(d: &'a AsBytesRef) -> Self { HexDisplay(d.as_bytes_ref()) }
|
||||
}
|
||||
|
||||
impl<'a> ::std::fmt::Display for HexDisplay<'a> {
|
||||
impl<'a> ::core::fmt::Display for HexDisplay<'a> {
|
||||
fn fmt(&self, fmtr: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
|
||||
for byte in self.0 {
|
||||
try!( fmtr.write_fmt(format_args!("{:02x}", byte)));
|
||||
@@ -47,7 +47,7 @@ impl AsBytesRef for [u8] {
|
||||
fn as_bytes_ref(&self) -> &[u8] { &self }
|
||||
}
|
||||
|
||||
impl AsBytesRef for Vec<u8> {
|
||||
impl AsBytesRef for ::bytes::Vec<u8> {
|
||||
fn as_bytes_ref(&self) -> &[u8] { &self }
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||
|
||||
extern crate rustc_hex;
|
||||
extern crate serde;
|
||||
extern crate ring;
|
||||
@@ -35,7 +38,7 @@ extern crate serde_derive;
|
||||
#[macro_use]
|
||||
extern crate uint as uint_crate;
|
||||
|
||||
#[cfg(feature="std")]
|
||||
#[cfg(feature = "std")]
|
||||
extern crate core;
|
||||
#[cfg(test)]
|
||||
extern crate polkadot_serializer;
|
||||
@@ -43,6 +46,10 @@ extern crate polkadot_serializer;
|
||||
#[macro_use]
|
||||
extern crate pretty_assertions;
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
|
||||
mod bytes;
|
||||
pub mod block;
|
||||
pub mod contract;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Parachain data types.
|
||||
|
||||
use bytes;
|
||||
use bytes::{self, Vec};
|
||||
|
||||
/// Unique identifier of a parachain.
|
||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Serialize, Deserialize)]
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
//! Validator primitives.
|
||||
|
||||
use bytes;
|
||||
use bytes::{self, Vec};
|
||||
use parachain;
|
||||
|
||||
/// Parachain outgoing message.
|
||||
|
||||
Reference in New Issue
Block a user