From d3e1dfb712c5d751675167ddd6c526bd6ff5f8b7 Mon Sep 17 00:00:00 2001 From: /raw PONG _GHMoaCXLT <58883403+q9f@users.noreply.github.com> Date: Sat, 11 Apr 2020 14:12:17 +0200 Subject: [PATCH 1/2] remove eip-2200-advance transition --- ethcore/spec/src/spec.rs | 1 - ethcore/types/src/engines/params.rs | 10 ---------- json/src/spec/params.rs | 2 -- 3 files changed, 13 deletions(-) diff --git a/ethcore/spec/src/spec.rs b/ethcore/spec/src/spec.rs index 43447347b3b..539edc8e841 100644 --- a/ethcore/spec/src/spec.rs +++ b/ethcore/spec/src/spec.rs @@ -407,7 +407,6 @@ impl Spec { params.eip1344_transition, params.eip1884_transition, params.eip2028_transition, - params.eip2200_advance_transition, params.dust_protection_transition, params.wasm_activation_transition, params.kip4_transition, diff --git a/ethcore/types/src/engines/params.rs b/ethcore/types/src/engines/params.rs index 571996d06fb..02f50423e79 100644 --- a/ethcore/types/src/engines/params.rs +++ b/ethcore/types/src/engines/params.rs @@ -102,8 +102,6 @@ pub struct CommonParams { pub eip2028_transition: BlockNumber, /// Number of first block where EIP-2046/1352 rules begin. pub eip2046_transition: BlockNumber, - /// Number of first block where EIP-2200 advance transition begin. - pub eip2200_advance_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. @@ -189,10 +187,6 @@ impl CommonParams { if block_number >= self.eip2028_transition { schedule.tx_data_non_zero_gas = 16; } - if block_number >= self.eip2200_advance_transition { - schedule.sload_gas = 800; - schedule.sstore_dirty_gas = Some(800); - } if block_number >= self.eip2046_transition { schedule.staticcall_precompile_gas = 40; } @@ -337,10 +331,6 @@ impl From for CommonParams { BlockNumber::max_value, Into::into, ), - eip2200_advance_transition: p.eip2200_advance_transition.map_or_else( - BlockNumber::max_value, - Into::into, - ), dust_protection_transition: p.dust_protection_transition.map_or_else( BlockNumber::max_value, Into::into, diff --git a/json/src/spec/params.rs b/json/src/spec/params.rs index df117bb1df1..1b76f82e603 100644 --- a/json/src/spec/params.rs +++ b/json/src/spec/params.rs @@ -109,8 +109,6 @@ pub struct Params { /// See `CommonParams` docs. pub eip2046_transition: Option, /// See `CommonParams` docs. - pub eip2200_advance_transition: Option, - /// See `CommonParams` docs. pub dust_protection_transition: Option, /// See `CommonParams` docs. pub nonce_cap_increment: Option, From f2757aff922480446b2e914da56d475886d3d1f7 Mon Sep 17 00:00:00 2001 From: /raw PONG _GHMoaCXLT <58883403+q9f@users.noreply.github.com> Date: Sat, 11 Apr 2020 14:23:55 +0200 Subject: [PATCH 2/2] remove sstore dirty gas from schedule --- ethcore/evm/src/interpreter/gasometer.rs | 14 ++++++-------- ethcore/vm/src/schedule.rs | 6 +----- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ethcore/evm/src/interpreter/gasometer.rs b/ethcore/evm/src/interpreter/gasometer.rs index 2c2e148dfdc..29b256edc48 100644 --- a/ethcore/evm/src/interpreter/gasometer.rs +++ b/ethcore/evm/src/interpreter/gasometer.rs @@ -236,7 +236,7 @@ impl Gasometer { Request::GasMemProvide(gas, mem, Some(requested)) }, - instructions::STATICCALL => { + instructions::STATICCALL => { let code_address = u256_to_address(stack.peek(1)); let gas = if code_address <= PRECOMPILES_ADDRESS_LIMIT { Gas::from(schedule.staticcall_precompile_gas) @@ -245,7 +245,7 @@ impl Gasometer { }; let mem = cmp::max( - mem_needed(stack.peek(4), stack.peek(5))?, // out_off, out_size + mem_needed(stack.peek(4), stack.peek(5))?, // out_off, out_size mem_needed(stack.peek(2), stack.peek(3))? // in_off, in_size ); @@ -396,7 +396,7 @@ fn calculate_eip1283_sstore_gas(schedule: &Schedule, origina if current == new { // 1. If current value equals new value (this is a no-op), `SSTORE_DIRTY_GAS` // (or if not set, `SLOAD_GAS`) is deducted. - schedule.sstore_dirty_gas.unwrap_or(schedule.sload_gas) + schedule.sload_gas } else { // 2. If current value does not equal new value if original == current { @@ -415,7 +415,7 @@ fn calculate_eip1283_sstore_gas(schedule: &Schedule, origina // 2.2. If original value does not equal current value (this storage slot is // dirty), `SSTORE_DIRTY_GAS` (or if not set, `SLOAD_GAS`) is deducted. // Apply both of the following clauses. - schedule.sstore_dirty_gas.unwrap_or(schedule.sload_gas) + schedule.sload_gas // 2.2.1. If original value is not 0 // 2.2.1.1. If current value is 0 (also means that new value is not 0), remove @@ -476,14 +476,12 @@ pub fn handle_eip1283_sstore_clears_refund(ext: &mut dyn vm::Ext, original: &U25 if original.is_zero() { // 2.2.2.1. If original value is 0, add `SSTORE_SET_GAS - SSTORE_DIRTY_GAS` // to refund counter. - let refund = ext.schedule().sstore_set_gas - - ext.schedule().sstore_dirty_gas.unwrap_or(ext.schedule().sload_gas); + let refund = ext.schedule().sstore_set_gas - ext.schedule().sload_gas; ext.add_sstore_refund(refund); } else { // 2.2.2.2. Otherwise, add `SSTORE_RESET_GAS - SSTORE_DIRTY_GAS` // to refund counter. - let refund = ext.schedule().sstore_reset_gas - - ext.schedule().sstore_dirty_gas.unwrap_or(ext.schedule().sload_gas); + let refund = ext.schedule().sstore_reset_gas - ext.schedule().sload_gas; ext.add_sstore_refund(refund); } } diff --git a/ethcore/vm/src/schedule.rs b/ethcore/vm/src/schedule.rs index 8be062e5782..5524b270c44 100644 --- a/ethcore/vm/src/schedule.rs +++ b/ethcore/vm/src/schedule.rs @@ -53,8 +53,6 @@ pub struct Schedule { pub sha3_word_gas: usize, /// Gas price for loading from storage pub sload_gas: usize, - /// Special gas price for dirty gas of SSTORE, after net gas metering. - pub sstore_dirty_gas: Option, /// Gas price for setting new value to storage (`storage==0`, `new!=0`) pub sstore_set_gas: usize, /// Gas price for altering value in storage @@ -242,7 +240,6 @@ impl Schedule { sha3_gas: 30, sha3_word_gas: 6, sload_gas: 200, - sstore_dirty_gas: None, sstore_set_gas: 20000, sstore_reset_gas: 5000, sstore_refund_gas: 15000, @@ -321,7 +318,7 @@ impl Schedule { schedule.staticcall_precompile_gas = 40; // EIPs 2046 1352 schedule } - + fn new(efcd: bool, hdc: bool, tcg: usize) -> Schedule { Schedule { exceptional_failed_code_deposit: efcd, @@ -341,7 +338,6 @@ impl Schedule { sha3_gas: 30, sha3_word_gas: 6, sload_gas: 50, - sstore_dirty_gas: None, sstore_set_gas: 20000, sstore_reset_gas: 5000, sstore_refund_gas: 15000,