mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 16:11:05 +00:00
Improves EVM gas price check (#7051)
This commit is contained in:
@@ -333,7 +333,7 @@ decl_module! {
|
|||||||
input,
|
input,
|
||||||
value,
|
value,
|
||||||
gas_limit,
|
gas_limit,
|
||||||
Some(gas_price),
|
gas_price,
|
||||||
nonce,
|
nonce,
|
||||||
true,
|
true,
|
||||||
)? {
|
)? {
|
||||||
@@ -367,7 +367,7 @@ decl_module! {
|
|||||||
init,
|
init,
|
||||||
value,
|
value,
|
||||||
gas_limit,
|
gas_limit,
|
||||||
Some(gas_price),
|
gas_price,
|
||||||
nonce,
|
nonce,
|
||||||
true,
|
true,
|
||||||
)? {
|
)? {
|
||||||
@@ -402,7 +402,7 @@ decl_module! {
|
|||||||
salt,
|
salt,
|
||||||
value,
|
value,
|
||||||
gas_limit,
|
gas_limit,
|
||||||
Some(gas_price),
|
gas_price,
|
||||||
nonce,
|
nonce,
|
||||||
true,
|
true,
|
||||||
)? {
|
)? {
|
||||||
@@ -482,7 +482,7 @@ impl<T: Trait> Module<T> {
|
|||||||
init: Vec<u8>,
|
init: Vec<u8>,
|
||||||
value: U256,
|
value: U256,
|
||||||
gas_limit: u32,
|
gas_limit: u32,
|
||||||
gas_price: Option<U256>,
|
gas_price: U256,
|
||||||
nonce: Option<U256>,
|
nonce: Option<U256>,
|
||||||
apply_state: bool,
|
apply_state: bool,
|
||||||
) -> Result<(ExitReason, H160, U256), Error<T>> {
|
) -> Result<(ExitReason, H160, U256), Error<T>> {
|
||||||
@@ -514,7 +514,7 @@ impl<T: Trait> Module<T> {
|
|||||||
salt: H256,
|
salt: H256,
|
||||||
value: U256,
|
value: U256,
|
||||||
gas_limit: u32,
|
gas_limit: u32,
|
||||||
gas_price: Option<U256>,
|
gas_price: U256,
|
||||||
nonce: Option<U256>,
|
nonce: Option<U256>,
|
||||||
apply_state: bool,
|
apply_state: bool,
|
||||||
) -> Result<(ExitReason, H160, U256), Error<T>> {
|
) -> Result<(ExitReason, H160, U256), Error<T>> {
|
||||||
@@ -548,7 +548,7 @@ impl<T: Trait> Module<T> {
|
|||||||
input: Vec<u8>,
|
input: Vec<u8>,
|
||||||
value: U256,
|
value: U256,
|
||||||
gas_limit: u32,
|
gas_limit: u32,
|
||||||
gas_price: Option<U256>,
|
gas_price: U256,
|
||||||
nonce: Option<U256>,
|
nonce: Option<U256>,
|
||||||
apply_state: bool,
|
apply_state: bool,
|
||||||
) -> Result<(ExitReason, Vec<u8>, U256), Error<T>> {
|
) -> Result<(ExitReason, Vec<u8>, U256), Error<T>> {
|
||||||
@@ -574,20 +574,18 @@ impl<T: Trait> Module<T> {
|
|||||||
source: H160,
|
source: H160,
|
||||||
value: U256,
|
value: U256,
|
||||||
gas_limit: u32,
|
gas_limit: u32,
|
||||||
gas_price: Option<U256>,
|
gas_price: U256,
|
||||||
nonce: Option<U256>,
|
nonce: Option<U256>,
|
||||||
apply_state: bool,
|
apply_state: bool,
|
||||||
f: F,
|
f: F,
|
||||||
) -> Result<(ExitReason, R, U256), Error<T>> where
|
) -> Result<(ExitReason, R, U256), Error<T>> where
|
||||||
F: FnOnce(&mut StackExecutor<Backend<T>>) -> (ExitReason, R),
|
F: FnOnce(&mut StackExecutor<Backend<T>>) -> (ExitReason, R),
|
||||||
{
|
{
|
||||||
let gas_price = match gas_price {
|
|
||||||
Some(gas_price) => {
|
// Gas price check is skipped when performing a gas estimation.
|
||||||
ensure!(gas_price >= T::FeeCalculator::min_gas_price(), Error::<T>::GasPriceTooLow);
|
if apply_state {
|
||||||
gas_price
|
ensure!(gas_price >= T::FeeCalculator::min_gas_price(), Error::<T>::GasPriceTooLow);
|
||||||
},
|
}
|
||||||
None => U256::zero(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let vicinity = Vicinity {
|
let vicinity = Vicinity {
|
||||||
gas_price,
|
gas_price,
|
||||||
|
|||||||
Reference in New Issue
Block a user