EIP-1702: Generalized Account Versioning Scheme (#10771)
* EIP-1702: Generalized Account Versioning Scheme * Fix pWASM's `create` and `create2` contract creation version * Update ethcore/src/snapshot/account.rs Co-Authored-By: Andronik Ordian <write@reusable.software> * Update ethcore/src/factory.rs Co-Authored-By: Andronik Ordian <write@reusable.software> * Add pWasm frontend config * Add snapshot testing with version * Fix merge conflict
This commit is contained in:
@@ -84,6 +84,8 @@ pub struct ActionParams {
|
||||
pub value: ActionValue,
|
||||
/// Code being executed.
|
||||
pub code: Option<Arc<Bytes>>,
|
||||
/// Code version being executed.
|
||||
pub code_version: U256,
|
||||
/// Input data.
|
||||
pub data: Option<Bytes>,
|
||||
/// Type of call
|
||||
@@ -105,6 +107,7 @@ impl Default for ActionParams {
|
||||
gas_price: U256::zero(),
|
||||
value: ActionValue::Transfer(U256::zero()),
|
||||
code: None,
|
||||
code_version: U256::zero(),
|
||||
data: None,
|
||||
call_type: CallType::None,
|
||||
params_type: ParamsType::Separate,
|
||||
@@ -122,6 +125,7 @@ impl From<ethjson::vm::Transaction> for ActionParams {
|
||||
sender: t.sender.into(),
|
||||
origin: t.origin.into(),
|
||||
code: Some(Arc::new(t.code.into())),
|
||||
code_version: t.code_version.into(),
|
||||
data: Some(t.data.into()),
|
||||
gas: t.gas.into(),
|
||||
gas_price: t.gas_price.into(),
|
||||
|
||||
@@ -97,6 +97,7 @@ pub trait Ext {
|
||||
gas: &U256,
|
||||
value: &U256,
|
||||
code: &[u8],
|
||||
parent_version: &U256,
|
||||
address: CreateContractAddress,
|
||||
trap: bool,
|
||||
) -> ::std::result::Result<ContractCreateResult, TrapKind>;
|
||||
|
||||
@@ -36,7 +36,7 @@ pub mod tests;
|
||||
pub use action_params::{ActionParams, ActionValue, ParamsType};
|
||||
pub use call_type::CallType;
|
||||
pub use env_info::{EnvInfo, LastHashes};
|
||||
pub use schedule::{Schedule, CleanDustMode, WasmCosts};
|
||||
pub use schedule::{Schedule, VersionedSchedule, CleanDustMode, WasmCosts};
|
||||
pub use ext::{Ext, MessageCallResult, ContractCreateResult, CreateContractAddress};
|
||||
pub use return_data::{ReturnData, GasLeft};
|
||||
pub use error::{Error, Result, TrapResult, TrapError, TrapKind, ExecTrapResult, ExecTrapError};
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! Cost schedule and other parameterisations for the EVM.
|
||||
use std::collections::HashMap;
|
||||
use ethereum_types::U256;
|
||||
|
||||
/// Definition of schedules that can be applied to a version.
|
||||
pub enum VersionedSchedule {
|
||||
PWasm,
|
||||
}
|
||||
|
||||
/// Definition of the cost schedule and other parameterisations for the EVM.
|
||||
pub struct Schedule {
|
||||
@@ -121,6 +128,10 @@ pub struct Schedule {
|
||||
pub eip1283: bool,
|
||||
/// VM execution does not increase null signed address nonce if this field is true.
|
||||
pub keep_unsigned_nonce: bool,
|
||||
/// Latest VM version for contract creation transaction.
|
||||
pub latest_version: U256,
|
||||
/// All supported non-legacy VM versions.
|
||||
pub versions: HashMap<U256, VersionedSchedule>,
|
||||
/// Wasm extra schedule settings, if wasm activated
|
||||
pub wasm: Option<WasmCosts>,
|
||||
}
|
||||
@@ -254,6 +265,8 @@ impl Schedule {
|
||||
kill_dust: CleanDustMode::Off,
|
||||
eip1283: false,
|
||||
keep_unsigned_nonce: false,
|
||||
latest_version: U256::zero(),
|
||||
versions: HashMap::new(),
|
||||
wasm: None,
|
||||
}
|
||||
}
|
||||
@@ -328,6 +341,8 @@ impl Schedule {
|
||||
kill_dust: CleanDustMode::Off,
|
||||
eip1283: false,
|
||||
keep_unsigned_nonce: false,
|
||||
latest_version: U256::zero(),
|
||||
versions: HashMap::new(),
|
||||
wasm: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +144,7 @@ impl Ext for FakeExt {
|
||||
gas: &U256,
|
||||
value: &U256,
|
||||
code: &[u8],
|
||||
_parent_version: &U256,
|
||||
address: CreateContractAddress,
|
||||
_trap: bool,
|
||||
) -> ::std::result::Result<ContractCreateResult, TrapKind> {
|
||||
|
||||
Reference in New Issue
Block a user