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): fix chainid check to allow the case where chainid = type(uint64).max to still be valid, per the implied intention of type downcasting #15792

Merged
merged 3 commits into from
Feb 14, 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
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
Loading