Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ethcore/evm/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ enum_with_from_u8! {
#[doc = "like CALLCODE but keeps caller's value and sender"]
DELEGATECALL = 0xf4,
#[doc = "create a new account and set creation address to sha3(sender + sha3(init code)) % 2**160"]
CREATE2 = 0xfb,
CREATE2 = 0xf5,
#[doc = "stop execution and revert state changes. Return output data."]
REVERT = 0xfd,
#[doc = "like CALL but it does not take value, nor modify the state"]
Expand Down
4 changes: 2 additions & 2 deletions ethcore/evm/src/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,13 +426,13 @@ impl<Cost: CostType> Interpreter<Cost> {
},
instructions::CREATE | instructions::CREATE2 => {
let endowment = self.stack.pop_back();
let init_off = self.stack.pop_back();
let init_size = self.stack.pop_back();
let address_scheme = match instruction {
instructions::CREATE => CreateContractAddress::FromSenderAndNonce,
instructions::CREATE2 => CreateContractAddress::FromSenderSaltAndCodeHash(self.stack.pop_back().into()),
_ => unreachable!("instruction can only be CREATE/CREATE2 checked above; qed"),
};
let init_off = self.stack.pop_back();
let init_size = self.stack.pop_back();

let create_gas = provided.expect("`provided` comes through Self::exec from `Gasometer::get_gas_cost_mem`; `gas_gas_mem_cost` guarantees `Some` when instruction is `CALL`/`CALLCODE`/`DELEGATECALL`/`CREATE`; this is `CREATE`; qed");

Expand Down
7 changes: 0 additions & 7 deletions ethcore/light/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ pub trait LightChainClient: Send + Sync {
/// Get the `i`th CHT root.
fn cht_root(&self, i: usize) -> Option<H256>;

/// Get the EIP-86 transition block number.
fn eip86_transition(&self) -> BlockNumber;

/// Get a report of import activity since the last call.
fn report(&self) -> ClientReport;
}
Expand Down Expand Up @@ -585,10 +582,6 @@ impl<T: ChainDataFetcher> LightChainClient for Client<T> {
Client::cht_root(self, i)
}

fn eip86_transition(&self) -> BlockNumber {
self.engine().params().eip86_transition
}

fn report(&self) -> ClientReport {
Client::report(self)
}
Expand Down
3 changes: 1 addition & 2 deletions ethcore/res/ethereum/classic.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"eip161abcTransition": "0x7fffffffffffffff",
"eip161dTransition": "0x7fffffffffffffff",
"eip155Transition": 3000000,
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff"
"eip98Transition": "0x7fffffffffffff"
},
"genesis": {
"seal": {
Expand Down
3 changes: 1 addition & 2 deletions ethcore/res/ethereum/easthub.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"eip155Transition": "0x0",
"eip161abcTransition": "0x7fffffffffffffff",
"eip161dTransition": "0x7fffffffffffffff",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff"
"eip98Transition": "0x7fffffffffffff"
},
"genesis": {
"seal": {
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/eip150_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"eip161abcTransition": "0x7fffffffffffffff",
"eip161dTransition": "0x7fffffffffffffff",
"eip98Transition": "0x7fffffffffffffff",
"eip86Transition": "0x7fffffffffffffff",
"eip155Transition": "0x7fffffffffffffff",
"maxCodeSize": 24576,
"maxCodeSizeTransition": "0x7fffffffffffffff"
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/eip161_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"eip161abcTransition": "0x0",
"eip161dTransition": "0x0",
"eip98Transition": "0x7fffffffffffffff",
"eip86Transition": "0x7fffffffffffffff",
"eip155Transition": "0x7fffffffffffffff",
"maxCodeSize": 24576,
"maxCodeSizeTransition": "0x0"
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/ellaism.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"eip161dTransition": "0x7fffffffffffffff",
"eip155Transition": "0x0",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"wasmActivationTransition": 2000000,
"eip140Transition": 2000000,
"eip211Transition": 2000000,
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/expanse.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"eip161abcTransition": "0x927C0",
"eip161dTransition": "0x927C0",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"eip155Transition": "0x927C0",
"eip140Transition": "0xC3500",
"eip211Transition": "0xC3500",
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/foundation.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@
"eip161dTransition": 2675000,
"eip155Transition": 2675000,
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"maxCodeSize": 24576,
"maxCodeSizeTransition": 2675000,
"eip140Transition": 4370000,
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/frontier_like_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@
"eip161abcTransition": "0x7fffffffffffffff",
"eip161dTransition": "0x7fffffffffffffff",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"eip155Transition": "0x7fffffffffffffff"
},
"genesis": {
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/frontier_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"eip161abcTransition": "0x7fffffffffffffff",
"eip161dTransition": "0x7fffffffffffffff",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"eip155Transition": "0x7fffffffffffffff"
},
"genesis": {
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/homestead_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"minGasLimit": "0x1388",
"networkID" : "0x1",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"eip155Transition": "0x7fffffffffffffff",
"eip150Transition": "0x7fffffffffffffff",
"eip160Transition": "0x7fffffffffffffff",
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/mcip3_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"eip160Transition":"0x7fffffffffffff",
"eip161abcTransition":"0x7fffffffffffff",
"eip161dTransition":"0x7fffffffffffff",
"eip86Transition":"0x7fffffffffffff",
"eip98Transition":"0x7fffffffffffff",
"eip140Transition":"0x7fffffffffffff",
"eip155Transition":"0x7fffffffffffff",
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/mcip6_byz.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"eip160Transition":"0x7fffffffffffff",
"eip161abcTransition":"0x7fffffffffffff",
"eip161dTransition":"0x7fffffffffffff",
"eip86Transition":"0x7fffffffffffff",
"eip98Transition":"0x7fffffffffffff",
"eip140Transition":"0x2a",
"eip155Transition":"0x2a",
Expand Down
3 changes: 1 addition & 2 deletions ethcore/res/ethereum/morden.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"eip161abcTransition": "0x7fffffffffffffff",
"eip161dTransition": "0x7fffffffffffffff",
"eip155Transition": 1915000,
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff"
"eip98Transition": "0x7fffffffffffff"
},
"genesis": {
"seal": {
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/musicoin.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"eip160Transition":"0x21e88e",
"eip161abcTransition":"0x21e88e",
"eip161dTransition":"0x21e88e",
"eip86Transition":"0x7fffffffffffff",
"eip98Transition":"0x7fffffffffffff",
"eip140Transition":"0x21e88e",
"eip155Transition":"0x21e88e",
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/olympic.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"eip161abcTransition": "0x7fffffffffffffff",
"eip161dTransition": "0x7fffffffffffffff",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"eip155Transition": "0x7fffffffffffffff"
},
"genesis": {
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/ethereum/ropsten.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"eip161dTransition": 10,
"eip155Transition": 10,
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"eip140Transition": 1700000,
"eip211Transition": 1700000,
"eip214Transition": 1700000,
Expand Down
3 changes: 1 addition & 2 deletions ethcore/res/ethereum/social.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"eip161abcTransition": "0x7fffffffffffffff",
"eip161dTransition": "0x7fffffffffffffff",
"eip155Transition": "0x0",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff"
"eip98Transition": "0x7fffffffffffff"
},
"genesis": {
"seal": {
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/instant_seal.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"eip161dTransition": "0x0",
"eip155Transition": "0x0",
"eip98Transition": "0x7fffffffffffff",
"eip86Transition": "0x7fffffffffffff",
"maxCodeSize": 24576,
"maxCodeSizeTransition": "0x0",
"eip140Transition": "0x0",
Expand Down
1 change: 0 additions & 1 deletion ethcore/res/null.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x2",
"eip86Transition": "0x7fffffffffffff",
"eip140Transition": "0x0",
"eip211Transition": "0x0",
"eip214Transition": "0x0",
Expand Down
4 changes: 0 additions & 4 deletions ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2037,10 +2037,6 @@ impl BlockChainClient for Client {
fn registrar_address(&self) -> Option<Address> {
self.registrar_address.clone()
}

fn eip86_transition(&self) -> u64 {
self.engine().params().eip86_transition
}
}

impl IoClient for Client {
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/client/evm_test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl<'a> EvmTestClient<'a> {
) -> TransactResult<T::Output, V::Output> {
let initial_gas = transaction.gas;
// Verify transaction
let is_ok = transaction.verify_basic(true, None, env_info.number >= self.spec.engine.params().eip86_transition);
let is_ok = transaction.verify_basic(true, None, false);
if let Err(error) = is_ok {
return TransactResult::Err {
state_root: *self.state.root(),
Expand Down
2 changes: 0 additions & 2 deletions ethcore/src/client/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,6 @@ impl BlockChainClient for TestBlockChainClient {
}

fn registrar_address(&self) -> Option<Address> { None }

fn eip86_transition(&self) -> u64 { u64::max_value() }
}

impl IoClient for TestBlockChainClient {
Expand Down
3 changes: 0 additions & 3 deletions ethcore/src/client/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,6 @@ pub trait BlockChainClient : Sync + Send + AccountData + BlockChain + CallContra

/// Get the address of the registry itself.
fn registrar_address(&self) -> Option<Address>;

/// Get the EIP-86 transition block number.
fn eip86_transition(&self) -> u64;
}

/// Provides `reopen_block` method
Expand Down
11 changes: 6 additions & 5 deletions ethcore/src/executive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ pub fn contract_address(address_scheme: CreateContractAddress, sender: &Address,
},
CreateContractAddress::FromSenderSaltAndCodeHash(salt) => {
let code_hash = keccak(code);
let mut buffer = [0u8; 20 + 32 + 32];
&mut buffer[0..20].copy_from_slice(&sender[..]);
&mut buffer[20..(20+32)].copy_from_slice(&salt[..]);
&mut buffer[(20+32)..].copy_from_slice(&code_hash[..]);
let mut buffer = [0u8; 1 + 20 + 32 + 32];
buffer[0] = 0xff;
&mut buffer[1..(1+20)].copy_from_slice(&sender[..]);
&mut buffer[(1+20)..(1+20+32)].copy_from_slice(&salt[..]);
&mut buffer[(1+20+32)..].copy_from_slice(&code_hash[..]);
(From::from(keccak(&buffer[..])), Some(code_hash))
},
CreateContractAddress::FromSenderAndCodeHash => {
Expand Down Expand Up @@ -290,7 +291,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
let mut substate = Substate::new();

// NOTE: there can be no invalid transactions from this point.
if !schedule.eip86 || !t.is_unsigned() {
if !schedule.keep_unsigned_nonce || !t.is_unsigned() {
self.state.inc_nonce(&sender)?;
}
self.state.sub_balance(&sender, &U256::from(gas_cost), &mut substate.to_cleanup_mode(&schedule))?;
Expand Down
4 changes: 2 additions & 2 deletions ethcore/src/externalities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl<'a, T: 'a, V: 'a, B: 'a> Ext for Externalities<'a, T, V, B>
};

if !self.static_flag {
if !self.schedule.eip86 || params.sender != UNSIGNED_SENDER {
if !self.schedule.keep_unsigned_nonce || params.sender != UNSIGNED_SENDER {
if let Err(e) = self.state.inc_nonce(&self.origin_info.address) {
debug!(target: "ext", "Database corruption encountered: {:?}", e);
return ContractCreateResult::Failed
Expand Down Expand Up @@ -611,6 +611,6 @@ mod tests {
}
};

assert_eq!(address, Address::from_str("b7c227636666831278bacdb8d7f52933b8698ab9").unwrap());
assert_eq!(address, Address::from_str("e33c0c7f7df4809055c3eba6c09cfe4baf1bd9e0").unwrap());
}
}
14 changes: 7 additions & 7 deletions ethcore/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ pub struct CommonParams {
pub validate_receipts_transition: BlockNumber,
/// Validate transaction chain id.
pub validate_chain_id_transition: BlockNumber,
/// Number of first block where EIP-86 (Metropolis) rules begin.
pub eip86_transition: BlockNumber,
/// Number of first block where EIP-140 (Metropolis: REVERT opcode) rules begin.
pub eip140_transition: BlockNumber,
/// Number of first block where EIP-210 (Metropolis: BLOCKHASH changes) rules begin.
Expand All @@ -117,6 +115,8 @@ pub struct CommonParams {
pub eip145_transition: BlockNumber,
/// Number of first block where EIP-1052 rules begin.
pub eip1052_transition: BlockNumber,
/// Number of first block where EIP-1014 rules begin.
pub eip1014_transition: BlockNumber,
/// Number of first block where dust cleanup rules (EIP-168 and EIP169) begin.
pub dust_protection_transition: BlockNumber,
/// Nonce cap increase per block. Nonce cap is only checked if dust protection is enabled.
Expand Down Expand Up @@ -175,7 +175,7 @@ impl CommonParams {

/// Apply common spec config parameters to the schedule.
pub fn update_schedule(&self, block_number: u64, schedule: &mut ::vm::Schedule) {
schedule.have_create2 = block_number >= self.eip86_transition;
schedule.have_create2 = block_number >= self.eip1014_transition;
schedule.have_revert = block_number >= self.eip140_transition;
schedule.have_static_call = block_number >= self.eip214_transition;
schedule.have_return_data = block_number >= self.eip211_transition;
Expand Down Expand Up @@ -243,10 +243,6 @@ impl From<ethjson::spec::Params> for CommonParams {
eip155_transition: p.eip155_transition.map_or(0, Into::into),
validate_receipts_transition: p.validate_receipts_transition.map_or(0, Into::into),
validate_chain_id_transition: p.validate_chain_id_transition.map_or(0, Into::into),
eip86_transition: p.eip86_transition.map_or_else(
BlockNumber::max_value,
Into::into,
),
eip140_transition: p.eip140_transition.map_or_else(
BlockNumber::max_value,
Into::into,
Expand Down Expand Up @@ -285,6 +281,10 @@ impl From<ethjson::spec::Params> for CommonParams {
BlockNumber::max_value,
Into::into,
),
eip1014_transition: p.eip1014_transition.map_or_else(
BlockNumber::max_value,
Into::into,
),
dust_protection_transition: p.dust_protection_transition.map_or_else(
BlockNumber::max_value,
Into::into,
Expand Down
4 changes: 2 additions & 2 deletions ethcore/vm/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ pub enum MessageCallResult {
/// Specifies how an address is calculated for a new contract.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
pub enum CreateContractAddress {
/// Address is calculated from sender and nonce. Pre EIP-86 (Metropolis)
/// Address is calculated from sender and nonce. pWASM `create` scheme.
FromSenderAndNonce,
/// Address is calculated from sender, salt and code hash. EIP-86 CREATE2 scheme.
/// Address is calculated from sender, salt and code hash. pWASM `create2` scheme and EIP-1014 CREATE2 scheme.
FromSenderSaltAndCodeHash(H256),
/// Address is calculated from code hash and sender. Used by pwasm create ext.
FromSenderAndCodeHash,
Expand Down
8 changes: 4 additions & 4 deletions ethcore/vm/src/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ pub struct Schedule {
pub have_bitwise_shifting: bool,
/// Kill basic accounts below this balance if touched.
pub kill_dust: CleanDustMode,
/// Enable EIP-86 rules
pub eip86: bool,
/// VM execution does not increase null signed address nonce if this field is true.
pub keep_unsigned_nonce: bool,
/// Wasm extra schedule settings, if wasm activated
pub wasm: Option<WasmCosts>,
}
Expand Down Expand Up @@ -247,7 +247,7 @@ impl Schedule {
blockhash_gas: 20,
have_static_call: false,
kill_dust: CleanDustMode::Off,
eip86: false,
keep_unsigned_nonce: false,
wasm: None,
}
}
Expand Down Expand Up @@ -320,7 +320,7 @@ impl Schedule {
blockhash_gas: 20,
have_static_call: false,
kill_dust: CleanDustMode::Off,
eip86: false,
keep_unsigned_nonce: false,
wasm: None,
}
}
Expand Down
6 changes: 3 additions & 3 deletions json/src/spec/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ pub struct Params {
#[serde(rename="validateReceiptsTransition")]
pub validate_receipts_transition: Option<Uint>,
/// See `CommonParams` docs.
#[serde(rename="eip86Transition")]
pub eip86_transition: Option<Uint>,
/// See `CommonParams` docs.
#[serde(rename="eip140Transition")]
pub eip140_transition: Option<Uint>,
/// See `CommonParams` docs.
Expand Down Expand Up @@ -112,6 +109,9 @@ pub struct Params {
#[serde(rename="eip1052Transition")]
pub eip1052_transition: Option<Uint>,
/// See `CommonParams` docs.
#[serde(rename="eip1014Transition")]
pub eip1014_transition: Option<Uint>,
/// See `CommonParams` docs.
#[serde(rename="dustProtectionTransition")]
pub dust_protection_transition: Option<Uint>,
/// See `CommonParams` docs.
Expand Down