From 437ba9b044f264bece842b509082a313926fb38a Mon Sep 17 00:00:00 2001 From: POA <33550681+poa@users.noreply.github.com> Date: Mon, 1 Nov 2021 10:53:50 +0300 Subject: [PATCH] Add eip1559BaseFeeFixedValue and eip1559BaseFeeFixedValueTransition spec options and bump to v3.3.0-rc.14 --- CHANGELOG.md | 7 +++++++ Cargo.lock | 4 ++-- Cargo.toml | 2 +- crates/ethcore/res/chainspec/xdai.json | 4 ++-- crates/ethcore/src/machine/impls.rs | 19 ++++++++++++++++++- crates/ethcore/src/spec/spec.rs | 15 +++++++++++---- crates/ethjson/src/spec/params.rs | 4 ++++ crates/util/version/Cargo.toml | 2 +- 8 files changed, 46 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 13f86f5fa..32d24f6ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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: diff --git a/Cargo.lock b/Cargo.lock index 03837c472..b32470db6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2932,7 +2932,7 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "openethereum" -version = "3.3.0-rc.13" +version = "3.3.0-rc.14" dependencies = [ "ansi_term 0.10.2", "atty", @@ -3282,7 +3282,7 @@ dependencies = [ [[package]] name = "parity-version" -version = "3.3.0-rc.13" +version = "3.3.0-rc.14" dependencies = [ "parity-bytes", "rlp", diff --git a/Cargo.toml b/Cargo.toml index 5778c72eb..7fa130a83 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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", diff --git a/crates/ethcore/res/chainspec/xdai.json b/crates/ethcore/res/chainspec/xdai.json index 40194e42f..05570fa8e 100644 --- a/crates/ethcore/res/chainspec/xdai.json +++ b/crates/ethcore/res/chainspec/xdai.json @@ -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", diff --git a/crates/ethcore/src/machine/impls.rs b/crates/ethcore/src/machine/impls.rs index 066d50c96..c5860b9ff 100644 --- a/crates/ethcore/src/machine/impls.rs +++ b/crates/ethcore/src/machine/impls.rs @@ -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 { // 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 diff --git a/crates/ethcore/src/spec/spec.rs b/crates/ethcore/src/spec/spec.rs index a37fe92ac..08cbe10e9 100644 --- a/crates/ethcore/src/spec/spec.rs +++ b/crates/ethcore/src/spec/spec.rs @@ -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, + /// Constant value for the block base fee. + pub eip1559_base_fee_fixed_value: Option, + /// 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
, /// Block at which the fee collector should start being used. @@ -460,9 +464,11 @@ impl From 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 @@ -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 { diff --git a/crates/ethjson/src/spec/params.rs b/crates/ethjson/src/spec/params.rs index f321821f2..14deecdbc 100644 --- a/crates/ethjson/src/spec/params.rs +++ b/crates/ethjson/src/spec/params.rs @@ -158,6 +158,10 @@ pub struct Params { pub eip1559_elasticity_multiplier: Option, /// Default value for the block base fee pub eip1559_base_fee_initial_value: Option, + /// Constant value for the block base fee. + pub eip1559_base_fee_fixed_value: Option, + /// Block at which the constant value for the base fee starts to be used. + pub eip1559_base_fee_fixed_value_transition: Option, /// Address where EIP-1559 burnt fee will be accrued to. pub eip1559_fee_collector: Option
, /// Block at which the fee collector should start being used. diff --git a/crates/util/version/Cargo.toml b/crates/util/version/Cargo.toml index 52abb0a01..42634e735 100644 --- a/crates/util/version/Cargo.toml +++ b/crates/util/version/Cargo.toml @@ -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 "] build = "build.rs"