Skip to content

Commit

Permalink
Update TaikoL2.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Aug 2, 2024
1 parent 55dbace commit baf39b1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/protocol/contracts/L2/TaikoL2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -287,24 +287,25 @@ contract TaikoL2 is EssentialContract {
if (publicInputHash != currentPublicInputHash) revert L2_PUBLIC_INPUT_HASH_MISMATCH();

// Check if the gas settings has changed
bool postFork = block.number >= ontakeForkHeight();
uint64 newGasTarget = uint64(_gasIssuancePerSecond) * _basefeeAdjustmentQuotient;
if (newGasTarget != parentGasTarget) {
if (postFork && newGasTarget != parentGasTarget) {
// adjust parentGasExcess to keep the basefee unchanged. Note that due to math
// calculation precision, the basefee may change slightly.
parentGasExcess =
Lib1559Math.adjustExcess(parentGasExcess, parentGasTarget, newGasTarget);
}

// Verify the base fee per gas is correct
(uint256 basefee, uint64 newGasExcess) = block.number < ontakeForkHeight()
? getBasefee(_anchorBlockId, _parentGasUsed)
: calculateBaseFee(
(uint256 basefee, uint64 newGasExcess) = postFork
? calculateBaseFee(
_gasIssuancePerSecond,
uint64(block.timestamp - parentTimestamp),
_basefeeAdjustmentQuotient,
parentGasExcess,
_parentGasUsed
);
)
: getBasefee(_anchorBlockId, _parentGasUsed);

if (!skipFeeCheck() && block.basefee != basefee) revert L2_BASEFEE_MISMATCH();

Expand All @@ -319,7 +320,6 @@ contract TaikoL2 is EssentialContract {
}

// Update state variables

bytes32 parentHash = blockhash(parentId);
l2Hashes[parentId] = parentHash;

Expand Down

0 comments on commit baf39b1

Please sign in to comment.