mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
update most of the dependencies (#1946)
* update tiny-keccak to 0.2 * update deps except bitvec and shared_memory * fix some warning after futures upgrade * remove useless package rename caused by bug in cargo-upgrade * revert parity-util-mem * * remove unused import * cargo update * remove all renames on parity-scale-codec * remove the leftovers * remove unused dep
This commit is contained in:
@@ -8,9 +8,9 @@ build = "build.rs"
|
||||
|
||||
[dependencies]
|
||||
parachain = { package = "polkadot-parachain", path = "../../", default-features = false, features = [ "wasm-api" ] }
|
||||
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] }
|
||||
parity-scale-codec = { version = "1.3.5", default-features = false, features = ["derive"] }
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
tiny-keccak = "1.5.0"
|
||||
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
|
||||
dlmalloc = { version = "0.1.3", features = [ "global" ] }
|
||||
|
||||
# We need to make sure the global allocator is disabled until we have support of full substrate externalities
|
||||
|
||||
@@ -10,11 +10,11 @@ name = "adder-collator"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] }
|
||||
futures = "0.3.4"
|
||||
parity-scale-codec = { version = "1.3.5", default-features = false, features = ["derive"] }
|
||||
futures = "0.3.8"
|
||||
futures-timer = "3.0.2"
|
||||
log = "0.4.8"
|
||||
structopt = "0.3.8"
|
||||
log = "0.4.11"
|
||||
structopt = "0.3.20"
|
||||
|
||||
test-parachain-adder = { path = ".." }
|
||||
polkadot-primitives = { path = "../../../../primitives" }
|
||||
|
||||
@@ -21,7 +21,7 @@ use test_parachain_adder::{hash_state, BlockData, HeadData, execute};
|
||||
use futures_timer::Delay;
|
||||
use polkadot_primitives::v1::{PoV, CollatorId, CollatorPair};
|
||||
use polkadot_node_primitives::{Collation, CollatorFn};
|
||||
use codec::{Encode, Decode};
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
use sp_core::Pair;
|
||||
|
||||
/// The amount we add when producing a new block.
|
||||
@@ -168,7 +168,7 @@ mod tests {
|
||||
use futures::executor::block_on;
|
||||
use polkadot_parachain::{primitives::ValidationParams, wasm_executor::IsolationStrategy};
|
||||
use polkadot_primitives::v1::{ValidationData, PersistedValidationData};
|
||||
use codec::Decode;
|
||||
use parity_scale_codec::Decode;
|
||||
|
||||
#[test]
|
||||
fn collator_works() {
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), feature(core_intrinsics, lang_items, core_panic_info, alloc_error_handler))]
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
use tiny_keccak::{Hasher as _, Keccak};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod wasm_validation;
|
||||
@@ -33,6 +34,14 @@ static ALLOC: dlmalloc::GlobalDlmalloc = dlmalloc::GlobalDlmalloc;
|
||||
#[cfg(feature = "std")]
|
||||
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
||||
|
||||
fn keccak256(input: &[u8]) -> [u8; 32] {
|
||||
let mut out = [0u8; 32];
|
||||
let mut keccak256 = Keccak::v256();
|
||||
keccak256.update(input);
|
||||
keccak256.finalize(&mut out);
|
||||
out
|
||||
}
|
||||
|
||||
/// Wasm binary unwrapped. If built with `BUILD_DUMMY_WASM_BINARY`, the function panics.
|
||||
#[cfg(feature = "std")]
|
||||
pub fn wasm_binary_unwrap() -> &'static [u8] {
|
||||
@@ -53,7 +62,7 @@ pub struct HeadData {
|
||||
|
||||
impl HeadData {
|
||||
pub fn hash(&self) -> [u8; 32] {
|
||||
tiny_keccak::keccak256(&self.encode())
|
||||
keccak256(&self.encode())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +76,7 @@ pub struct BlockData {
|
||||
}
|
||||
|
||||
pub fn hash_state(state: u64) -> [u8; 32] {
|
||||
tiny_keccak::keccak256(state.encode().as_slice())
|
||||
keccak256(state.encode().as_slice())
|
||||
}
|
||||
|
||||
/// Start state mismatched with parent header's state hash.
|
||||
|
||||
@@ -20,7 +20,7 @@ use crate::{HeadData, BlockData};
|
||||
use core::panic;
|
||||
use sp_std::vec::Vec;
|
||||
use parachain::primitives::{ValidationResult, HeadData as GenericHeadData};
|
||||
use codec::{Encode, Decode};
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn validate_block(params: *const u8, len: usize) -> u64 {
|
||||
@@ -31,7 +31,7 @@ pub extern "C" fn validate_block(params: *const u8, len: usize) -> u64 {
|
||||
let block_data = BlockData::decode(&mut ¶ms.block_data.0[..])
|
||||
.expect("invalid block data format.");
|
||||
|
||||
let parent_hash = tiny_keccak::keccak256(¶ms.parent_head.0[..]);
|
||||
let parent_hash = crate::keccak256(¶ms.parent_head.0[..]);
|
||||
|
||||
let new_head = crate::execute(parent_hash, parent_head, &block_data).expect("Executes block");
|
||||
parachain::write_result(
|
||||
|
||||
Reference in New Issue
Block a user