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:
Andronik Ordian
2020-11-17 11:16:31 +01:00
committed by GitHub
parent 2a25eacb22
commit 0a8a607a58
91 changed files with 1413 additions and 1310 deletions
@@ -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 &params.block_data.0[..])
.expect("invalid block data format.");
let parent_hash = tiny_keccak::keccak256(&params.parent_head.0[..]);
let parent_hash = crate::keccak256(&params.parent_head.0[..]);
let new_head = crate::execute(parent_hash, parent_head, &block_data).expect("Executes block");
parachain::write_result(