Bump to v3.3.2, London on Sokol, effective_gas_price function enhancement
This commit is contained in:
parent
657100cebc
commit
f13fa10b8a
@ -1,3 +1,11 @@
|
|||||||
|
## OpenEthereum v3.3.2
|
||||||
|
|
||||||
|
Enhancements:
|
||||||
|
* London hardfork block: Sokol (24114400)
|
||||||
|
|
||||||
|
Bug fixes:
|
||||||
|
* Fix for maxPriorityFeePerGas overflow
|
||||||
|
|
||||||
## OpenEthereum v3.3.1
|
## OpenEthereum v3.3.1
|
||||||
|
|
||||||
Enhancements:
|
Enhancements:
|
||||||
|
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -2932,7 +2932,7 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openethereum"
|
name = "openethereum"
|
||||||
version = "3.3.1"
|
version = "3.3.2"
|
||||||
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.1"
|
version = "3.3.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-bytes",
|
"parity-bytes",
|
||||||
"rlp",
|
"rlp",
|
||||||
|
@ -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.1"
|
version = "3.3.2"
|
||||||
license = "GPL-3.0"
|
license = "GPL-3.0"
|
||||||
authors = [
|
authors = [
|
||||||
"OpenEthereum developers",
|
"OpenEthereum developers",
|
||||||
|
@ -52,7 +52,16 @@
|
|||||||
"eip1884Transition": 12095200,
|
"eip1884Transition": 12095200,
|
||||||
"eip2028Transition": 12095200,
|
"eip2028Transition": 12095200,
|
||||||
"eip2929Transition": 21050600,
|
"eip2929Transition": 21050600,
|
||||||
"eip2930Transition": 21050600
|
"eip2930Transition": 21050600,
|
||||||
|
"eip3198Transition": 24114400,
|
||||||
|
"eip3529Transition": 24114400,
|
||||||
|
"eip3541Transition": 24114400,
|
||||||
|
"eip1559Transition": 24114400,
|
||||||
|
"eip1559BaseFeeMaxChangeDenominator": "0x8",
|
||||||
|
"eip1559ElasticityMultiplier": "0x2",
|
||||||
|
"eip1559BaseFeeInitialValue": "0x3b9aca00",
|
||||||
|
"eip1559FeeCollector": "0xE8DDc5c7A2d2F0D7a9798459c0104fDf5E987ACA",
|
||||||
|
"eip1559FeeCollectorTransition": 24114400
|
||||||
},
|
},
|
||||||
"genesis": {
|
"genesis": {
|
||||||
"seal": {
|
"seal": {
|
||||||
|
@ -2760,6 +2760,127 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
evm_test! {test_too_big_max_priority_fee_with_not_enough_cash: test_too_big_max_priority_fee_with_not_enough_cash_int}
|
||||||
|
fn test_too_big_max_priority_fee_with_not_enough_cash(factory: Factory) {
|
||||||
|
let keypair = Random.generate();
|
||||||
|
let max_priority_fee_per_gas /* 2**256 - 1 */ = U256::from(340282366920938463463374607431768211455u128)
|
||||||
|
* U256::from(340282366920938463463374607431768211455u128)
|
||||||
|
+ U256::from(340282366920938463463374607431768211455u128)
|
||||||
|
+ U256::from(340282366920938463463374607431768211455u128);
|
||||||
|
let t = TypedTransaction::EIP1559Transaction(EIP1559TransactionTx {
|
||||||
|
transaction: AccessListTx::new(
|
||||||
|
Transaction {
|
||||||
|
action: Action::Create,
|
||||||
|
value: U256::from(17),
|
||||||
|
data: "3331600055".from_hex().unwrap(),
|
||||||
|
gas: U256::from(100_000),
|
||||||
|
gas_price: max_priority_fee_per_gas,
|
||||||
|
nonce: U256::zero(),
|
||||||
|
},
|
||||||
|
vec![
|
||||||
|
(
|
||||||
|
H160::from_low_u64_be(10),
|
||||||
|
vec![H256::from_low_u64_be(102), H256::from_low_u64_be(103)],
|
||||||
|
),
|
||||||
|
(H160::from_low_u64_be(400), vec![]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
max_priority_fee_per_gas,
|
||||||
|
})
|
||||||
|
.sign(keypair.secret(), None);
|
||||||
|
|
||||||
|
let sender = t.sender();
|
||||||
|
|
||||||
|
let mut state = get_temp_state_with_factory(factory);
|
||||||
|
state
|
||||||
|
.add_balance(&sender, &U256::from(15000017), CleanupMode::NoEmpty)
|
||||||
|
.unwrap();
|
||||||
|
let mut info = EnvInfo::default();
|
||||||
|
info.gas_limit = U256::from(100_000);
|
||||||
|
info.base_fee = Some(U256::from(100));
|
||||||
|
let machine = make_london_machine(0);
|
||||||
|
let schedule = machine.schedule(info.number);
|
||||||
|
|
||||||
|
let res = {
|
||||||
|
let mut ex = Executive::new(&mut state, &info, &machine, &schedule);
|
||||||
|
let opts = TransactOptions::with_no_tracing();
|
||||||
|
ex.transact(&t, opts)
|
||||||
|
};
|
||||||
|
|
||||||
|
match res {
|
||||||
|
Err(ExecutionError::NotEnoughCash { required, got })
|
||||||
|
if required
|
||||||
|
== U512::from(max_priority_fee_per_gas) * U512::from(100_000)
|
||||||
|
+ U512::from(17)
|
||||||
|
&& got == U512::from(15000017) =>
|
||||||
|
{
|
||||||
|
()
|
||||||
|
}
|
||||||
|
_ => assert!(false, "Expected not enough cash error. {:?}", res),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
evm_test! {test_too_big_max_priority_fee_with_less_max_fee_per_gas: test_too_big_max_priority_fee_with_less_max_fee_per_gas_int}
|
||||||
|
fn test_too_big_max_priority_fee_with_less_max_fee_per_gas(factory: Factory) {
|
||||||
|
let keypair = Random.generate();
|
||||||
|
let max_priority_fee_per_gas /* 2**256 - 1 */ = U256::from(340282366920938463463374607431768211455u128)
|
||||||
|
* U256::from(340282366920938463463374607431768211455u128)
|
||||||
|
+ U256::from(340282366920938463463374607431768211455u128)
|
||||||
|
+ U256::from(340282366920938463463374607431768211455u128);
|
||||||
|
let t = TypedTransaction::EIP1559Transaction(EIP1559TransactionTx {
|
||||||
|
transaction: AccessListTx::new(
|
||||||
|
Transaction {
|
||||||
|
action: Action::Create,
|
||||||
|
value: U256::from(17),
|
||||||
|
data: "3331600055".from_hex().unwrap(),
|
||||||
|
gas: U256::from(100_000),
|
||||||
|
gas_price: U256::from(150),
|
||||||
|
nonce: U256::zero(),
|
||||||
|
},
|
||||||
|
vec![
|
||||||
|
(
|
||||||
|
H160::from_low_u64_be(10),
|
||||||
|
vec![H256::from_low_u64_be(102), H256::from_low_u64_be(103)],
|
||||||
|
),
|
||||||
|
(H160::from_low_u64_be(400), vec![]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
max_priority_fee_per_gas,
|
||||||
|
})
|
||||||
|
.sign(keypair.secret(), None);
|
||||||
|
|
||||||
|
let sender = t.sender();
|
||||||
|
|
||||||
|
let mut state = get_temp_state_with_factory(factory);
|
||||||
|
state
|
||||||
|
.add_balance(&sender, &U256::from(15000017), CleanupMode::NoEmpty)
|
||||||
|
.unwrap();
|
||||||
|
let mut info = EnvInfo::default();
|
||||||
|
info.gas_limit = U256::from(100_000);
|
||||||
|
info.base_fee = Some(U256::from(100));
|
||||||
|
let machine = make_london_machine(0);
|
||||||
|
let schedule = machine.schedule(info.number);
|
||||||
|
|
||||||
|
let res = {
|
||||||
|
let mut ex = Executive::new(&mut state, &info, &machine, &schedule);
|
||||||
|
let opts = TransactOptions::with_no_tracing();
|
||||||
|
ex.transact(&t, opts)
|
||||||
|
};
|
||||||
|
|
||||||
|
match res {
|
||||||
|
Err(ExecutionError::TransactionMalformed(err))
|
||||||
|
if err.contains("maxPriorityFeePerGas higher than maxFeePerGas") =>
|
||||||
|
{
|
||||||
|
()
|
||||||
|
}
|
||||||
|
_ => assert!(
|
||||||
|
false,
|
||||||
|
"Expected maxPriorityFeePerGas higher than maxFeePerGas error. {:?}",
|
||||||
|
res
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
evm_test! {test_keccak: test_keccak_int}
|
evm_test! {test_keccak: test_keccak_int}
|
||||||
fn test_keccak(factory: Factory) {
|
fn test_keccak(factory: Factory) {
|
||||||
let code = "6064640fffffffff20600055".from_hex().unwrap();
|
let code = "6064640fffffffff20600055".from_hex().unwrap();
|
||||||
|
@ -634,10 +634,16 @@ impl TypedTransaction {
|
|||||||
|
|
||||||
pub fn effective_gas_price(&self, block_base_fee: Option<U256>) -> U256 {
|
pub fn effective_gas_price(&self, block_base_fee: Option<U256>) -> U256 {
|
||||||
match self {
|
match self {
|
||||||
Self::EIP1559Transaction(tx) => min(
|
Self::EIP1559Transaction(tx) => {
|
||||||
self.tx().gas_price,
|
let (v2, overflow) = tx
|
||||||
tx.max_priority_fee_per_gas + block_base_fee.unwrap_or_default(),
|
.max_priority_fee_per_gas
|
||||||
),
|
.overflowing_add(block_base_fee.unwrap_or_default());
|
||||||
|
if overflow {
|
||||||
|
self.tx().gas_price
|
||||||
|
} else {
|
||||||
|
min(self.tx().gas_price, v2)
|
||||||
|
}
|
||||||
|
}
|
||||||
Self::AccessList(_) => self.tx().gas_price,
|
Self::AccessList(_) => self.tx().gas_price,
|
||||||
Self::Legacy(_) => self.tx().gas_price,
|
Self::Legacy(_) => self.tx().gas_price,
|
||||||
}
|
}
|
||||||
@ -1337,4 +1343,41 @@ mod tests {
|
|||||||
test_vector("f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10", "9bddad43f934d313c2b79ca28a432dd2b7281029");
|
test_vector("f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10", "9bddad43f934d313c2b79ca28a432dd2b7281029");
|
||||||
test_vector("f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", "3c24d7329e92f84f08556ceb6df1cdb0104ca49f");
|
test_vector("f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb", "3c24d7329e92f84f08556ceb6df1cdb0104ca49f");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_not_panic_on_effective_gas_price_overflow() {
|
||||||
|
use self::publickey::{Generator, Random};
|
||||||
|
let key = Random.generate();
|
||||||
|
let gas_price /* 2**256 - 1 */ = U256::from(340282366920938463463374607431768211455u128)
|
||||||
|
* U256::from(340282366920938463463374607431768211455u128)
|
||||||
|
+ U256::from(340282366920938463463374607431768211455u128)
|
||||||
|
+ U256::from(340282366920938463463374607431768211455u128);
|
||||||
|
let t = TypedTransaction::EIP1559Transaction(EIP1559TransactionTx {
|
||||||
|
transaction: AccessListTx::new(
|
||||||
|
Transaction {
|
||||||
|
action: Action::Create,
|
||||||
|
nonce: U256::from(42),
|
||||||
|
gas_price,
|
||||||
|
gas: U256::from(50_000),
|
||||||
|
value: U256::from(1),
|
||||||
|
data: b"Hello!".to_vec(),
|
||||||
|
},
|
||||||
|
vec![
|
||||||
|
(
|
||||||
|
H160::from_low_u64_be(10),
|
||||||
|
vec![H256::from_low_u64_be(102), H256::from_low_u64_be(103)],
|
||||||
|
),
|
||||||
|
(H160::from_low_u64_be(400), vec![]),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
max_priority_fee_per_gas: gas_price,
|
||||||
|
})
|
||||||
|
.sign(&key.secret(), Some(69));
|
||||||
|
|
||||||
|
let result = t.transaction.effective_gas_price(Some(124.into()));
|
||||||
|
assert_eq!(
|
||||||
|
gas_price, result,
|
||||||
|
"Invalid effective gas price, when max_priority_fee_per_gas is U256::max"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.1"
|
version = "3.3.2"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user