refactor(primitives): group effective_gas_tip
and effective_tip_per_gas
functions together
#5141
Labels
C-enhancement
New feature or request
Describe the feature
Observation
In the current codebase, we have two separate functions,
effective_gas_tip
andeffective_tip_per_gas
, in the implementation of theTransaction
enum, that perform similar computations to determine the effective gas tip or gasTipCap for a given transaction and base fee:reth/crates/primitives/src/transaction/mod.rs
Lines 308 to 352 in d05b324
These two functions car be grouped together using a common logic.
Proposed Solution
I propose merging the logic of these two functions into a single function, which we can name
effective_tip_per_gas
. This consolidated function can accept anOption<u64>
for the base fee, making it versatile enough to handle cases where the base fee is either present or absent.The consolidated function will centralize the logic for calculating the effective gas tip or gasTipCap, which includes handling scenarios where the base fee is not specified. This refactoring will lead to more maintainable and cleaner code.
Additional context
No response
The text was updated successfully, but these errors were encountered: