Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

remove eip-2200-advance transition #11624

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 6 additions & 8 deletions ethcore/evm/src/interpreter/gasometer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl<Gas: evm::CostType> Gasometer<Gas> {

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)
Expand All @@ -245,7 +245,7 @@ impl<Gas: evm::CostType> Gasometer<Gas> {
};

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
);

Expand Down Expand Up @@ -396,7 +396,7 @@ fn calculate_eip1283_sstore_gas<Gas: evm::CostType>(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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the comments need to be updated here and below, it might be easier to just revert #11347

Copy link
Collaborator

@niklasad1 niklasad1 Apr 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we can revert it entirely because we still need the builtins, no?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, we can revert this commit only openethereum/openethereum@10077a7

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not everything in that commit is inaccurate. Maybe I'll just manually rewrite the comments in question.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs to be addressed ^^

} else {
// 2. If current value does not equal new value
if original == current {
Expand All @@ -415,7 +415,7 @@ fn calculate_eip1283_sstore_gas<Gas: evm::CostType>(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
Expand Down Expand Up @@ -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);
}
}
Expand Down
1 change: 0 additions & 1 deletion ethcore/spec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 0 additions & 10 deletions ethcore/types/src/engines/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -337,10 +331,6 @@ impl From<ethjson::spec::Params> 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,
Expand Down
6 changes: 1 addition & 5 deletions ethcore/vm/src/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<usize>,
/// Gas price for setting new value to storage (`storage==0`, `new!=0`)
pub sstore_set_gas: usize,
/// Gas price for altering value in storage
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions json/src/spec/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ pub struct Params {
/// See `CommonParams` docs.
pub eip2046_transition: Option<Uint>,
/// See `CommonParams` docs.
pub eip2200_advance_transition: Option<Uint>,
/// See `CommonParams` docs.
pub dust_protection_transition: Option<Uint>,
/// See `CommonParams` docs.
pub nonce_cap_increment: Option<Uint>,
Expand Down