Skip to content

Commit

Permalink
Merge pull request #5 from m8b-dev/dev
Browse files Browse the repository at this point in the history
Fix EIP1559 base fee calculation
  • Loading branch information
DubbaThony authored Oct 11, 2024
2 parents b84522b + 8a2fe3d commit 983f325
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Common/LondonTransaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ public function setGasFeeTip(OOGmp $gasFeeTip): static
public function useRpcEstimatesWithBump(AbstractRPC $rpc, ?Address $from, int $bumpGasPercentage, int $bumpFeePercentage): static
{
$gas = ($rpc->ethEstimateGas($this, $from) * ($bumpFeePercentage + 100)) / 100;
$gas = (int)ceil($gas);
$base = Functions::getPessimisticBlockBaseFee($rpc->ethGetBlockByNumber(), 3, EIP1559Config::sepolia()
/* using sepolia as only difference for this config is start block, which is 0. This function is expected
to be called on London transaction for London-enabled chains, regardless of starting block */
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public static function getNextBlockBaseFee(Block $previous, EIP1559Config $confi
return new OOGmp(EIP1559Config::INITIAL_BASE_FEE);
}

$parentGasTarget = $previous->gasLimit / EIP1559Config::ELASTICITY_MULTIPLIER;
$parentGasTarget = (int)floor($previous->gasLimit / EIP1559Config::ELASTICITY_MULTIPLIER);
if($parentGasTarget == $previous->gasUsed) {
return $previous->baseFeePerGas;
}
Expand Down

0 comments on commit 983f325

Please sign in to comment.