Add eip1559FeeCollector and eip1559FeeCollectorTransition spec options and bump to v3.3.0-rc.10

This commit is contained in:
POA 2021-10-14 16:14:38 +03:00
parent 5e9b4c58ae
commit ac30783c82
7 changed files with 39 additions and 8 deletions

View File

@ -1,3 +1,8 @@
## OpenEthereum v3.3.0-rc.10
Enhancements:
* Add eip1559FeeCollector and eip1559FeeCollectorTransition spec options
## OpenEthereum v3.3.0-rc.9 ## OpenEthereum v3.3.0-rc.9
Bug fixes: Bug fixes:

4
Cargo.lock generated
View File

@ -2932,7 +2932,7 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]] [[package]]
name = "openethereum" name = "openethereum"
version = "3.3.0-rc.9" version = "3.3.0-rc.10"
dependencies = [ dependencies = [
"ansi_term 0.10.2", "ansi_term 0.10.2",
"atty", "atty",
@ -3282,7 +3282,7 @@ dependencies = [
[[package]] [[package]]
name = "parity-version" name = "parity-version"
version = "3.3.0-rc.9" version = "3.3.0-rc.10"
dependencies = [ dependencies = [
"parity-bytes", "parity-bytes",
"rlp", "rlp",

View File

@ -2,7 +2,7 @@
description = "OpenEthereum" description = "OpenEthereum"
name = "openethereum" name = "openethereum"
# NOTE Make sure to update util/version/Cargo.toml as well # NOTE Make sure to update util/version/Cargo.toml as well
version = "3.3.0-rc.9" version = "3.3.0-rc.10"
license = "GPL-3.0" license = "GPL-3.0"
authors = [ authors = [
"OpenEthereum developers", "OpenEthereum developers",

View File

@ -1516,18 +1516,20 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
// Up until now, fees_value is calculated for each type of transaction based on their gas prices // Up until now, fees_value is calculated for each type of transaction based on their gas prices
// Now, if eip1559 is activated, burn the base fee // Now, if eip1559 is activated, burn the base fee
// miner only receives the inclusion fee; note that the base fee is not given to anyone (it is burned) // miner only receives the inclusion fee; note that the base fee is not given to anyone (it is burned)
let fees_value = fees_value.saturating_sub(if schedule.eip1559 { let burnt_fee = if schedule.eip1559 && !t.is_service() {
let (base_fee, overflow_3) = let (fee, overflow_3) =
gas_used.overflowing_mul(self.info.base_fee.unwrap_or_default()); gas_used.overflowing_mul(self.info.base_fee.unwrap_or_default());
if overflow_3 { if overflow_3 {
return Err(ExecutionError::TransactionMalformed( return Err(ExecutionError::TransactionMalformed(
"U256 Overflow".to_string(), "U256 Overflow".to_string(),
)); ));
} }
base_fee fee
} else { } else {
U256::from(0) U256::from(0)
}); };
let fees_value = fees_value.saturating_sub(burnt_fee);
trace!("exec::finalize: t.gas={}, sstore_refunds={}, suicide_refunds={}, refunds_bound={}, gas_left_prerefund={}, refunded={}, gas_left={}, gas_used={}, refund_value={}, fees_value={}\n", trace!("exec::finalize: t.gas={}, sstore_refunds={}, suicide_refunds={}, refunds_bound={}, gas_left_prerefund={}, refunded={}, gas_left={}, gas_used={}, refund_value={}, fees_value={}\n",
t.tx().gas, sstore_refunds, suicide_refunds, refunds_bound, gas_left_prerefund, refunded, gas_left, gas_used, refund_value, fees_value); t.tx().gas, sstore_refunds, suicide_refunds, refunds_bound, gas_left_prerefund, refunded, gas_left, gas_used, refund_value, fees_value);
@ -1552,6 +1554,17 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
substate.to_cleanup_mode(&schedule), substate.to_cleanup_mode(&schedule),
)?; )?;
if burnt_fee > U256::from(0)
&& self.machine.params().eip1559_fee_collector.is_some()
&& self.info.number >= self.machine.params().eip1559_fee_collector_transition
{
self.state.add_balance(
&self.machine.params().eip1559_fee_collector.unwrap(),
&burnt_fee,
substate.to_cleanup_mode(&schedule),
)?;
};
// perform suicides // perform suicides
for address in &substate.suicides { for address in &substate.suicides {
self.state.kill_account(address); self.state.kill_account(address);

View File

@ -183,6 +183,10 @@ pub struct CommonParams {
pub eip1559_elasticity_multiplier: U256, pub eip1559_elasticity_multiplier: U256,
/// Default value for the block base fee /// Default value for the block base fee
pub eip1559_base_fee_initial_value: U256, pub eip1559_base_fee_initial_value: U256,
/// 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.
pub eip1559_fee_collector_transition: BlockNumber,
} }
impl CommonParams { impl CommonParams {
@ -459,6 +463,10 @@ impl From<ethjson::spec::Params> for CommonParams {
eip1559_base_fee_initial_value: p eip1559_base_fee_initial_value: p
.eip1559_base_fee_initial_value .eip1559_base_fee_initial_value
.map_or_else(U256::zero, Into::into), .map_or_else(U256::zero, Into::into),
eip1559_fee_collector: p.eip1559_fee_collector.map(Into::into),
eip1559_fee_collector_transition: p
.eip1559_fee_collector_transition
.map_or_else(BlockNumber::max_value, Into::into),
} }
} }
} }
@ -734,6 +742,7 @@ impl Spec {
params.kip6_transition, params.kip6_transition,
params.max_code_size_transition, params.max_code_size_transition,
params.transaction_permission_contract_transition, params.transaction_permission_contract_transition,
params.eip1559_fee_collector_transition,
]; ];
// BUG: Rinkeby has homestead transition at block 1 but we can't reflect that in specs for non-Ethash networks // 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 { if params.network_id == 0x4 {

View File

@ -158,6 +158,10 @@ pub struct Params {
pub eip1559_elasticity_multiplier: Option<Uint>, pub eip1559_elasticity_multiplier: Option<Uint>,
/// Default value for the block base fee /// Default value for the block base fee
pub eip1559_base_fee_initial_value: Option<Uint>, pub eip1559_base_fee_initial_value: 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.
pub eip1559_fee_collector_transition: Option<Uint>,
} }
#[cfg(test)] #[cfg(test)]

View File

@ -1,7 +1,7 @@
[package] [package]
name = "parity-version" name = "parity-version"
# NOTE: this value is used for OpenEthereum version string (via env CARGO_PKG_VERSION) # NOTE: this value is used for OpenEthereum version string (via env CARGO_PKG_VERSION)
version = "3.3.0-rc.9" version = "3.3.0-rc.10"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs" build = "build.rs"