Skip to content

Commit

Permalink
fix(protocol): check blob capability in LibProposing using LibNetwork…
Browse files Browse the repository at this point in the history
….isDencunSupported (#16657)
  • Loading branch information
dantaik authored Apr 5, 2024
1 parent 86a41ac commit e787493
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion packages/protocol/contracts/L1/libs/LibProposing.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../../common/IAddressResolver.sol";
import "../../libs/LibAddress.sol";
import "../../libs/LibNetwork.sol";
import "../hooks/IHook.sol";
import "../tiers/ITierProvider.sol";

Expand Down Expand Up @@ -122,7 +123,7 @@ library LibProposing {

// Update certain meta fields
if (meta_.blobUsed) {
if (block.chainid != 1) revert L1_BLOB_NOT_AVAILABLE();
if (!LibNetwork.isDencunSupported(block.chainid)) revert L1_BLOB_NOT_AVAILABLE();

// Always use the first blob in this transaction. If the
// proposeBlock functions are called more than once in the same
Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/bridge/Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ contract Bridge is EssentialContract, IBridge {
// For Taiko mainnet and public testnets
// 384 seconds = 6.4 minutes = one ethereum epoch
return (1 hours, 384 seconds);
} else if (LibNetwork.isTaikoDevnet(block.chainid)) {
} else if (LibNetwork.isTaikoDevnetL1(block.chainid)) {
return (5 minutes, 384 seconds);
} else {
// This is a Taiko L2 chain where no deleys are applied.
Expand Down
9 changes: 5 additions & 4 deletions packages/protocol/contracts/libs/LibNetwork.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ library LibNetwork {
return _chainId == LibNetwork.MAINNET || isEthereumTestnet(_chainId);
}

/// @dev Checks if the chain ID represents an internal Taiko devnet.
/// @dev Checks if the chain ID represents an internal Taiko devnet's base layer.
/// @param _chainId The chain ID.
/// @return true if the chain ID represents an internal Taiko devnet, false otherwise.
function isTaikoDevnet(uint256 _chainId) internal pure returns (bool) {
/// @return true if the chain ID represents an internal Taiko devnet's base layer, false
/// otherwise.
function isTaikoDevnetL1(uint256 _chainId) internal pure returns (bool) {
return _chainId >= 32_300 && _chainId <= 32_400;
}

Expand All @@ -41,6 +42,6 @@ library LibNetwork {
/// @return true if the chain supports Dencun hardfork, false otherwise.
function isDencunSupported(uint256 _chainId) internal pure returns (bool) {
return _chainId == LibNetwork.MAINNET || _chainId == LibNetwork.HOLESKY
|| _chainId == LibNetwork.SEPOLIA;
|| _chainId == LibNetwork.SEPOLIA || isTaikoDevnetL1(_chainId);
}
}

0 comments on commit e787493

Please sign in to comment.