Skip to content

Commit

Permalink
Tasks: Check base fee only if needed (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
facuspagnuolo authored Dec 20, 2023
1 parent de42f5a commit cca4408
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/tasks/contracts/base/GasLimitedTask.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**
Expand Down

0 comments on commit cca4408

Please sign in to comment.