Skip to content
Snippets Groups Projects
Commit 27d5584f authored by Alan Sapede's avatar Alan Sapede Committed by GitHub
Browse files

Improves EVM gas price check (#7051)

parent 5db3a4f5
Branches
No related merge requests found
......@@ -333,7 +333,7 @@ decl_module! {
input,
value,
gas_limit,
Some(gas_price),
gas_price,
nonce,
true,
)? {
......@@ -367,7 +367,7 @@ decl_module! {
init,
value,
gas_limit,
Some(gas_price),
gas_price,
nonce,
true,
)? {
......@@ -402,7 +402,7 @@ decl_module! {
salt,
value,
gas_limit,
Some(gas_price),
gas_price,
nonce,
true,
)? {
......@@ -482,7 +482,7 @@ impl<T: Trait> Module<T> {
init: Vec<u8>,
value: U256,
gas_limit: u32,
gas_price: Option<U256>,
gas_price: U256,
nonce: Option<U256>,
apply_state: bool,
) -> Result<(ExitReason, H160, U256), Error<T>> {
......@@ -514,7 +514,7 @@ impl<T: Trait> Module<T> {
salt: H256,
value: U256,
gas_limit: u32,
gas_price: Option<U256>,
gas_price: U256,
nonce: Option<U256>,
apply_state: bool,
) -> Result<(ExitReason, H160, U256), Error<T>> {
......@@ -548,7 +548,7 @@ impl<T: Trait> Module<T> {
input: Vec<u8>,
value: U256,
gas_limit: u32,
gas_price: Option<U256>,
gas_price: U256,
nonce: Option<U256>,
apply_state: bool,
) -> Result<(ExitReason, Vec<u8>, U256), Error<T>> {
......@@ -574,20 +574,18 @@ impl<T: Trait> Module<T> {
source: H160,
value: U256,
gas_limit: u32,
gas_price: Option<U256>,
gas_price: U256,
nonce: Option<U256>,
apply_state: bool,
f: F,
) -> Result<(ExitReason, R, U256), Error<T>> where
F: FnOnce(&mut StackExecutor<Backend<T>>) -> (ExitReason, R),
{
let gas_price = match gas_price {
Some(gas_price) => {
ensure!(gas_price >= T::FeeCalculator::min_gas_price(), Error::<T>::GasPriceTooLow);
gas_price
},
None => U256::zero(),
};
// Gas price check is skipped when performing a gas estimation.
if apply_state {
ensure!(gas_price >= T::FeeCalculator::min_gas_price(), Error::<T>::GasPriceTooLow);
}
let vicinity = Vicinity {
gas_price,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment