mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 19:51:05 +00:00
Update to parity-scale-codec (#3232)
* WIP: update codec * WIP * compiling * WIP * rename parity-scale-codec to codec * WIP * fix * remove old comments * use published crates * fix expected error msg * bump version * fmt and fix * remove old comment * fix wrong decoding impl * implement encode like for structures * undo removal of old pending changes * trailingzeroinput * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com> * update codec * fmt * version is 1.0.0 * show more error * fmt
This commit is contained in:
committed by
Bastian Köcher
parent
a0d442333f
commit
4ed67e03a4
@@ -98,7 +98,7 @@ use crate::wasm::{WasmLoader, WasmVm};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use primitives::crypto::UncheckedFrom;
|
||||
use rstd::{prelude::*, marker::PhantomData};
|
||||
use parity_codec::{Codec, Encode, Decode};
|
||||
use codec::{Codec, Encode, Decode};
|
||||
use runtime_io::blake2_256;
|
||||
use sr_primitives::traits::{
|
||||
Hash, StaticLookup, Zero, MaybeSerializeDebug, Member
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::{
|
||||
};
|
||||
use assert_matches::assert_matches;
|
||||
use hex_literal::*;
|
||||
use parity_codec::{Decode, Encode, KeyedVec};
|
||||
use codec::{Decode, Encode, KeyedVec};
|
||||
use runtime_io;
|
||||
use runtime_io::with_externalities;
|
||||
use sr_primitives::testing::{Digest, DigestItem, Header, UintAuthorityId, H256};
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::exec::{Ext, EmptyOutputBuf, VmExecResult};
|
||||
use crate::gas::GasMeter;
|
||||
|
||||
use rstd::prelude::*;
|
||||
use parity_codec::{Encode, Decode};
|
||||
use codec::{Encode, Decode};
|
||||
use sandbox;
|
||||
|
||||
#[macro_use]
|
||||
|
||||
@@ -26,7 +26,7 @@ use sandbox;
|
||||
use system;
|
||||
use rstd::prelude::*;
|
||||
use rstd::mem;
|
||||
use parity_codec::{Decode, Encode};
|
||||
use codec::{Decode, Encode};
|
||||
use sr_primitives::traits::{Bounded, SaturatedConversion};
|
||||
|
||||
/// Enumerates all possible *special* trap conditions.
|
||||
@@ -325,12 +325,12 @@ define_env!(Env, <E: Ext>,
|
||||
let callee = {
|
||||
let callee_buf = read_sandbox_memory(ctx, callee_ptr, callee_len)?;
|
||||
<<E as Ext>::T as system::Trait>::AccountId::decode(&mut &callee_buf[..])
|
||||
.ok_or_else(|| sandbox::HostError)?
|
||||
.map_err(|_| sandbox::HostError)?
|
||||
};
|
||||
let value = {
|
||||
let value_buf = read_sandbox_memory(ctx, value_ptr, value_len)?;
|
||||
BalanceOf::<<E as Ext>::T>::decode(&mut &value_buf[..])
|
||||
.ok_or_else(|| sandbox::HostError)?
|
||||
.map_err(|_| sandbox::HostError)?
|
||||
};
|
||||
let input_data = read_sandbox_memory(ctx, input_data_ptr, input_data_len)?;
|
||||
|
||||
@@ -399,12 +399,12 @@ define_env!(Env, <E: Ext>,
|
||||
) -> u32 => {
|
||||
let code_hash = {
|
||||
let code_hash_buf = read_sandbox_memory(ctx, code_hash_ptr, code_hash_len)?;
|
||||
<CodeHash<<E as Ext>::T>>::decode(&mut &code_hash_buf[..]).ok_or_else(|| sandbox::HostError)?
|
||||
<CodeHash<<E as Ext>::T>>::decode(&mut &code_hash_buf[..]).map_err(|_| sandbox::HostError)?
|
||||
};
|
||||
let value = {
|
||||
let value_buf = read_sandbox_memory(ctx, value_ptr, value_len)?;
|
||||
BalanceOf::<<E as Ext>::T>::decode(&mut &value_buf[..])
|
||||
.ok_or_else(|| sandbox::HostError)?
|
||||
.map_err(|_| sandbox::HostError)?
|
||||
};
|
||||
let input_data = read_sandbox_memory(ctx, input_data_ptr, input_data_len)?;
|
||||
|
||||
@@ -569,7 +569,7 @@ define_env!(Env, <E: Ext>,
|
||||
let call = {
|
||||
let call_buf = read_sandbox_memory(ctx, call_ptr, call_len)?;
|
||||
<<<E as Ext>::T as Trait>::Call>::decode(&mut &call_buf[..])
|
||||
.ok_or_else(|| sandbox::HostError)?
|
||||
.map_err(|_| sandbox::HostError)?
|
||||
};
|
||||
|
||||
// Charge gas for dispatching this call.
|
||||
@@ -618,12 +618,12 @@ define_env!(Env, <E: Ext>,
|
||||
let dest = {
|
||||
let dest_buf = read_sandbox_memory(ctx, dest_ptr, dest_len)?;
|
||||
<<E as Ext>::T as system::Trait>::AccountId::decode(&mut &dest_buf[..])
|
||||
.ok_or_else(|| sandbox::HostError)?
|
||||
.map_err(|_| sandbox::HostError)?
|
||||
};
|
||||
let code_hash = {
|
||||
let code_hash_buf = read_sandbox_memory(ctx, code_hash_ptr, code_hash_len)?;
|
||||
<CodeHash<<E as Ext>::T>>::decode(&mut &code_hash_buf[..])
|
||||
.ok_or_else(|| sandbox::HostError)?
|
||||
.map_err(|_| sandbox::HostError)?
|
||||
};
|
||||
let rent_allowance = {
|
||||
let rent_allowance_buf = read_sandbox_memory(
|
||||
@@ -632,7 +632,7 @@ define_env!(Env, <E: Ext>,
|
||||
rent_allowance_len
|
||||
)?;
|
||||
BalanceOf::<<E as Ext>::T>::decode(&mut &rent_allowance_buf[..])
|
||||
.ok_or_else(|| sandbox::HostError)?
|
||||
.map_err(|_| sandbox::HostError)?
|
||||
};
|
||||
let delta = {
|
||||
// We don't use `with_capacity` here to not eagerly allocate the user specified amount
|
||||
@@ -717,7 +717,7 @@ define_env!(Env, <E: Ext>,
|
||||
_ => {
|
||||
let topics_buf = read_sandbox_memory(ctx, topics_ptr, topics_len)?;
|
||||
Vec::<TopicOf<<E as Ext>::T>>::decode(&mut &topics_buf[..])
|
||||
.ok_or_else(|| sandbox::HostError)?
|
||||
.map_err(|_| sandbox::HostError)?
|
||||
}
|
||||
};
|
||||
|
||||
@@ -757,7 +757,7 @@ define_env!(Env, <E: Ext>,
|
||||
let value = {
|
||||
let value_buf = read_sandbox_memory(ctx, value_ptr, value_len)?;
|
||||
BalanceOf::<<E as Ext>::T>::decode(&mut &value_buf[..])
|
||||
.ok_or_else(|| sandbox::HostError)?
|
||||
.map_err(|_| sandbox::HostError)?
|
||||
};
|
||||
ctx.ext.set_rent_allowance(value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user