From cca44083107b1c2fb85d4a0c9e28f462c86ed865 Mon Sep 17 00:00:00 2001 From: Facu Spagnuolo Date: Wed, 20 Dec 2023 10:48:34 -0300 Subject: [PATCH] Tasks: Check base fee only if needed (#139) --- packages/tasks/contracts/base/GasLimitedTask.sol | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/tasks/contracts/base/GasLimitedTask.sol b/packages/tasks/contracts/base/GasLimitedTask.sol index 748591ae..281b487e 100644 --- a/packages/tasks/contracts/base/GasLimitedTask.sol +++ b/packages/tasks/contracts/base/GasLimitedTask.sol @@ -104,9 +104,11 @@ abstract contract GasLimitedTask is IGasLimitedTask, Authorized { bool isGasPriceAllowed = config.gasPriceLimit == 0 || tx.gasprice <= config.gasPriceLimit; if (!isGasPriceAllowed) revert TaskGasPriceLimitExceeded(tx.gasprice, config.gasPriceLimit); - uint256 priorityFee = tx.gasprice - block.basefee; - bool isPriorityFeeAllowed = config.priorityFeeLimit == 0 || priorityFee <= config.priorityFeeLimit; - if (!isPriorityFeeAllowed) revert TaskPriorityFeeLimitExceeded(priorityFee, config.priorityFeeLimit); + if (config.priorityFeeLimit > 0) { + uint256 priorityFee = tx.gasprice - block.basefee; + bool isPriorityFeeAllowed = priorityFee <= config.priorityFeeLimit; + if (!isPriorityFeeAllowed) revert TaskPriorityFeeLimitExceeded(priorityFee, config.priorityFeeLimit); + } } /**