Compare commits

..

No commits in common. "main" and "v3.3.0-rc.7" have entirely different histories.

61 changed files with 87 additions and 1580 deletions

View File

@ -1,82 +1,3 @@
## OpenEthereum v3.3.3
Enhancements:
* Implement eip-3607 (#593)
Bug fixes:
* Add type field for legacy transactions in RPC calls (#580)
* Makes eth_mining to return False if not is not allowed to seal (#581)
* Made nodes data concatenate as RLP sequences instead of bytes (#598)
## OpenEthereum v3.3.2
Enhancements:
* London hardfork block: Sokol (24114400)
Bug fixes:
* Fix for maxPriorityFeePerGas overflow
## OpenEthereum v3.3.1
Enhancements:
* Add eth_maxPriorityFeePerGas implementation (#570)
* Add a bootnode for Kovan
Bug fixes:
* Fix for modexp overflow in debug mode (#578)
## OpenEthereum v3.3.0
Enhancements:
* Add `validateServiceTransactionsTransition` spec option to be able to enable additional checking of zero gas price transactions by block verifier
## OpenEthereum v3.3.0-rc.15
* Revert eip1559BaseFeeMinValue activation on xDai at London hardfork block
## OpenEthereum v3.3.0-rc.14
Enhancements:
* Add eip1559BaseFeeMinValue and eip1559BaseFeeMinValueTransition spec options
* Activate eip1559BaseFeeMinValue on xDai at London hardfork block (19040000), set it to 20 GWei
* Activate eip1559BaseFeeMinValue on POA Core at block 24199500 (November 8, 2021), set it to 10 GWei
* Delay difficulty bomb to June 2022 for Ethereum Mainnet (EIP-4345)
## OpenEthereum v3.3.0-rc.13
Enhancements:
* London hardfork block: POA Core (24090200)
## OpenEthereum v3.3.0-rc.12
Enhancements:
* London hardfork block: xDai (19040000)
## OpenEthereum v3.3.0-rc.11
Bug fixes:
* Ignore GetNodeData requests only for non-AuRa chains
## OpenEthereum v3.3.0-rc.10
Enhancements:
* Add eip1559FeeCollector and eip1559FeeCollectorTransition spec options
## OpenEthereum v3.3.0-rc.9
Bug fixes:
* Add service transactions support for EIP-1559
* Fix MinGasPrice config option for POSDAO and EIP-1559
Enhancements:
* min_gas_price becomes min_effective_priority_fee
* added version 4 for TxPermission contract
## OpenEthereum v3.3.0-rc.8
Bug fixes:
* Ignore GetNodeData requests (#519)
## OpenEthereum v3.3.0-rc.7
Bug fixes:

6
Cargo.lock generated
View File

@ -1,7 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "addr2line"
version = "0.14.1"
@ -2932,7 +2930,7 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "openethereum"
version = "3.3.3"
version = "3.3.0-rc.7"
dependencies = [
"ansi_term 0.10.2",
"atty",
@ -3282,7 +3280,7 @@ dependencies = [
[[package]]
name = "parity-version"
version = "3.3.3"
version = "3.3.0-rc.7"
dependencies = [
"parity-bytes",
"rlp",

View File

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

View File

@ -680,7 +680,7 @@ usage! {
ARG arg_min_gas_price: (Option<u64>) = None, or |c: &Config| c.mining.as_ref()?.min_gas_price.clone(),
"--min-gas-price=[STRING]",
"Minimum amount of Wei per GAS to be paid for a transaction on top of base fee, to be accepted for mining. Overrides --usd-per-tx.",
"Minimum amount of Wei per GAS to be paid for a transaction to be accepted for mining. Overrides --usd-per-tx.",
ARG arg_gas_price_percentile: (usize) = 50usize, or |c: &Config| c.mining.as_ref()?.gas_price_percentile,
"--gas-price-percentile=[PCT]",

View File

@ -640,7 +640,7 @@ impl Configuration {
fn pool_verification_options(&self) -> Result<pool::verifier::Options, String> {
Ok(pool::verifier::Options {
// NOTE min_gas_price,block_gas_limit block_base_fee, and allow_non_eoa_sender will be overwritten right after start.
// NOTE min_gas_price,block_gas_limit and block_base_fee will be overwritten right after start.
minimal_gas_price: U256::from(20_000_000) * 1_000u32,
block_gas_limit: U256::max_value(),
block_base_fee: None,
@ -649,7 +649,6 @@ impl Configuration {
None => U256::max_value(),
},
no_early_reject: self.args.flag_tx_queue_no_early_reject,
allow_non_eoa_sender: false,
})
}

View File

@ -370,14 +370,7 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
let base_fee = client
.engine()
.calculate_base_fee(&client.best_block_header());
let allow_non_eoa_sender = client
.engine()
.allow_non_eoa_sender(client.best_block_header().number() + 1);
miner.update_transaction_queue_limits(
*client.best_block_header().gas_limit(),
base_fee,
allow_non_eoa_sender,
);
miner.update_transaction_queue_limits(*client.best_block_header().gas_limit(), base_fee);
let connection_filter = connection_filter_address.map(|a| {
Arc::new(NodeFilter::new(

View File

@ -32,8 +32,6 @@ pub struct AccountDetails {
pub nonce: U256,
/// Current account balance
pub balance: U256,
/// Code hash associated with an account if any
pub code_hash: Option<H256>,
/// Is this account a local account?
pub is_local: bool,
}

View File

@ -188,10 +188,6 @@ impl txpool::VerifiedTransaction for VerifiedTransaction {
fn sender(&self) -> &Address {
&self.sender
}
fn has_zero_gas_price(&self) -> bool {
self.transaction.has_zero_gas_price()
}
}
impl ScoredTransaction for VerifiedTransaction {

View File

@ -659,27 +659,10 @@ impl TransactionQueue {
Some(tx) => tx
.signed()
.effective_gas_price(self.options.read().block_base_fee),
None => {
self.options.read().minimal_gas_price
+ self.options.read().block_base_fee.unwrap_or_default()
}
None => self.options.read().minimal_gas_price,
}
}
/// Returns effective priority fee gas price of currently the worst transaction in the pool.
/// If the worst transaction has zero gas price, the minimal gas price is returned.
pub fn current_worst_effective_priority_fee(&self) -> U256 {
self.pool
.read()
.worst_transaction()
.filter(|tx| !tx.signed().has_zero_gas_price())
.map(|tx| {
tx.signed()
.effective_priority_fee(self.options.read().block_base_fee)
})
.unwrap_or(self.options.read().minimal_gas_price)
}
/// Returns a status of the queue.
pub fn status(&self) -> Status {
let pool = self.pool.read();

View File

@ -43,7 +43,6 @@ impl Default for TestClient {
account_details: AccountDetails {
nonce: 123.into(),
balance: 63_100.into(),
code_hash: None,
is_local: false,
},
gas_required: 21_000.into(),
@ -69,11 +68,6 @@ impl TestClient {
self
}
pub fn with_code_hash<T: Into<H256>>(mut self, code_hash: T) -> Self {
self.account_details.code_hash = Some(code_hash.into());
self
}
pub fn with_gas_required<T: Into<U256>>(mut self, gas_required: T) -> Self {
self.gas_required = gas_required.into();
self

View File

@ -15,7 +15,6 @@
// along with OpenEthereum. If not, see <http://www.gnu.org/licenses/>.
use ethereum_types::U256;
use hash::KECCAK_EMPTY;
use txpool;
use types::transaction::{self, PendingTransaction};
@ -48,7 +47,6 @@ fn new_queue() -> TransactionQueue {
tx_gas_limit: 1_000_000.into(),
no_early_reject: false,
block_base_fee: None,
allow_non_eoa_sender: false,
},
PrioritizationStrategy::GasPriceOnly,
)
@ -68,7 +66,6 @@ fn should_return_correct_nonces_when_dropped_because_of_limit() {
tx_gas_limit: 1_000_000.into(),
no_early_reject: false,
block_base_fee: None,
allow_non_eoa_sender: false,
},
PrioritizationStrategy::GasPriceOnly,
);
@ -130,7 +127,6 @@ fn should_never_drop_local_transactions_from_different_senders() {
tx_gas_limit: 1_000_000.into(),
no_early_reject: false,
block_base_fee: None,
allow_non_eoa_sender: false,
},
PrioritizationStrategy::GasPriceOnly,
);
@ -276,71 +272,6 @@ fn should_import_transaction_below_min_gas_price_threshold_if_local() {
assert_eq!(txq.status().status.transaction_count, 1);
}
#[test]
fn should_reject_transaction_from_non_eoa_if_non_eoa_sender_is_not_allowed() {
// given
let txq = new_queue();
let tx = Tx::default();
let code_hash = [
0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f,
0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a,
0x0f, 0x0e,
];
// when
let res = txq.import(
TestClient::new().with_code_hash(code_hash),
vec![tx.signed().unverified()],
);
// then
assert_eq!(res, vec![Err(transaction::Error::SenderIsNotEOA)]);
assert_eq!(txq.status().status.transaction_count, 0);
}
#[test]
fn should_import_transaction_from_non_eoa_if_non_eoa_sender_is_allowed() {
// given
let txq = new_queue();
let tx = Tx::default();
let code_hash = [
0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f,
0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a, 0x0f, 0x0e, 0x0c, 0x0a,
0x0f, 0x0e,
];
txq.set_verifier_options(verifier::Options {
allow_non_eoa_sender: true,
..Default::default()
});
// when
let res = txq.import(
TestClient::new().with_code_hash(code_hash),
vec![tx.signed().unverified()],
);
// then
assert_eq!(res, vec![Ok(())]);
assert_eq!(txq.status().status.transaction_count, 1);
}
#[test]
fn should_import_transaction_if_account_code_hash_is_keccak_empty() {
// given
let txq = new_queue();
let tx = Tx::default();
// when
let res = txq.import(
TestClient::new().with_code_hash(KECCAK_EMPTY),
vec![tx.signed().unverified()],
);
// then
assert_eq!(res, vec![Ok(())]);
assert_eq!(txq.status().status.transaction_count, 1);
}
#[test]
fn should_import_txs_from_same_sender() {
// given
@ -614,7 +545,6 @@ fn should_prefer_current_transactions_when_hitting_the_limit() {
tx_gas_limit: 1_000_000.into(),
no_early_reject: false,
block_base_fee: None,
allow_non_eoa_sender: false,
},
PrioritizationStrategy::GasPriceOnly,
);
@ -1113,7 +1043,6 @@ fn should_include_local_transaction_to_a_full_pool() {
tx_gas_limit: 1_000_000.into(),
no_early_reject: false,
block_base_fee: None,
allow_non_eoa_sender: false,
},
PrioritizationStrategy::GasPriceOnly,
);
@ -1147,7 +1076,6 @@ fn should_avoid_verifying_transaction_already_in_pool() {
tx_gas_limit: 1_000_000.into(),
no_early_reject: false,
block_base_fee: None,
allow_non_eoa_sender: false,
},
PrioritizationStrategy::GasPriceOnly,
);
@ -1184,7 +1112,6 @@ fn should_avoid_reverifying_recently_rejected_transactions() {
tx_gas_limit: 1_000_000.into(),
no_early_reject: false,
block_base_fee: None,
allow_non_eoa_sender: false,
},
PrioritizationStrategy::GasPriceOnly,
);
@ -1234,7 +1161,6 @@ fn should_reject_early_in_case_gas_price_is_less_than_min_effective() {
tx_gas_limit: 1_000_000.into(),
no_early_reject: false,
block_base_fee: None,
allow_non_eoa_sender: false,
},
PrioritizationStrategy::GasPriceOnly,
);
@ -1278,7 +1204,6 @@ fn should_not_reject_early_in_case_gas_price_is_less_than_min_effective() {
tx_gas_limit: 1_000_000.into(),
no_early_reject: true,
block_base_fee: None,
allow_non_eoa_sender: false,
},
PrioritizationStrategy::GasPriceOnly,
);

View File

@ -31,7 +31,6 @@ use std::{
};
use ethereum_types::{H256, U256};
use hash::KECCAK_EMPTY;
use txpool;
use types::transaction;
@ -43,7 +42,7 @@ use super::{
/// Verification options.
#[derive(Debug, Clone, PartialEq)]
pub struct Options {
/// Minimal allowed gas price (actually minimal block producer reward = effective_priority_fee).
/// Minimal allowed gas price.
pub minimal_gas_price: U256,
/// Current block gas limit.
pub block_gas_limit: U256,
@ -53,8 +52,6 @@ pub struct Options {
pub tx_gas_limit: U256,
/// Skip checks for early rejection, to make sure that local transactions are always imported.
pub no_early_reject: bool,
/// Accept transactions from non EOAs (see EIP-3607)
pub allow_non_eoa_sender: bool,
}
#[cfg(test)]
@ -66,7 +63,6 @@ impl Default for Options {
block_base_fee: None,
tx_gas_limit: U256::max_value(),
no_early_reject: false,
allow_non_eoa_sender: false,
}
}
}
@ -126,24 +122,6 @@ impl Transaction {
}
}
/// Return effective fee - part of the transaction fee that goes to the miner
pub fn effective_priority_fee(&self, block_base_fee: Option<U256>) -> U256 {
match *self {
Transaction::Unverified(ref tx) => tx.effective_priority_fee(block_base_fee),
Transaction::Retracted(ref tx) => tx.effective_priority_fee(block_base_fee),
Transaction::Local(ref tx) => tx.effective_priority_fee(block_base_fee),
}
}
/// Check if transaction has zero gas price
pub fn has_zero_gas_price(&self) -> bool {
match *self {
Transaction::Unverified(ref tx) => tx.has_zero_gas_price(),
Transaction::Retracted(ref tx) => tx.has_zero_gas_price(),
Transaction::Local(ref tx) => tx.has_zero_gas_price(),
}
}
fn transaction(&self) -> &transaction::TypedTransaction {
match *self {
Transaction::Unverified(ref tx) => &*tx,
@ -247,26 +225,24 @@ impl<C: Client> txpool::Verifier<Transaction>
}
let is_own = tx.is_local();
let has_zero_gas_price = tx.has_zero_gas_price();
let gas_price = tx.effective_gas_price(self.options.block_base_fee);
// Quick exit for non-service and non-local transactions
//
// We're checking if the transaction is below configured minimal gas price
// or the effective minimal gas price in case the pool is full.
if !has_zero_gas_price && !is_own {
let effective_priority_fee = tx.effective_priority_fee(self.options.block_base_fee);
if effective_priority_fee < self.options.minimal_gas_price {
if !gas_price.is_zero() && !is_own {
if gas_price < self.options.minimal_gas_price {
trace!(
target: "txqueue",
"[{:?}] Rejected tx below minimal gas price threshold: {} < {}",
hash,
effective_priority_fee,
gas_price,
self.options.minimal_gas_price,
);
bail!(transaction::Error::InsufficientGasPrice {
minimal: self.options.minimal_gas_price,
got: effective_priority_fee,
got: gas_price,
});
}
@ -276,7 +252,7 @@ impl<C: Client> txpool::Verifier<Transaction>
target: "txqueue",
"[{:?}] Rejected tx early, cause it doesn't have any chance to get to the pool: (gas price: {} < {})",
hash,
tx.effective_gas_price(self.options.block_base_fee),
gas_price,
vtx.transaction.effective_gas_price(self.options.block_base_fee),
);
return Err(transaction::Error::TooCheapToReplace {
@ -284,7 +260,7 @@ impl<C: Client> txpool::Verifier<Transaction>
vtx.transaction
.effective_gas_price(self.options.block_base_fee),
),
new: Some(tx.effective_gas_price(self.options.block_base_fee)),
new: Some(gas_price),
});
}
}
@ -321,24 +297,9 @@ impl<C: Client> txpool::Verifier<Transaction>
let sender = transaction.sender();
let account_details = self.client.account_details(&sender);
if !self.options.allow_non_eoa_sender {
if let Some(code_hash) = account_details.code_hash {
if code_hash != KECCAK_EMPTY {
debug!(
target: "txqueue",
"[{:?}] Rejected tx, sender is not an EOA: {}",
hash,
code_hash
);
bail!(transaction::Error::SenderIsNotEOA);
}
}
}
let gas_price = transaction.tx().gas_price;
let effective_priority_fee =
transaction.effective_priority_fee(self.options.block_base_fee);
if effective_priority_fee < self.options.minimal_gas_price {
if gas_price < self.options.minimal_gas_price {
let transaction_type = self.client.transaction_type(&transaction);
if let TransactionType::Service = transaction_type {
debug!(target: "txqueue", "Service tx {:?} below minimal gas price accepted", hash);
@ -349,18 +310,16 @@ impl<C: Client> txpool::Verifier<Transaction>
target: "txqueue",
"[{:?}] Rejected tx below minimal gas price threshold: {} < {}",
hash,
effective_priority_fee,
gas_price,
self.options.minimal_gas_price,
);
bail!(transaction::Error::InsufficientGasPrice {
minimal: self.options.minimal_gas_price,
got: effective_priority_fee,
got: gas_price,
});
}
}
let gas_price = transaction.tx().gas_price;
if gas_price < transaction.max_priority_fee_per_gas() {
bail!(transaction::Error::InsufficientGasPrice {
minimal: transaction.max_priority_fee_per_gas(),

View File

@ -45,7 +45,7 @@ impl ServiceTransactionChecker {
) -> Result<bool, String> {
let sender = tx.sender();
// Skip checking the contract if the transaction does not have zero gas price
if !tx.has_zero_gas_price() {
if !tx.tx().gas_price.is_zero() {
return Ok(false);
}
@ -72,7 +72,7 @@ impl ServiceTransactionChecker {
SERVICE_TRANSACTION_CONTRACT_REGISTRY_NAME.to_owned(),
BlockId::Latest,
)
.ok_or_else(|| "Certifier contract is not configured")?;
.ok_or_else(|| "contract is not configured")?;
self.call_contract(client, contract_address, sender)
.and_then(|allowed| {
if let Some(mut cache) = self.certified_addresses_cache.try_write() {

View File

@ -138,8 +138,7 @@
"0x42ae50": "0x2dc6c0",
"0x6f1580": "0x1e8480",
"0x8c6180": "0x3d0900",
"0xc5d488": "0xaae60",
"0xd228c8": "0xf4240"
"0xc5d488": "0xaae60"
}
}
}

View File

@ -265,7 +265,6 @@
},
"nodes": [
"enode://30499bde23362f7d310a34518a2a6ff765921870bf0c3e63d21153cfa7ba9cf39cc7c8e54e9dad2f2b3c07288b3e91b220656833cc2d843a54875c229f3f959a@8.9.8.175:30303",
"enode://30499bde23362f7d310a34518a2a6ff765921870bf0c3e63d21153cfa7ba9cf39cc7c8e54e9dad2f2b3c07288b3e91b220656833cc2d843a54875c229f3f959a@45.33.77.29:30303",
"enode://16898006ba2cd4fa8bf9a3dfe32684c178fa861df144bfc21fe800dc4838a03e342056951fa9fd533dcb0be1219e306106442ff2cf1f7e9f8faa5f2fc1a3aa45@116.203.116.241:30303",
"enode://49a0e1aa38caa12cbf31222cb4e31cef1e8794cb4dd38012f84498ac867b19584e29bbf6d53201d7dfd3b5eb0998a4d908d096ed4ddb5f9102c623852cd331ec@54.87.247.5:30303"
]

View File

@ -47,18 +47,7 @@
"eip1884Transition": 12598600,
"eip2028Transition": 12598600,
"eip2929Transition": 21364900,
"eip2930Transition": 21364900,
"eip3198Transition": 24090200,
"eip3529Transition": 24090200,
"eip3541Transition": 24090200,
"eip1559Transition": 24090200,
"eip1559BaseFeeMaxChangeDenominator": "0x8",
"eip1559ElasticityMultiplier": "0x2",
"eip1559BaseFeeInitialValue": "0x3b9aca00",
"eip1559BaseFeeMinValue": "0x2540be400",
"eip1559BaseFeeMinValueTransition": 24199500,
"eip1559FeeCollector": "0x517F3AcfF3aFC2fb45e574718bca6F919b798e10",
"eip1559FeeCollectorTransition": 24090200
"eip2930Transition": 21364900
},
"genesis": {
"seal": {

View File

@ -52,16 +52,7 @@
"eip1884Transition": 12095200,
"eip2028Transition": 12095200,
"eip2929Transition": 21050600,
"eip2930Transition": 21050600,
"eip3198Transition": 24114400,
"eip3529Transition": 24114400,
"eip3541Transition": 24114400,
"eip1559Transition": 24114400,
"eip1559BaseFeeMaxChangeDenominator": "0x8",
"eip1559ElasticityMultiplier": "0x2",
"eip1559BaseFeeInitialValue": "0x3b9aca00",
"eip1559FeeCollector": "0xE8DDc5c7A2d2F0D7a9798459c0104fDf5E987ACA",
"eip1559FeeCollectorTransition": 24114400
"eip2930Transition": 21050600
},
"genesis": {
"seal": {

View File

@ -1,65 +0,0 @@
pragma solidity ^0.4.20;
// Adapted from https://gist.github.com/VladLupashevskyi/84f18eabb1e4afadf572cf92af3e7e7f
// and: https://github.com/poanetwork/posdao-contracts/blob/master/contracts/TxPermission.sol
contract TxPermission {
/// Allowed transaction types mask
uint32 constant None = 0;
uint32 constant All = 0xffffffff;
uint32 constant Basic = 0x01;
uint32 constant Call = 0x02;
uint32 constant Create = 0x04;
uint32 constant Private = 0x08;
/// Contract name
function contractName() public constant returns (string) {
return "TX_PERMISSION_CONTRACT";
}
/// Contract name hash
function contractNameHash() public constant returns (bytes32) {
return keccak256(contractName());
}
/// Contract version
function contractVersion() public constant returns (uint256) {
return 4;
}
/// @dev Defines the allowed transaction types which may be initiated by the specified sender with
/// the specified gas price and data. Used by node's engine each time a transaction is about to be
/// included into a block. See https://openethereum.github.io/Permissioning.html#how-it-works-1
/// @param _sender Transaction sender address.
/// @param _to Transaction recipient address. If creating a contract, the `_to` address is zero.
/// @param _value Transaction amount in wei.
/// @param _maxFeePerGas The `maxFeePerGas` in Wei for EIP-1559 transaction, or gas price for a legacy transaction.
/// @param _maxInclusionFeePerGas The `maxInclusionFeePerGas` in Wei for EIP-1559 transaction.
/// Equals to gas price for a legacy transaction.
/// @param _gasLimit Gas limit for the transaction.
/// @param _data Transaction data.
/// @return `uint32 typesMask` - Set of allowed transactions for `_sender` depending on tx `_to` address,
/// `_gasPrice`, and `_data`. The result is represented as a set of flags:
/// 0x01 - basic transaction (e.g. ether transferring to user wallet);
/// 0x02 - contract call;
/// 0x04 - contract creation;
/// 0x08 - private transaction.
/// `bool cache` - If `true` is returned, the same permissions will be applied from the same
/// `_sender` without calling this contract again.
function allowedTxTypes(
address _sender,
address _to,
uint256 _value,
uint256 _maxFeePerGas, // equals to gasPrice for legacy transactions
uint256 _maxInclusionFeePerGas, // equals to gasPrice for legacy transactions
uint256 _gasLimit,
bytes memory _data
)
public
view
returns(uint32 typesMask, bool cache)
{
if (_maxFeePerGas > 0 || _data.length < 4) return (All, false);
return (None, false);
}
}

View File

@ -1,44 +0,0 @@
{
"name": "TestNodeFilterContract",
"engine": {
"authorityRound": {
"params": {
"stepDuration": 1,
"startStep": 2,
"validators": {
"contract": "0x0000000000000000000000000000000000000000"
}
}
}
},
"params": {
"accountStartNonce": "0x0",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x69",
"gasLimitBoundDivisor": "0x0400",
"transactionPermissionContract": "0xAB5b100cf7C8deFB3c8f3C48474223997A50fB13",
"transactionPermissionContractTransition": "1"
},
"genesis": {
"seal": {
"generic": "0xc180"
},
"difficulty": "0x20000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x222222"
},
"accounts": {
"0000000000000000000000000000000000000001": { "balance": "1", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
"0000000000000000000000000000000000000002": { "balance": "1", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0000000000000000000000000000000000000003": { "balance": "1", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0000000000000000000000000000000000000004": { "balance": "1", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"0xAB5b100cf7C8deFB3c8f3C48474223997A50fB13": {
"balance": "1",
"constructor": "608060405234801561001057600080fd5b50610370806100206000396000f300608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063469ab1e31461006757806375d0c0dc1461009a578063a0a8e4601461012a578063e4e3b5e514610155575b600080fd5b34801561007357600080fd5b5061007c610251565b60405180826000191660001916815260200191505060405180910390f35b3480156100a657600080fd5b506100af6102c2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100ef5780820151818401526020810190506100d4565b50505050905090810190601f16801561011c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013657600080fd5b5061013f6102ff565b6040518082815260200191505060405180910390f35b34801561016157600080fd5b50610224600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919080359060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610308565b604051808363ffffffff1663ffffffff168152602001821515151581526020019250505060405180910390f35b600061025b6102c2565b6040518082805190602001908083835b602083101515610290578051825260208201915060208101905060208303925061026b565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020905090565b60606040805190810160405280601681526020017f54585f5045524d495353494f4e5f434f4e545241435400000000000000000000815250905090565b60006004905090565b600080600086118061031b575060048351105b156103305763ffffffff600091509150610338565b600080915091505b975097955050505050505600a165627a7a72305820592b45ee74cc856b6c84f99ed8ddd4790d844a9065a07c7bbfc5dfa05cc394c50029"
}
}
}

View File

@ -1,47 +0,0 @@
{
"name": "Morden",
"engine": {
"null": {
"params": {}
}
},
"params": {
"gasLimitBoundDivisor": "0x0400",
"accountStartNonce": "0x0",
"maximumExtraDataSize": "0x20",
"minGasLimit": "0x1388",
"networkID" : "0x2",
"registrar" : "0x0000000000000000000000000000000000001337",
"eip140Transition": "0x0",
"eip211Transition": "0x0",
"eip214Transition": "0x0",
"eip658Transition": "0x0",
"eip3607Transition": "0x2"
},
"genesis": {
"seal": {
"ethereum": {
"nonce": "0x00006d6f7264656e",
"mixHash": "0x00000000000000000000000000000000000000647572616c65787365646c6578"
}
},
"difficulty": "0x20000",
"author": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x2fefd8"
},
"accounts": {
"0000000000000000000000000000000000000001": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ecrecover", "pricing": { "linear": { "base": 3000, "word": 0 } } } },
"0000000000000000000000000000000000000002": { "balance": "1", "nonce": "1048576", "builtin": { "name": "sha256", "pricing": { "linear": { "base": 60, "word": 12 } } } },
"0000000000000000000000000000000000000003": { "balance": "1", "nonce": "1048576", "builtin": { "name": "ripemd160", "pricing": { "linear": { "base": 600, "word": 120 } } } },
"0000000000000000000000000000000000000004": { "balance": "1", "nonce": "1048576", "builtin": { "name": "identity", "pricing": { "linear": { "base": 15, "word": 3 } } } },
"102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376", "nonce": "1048576" },
"0x71562b71999873DB5b286dF957af199Ec94617F7": {
"balance": "1000000000000000000",
"nonce": "0",
"code": "0xB0B0FACE"
}
}
}

View File

@ -56,15 +56,6 @@
"eip2028Transition": 7298030,
"eip2929Transition": 16101500,
"eip2930Transition": 16101500,
"eip3198Transition": 19040000,
"eip3529Transition": 19040000,
"eip3541Transition": 19040000,
"eip1559Transition": 19040000,
"eip1559BaseFeeMaxChangeDenominator": "0x8",
"eip1559ElasticityMultiplier": "0x2",
"eip1559BaseFeeInitialValue": "0x3b9aca00",
"eip1559FeeCollector": "0x6BBe78ee9e474842Dbd4AB4987b3CeFE88426A92",
"eip1559FeeCollectorTransition": 19040000,
"registrar": "0x6B53721D4f2Fb9514B85f5C49b197D857e36Cf03",
"transactionPermissionContract": "0x7Dd7032AA75A37ea0b150f57F899119C7379A78b",
"transactionPermissionContractTransition": 9186425

View File

@ -1,91 +0,0 @@
[
{
"constant": true,
"inputs": [],
"name": "contractNameHash",
"outputs": [
{
"name": "",
"type": "bytes32"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "contractName",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "contractVersion",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "sender",
"type": "address"
},
{
"name": "to",
"type": "address"
},
{
"name": "value",
"type": "uint256"
},
{
"name": "maxFeePerGas",
"type": "uint256"
},
{
"name": "maxPriorityFeePerGas",
"type": "uint256"
},
{
"name": "gasLimit",
"type": "uint256"
},
{
"name": "data",
"type": "bytes"
}
],
"name": "allowedTxTypes",
"outputs": [
{
"name": "",
"type": "uint32"
},
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]

View File

@ -488,52 +488,6 @@ impl Importer {
.epoch_transition(parent.number(), *header.parent_hash())
.is_some();
if header.number() >= engine.params().validate_service_transactions_transition {
// Check if zero gas price transactions are certified to be service transactions
// using the Certifier contract. If they are not certified, the block is treated as invalid.
let service_transaction_checker = self.miner.service_transaction_checker();
if service_transaction_checker.is_some() {
match service_transaction_checker.unwrap().refresh_cache(client) {
Ok(true) => {
trace!(target: "client", "Service transaction cache was refreshed successfully");
}
Ok(false) => {
trace!(target: "client", "Registrar or/and service transactions contract does not exist");
}
Err(e) => {
error!(target: "client", "Error occurred while refreshing service transaction cache: {}", e)
}
};
};
for t in &block.transactions {
if t.has_zero_gas_price() {
match self.miner.service_transaction_checker() {
None => {
let e = "Service transactions are not allowed. You need to enable Certifier contract.";
warn!(target: "client", "Service tx checker error: {:?}", e);
bail!(e);
}
Some(ref checker) => match checker.check(client, &t) {
Ok(true) => {}
Ok(false) => {
let e = format!(
"Service transactions are not allowed for the sender {:?}",
t.sender()
);
warn!(target: "client", "Service tx checker error: {:?}", e);
bail!(e);
}
Err(e) => {
debug!(target: "client", "Unable to verify service transaction: {:?}", e);
warn!(target: "client", "Service tx checker error: {:?}", e);
bail!(e);
}
},
}
};
}
}
// t_nb 8.0 Block enacting. Execution of transactions.
let enact_result = enact_verified(
block,
@ -2001,7 +1955,7 @@ impl Call for Client {
gas_used: U256::default(),
gas_limit: U256::max_value(),
//if gas pricing is not defined, force base_fee to zero
base_fee: if transaction.effective_gas_price(header.base_fee()).is_zero() {
base_fee: if transaction.effective_gas_price(header.base_fee()) == 0.into() {
Some(0.into())
} else {
header.base_fee()
@ -2034,7 +1988,7 @@ impl Call for Client {
for &(ref t, analytics) in transactions {
//if gas pricing is not defined, force base_fee to zero
if t.effective_gas_price(header.base_fee()).is_zero() {
if t.effective_gas_price(header.base_fee()) == 0.into() {
env_info.base_fee = Some(0.into());
} else {
env_info.base_fee = header.base_fee()
@ -2066,7 +2020,7 @@ impl Call for Client {
last_hashes: self.build_last_hashes(header.parent_hash()),
gas_used: U256::default(),
gas_limit: max,
base_fee: if t.effective_gas_price(header.base_fee()).is_zero() {
base_fee: if t.effective_gas_price(header.base_fee()) == 0.into() {
Some(0.into())
} else {
header.base_fee()

View File

@ -1087,17 +1087,6 @@ impl BlockChainClient for TestBlockChainClient {
let mut rlp = RlpStream::new();
rlp.append(&hash.clone());
return Some(rlp.out());
} else if *hash
== H256::from_str("000000000000000000000000000000000000000000000000000000000000000a")
.unwrap()
{
// for basic `return_node_data` tests
return Some(vec![0xaa, 0xaa]);
} else if *hash
== H256::from_str("000000000000000000000000000000000000000000000000000000000000000c")
.unwrap()
{
return Some(vec![0xcc]);
}
None
}

View File

@ -413,40 +413,6 @@ pub trait BlockChainClient:
corpus.into()
}
/// Sorted list of transaction priority gas prices from at least last sample_size blocks.
fn priority_gas_price_corpus(
&self,
sample_size: usize,
eip1559_transition: BlockNumber,
) -> ::stats::Corpus<U256> {
let mut h = self.chain_info().best_block_hash;
let mut corpus = Vec::new();
while corpus.is_empty() {
for _ in 0..sample_size {
let block = match self.block(BlockId::Hash(h)) {
Some(block) => block,
None => return corpus.into(),
};
if block.number() == 0 || block.number() < eip1559_transition {
return corpus.into();
}
block
.transaction_views()
.iter()
.filter(
|t| t.gas_price() > 0.into(), /* filter zero cost transactions */
)
.foreach(|t| {
// As block.number() >= eip_1559_transition, the base_fee should exist
corpus.push(t.effective_priority_gas_price(Some(block.header().base_fee())))
});
h = block.parent_hash().clone();
}
}
corpus.into()
}
/// Get the preferred chain ID to sign on
fn signing_chain_id(&self) -> Option<u64>;

View File

@ -1557,43 +1557,6 @@ impl Engine<EthereumMachine> for AuthorityRound {
}
}
// Mostly is the same as `fn sealing_state(&self)` except that it does not
// check whether the node is a step proposer.
fn is_allowed_to_seal(&self) -> bool {
let our_addr = match *self.signer.read() {
Some(ref signer) => signer.address(),
None => return false,
};
let client = match self.upgrade_client_or("Not preparing block") {
Ok(client) => client,
Err(_) => return false,
};
let parent = match client.as_full_client() {
Some(full_client) => full_client.best_block_header(),
None => {
return false;
}
};
let validators = if self.immediate_transitions {
CowLike::Borrowed(&*self.validators)
} else {
let mut epoch_manager = self.epoch_manager.lock();
if !epoch_manager.zoom_to_after(
&*client,
&self.machine,
&*self.validators,
parent.hash(),
) {
return false;
}
CowLike::Owned(epoch_manager.validators().clone())
};
validators.contains(&parent.hash(), &our_addr)
}
fn sealing_state(&self) -> SealingState {
let our_addr = match *self.signer.read() {
Some(ref signer) => signer.address(),

View File

@ -470,14 +470,6 @@ pub trait Engine<M: Machine>: Sync + Send {
/// Register a component which signs consensus messages.
fn set_signer(&self, _signer: Option<Box<dyn EngineSigner>>) {}
/// Returns whether the current node is a validator and
/// actually may seal a block if AuRa engine is used.
///
/// Used by `eth_mining` rpc call.
fn is_allowed_to_seal(&self) -> bool {
true
}
/// Sign using the EngineSigner, to be used for consensus tx signing.
fn sign(&self, _hash: H256) -> Result<Signature, M::Error> {
unimplemented!()
@ -668,14 +660,6 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> {
fn min_gas_limit(&self) -> U256 {
self.params().min_gas_limit
}
/// Returns whether transactions from non externally owned accounts (EOA)
/// are allowed in the given block number (see EIP-3607).
///
/// That is only possible if EIP-3607 is still not activated.
fn allow_non_eoa_sender(&self, best_block_number: BlockNumber) -> bool {
self.params().eip3607_transition > best_block_number
}
}
// convenience wrappers for existing functions.

View File

@ -1207,7 +1207,7 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
}
// ensure that the user was willing to at least pay the base fee
if t.tx().gas_price < self.info.base_fee.unwrap_or_default() && !t.has_zero_gas_price() {
if t.tx().gas_price < self.info.base_fee.unwrap_or_default() {
return Err(ExecutionError::GasPriceLowerThanBaseFee {
gas_price: t.tx().gas_price,
base_fee: self.info.base_fee.unwrap_or_default(),
@ -1516,20 +1516,18 @@ 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
// 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)
let burnt_fee = if schedule.eip1559 && !t.has_zero_gas_price() {
let (fee, overflow_3) =
let fees_value = fees_value.saturating_sub(if schedule.eip1559 {
let (base_fee, overflow_3) =
gas_used.overflowing_mul(self.info.base_fee.unwrap_or_default());
if overflow_3 {
return Err(ExecutionError::TransactionMalformed(
"U256 Overflow".to_string(),
));
}
fee
base_fee
} else {
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",
t.tx().gas, sstore_refunds, suicide_refunds, refunds_bound, gas_left_prerefund, refunded, gas_left, gas_used, refund_value, fees_value);
@ -1554,17 +1552,6 @@ impl<'a, B: 'a + StateBackend> Executive<'a, B> {
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
for address in &substate.suicides {
self.state.kill_account(address);
@ -2760,127 +2747,6 @@ 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}
fn test_keccak(factory: Factory) {
let code = "6064640fffffffff20600055".from_hex().unwrap();

View File

@ -376,7 +376,7 @@ impl EthereumMachine {
header: &Header,
) -> Result<SignedTransaction, transaction::Error> {
// ensure that the user was willing to at least pay the base fee
if t.tx().gas_price < header.base_fee().unwrap_or_default() && !t.has_zero_gas_price() {
if t.tx().gas_price < header.base_fee().unwrap_or_default() {
return Err(transaction::Error::GasPriceLowerThanBaseFee {
gas_price: t.tx().gas_price,
base_fee: header.base_fee().unwrap_or_default(),
@ -466,32 +466,15 @@ 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 min base fee
/// through eip1559BaseFeeMinValue 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;
}
let base_fee_min_value =
if parent.number() + 1 >= self.params().eip1559_base_fee_min_value_transition {
match self.params().eip1559_base_fee_min_value {
None => panic!("Base fee min value must be set in spec."),
Some(min_value) => min_value,
}
} else {
U256::zero()
};
// Block eip1559_transition has base_fee = self.params().eip1559_base_fee_initial_value
if parent.number() + 1 == self.params().eip1559_transition {
return Some(max(
self.params().eip1559_base_fee_initial_value,
base_fee_min_value,
));
return Some(self.params().eip1559_base_fee_initial_value);
}
// Block eip1559_transition + 1 has base_fee = calculated
@ -509,23 +492,21 @@ impl EthereumMachine {
panic!("Can't calculate base fee if parent gas target is zero.");
}
let result = if parent.gas_used() == &parent_gas_target {
parent_base_fee
if parent.gas_used() == &parent_gas_target {
Some(parent_base_fee)
} else if parent.gas_used() > &parent_gas_target {
let gas_used_delta = parent.gas_used() - parent_gas_target;
let base_fee_per_gas_delta = max(
parent_base_fee * gas_used_delta / parent_gas_target / base_fee_denominator,
U256::from(1),
);
parent_base_fee + base_fee_per_gas_delta
Some(parent_base_fee + base_fee_per_gas_delta)
} else {
let gas_used_delta = parent_gas_target - parent.gas_used();
let base_fee_per_gas_delta =
parent_base_fee * gas_used_delta / parent_gas_target / base_fee_denominator;
max(parent_base_fee - base_fee_per_gas_delta, U256::zero())
};
Some(max(result, base_fee_min_value))
Some(max(parent_base_fee - base_fee_per_gas_delta, U256::zero()))
}
}
}

View File

@ -190,7 +190,6 @@ impl Default for MinerOptions {
block_base_fee: None,
tx_gas_limit: U256::max_value(),
no_early_reject: false,
allow_non_eoa_sender: false,
},
}
}
@ -342,7 +341,6 @@ impl Miner {
block_base_fee: None,
tx_gas_limit: U256::max_value(),
no_early_reject: false,
allow_non_eoa_sender: false,
},
reseal_min_period: Duration::from_secs(0),
force_sealing,
@ -384,7 +382,6 @@ impl Miner {
&self,
block_gas_limit: U256,
block_base_fee: Option<U256>,
allow_non_eoa_sender: bool,
) {
trace!(target: "miner", "minimal_gas_price: recalibrating...");
let txq = self.transaction_queue.clone();
@ -394,7 +391,6 @@ impl Miner {
options.minimal_gas_price = gas_price;
options.block_gas_limit = block_gas_limit;
options.block_base_fee = block_base_fee;
options.allow_non_eoa_sender = allow_non_eoa_sender;
txq.set_verifier_options(options);
});
@ -1010,14 +1006,6 @@ impl miner::MinerService for Miner {
self.transaction_queue.current_worst_gas_price() * 110u32 / 100
}
fn sensible_max_priority_fee(&self) -> U256 {
// 10% above our minimum.
self.transaction_queue
.current_worst_effective_priority_fee()
* 110u32
/ 100
}
fn sensible_gas_limit(&self) -> U256 {
self.params.read().gas_range_target.0 / 5
}
@ -1381,7 +1369,7 @@ impl miner::MinerService for Miner {
}
fn is_currently_sealing(&self) -> bool {
self.sealing.lock().enabled && self.engine.is_allowed_to_seal()
self.sealing.lock().enabled
}
fn work_package<C>(&self, chain: &C) -> Option<(H256, BlockNumber, u64, U256)>
@ -1470,10 +1458,7 @@ impl miner::MinerService for Miner {
} else {
1
};
let allow_non_eoa_sender = self
.engine
.allow_non_eoa_sender(chain.best_block_header().number() + 1);
self.update_transaction_queue_limits(gas_limit, base_fee, allow_non_eoa_sender);
self.update_transaction_queue_limits(gas_limit, base_fee);
// t_nb 10.2 Then import all transactions from retracted blocks (retracted means from side chain).
let client = self.pool_client(chain);
@ -1615,9 +1600,7 @@ mod tests {
use client::{ChainInfo, EachBlockWith, ImportSealedBlock, TestBlockChainClient};
use miner::{MinerService, PendingOrdering};
use test_helpers::{
dummy_engine_signer_with_address, generate_dummy_client, generate_dummy_client_with_spec,
};
use test_helpers::{generate_dummy_client, generate_dummy_client_with_spec};
use types::transaction::{Transaction, TypedTransaction};
#[test]
@ -1677,7 +1660,6 @@ mod tests {
block_base_fee: None,
tx_gas_limit: U256::max_value(),
no_early_reject: false,
allow_non_eoa_sender: false,
},
},
GasPricer::new_fixed(0u64.into()),
@ -1823,40 +1805,6 @@ mod tests {
);
}
#[test]
fn should_activate_eip_3607_according_to_spec() {
// given
let spec = Spec::new_test_eip3607();
let miner = Miner::new_for_tests(&spec, None);
let client = TestBlockChainClient::new_with_spec(spec);
let imported = [H256::zero()];
let empty = &[];
// the client best block is below EIP-3607 transition number
miner.chain_new_blocks(&client, &imported, empty, &imported, empty, false);
assert!(
miner.queue_status().options.allow_non_eoa_sender,
"The client best block is below EIP-3607 transition number. Non EOA senders should be allowed"
);
// the client best block equals EIP-3607 transition number
client.add_block(EachBlockWith::Nothing, |header| header);
miner.chain_new_blocks(&client, &imported, empty, &imported, empty, false);
assert!(
!miner.queue_status().options.allow_non_eoa_sender,
"The client best block equals EIP-3607 transition number. Non EOA senders should not be allowed"
);
// the client best block is above EIP-3607 transition number
client.add_block(EachBlockWith::Nothing, |header| header);
miner.chain_new_blocks(&client, &imported, empty, &imported, empty, false);
assert!(
!miner.queue_status().options.allow_non_eoa_sender,
"The client best block is above EIP-3607 transition number. Non EOA senders should not be allowed"
);
}
#[test]
fn should_treat_unfamiliar_locals_selectively() {
// given
@ -2122,31 +2070,6 @@ mod tests {
assert!(miner.is_currently_sealing());
}
#[test]
fn should_not_mine_if_is_not_allowed_to_seal() {
let spec = Spec::new_test_round();
let miner = Miner::new_for_tests_force_sealing(&spec, None, true);
assert!(!miner.is_currently_sealing());
}
#[test]
fn should_mine_if_is_allowed_to_seal() {
let verifier: Address = [
0x7d, 0x57, 0x7a, 0x59, 0x7b, 0x27, 0x42, 0xb4, 0x98, 0xcb, 0x5c, 0xf0, 0xc2, 0x6c,
0xdc, 0xd7, 0x26, 0xd3, 0x9e, 0x6e,
]
.into();
let spec = Spec::new_test_round();
let client: Arc<dyn EngineClient> = generate_dummy_client(2);
let miner = Miner::new_for_tests_force_sealing(&spec, None, true);
miner.engine.register_client(Arc::downgrade(&client));
miner.set_author(Author::Sealer(dummy_engine_signer_with_address(verifier)));
assert!(miner.is_currently_sealing());
}
#[test]
fn should_set_new_minimum_gas_price() {
// Creates a new GasPricer::Fixed behind the scenes

View File

@ -260,9 +260,6 @@ pub trait MinerService: Send + Sync {
/// Suggested gas price.
fn sensible_gas_price(&self) -> U256;
/// Suggested max priority fee gas price
fn sensible_max_priority_fee(&self) -> U256;
/// Suggested gas limit.
fn sensible_gas_limit(&self) -> U256;

View File

@ -30,7 +30,7 @@ use types::{
};
use call_contract::CallContract;
use client::{BlockId, BlockInfo, Nonce, TransactionId};
use client::{BlockInfo, Nonce, TransactionId};
use engines::EthEngine;
use miner;
use transaction_ext::Transaction;
@ -168,7 +168,6 @@ where
pool::client::AccountDetails {
nonce: self.cached_nonces.account_nonce(address),
balance: self.chain.latest_balance(address),
code_hash: self.chain.code_hash(address, BlockId::Latest),
is_local: self.accounts.is_local(address),
}
}

View File

@ -147,8 +147,6 @@ pub struct CommonParams {
pub eip3529_transition: BlockNumber,
/// Number of first block where EIP-3541 rule begins.
pub eip3541_transition: BlockNumber,
/// Number of first block where EIP-3607 rule begins.
pub eip3607_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.
@ -185,16 +183,6 @@ pub struct CommonParams {
pub eip1559_elasticity_multiplier: U256,
/// Default value for the block base fee
pub eip1559_base_fee_initial_value: U256,
/// Min value for the block base fee.
pub eip1559_base_fee_min_value: Option<U256>,
/// Block at which the min value for the base fee starts to be used.
pub eip1559_base_fee_min_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.
pub eip1559_fee_collector_transition: BlockNumber,
/// Block at which zero gas price transactions start being checked with Certifier contract.
pub validate_service_transactions_transition: BlockNumber,
}
impl CommonParams {
@ -436,7 +424,6 @@ impl From<ethjson::spec::Params> for CommonParams {
dust_protection_transition: p
.dust_protection_transition
.map_or_else(BlockNumber::max_value, Into::into),
eip3607_transition: p.eip3607_transition.map_or(0, Into::into),
nonce_cap_increment: p.nonce_cap_increment.map_or(64, Into::into),
remove_dust_contracts: p.remove_dust_contracts.unwrap_or(false),
gas_limit_bound_divisor: p.gas_limit_bound_divisor.into(),
@ -472,17 +459,6 @@ impl From<ethjson::spec::Params> for CommonParams {
eip1559_base_fee_initial_value: p
.eip1559_base_fee_initial_value
.map_or_else(U256::zero, Into::into),
eip1559_base_fee_min_value: p.eip1559_base_fee_min_value.map(Into::into),
eip1559_base_fee_min_value_transition: p
.eip1559_base_fee_min_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
.map_or_else(BlockNumber::max_value, Into::into),
validate_service_transactions_transition: p
.validate_service_transactions_transition
.map_or_else(BlockNumber::max_value, Into::into),
}
}
}
@ -758,9 +734,6 @@ impl Spec {
params.kip6_transition,
params.max_code_size_transition,
params.transaction_permission_contract_transition,
params.eip1559_fee_collector_transition,
params.eip1559_base_fee_min_value_transition,
params.validate_service_transactions_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 {
@ -1154,13 +1127,6 @@ impl Spec {
load_bundled!("test/constructor")
}
/// Create a new Spec which is a NullEngine consensus with EIP3607 transition equal to 2,
/// and with a contract at address '0x71562b71999873DB5b286dF957af199Ec94617F7'.
#[cfg(any(test, feature = "test-helpers"))]
pub fn new_test_eip3607() -> Self {
load_bundled!("test/eip3607_test")
}
/// Create a new Spec with Autority Round randomness contract
#[cfg(any(test, feature = "test-helpers"))]
pub fn new_test_round_randomness_contract() -> Spec {

View File

@ -46,8 +46,6 @@ use block::{Drain, OpenBlock};
use client::{
ChainInfo, ChainMessageType, ChainNotify, Client, ClientConfig, ImportBlock, PrepareOpenBlock,
};
use engines::EngineSigner;
use ethjson::crypto::publickey::{Public, Signature};
use factory::Factories;
use miner::Miner;
use spec::Spec;
@ -646,38 +644,3 @@ impl ChainNotify for TestNotify {
self.messages.write().push(data);
}
}
/// Returns engine signer with specified address
pub fn dummy_engine_signer_with_address(addr: Address) -> Box<dyn EngineSigner> {
struct TestEngineSigner(Address);
impl TestEngineSigner {
fn with_address(addr: Address) -> Self {
Self(addr)
}
}
impl EngineSigner for TestEngineSigner {
fn sign(&self, _hash: H256) -> Result<Signature, ethjson::crypto::publickey::Error> {
unimplemented!()
}
fn address(&self) -> Address {
self.0
}
fn decrypt(
&self,
_auth_data: &[u8],
_cipher: &[u8],
) -> Result<Vec<u8>, parity_crypto::publickey::Error> {
unimplemented!()
}
fn public(&self) -> Option<Public> {
unimplemented!()
}
}
Box::new(TestEngineSigner::with_address(addr))
}

View File

@ -39,7 +39,6 @@ use_contract!(
transact_acl_gas_price,
"res/contracts/tx_acl_gas_price.json"
);
use_contract!(transact_acl_1559, "res/contracts/tx_acl_1559.json");
const MAX_CACHE_SIZE: usize = 4096;
@ -105,8 +104,6 @@ impl TransactionFilter {
let sender = transaction.sender();
let value = transaction.tx().value;
let gas_price = transaction.tx().gas_price;
let max_priority_fee_per_gas = transaction.max_priority_fee_per_gas();
let gas_limit = transaction.tx().gas;
let key = (*parent_hash, sender);
if let Some(permissions) = permission_cache.get_mut(&key) {
@ -164,25 +161,6 @@ impl TransactionFilter {
(tx_permissions::NONE, true)
})
}
4 => {
trace!(target: "tx_filter", "Using filter with maxFeePerGas and maxPriorityFeePerGas and data");
let (data, decoder) = transact_acl_1559::functions::allowed_tx_types::call(
sender,
to,
value,
gas_price,
max_priority_fee_per_gas,
gas_limit,
transaction.tx().data.clone(),
);
client.call_contract(BlockId::Hash(*parent_hash), contract_address, data)
.and_then(|value| decoder.decode(&value).map_err(|e| e.to_string()))
.map(|(p, f)| (p.low_u32(), f))
.unwrap_or_else(|e| {
error!(target: "tx_filter", "Error calling tx permissions contract: {:?}", e);
(tx_permissions::NONE, true)
})
}
_ => {
error!(target: "tx_filter", "Unknown version of tx permissions contract is used");
(tx_permissions::NONE, true)
@ -223,9 +201,7 @@ mod test {
use std::{str::FromStr, sync::Arc};
use tempdir::TempDir;
use test_helpers;
use types::transaction::{
AccessListTx, Action, EIP1559TransactionTx, Transaction, TypedTransaction,
};
use types::transaction::{Action, Transaction, TypedTransaction};
/// Contract code: https://gist.github.com/VladLupashevskyi/84f18eabb1e4afadf572cf92af3e7e7f
#[test]
@ -462,7 +438,7 @@ mod test {
));
}
/// Contract code: res/chainspec/test/contract_ver_3.sol
/// Contract code: res/tx_permission_tests/contract_ver_3.sol
#[test]
fn transaction_filter_ver_3() {
let spec_data = include_str!("../res/chainspec/test/contract_ver_3_genesis.json");
@ -530,145 +506,6 @@ mod test {
));
}
/// Contract code: res/chainspec/test/contract_ver_4.sol
#[test]
fn transaction_filter_ver_4_legacy() {
let spec_data = include_str!("../res/chainspec/test/contract_ver_4_genesis.json");
let db = test_helpers::new_db();
let tempdir = TempDir::new("").unwrap();
let spec = Spec::load(&tempdir.path(), spec_data.as_bytes()).unwrap();
let client = Client::new(
ClientConfig::default(),
&spec,
db,
Arc::new(Miner::new_for_tests(&spec, None)),
IoChannel::disconnected(),
)
.unwrap();
let key1 = KeyPair::from_secret(
Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001")
.unwrap(),
)
.unwrap();
// The only difference to version 2 is that the contract now knows the transaction's gas price and data.
// So we only test those: The contract allows only transactions with either nonzero gas price or short data.
let filter = TransactionFilter::from_params(spec.params()).unwrap();
let mut tx = TypedTransaction::Legacy(Transaction::default());
tx.tx_mut().action =
Action::Call(Address::from_str("0000000000000000000000000000000000000042").unwrap());
tx.tx_mut().data = b"01234567".to_vec();
tx.tx_mut().gas_price = 0.into();
let genesis = client.block_hash(BlockId::Latest).unwrap();
let block_number = 1;
// Data too long and gas price zero. This transaction is not allowed.
assert!(!filter.transaction_allowed(
&genesis,
block_number,
&tx.clone().sign(key1.secret(), None),
&*client
));
// But if we either set a nonzero gas price or short data or both, it is allowed.
tx.tx_mut().gas_price = 1.into();
assert!(filter.transaction_allowed(
&genesis,
block_number,
&tx.clone().sign(key1.secret(), None),
&*client
));
tx.tx_mut().data = b"01".to_vec();
assert!(filter.transaction_allowed(
&genesis,
block_number,
&tx.clone().sign(key1.secret(), None),
&*client
));
tx.tx_mut().gas_price = 0.into();
assert!(filter.transaction_allowed(
&genesis,
block_number,
&tx.clone().sign(key1.secret(), None),
&*client
));
}
/// Contract code: res/chainspec/test/contract_ver_4.sol
#[test]
fn transaction_filter_ver_4_1559() {
let spec_data = include_str!("../res/chainspec/test/contract_ver_4_genesis.json");
let db = test_helpers::new_db();
let tempdir = TempDir::new("").unwrap();
let spec = Spec::load(&tempdir.path(), spec_data.as_bytes()).unwrap();
let client = Client::new(
ClientConfig::default(),
&spec,
db,
Arc::new(Miner::new_for_tests(&spec, None)),
IoChannel::disconnected(),
)
.unwrap();
let key1 = KeyPair::from_secret(
Secret::from_str("0000000000000000000000000000000000000000000000000000000000000001")
.unwrap(),
)
.unwrap();
// The only difference to version 2 is that the contract now knows the transaction's gas price and data.
// So we only test those: The contract allows only transactions with either nonzero gas price or short data.
let filter = TransactionFilter::from_params(spec.params()).unwrap();
let mut tx = TypedTransaction::EIP1559Transaction(EIP1559TransactionTx {
transaction: AccessListTx::new(Transaction::default(), vec![]),
max_priority_fee_per_gas: U256::from(0),
});
tx.tx_mut().action =
Action::Call(Address::from_str("0000000000000000000000000000000000000042").unwrap());
tx.tx_mut().data = b"01234567".to_vec();
tx.tx_mut().gas_price = 0.into();
let genesis = client.block_hash(BlockId::Latest).unwrap();
let block_number = 1;
// Data too long and gas price zero. This transaction is not allowed.
assert!(!filter.transaction_allowed(
&genesis,
block_number,
&tx.clone().sign(key1.secret(), None),
&*client
));
// But if we either set a nonzero gas price or short data or both, it is allowed.
tx.tx_mut().gas_price = 1.into();
assert!(filter.transaction_allowed(
&genesis,
block_number,
&tx.clone().sign(key1.secret(), None),
&*client
));
tx.tx_mut().data = b"01".to_vec();
assert!(filter.transaction_allowed(
&genesis,
block_number,
&tx.clone().sign(key1.secret(), None),
&*client
));
tx.tx_mut().gas_price = 0.into();
assert!(filter.transaction_allowed(
&genesis,
block_number,
&tx.clone().sign(key1.secret(), None),
&*client
));
}
/// Contract code: https://gist.github.com/arkpar/38a87cb50165b7e683585eec71acb05a
#[test]
fn transaction_filter_deprecated() {

View File

@ -86,7 +86,7 @@ mod tests {
|| ethereum::new_foundation(&String::new()),
vec![
1_150_000, 1_920_000, 2_463_000, 2_675_000, 4_370_000, 7_280_000, 9_069_000,
9_200_000, 12_244_000, 12_965_000, 13_773_000,
9_200_000, 12_244_000, 12_965_000,
],
)
}

View File

@ -1704,14 +1704,6 @@ pub mod tests {
assert!(!sync_status(SyncState::Idle).is_syncing(queue_info(0, 0)));
}
pub fn dummy_sync(client: &dyn BlockChainClient) -> ChainSync {
ChainSync::new(
SyncConfig::default(),
client,
ForkFilterApi::new_dummy(client),
)
}
pub fn dummy_sync_with_peer(
peer_latest_hash: H256,
client: &dyn BlockChainClient,

View File

@ -352,31 +352,26 @@ impl SyncSupplier {
fn return_node_data(io: &dyn SyncIo, rlp: &Rlp, peer_id: PeerId) -> RlpResponseResult {
let count = cmp::min(rlp.item_count().unwrap_or(0), MAX_NODE_DATA_TO_SEND);
trace!(target: "sync", "{} -> GetNodeData: {} entries", peer_id, count);
if count == 0 {
debug!(target: "sync", "Empty GetNodeData request, ignoring.");
return Ok(None);
}
let mut data = Bytes::new();
let mut added = 0usize;
let mut data = Vec::new();
let mut total_bytes = 0;
for i in 0..count {
if let Some(node_data) = io.chain().state_data(&rlp.val_at::<H256>(i)?) {
total_bytes += node_data.len();
// Check that the packet won't be oversized
if total_bytes > PAYLOAD_SOFT_LIMIT {
if let Some(ref mut node_data) = io.chain().state_data(&rlp.val_at::<H256>(i)?) {
data.append(node_data);
added += 1;
if data.len() > PAYLOAD_SOFT_LIMIT {
break;
}
data.push(node_data);
added += 1;
}
}
let mut rlp = RlpStream::new_list(added);
for d in data {
rlp.append(&d);
}
rlp.append_raw(&data, added);
trace!(target: "sync", "{} -> GetNodeData: returned {} entries", peer_id, added);
Ok(Some((NodeDataPacket, rlp)))
}
@ -502,10 +497,7 @@ mod test {
use super::{super::tests::*, *};
use blocks::SyncHeader;
use bytes::Bytes;
use ethcore::{
client::{BlockChainClient, EachBlockWith, TestBlockChainClient},
spec::Spec,
};
use ethcore::client::{BlockChainClient, EachBlockWith, TestBlockChainClient};
use ethereum_types::H256;
use parking_lot::RwLock;
use rlp::{Rlp, RlpStream};
@ -770,7 +762,7 @@ mod test {
#[test]
fn return_nodes() {
let mut client = TestBlockChainClient::new_with_spec(Spec::new_test_round());
let mut client = TestBlockChainClient::new();
let queue = RwLock::new(VecDeque::new());
let sync = dummy_sync_with_peer(H256::zero(), &client);
let ss = TestSnapshotService::new();
@ -814,48 +806,4 @@ mod test {
);
assert_eq!(1, io.packets.len());
}
#[test]
fn dispatch_get_node_data_request() {
let mut client = TestBlockChainClient::new_with_spec(Spec::new_test_round());
let queue = RwLock::new(VecDeque::new());
let sync = dummy_sync(&client);
let ss = TestSnapshotService::new();
let mut io = TestIo::new(&mut client, &ss, &queue, None);
let mut node_list = RlpStream::new_list(3);
node_list.append(
&H256::from_str("000000000000000000000000000000000000000000000000000000000000000a")
.unwrap(),
);
node_list.append(
&H256::from_str("000000000000000000000000000000000000000000000000000000000000000b")
.unwrap(),
);
node_list.append(
&H256::from_str("000000000000000000000000000000000000000000000000000000000000000c")
.unwrap(),
);
let node_request = node_list;
let node_request = prepend_request_id(node_request, Some(0x0b3a73ce2ff2));
io.sender = Some(2usize);
// it returns rlp ONLY for hashes ending with "a" and "c"
SyncSupplier::dispatch_packet(
&RwLock::new(sync),
&mut io,
0usize,
GetNodeDataPacket.id(),
&node_request.out(),
);
assert_eq!(1, io.packets.len());
assert_eq!(
&io.packets[0].data,
&vec![
0xcd, 0x86, 0x0b, 0x3a, 0x73, 0xce, 0x2f, 0xf2, 0xc5, 0x82, 0xaa, 0xaa, 0x81, 0xcc
]
);
}
}

View File

@ -93,8 +93,6 @@ pub enum Error {
InvalidRlp(String),
/// Transaciton is still not enabled.
TransactionTypeNotEnabled,
/// Transaction sender is not an EOA (see EIP-3607)
SenderIsNotEOA,
}
impl From<crypto::publickey::Error> for Error {
@ -156,7 +154,6 @@ impl fmt::Display for Error {
TransactionTypeNotEnabled => {
format!("Transaction type is not enabled for current block")
}
SenderIsNotEOA => "Transaction sender is not an EOA (see EIP-3607)".into(),
};
f.write_fmt(format_args!("Transaction error ({})", msg))

View File

@ -634,16 +634,10 @@ impl TypedTransaction {
pub fn effective_gas_price(&self, block_base_fee: Option<U256>) -> U256 {
match self {
Self::EIP1559Transaction(tx) => {
let (v2, overflow) = tx
.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::EIP1559Transaction(tx) => min(
self.tx().gas_price,
tx.max_priority_fee_per_gas + block_base_fee.unwrap_or_default(),
),
Self::AccessList(_) => self.tx().gas_price,
Self::Legacy(_) => self.tx().gas_price,
}
@ -657,22 +651,6 @@ impl TypedTransaction {
}
}
pub fn effective_priority_fee(&self, block_base_fee: Option<U256>) -> U256 {
self.effective_gas_price(block_base_fee)
.checked_sub(block_base_fee.unwrap_or_default())
.unwrap_or_default()
}
pub fn has_zero_gas_price(&self) -> bool {
match self {
Self::EIP1559Transaction(tx) => {
tx.tx().gas_price.is_zero() && tx.max_priority_fee_per_gas.is_zero()
}
Self::AccessList(tx) => tx.tx().gas_price.is_zero(),
Self::Legacy(tx) => tx.gas_price.is_zero(),
}
}
fn decode_new(tx: &[u8]) -> Result<UnverifiedTransaction, DecoderError> {
if tx.is_empty() {
// at least one byte needs to be present
@ -1343,41 +1321,4 @@ mod tests {
test_vector("f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10", "9bddad43f934d313c2b79ca28a432dd2b7281029");
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"
);
}
}

View File

@ -51,7 +51,6 @@ impl TypedTxId {
pub fn from_U64_option_id(n: Option<U64>) -> Option<Self> {
match n.map(|t| t.as_u64()) {
None => Some(Self::Legacy),
Some(0x00) => Some(Self::Legacy),
Some(0x01) => Some(Self::AccessList),
Some(0x02) => Some(Self::EIP1559Transaction),
_ => None,
@ -60,7 +59,10 @@ impl TypedTxId {
#[allow(non_snake_case)]
pub fn to_U64_option_id(self) -> Option<U64> {
Some(U64::from(self as u8))
match self {
Self::Legacy => None,
_ => Some(U64::from(self as u8)),
}
}
}
@ -91,7 +93,7 @@ mod tests {
#[test]
fn typed_tx_id_to_u64_option_id() {
assert_eq!(Some(U64::from(0x00)), TypedTxId::Legacy.to_U64_option_id());
assert_eq!(None, TypedTxId::Legacy.to_U64_option_id());
assert_eq!(
Some(U64::from(0x01)),
TypedTxId::AccessList.to_U64_option_id()

View File

@ -137,29 +137,6 @@ impl<'a> TypedTransactionView<'a> {
}
}
/// Get the actual priority gas price paid to the miner
pub fn effective_priority_gas_price(&self, block_base_fee: Option<U256>) -> U256 {
match self.transaction_type {
TypedTxId::Legacy => self
.gas_price()
.saturating_sub(block_base_fee.unwrap_or_default()),
TypedTxId::AccessList => self
.gas_price()
.saturating_sub(block_base_fee.unwrap_or_default()),
TypedTxId::EIP1559Transaction => {
let max_priority_fee_per_gas: U256 =
view!(Self, &self.rlp.rlp.data().unwrap()[1..])
.rlp
.val_at(2);
min(
max_priority_fee_per_gas,
self.gas_price()
.saturating_sub(block_base_fee.unwrap_or_default()),
)
}
}
}
/// Get the gas field of the transaction.
pub fn gas(&self) -> U256 {
match self.transaction_type {
@ -283,7 +260,6 @@ mod tests {
assert_eq!(view.nonce(), 0.into());
assert_eq!(view.gas_price(), 1.into());
assert_eq!(view.effective_gas_price(None), 1.into());
assert_eq!(view.effective_priority_gas_price(None), 1.into());
assert_eq!(view.gas(), 0x61a8.into());
assert_eq!(view.value(), 0xa.into());
assert_eq!(
@ -309,7 +285,6 @@ mod tests {
let view = view!(TypedTransactionView, &rlp);
assert_eq!(view.nonce(), 0x1.into());
assert_eq!(view.gas_price(), 0xa.into());
assert_eq!(view.effective_priority_gas_price(None), 0xa.into());
assert_eq!(view.gas(), 0x1e241.into());
assert_eq!(view.value(), 0x0.into());
assert_eq!(view.data(), "".from_hex().unwrap());
@ -331,10 +306,6 @@ mod tests {
assert_eq!(view.nonce(), 0x1.into());
assert_eq!(view.gas_price(), 0xa.into());
assert_eq!(view.effective_gas_price(Some(0x07.into())), 0x08.into());
assert_eq!(
view.effective_priority_gas_price(Some(0x07.into())),
0x01.into()
);
assert_eq!(view.gas(), 0x1e241.into());
assert_eq!(view.value(), 0x0.into());
assert_eq!(view.data(), "".from_hex().unwrap());

View File

@ -120,8 +120,6 @@ pub struct Params {
/// See `CommonParams` docs.
pub eip3541_transition: Option<Uint>,
/// See `CommonParams` docs.
pub eip3607_transition: Option<Uint>,
/// See `CommonParams` docs.
pub dust_protection_transition: Option<Uint>,
/// See `CommonParams` docs.
pub nonce_cap_increment: Option<Uint>,
@ -160,16 +158,6 @@ pub struct Params {
pub eip1559_elasticity_multiplier: Option<Uint>,
/// Default value for the block base fee
pub eip1559_base_fee_initial_value: Option<Uint>,
/// Min value for the block base fee.
pub eip1559_base_fee_min_value: Option<Uint>,
/// Block at which the min value for the base fee starts to be used.
pub eip1559_base_fee_min_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.
pub eip1559_fee_collector_transition: Option<Uint>,
/// Block at which zero gas price transactions start being checked with Certifier contract.
pub validate_service_transactions_transition: Option<Uint>,
}
#[cfg(test)]

View File

@ -91,10 +91,7 @@ use ethcore::{client::BlockChainClient, miner::MinerService};
use ethereum_types::{Address, H256, H520, U256};
use ethkey::Password;
use hash::keccak;
use types::{
transaction::{PendingTransaction, SignedTransaction},
BlockNumber,
};
use types::transaction::{PendingTransaction, SignedTransaction};
use jsonrpc_core::{
futures::{future, Future, IntoFuture},
@ -400,24 +397,6 @@ where
.unwrap_or_else(|| miner.sensible_gas_price())
}
/// Extract the default priority gas price from a client and miner.
pub fn default_max_priority_fee_per_gas<C, M>(
client: &C,
miner: &M,
percentile: usize,
eip1559_transition: BlockNumber,
) -> U256
where
C: BlockChainClient,
M: MinerService,
{
client
.priority_gas_price_corpus(100, eip1559_transition)
.percentile(percentile)
.cloned()
.unwrap_or_else(|| miner.sensible_max_priority_fee())
}
/// Convert RPC confirmation payload to signer confirmation payload.
/// May need to resolve in the future to fetch things like gas price.
pub fn from_rpc<D>(

View File

@ -273,10 +273,6 @@ where
}
}
pub fn eip1559_not_activated() -> Error {
unsupported("EIP-1559 is not activated", None)
}
pub fn not_enough_data() -> Error {
Error {
code: ErrorCode::ServerError(codes::UNSUPPORTED_REQUEST),
@ -408,7 +404,6 @@ pub fn transaction_message(error: &TransactionError) -> String {
TooBig => "Transaction is too big, see chain specification for the limit.".into(),
InvalidRlp(ref descr) => format!("Invalid RLP data: {}", descr),
TransactionTypeNotEnabled => format!("Transaction type is not enabled for current block"),
SenderIsNotEOA => "Transaction sender is not an EOA (see EIP-3607)".into(),
}
}

View File

@ -52,7 +52,7 @@ use v1::{
self,
block_import::is_major_importing,
deprecated::{self, DeprecationNotice},
dispatch::{default_gas_price, default_max_priority_fee_per_gas, FullDispatcher},
dispatch::{default_gas_price, FullDispatcher},
errors, fake_sign, limit_logs,
},
metadata::Metadata,
@ -696,22 +696,6 @@ where
)))
}
fn max_priority_fee_per_gas(&self) -> BoxFuture<U256> {
let latest_block = self.client.chain_info().best_block_number;
let eip1559_transition = self.client.engine().params().eip1559_transition;
if latest_block + 1 >= eip1559_transition {
Box::new(future::ok(default_max_priority_fee_per_gas(
&*self.client,
&*self.miner,
self.options.gas_price_percentile,
eip1559_transition,
)))
} else {
Box::new(future::done(Err(errors::eip1559_not_activated())))
}
}
fn fee_history(
&self,
mut block_count: U256,
@ -821,11 +805,8 @@ where
gas_and_reward.push((
gas_used,
txs[i]
.effective_gas_price(base_fee)
.saturating_sub(
base_fee.unwrap_or_default(),
),
txs[i].effective_gas_price(base_fee)
- base_fee.unwrap_or_default(),
));
}
}

View File

@ -19,7 +19,7 @@ use std::{env, sync::Arc};
use accounts::AccountProvider;
use ethcore::{
client::{BlockChainClient, ChainInfo, Client, ClientConfig, EvmTestClient, ImportBlock},
client::{BlockChainClient, ChainInfo, Client, ClientConfig, ImportBlock},
ethereum,
miner::Miner,
spec::{Genesis, Spec},
@ -67,7 +67,7 @@ fn snapshot_service() -> Arc<TestSnapshotService> {
fn make_spec(chain: &BlockChain) -> Spec {
let genesis = Genesis::from(chain.genesis());
let mut spec = EvmTestClient::spec_from_json(&chain.network).unwrap();
let mut spec = ethereum::new_frontier_test();
let state = chain.pre_state.clone().into();
spec.set_genesis_state(state)
.expect("unable to set genesis state");
@ -281,26 +281,6 @@ fn eth_get_block() {
);
}
#[test]
fn eth_get_max_priority_fee_per_gas() {
let chain = extract_non_legacy_chain!(
"BlockchainTests/ValidBlocks/bcEIP1559/transType",
ForkSpec::London
);
let tester = EthTester::from_chain(&chain);
let request = r#"{"method":"eth_maxPriorityFeePerGas","params":[],"id":1,"jsonrpc":"2.0"}"#;
// We are expecting for 50-th percentile of the previous 100 blocks transactions priority fees.
//
// Sorted priority fees: 0x64 0x64 0x64 0x7d 0x7d 0xea 0x149.
// Currently, the way 50-th percentile is calculated, the 3rd fee would be the result.
let response = r#"{"jsonrpc":"2.0","result":"0x64","id":1}"#;
assert_eq!(
tester.handler.handle_request_sync(request).unwrap(),
response
)
}
#[test]
fn eth_get_block_by_hash() {
let chain = extract_chain!("BlockchainTests/ValidBlocks/bcGasPricerTest/RPC_API_Test");

View File

@ -335,7 +335,6 @@ impl MinerService for TestMinerService {
tx_gas_limit: 5_000_000.into(),
no_early_reject: false,
block_base_fee: None,
allow_non_eoa_sender: false,
},
status: txpool::LightStatus {
mem_usage: 1_000,
@ -360,10 +359,6 @@ impl MinerService for TestMinerService {
20_000_000_000u64.into()
}
fn sensible_max_priority_fee(&self) -> U256 {
2_000_000_000u64.into()
}
fn sensible_gas_limit(&self) -> U256 {
0x5208.into()
}

View File

@ -23,7 +23,7 @@ use std::{
use accounts::AccountProvider;
use ethcore::{
client::{BlockChainClient, EachBlockWith, EvmTestClient, Executed, TestBlockChainClient},
client::{BlockChainClient, EachBlockWith, Executed, TestBlockChainClient},
miner::{self, MinerService},
};
use ethereum_types::{Address, Bloom, H160, H256, U256};
@ -51,12 +51,6 @@ fn blockchain_client() -> Arc<TestBlockChainClient> {
Arc::new(client)
}
fn eip1559_blockchain_client() -> Arc<TestBlockChainClient> {
let spec = EvmTestClient::spec_from_json(&ethjson::spec::ForkSpec::London).unwrap();
let client = TestBlockChainClient::new_with_spec(spec);
Arc::new(client)
}
fn accounts_provider() -> Arc<AccountProvider> {
Arc::new(AccountProvider::transient_provider())
}
@ -95,25 +89,8 @@ impl Default for EthTester {
impl EthTester {
pub fn new_with_options(options: EthClientOptions) -> Self {
let client = blockchain_client();
EthTester::new_with_client_and_options(client, options)
}
fn new_eip1559_with_options(options: EthClientOptions) -> Self {
let client = eip1559_blockchain_client();
EthTester::new_with_client_and_options(client, options)
}
pub fn add_blocks(&self, count: usize, with: EachBlockWith) {
self.client.add_blocks(count, with);
self.sync.increase_imported_block_number(count as u64);
}
fn new_with_client_and_options(
client: Arc<TestBlockChainClient>,
options: EthClientOptions,
) -> Self {
let runtime = Runtime::with_thread_count(1);
let client = blockchain_client();
let sync = sync_provider();
let ap = accounts_provider();
let ap2 = ap.clone();
@ -149,6 +126,11 @@ impl EthTester {
hashrates,
}
}
pub fn add_blocks(&self, count: usize, with: EachBlockWith) {
self.client.add_blocks(count, with);
self.sync.increase_imported_block_number(count as u64);
}
}
#[test]
@ -555,33 +537,6 @@ fn rpc_eth_gas_price() {
);
}
#[test]
fn rpc_eth_get_max_priority_fee_per_gas() {
let tester = EthTester::new_eip1559_with_options(Default::default());
let request = r#"{"method":"eth_maxPriorityFeePerGas","params":[],"id":1,"jsonrpc":"2.0"}"#;
let response = r#"{"jsonrpc":"2.0","result":"0x77359400","id":1}"#; // 2 GWei
assert_eq!(
tester.io.handle_request_sync(request),
Some(response.to_owned())
);
}
#[test]
fn rpc_eth_get_max_priority_fee_per_gas_error() {
let tester = EthTester::default();
let request = r#"{"method":"eth_maxPriorityFeePerGas","params":[],"id":1,"jsonrpc":"2.0"}"#;
let response =
r#"{"jsonrpc":"2.0","error":{"code":-32000,"message":"EIP-1559 is not activated"},"id":1}"#;
assert_eq!(
tester.io.handle_request_sync(request),
Some(response.to_owned())
);
}
#[test]
fn rpc_eth_accounts() {
let tester = EthTester::default();
@ -765,7 +720,7 @@ fn rpc_eth_pending_transaction_by_hash() {
.insert(H256::zero(), tx);
}
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":null,"blockNumber":null,"chainId":null,"condition":null,"creates":null,"from":"0x0f65fe9276bc9a24ae7083ae28e2660ef72df99e","gas":"0x5208","gasPrice":"0x1","hash":"0x41df922fd0d4766fcc02e161f8295ec28522f329ae487f14d811e4b64c8d6e31","input":"0x","nonce":"0x0","publicKey":"0x7ae46da747962c2ee46825839c1ef9298e3bd2e70ca2938495c3693a485ec3eaa8f196327881090ff64cf4fbb0a48485d4f83098e189ed3b7a87d5941b59f789","r":"0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353","raw":"0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804","s":"0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804","standardV":"0x0","to":"0x095e7baea6a6c7c4c2dfeb977efac326af552d87","transactionIndex":null,"type":"0x0","v":"0x1b","value":"0xa"},"id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":null,"blockNumber":null,"chainId":null,"condition":null,"creates":null,"from":"0x0f65fe9276bc9a24ae7083ae28e2660ef72df99e","gas":"0x5208","gasPrice":"0x1","hash":"0x41df922fd0d4766fcc02e161f8295ec28522f329ae487f14d811e4b64c8d6e31","input":"0x","nonce":"0x0","publicKey":"0x7ae46da747962c2ee46825839c1ef9298e3bd2e70ca2938495c3693a485ec3eaa8f196327881090ff64cf4fbb0a48485d4f83098e189ed3b7a87d5941b59f789","r":"0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353","raw":"0xf85f800182520894095e7baea6a6c7c4c2dfeb977efac326af552d870a801ba048b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353a0efffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804","s":"0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804","standardV":"0x0","to":"0x095e7baea6a6c7c4c2dfeb977efac326af552d87","transactionIndex":null,"v":"0x1b","value":"0xa"},"id":1}"#;
let request = r#"{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
@ -1245,7 +1200,7 @@ fn rpc_eth_transaction_receipt() {
"params": ["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],
"id": 1
}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","contractAddress":null,"cumulativeGasUsed":"0x20","effectiveGasPrice":"0x0","from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","gasUsed":"0x10","logs":[{"address":"0x33990122638b9132ca29c723bdf037f1a891a70c","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","data":"0x","logIndex":"0x1","removed":false,"topics":["0xa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc","0x4861736852656700000000000000000000000000000000000000000000000000"],"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"mined"}],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","root":"0x0000000000000000000000000000000000000000000000000000000000000000","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","type":"0x0"},"id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","contractAddress":null,"cumulativeGasUsed":"0x20","effectiveGasPrice":"0x0","from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","gasUsed":"0x10","logs":[{"address":"0x33990122638b9132ca29c723bdf037f1a891a70c","blockHash":"0xed76641c68a1c641aee09a94b3b471f4dc0316efe5ac19cf488e2674cf8d05b5","blockNumber":"0x4510c","data":"0x","logIndex":"0x1","removed":false,"topics":["0xa6697e974e6a320f454390be03f74955e8978f1a6971ea6730542e37b66179bc","0x4861736852656700000000000000000000000000000000000000000000000000"],"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0","transactionLogIndex":"0x0","type":"mined"}],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","root":"0x0000000000000000000000000000000000000000000000000000000000000000","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000000","transactionIndex":"0x0"},"id":1}"#;
assert_eq!(
tester.io.handle_request_sync(request),
@ -1300,7 +1255,7 @@ fn rpc_eth_pending_receipt() {
"params": ["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],
"id": 1
}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":null,"blockNumber":null,"contractAddress":null,"cumulativeGasUsed":"0x20","effectiveGasPrice":"0x0","from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","gasUsed":"0x10","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionHash":"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238","transactionIndex":"0x0","type":"0x0"},"id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":null,"blockNumber":null,"contractAddress":null,"cumulativeGasUsed":"0x20","effectiveGasPrice":"0x0","from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","gasUsed":"0x10","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionHash":"0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238","transactionIndex":"0x0"},"id":1}"#;
assert_eq!(
tester.io.handle_request_sync(request),
Some(response.to_owned())

View File

@ -572,7 +572,7 @@ fn rpc_parity_block_receipts() {
"params": [],
"id": 1
}"#;
let response = r#"{"jsonrpc":"2.0","result":[{"blockHash":"0x0000000000000000000000000000000000000000000000000000000000000003","blockNumber":"0x0","contractAddress":null,"cumulativeGasUsed":"0x5208","effectiveGasPrice":"0x0","from":"0x0000000000000000000000000000000000000009","gasUsed":"0x5208","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001","to":null,"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000001","transactionIndex":"0x0","type":"0x0"}],"id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":[{"blockHash":"0x0000000000000000000000000000000000000000000000000000000000000003","blockNumber":"0x0","contractAddress":null,"cumulativeGasUsed":"0x5208","effectiveGasPrice":"0x0","from":"0x0000000000000000000000000000000000000009","gasUsed":"0x5208","logs":[],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001","to":null,"transactionHash":"0x0000000000000000000000000000000000000000000000000000000000000001","transactionIndex":"0x0"}],"id":1}"#;
assert_eq!(io.handle_request_sync(request), Some(response.to_owned()));
}

View File

@ -202,7 +202,7 @@ fn rpc_parity_remove_transaction() {
.to_owned()
+ &format!("0x{:x}", hash)
+ r#""], "id": 1}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":null,"blockNumber":null,"chainId":null,"condition":null,"creates":null,"from":"0x0000000000000000000000000000000000000002","gas":"0x76c0","gasPrice":"0x9184e72a000","hash":"0x49569012bc8523519642c337fded3f20ba987beab31e14c67223b3d31359956f","input":"0x","nonce":"0x1","publicKey":null,"r":"0x1","raw":"0xe9018609184e72a0008276c0940000000000000000000000000000000000000005849184e72a801f0101","s":"0x1","standardV":"0x4","to":"0x0000000000000000000000000000000000000005","transactionIndex":null,"type":"0x0","v":"0x1f","value":"0x9184e72a"},"id":1}"#;
let response = r#"{"jsonrpc":"2.0","result":{"blockHash":null,"blockNumber":null,"chainId":null,"condition":null,"creates":null,"from":"0x0000000000000000000000000000000000000002","gas":"0x76c0","gasPrice":"0x9184e72a000","hash":"0x49569012bc8523519642c337fded3f20ba987beab31e14c67223b3d31359956f","input":"0x","nonce":"0x1","publicKey":null,"r":"0x1","raw":"0xe9018609184e72a0008276c0940000000000000000000000000000000000000005849184e72a801f0101","s":"0x1","standardV":"0x4","to":"0x0000000000000000000000000000000000000005","transactionIndex":null,"v":"0x1f","value":"0x9184e72a"},"id":1}"#;
miner.pending_transactions.lock().insert(hash, signed);
assert_eq!(io.handle_request_sync(&request), Some(response.to_owned()));

View File

@ -656,7 +656,6 @@ fn should_confirm_sign_transaction_with_rlp() {
+ &format!("\"s\":\"0x{:x}\",", U256::from(signature.s()))
+ &format!("\"standardV\":\"0x{:x}\",", U256::from(t.standard_v()))
+ r#""to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionIndex":null,"#
+ r#""type":"0x0","#
+ &format!("\"v\":\"0x{:x}\",", U256::from(t.v()))
+ r#""value":"0x1""#
+ r#"}},"id":1}"#;

View File

@ -427,7 +427,6 @@ fn should_add_sign_transaction_to_the_queue() {
+ &format!("\"s\":\"0x{:x}\",", U256::from(signature.s()))
+ &format!("\"standardV\":\"0x{:x}\",", U256::from(t.standard_v()))
+ r#""to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionIndex":null,"#
+ r#""type":"0x0","#
+ &format!("\"v\":\"0x{:x}\",", U256::from(t.v()))
+ r#""value":"0x9184e72a""#
+ r#"}},"id":1}"#;

View File

@ -227,7 +227,6 @@ fn rpc_eth_sign_transaction() {
+ &format!("\"s\":\"0x{:x}\",", U256::from(signature.s()))
+ &format!("\"standardV\":\"0x{:x}\",", U256::from(t.standard_v()))
+ r#""to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","transactionIndex":null,"#
+ r#""type":"0x0","#
+ &format!("\"v\":\"0x{:x}\",", U256::from(t.v()))
+ r#""value":"0x9184e72a""#
+ r#"}},"id":1}"#;

View File

@ -51,23 +51,6 @@ macro_rules! register_test {
};
}
macro_rules! extract_non_legacy_chain {
($file: expr, $network: expr) => {{
const RAW_DATA: &'static [u8] = include_bytes!(concat!(
"../../../../ethcore/res/json_tests/",
$file,
".json"
));
::ethjson::blockchain::Test::load(RAW_DATA)
.unwrap()
.into_iter()
.filter(|&(_, ref t)| t.network == $network)
.next()
.unwrap()
.1
}};
}
#[cfg(test)]
mod eth;
#[cfg(test)]

View File

@ -60,10 +60,6 @@ pub trait Eth {
#[rpc(name = "eth_gasPrice")]
fn gas_price(&self) -> BoxFuture<U256>;
/// Returns current max_priority_fee
#[rpc(name = "eth_maxPriorityFeePerGas")]
fn max_priority_fee_per_gas(&self) -> BoxFuture<U256>;
/// Returns transaction fee history.
#[rpc(name = "eth_feeHistory")]
fn fee_history(&self, _: U256, _: BlockNumber, _: Option<Vec<f64>>)

View File

@ -113,7 +113,4 @@ pub trait VerifiedTransaction: fmt::Debug {
/// Transaction sender
fn sender(&self) -> &Self::Sender;
/// Does it have zero gas price?
fn has_zero_gas_price(&self) -> bool;
}

View File

@ -650,9 +650,7 @@ where
match self.ready.is_ready(&tx) {
Readiness::Ready => {
//return transaction with score higher or equal to desired
if score >= &self.includable_boundary
|| tx.transaction.has_zero_gas_price()
{
if score >= &self.includable_boundary {
return Some(tx.transaction.clone());
}
}
@ -739,9 +737,7 @@ where
if tx_state == Readiness::Ready {
//return transaction with score higher or equal to desired
if best.score >= self.includable_boundary
|| best.transaction.transaction.has_zero_gas_price()
{
if best.score >= self.includable_boundary {
return Some(best.transaction.transaction);
}
}

View File

@ -50,9 +50,6 @@ impl VerifiedTransaction for Transaction {
fn sender(&self) -> &Address {
&self.sender
}
fn has_zero_gas_price(&self) -> bool {
false
}
}
pub type SharedTransaction = Arc<Transaction>;

View File

@ -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.3"
version = "3.3.0-rc.7"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"

View File

@ -203,11 +203,11 @@ impl ModexpPricer {
let (base_len, exp_len) = (base_len_u256.low_u64(), exp_len_u256.low_u64());
// read fist 32-byte word of the exponent.
let exp_low = if base_len.wrapping_add(96) >= input.len() as u64 {
let exp_low = if base_len + 96 >= input.len() as u64 {
U256::zero()
} else {
buf.iter_mut().for_each(|b| *b = 0);
let mut reader = input[(base_len as usize).wrapping_add(96)..].chain(io::repeat(0));
let mut reader = input[(96 + base_len as usize)..].chain(io::repeat(0));
let len = min(exp_len, 32) as usize;
reader
.read_exact(&mut buf[(32 - len)..])
@ -1728,33 +1728,6 @@ mod tests {
native: EthereumBuiltin::from_str("modexp").unwrap(),
};
// test for potential base len overflow
{
let input = hex!(
"
00000000000000000000000000000000ffffffffffffffffffffffffffffffff
0000000000000000000000000000000000000000000000000000000000000001
0000000000000000000000000000000000000000000000000000000000000001
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
03
ff"
);
let expected_cost = U256::max_value();
assert_eq!(f.cost(&input[..], 0), expected_cost);
}
// another test for potential base len overflow
{
let input = hex!(
"
00000000000000000000000000000000ffffffffffffffffffffffffffffffff
0000000000000000000000000000000000000000000000000000000000000020
0000000000000000000000000000000000000000000000000000000000000020"
);
let expected_cost = U256::max_value();
assert_eq!(f.cost(&input[..], 0), expected_cost);
}
// test for potential gas cost multiplication overflow
{
let input = hex!("0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000003b27bafd00000000000000000000000000000000000000000000000000000000503c8ac3");
@ -1867,38 +1840,6 @@ mod tests {
}
}
#[test]
fn modexp2565() {
let pricer = Modexp2565Pricer {};
// test for potential base len overflow
{
let input = hex!(
"
00000000000000000000000000000000ffffffffffffffffffffffffffffffff
0000000000000000000000000000000000000000000000000000000000000001
0000000000000000000000000000000000000000000000000000000000000001
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
03
ff"
);
let expected_cost = U256::max_value();
assert_eq!(pricer.cost(&input[..]), expected_cost);
}
// another test for potential base len overflow
{
let input = hex!(
"
00000000000000000000000000000000ffffffffffffffffffffffffffffffff
0000000000000000000000000000000000000000000000000000000000000020
0000000000000000000000000000000000000000000000000000000000000020"
);
let expected_cost = U256::max_value();
assert_eq!(pricer.cost(&input[..]), expected_cost);
}
}
#[test]
fn bn128_add() {
let f = Builtin {