Skip to content

Commit

Permalink
fix(protocol): fix chainid check to allow the case where `chainid = t…
Browse files Browse the repository at this point in the history
…ype(uint64).max` to still be valid, per the implied intention of type downcasting (#15792)
  • Loading branch information
n1punp authored Feb 14, 2024
1 parent 005a37a commit a401622
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/protocol/contracts/L2/TaikoL2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ contract TaikoL2 is CrossChainOwned, ICrossChainSync {
{
__CrossChainOwned_init(_addressManager, _l1ChainId);

if (block.chainid <= 1 || block.chainid >= type(uint64).max) {
if (block.chainid <= 1 || block.chainid > type(uint64).max) {
revert L2_INVALID_CHAIN_ID();
}

Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/contracts/common/AddressResolver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ abstract contract AddressResolver {
/// @param _addressManager Address of the AddressManager.
// solhint-disable-next-line func-name-mixedcase
function __AddressResolver_init(address _addressManager) internal virtual {
if (block.chainid >= type(uint64).max) {
if (block.chainid > type(uint64).max) {
revert RESOLVER_UNEXPECTED_CHAINID();
}
addressManager = _addressManager;
Expand Down

0 comments on commit a401622

Please sign in to comment.