-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
WalkthroughThe changes involve refining the chain ID verification logic in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
chainid = type(uint64).max
to still be valid, per the implied intention of type downcastingchainid = type(uint64).max
to still be valid, per the implied intention of type downcasting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/protocol/contracts/common/AddressResolver.sol (1 hunks)
Additional comments: 1
packages/protocol/contracts/common/AddressResolver.sol (1)
- 97-97: The change from
>=
to>
in the comparison againsttype(uint64).max
correctly aligns with the PR's objective to allowchainId
values that are equal totype(uint64).max
. This adjustment ensures that the contract can handle the maximumuint64
value without imposing unintended restrictions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- packages/protocol/contracts/L2/TaikoL2.sol (1 hunks)
Additional comments: 1
packages/protocol/contracts/L2/TaikoL2.sol (1)
- 81-81: The condition
if (block.chainid <= 1 || block.chainid > type(uint64).max)
correctly checks ifblock.chainid
is outside the valid range for auint64
. However, the PR description suggests adjusting the logic to allowchainId
values equal totype(uint64).max
, which this condition already supports. Ensure the PR description aligns with the actual change, which seems to be a clarification rather than a functional adjustment.
My assumption is that from the casting in
resolve
function, the chainid gets downcasted touint64
, so to prevent any possible attack on duplicate chainid due to downcasting, the chainid check is done. However, the check should still be allowed for whenchainid == type(uint64).max
.Summary by CodeRabbit