Add hint in ActionParams for splitting code/data (#6957)

* Action params and embedded params handling

* fix namespaces
This commit is contained in:
Nikolay Volf
2017-11-02 14:49:57 +03:00
committed by Arkadiy Paronyan
parent 0a69d5ac4c
commit f72858ee0a
11 changed files with 84 additions and 14 deletions

View File

@@ -309,6 +309,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
code: Some(Arc::new(t.data.clone())),
data: None,
call_type: CallType::None,
params_type: vm::ParamsType::Embedded,
};
let mut out = if output_from_create { Some(vec![]) } else { None };
(self.create(params, &mut substate, &mut out, &mut tracer, &mut vm_tracer), out.unwrap_or_else(Vec::new))
@@ -326,6 +327,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
code_hash: Some(self.state.code_hash(address)?),
data: Some(t.data.clone()),
call_type: CallType::Call,
params_type: vm::ParamsType::Separate,
};
let mut out = vec![];
(self.call(params, &mut substate, BytesRef::Flexible(&mut out), &mut tracer, &mut vm_tracer), out)

View File

@@ -171,6 +171,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
code_hash: Some(code_hash),
data: Some(H256::from(number).to_vec()),
call_type: CallType::Call,
params_type: vm::ParamsType::Separate,
};
let mut output = H256::new();
@@ -219,6 +220,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
code_hash: code_hash,
data: None,
call_type: CallType::None,
params_type: vm::ParamsType::Embedded,
};
if !self.static_flag {
@@ -276,6 +278,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
code_hash: Some(code_hash),
data: Some(data.to_vec()),
call_type: call_type,
params_type: vm::ParamsType::Separate,
};
if let Some(value) = value {

View File

@@ -35,7 +35,7 @@ use tx_filter::TransactionFilter;
use bigint::prelude::U256;
use bytes::BytesRef;
use util::Address;
use vm::{CallType, ActionParams, ActionValue};
use vm::{CallType, ActionParams, ActionValue, ParamsType};
use vm::{EnvInfo, Schedule, CreateContractAddress};
/// Parity tries to round block.gas_limit to multiple of this constant
@@ -149,6 +149,7 @@ impl EthereumMachine {
code_hash: Some(state.code_hash(&contract_address)?),
data: data,
call_type: CallType::Call,
params_type: ParamsType::Separate,
};
let mut ex = Executive::new(&mut state, &env_info, self);
let mut substate = Substate::new();

View File

@@ -30,7 +30,7 @@ use parking_lot::RwLock;
use rlp::{Rlp, RlpStream};
use rustc_hex::FromHex;
use util::*;
use vm::{EnvInfo, CallType, ActionValue, ActionParams};
use vm::{EnvInfo, CallType, ActionValue, ActionParams, ParamsType};
use super::genesis::Genesis;
use super::seal::Generic as GenericSeal;
@@ -504,6 +504,7 @@ impl Spec {
code: Some(Arc::new(constructor.clone())),
data: None,
call_type: CallType::None,
params_type: ParamsType::Embedded,
};
let mut substate = Substate::new();

View File

@@ -2,7 +2,7 @@
use std::sync::Arc;
use hash::keccak;
use vm::{EnvInfo, ActionParams, ActionValue, CallType};
use vm::{EnvInfo, ActionParams, ActionValue, CallType, ParamsType};
use evm::{Factory, VMType};
use executive::Executive;
use state::Substate;
@@ -45,6 +45,7 @@ fn test_blockhash_eip210(factory: Factory) {
code_hash: Some(blockhash_contract_code_hash),
data: Some(H256::from(i - 1).to_vec()),
call_type: CallType::Call,
params_type: ParamsType::Separate,
};
let mut ex = Executive::new(&mut state, &env_info, &machine);
let mut substate = Substate::new();
@@ -67,6 +68,7 @@ fn test_blockhash_eip210(factory: Factory) {
code_hash: Some(get_prev_hash_code_hash),
data: None,
call_type: CallType::Call,
params_type: ParamsType::Separate,
};
let mut ex = Executive::new(&mut state, &env_info, &machine);
let mut substate = Substate::new();