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: L-02 Incorrect Casts #736

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

fix: L-02 Incorrect Casts #736

wants to merge 1 commit into from

Conversation

bmzig
Copy link
Contributor

@bmzig bmzig commented Nov 8, 2024

Orders inside the ERC7683OrderDepositor contract may be resolved either by the _resolve function or by the _resolveFor function. Both functions receive an order and convert it to the ResolvedCrossChainOrder struct, which contains the minReceived member of the Output[] type. However, inside both _resolve and _resolveFor functions, the minReceived member is initialized using the block.chainId cast to uint32, although the Output.chainId member is of type uint64. This means that the code will revert for blockchains with chainID not fitting into uint32, although it should work for all blockchains with chain IDs lower than type(uint64).max.

Consider casting block.chainId to uint64 instead of uint32 when initializing ResolvedCrossChainOrder.minReceived.

This commit changed the chainId field from a u64 to a u256, so the cast is now removed entirely.

Signed-off-by: bennett <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant