Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(protocol): check blob capability in LibProposing using LibNetwork.isDencunSupported #16657

Merged
merged 3 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
Loading