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

chore(l2): forbid index slicing #1344

Merged
merged 3 commits into from
Nov 29, 2024
Merged

chore(l2): forbid index slicing #1344

merged 3 commits into from
Nov 29, 2024

Conversation

dsocolobsky
Copy link
Contributor

Motivation

We should not use direct indexing var[idx] or direct index slicing var[0..2] and instead use safe alternatives and handle the errors.

Description

  • indexing_slicing = "deny" was added to Cargo.toml to forbid index slicing usage.
  • All usages were removed in the l2 crate

Closes #1270

Copy link
Contributor

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Left some nits.

crates/l2/proposer/l1_watcher.rs Outdated Show resolved Hide resolved
crates/l2/proposer/l1_watcher.rs Outdated Show resolved Hide resolved
crates/l2/utils/eth_client/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@fborello-lambda fborello-lambda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, left 2 suggestions

crates/l2/proposer/errors.rs Outdated Show resolved Hide resolved
crates/l2/utils/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@ilitteri ilitteri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jrchatruc jrchatruc added this pull request to the merge queue Nov 29, 2024
Merged via the queue into main with commit 4bc120d Nov 29, 2024
16 checks passed
@jrchatruc jrchatruc deleted the l2/forbid-index-slicing branch November 29, 2024 14:22
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.

L2: Forbid indexing slicing
4 participants