Skip to content

Commit

Permalink
Add eip1559BaseFeeFixedValue and eip1559BaseFeeFixedValueTransition s…
Browse files Browse the repository at this point in the history
…pec options and bump to v3.3.0-rc.14
  • Loading branch information
varasev committed Nov 1, 2021
1 parent 98873fc commit 437ba9b
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## OpenEthereum v3.3.0-rc.14

Enhancements:
* Add eip1559BaseFeeFixedValue and eip1559BaseFeeFixedValueTransition spec options
* Activate eip1559BaseFeeFixedValue on xDai at London hardfork block (19040000)
* Delay difficulty bomb to June 2022 (EIP-4345)

## OpenEthereum v3.3.0-rc.13

Enhancements:
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "OpenEthereum"
name = "openethereum"
# NOTE Make sure to update util/version/Cargo.toml as well
version = "3.3.0-rc.13"
version = "3.3.0-rc.14"
license = "GPL-3.0"
authors = [
"OpenEthereum developers",
Expand Down
4 changes: 2 additions & 2 deletions crates/ethcore/res/chainspec/xdai.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
"eip3529Transition": 19040000,
"eip3541Transition": 19040000,
"eip1559Transition": 19040000,
"eip1559BaseFeeMaxChangeDenominator": "0x8",
"eip1559ElasticityMultiplier": "0x2",
"eip1559BaseFeeInitialValue": "0x3b9aca00",
"eip1559BaseFeeFixedValue": "0x4A817C800",
"eip1559BaseFeeFixedValueTransition": 19040000,
"eip1559FeeCollector": "0x6BBe78ee9e474842Dbd4AB4987b3CeFE88426A92",
"eip1559FeeCollectorTransition": 19040000,
"registrar": "0x6B53721D4f2Fb9514B85f5C49b197D857e36Cf03",
Expand Down
19 changes: 18 additions & 1 deletion crates/ethcore/src/machine/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,15 +466,32 @@ impl EthereumMachine {
/// Base fee is calculated based on the parent header (last block in blockchain / best block).
///
/// Introduced by EIP1559 to support new market fee mechanism.
///
/// Modified for xDai chain to have an ability to set constant base fee
/// through eip1559BaseFeeFixedValue spec option. The modification made
/// in v3.3.0-rc.14
pub fn calc_base_fee(&self, parent: &Header) -> Option<U256> {
// Block eip1559_transition - 1 has base_fee = None
if parent.number() + 1 < self.params().eip1559_transition {
return None;
}

// If we use base fee constant value, ignore the code below
if parent.number() + 1 >= self.params().eip1559_base_fee_fixed_value_transition {
let base_fee_fixed_value = match self.params().eip1559_base_fee_fixed_value {
None => panic!("Base fee fixed value must be set in spec."),
Some(fixed_value) => fixed_value,
};
return Some(base_fee_fixed_value);
}

// Block eip1559_transition has base_fee = self.params().eip1559_base_fee_initial_value
if parent.number() + 1 == self.params().eip1559_transition {
return Some(self.params().eip1559_base_fee_initial_value);
let base_fee_initial_value = match self.params().eip1559_base_fee_initial_value {
None => panic!("Base fee initial value must be set in spec."),
Some(initial_value) => initial_value,
};
return Some(base_fee_initial_value);
}

// Block eip1559_transition + 1 has base_fee = calculated
Expand Down
15 changes: 11 additions & 4 deletions crates/ethcore/src/spec/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ pub struct CommonParams {
/// Elasticity multiplier
pub eip1559_elasticity_multiplier: U256,
/// Default value for the block base fee
pub eip1559_base_fee_initial_value: U256,
pub eip1559_base_fee_initial_value: Option<U256>,
/// Constant value for the block base fee.
pub eip1559_base_fee_fixed_value: Option<U256>,
/// Block at which the constant value for the base fee starts to be used.
pub eip1559_base_fee_fixed_value_transition: BlockNumber,
/// Address where EIP-1559 burnt fee will be accrued to.
pub eip1559_fee_collector: Option<Address>,
/// Block at which the fee collector should start being used.
Expand Down Expand Up @@ -460,9 +464,11 @@ impl From<ethjson::spec::Params> for CommonParams {
eip1559_elasticity_multiplier: p
.eip1559_elasticity_multiplier
.map_or_else(U256::zero, Into::into),
eip1559_base_fee_initial_value: p
.eip1559_base_fee_initial_value
.map_or_else(U256::zero, Into::into),
eip1559_base_fee_initial_value: p.eip1559_base_fee_initial_value.map(Into::into),
eip1559_base_fee_fixed_value: p.eip1559_base_fee_fixed_value.map(Into::into),
eip1559_base_fee_fixed_value_transition: p
.eip1559_base_fee_fixed_value_transition
.map_or_else(BlockNumber::max_value, Into::into),
eip1559_fee_collector: p.eip1559_fee_collector.map(Into::into),
eip1559_fee_collector_transition: p
.eip1559_fee_collector_transition
Expand Down Expand Up @@ -743,6 +749,7 @@ impl Spec {
params.max_code_size_transition,
params.transaction_permission_contract_transition,
params.eip1559_fee_collector_transition,
params.eip1559_base_fee_fixed_value_transition,
];
// BUG: Rinkeby has homestead transition at block 1 but we can't reflect that in specs for non-Ethash networks
if params.network_id == 0x4 {
Expand Down
4 changes: 4 additions & 0 deletions crates/ethjson/src/spec/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ pub struct Params {
pub eip1559_elasticity_multiplier: Option<Uint>,
/// Default value for the block base fee
pub eip1559_base_fee_initial_value: Option<Uint>,
/// Constant value for the block base fee.
pub eip1559_base_fee_fixed_value: Option<Uint>,
/// Block at which the constant value for the base fee starts to be used.
pub eip1559_base_fee_fixed_value_transition: Option<Uint>,
/// Address where EIP-1559 burnt fee will be accrued to.
pub eip1559_fee_collector: Option<Address>,
/// Block at which the fee collector should start being used.
Expand Down
2 changes: 1 addition & 1 deletion crates/util/version/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "parity-version"
# NOTE: this value is used for OpenEthereum version string (via env CARGO_PKG_VERSION)
version = "3.3.0-rc.13"
version = "3.3.0-rc.14"
authors = ["Parity Technologies <[email protected]>"]
build = "build.rs"

Expand Down

0 comments on commit 437ba9b

Please sign in to comment.