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(op-batcher): MaxFrameSize Validation #5186

Merged
merged 1 commit into from Mar 17, 2023
Merged

Conversation

refcell
Copy link
Contributor

@refcell refcell commented Mar 17, 2023

Description

Fixes CLI-3648

Context

If the MaxFrameSize is configured to be greater than 0 and less than 23, unexpected behavior will occur where the channel builder will call it's channel out OutputFrame function, passing in the MaxFrameSize as the max frame size. Inside the channel out OutputFrame function though, a frame overhead of 23 is subtracted from the passed in max size. If this is less than 23, this operation will underflow, causing the frame to be filled to a nearly unbounded uint64. The OutputFrame function will then return an unexpected, extremely large frame.

Solution

This pr validates that the configured MaxFrameSize is not less than 23, erroring with a ErrSmallMaxFrameSize.

Additional Info

Another PR will properly fix the channel out OutputFrame function to error on maxSize underflow as tracked in CLI-3649

@refcell refcell requested a review from a team as a code owner March 17, 2023 18:31
@refcell refcell self-assigned this Mar 17, 2023
@changeset-bot
Copy link

changeset-bot bot commented Mar 17, 2023

⚠️ No Changeset found

Latest commit: 06787ad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify
Copy link

netlify bot commented Mar 17, 2023

Deploy Preview for opstack-docs canceled.

Name Link
🔨 Latest commit 06787ad
🔍 Latest deploy log https://app.netlify.com/sites/opstack-docs/deploys/6414b21f9a0ddc00087072b7

@codecov
Copy link

codecov bot commented Mar 17, 2023

Codecov Report

Merging #5186 (06787ad) into develop (2351ed4) will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5186      +/-   ##
===========================================
- Coverage    41.93%   41.91%   -0.02%     
===========================================
  Files          354      354              
  Lines        21961    21964       +3     
  Branches       776      776              
===========================================
- Hits          9210     9207       -3     
- Misses       12051    12056       +5     
- Partials       700      701       +1     
Flag Coverage Δ
bedrock-go-tests 37.98% <100.00%> (-0.03%) ⬇️
contracts-bedrock-tests 51.04% <ø> (ø)
contracts-tests 98.86% <ø> (ø)
core-utils-tests 60.41% <ø> (ø)
dtl-tests 47.15% <ø> (ø)
fault-detector-tests 33.88% <ø> (ø)
sdk-tests 39.05% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
op-batcher/batcher/channel_builder.go 82.00% <100.00%> (+0.36%) ⬆️

... and 2 files with indirect coverage changes

@mergify mergify bot merged commit 07fc1d5 into develop Mar 17, 2023
12 checks passed
@mergify mergify bot deleted the refcell/fix/channel_out branch March 17, 2023 21:33
@mergify
Copy link
Contributor

mergify bot commented Mar 17, 2023

This PR has been added to the merge queue, and will be merged soon.

@mergify
Copy link
Contributor

mergify bot commented Mar 17, 2023

This PR is next in line to be merged, and will be merged as soon as checks pass.

@mergify mergify bot removed the on-merge-train label Mar 17, 2023

// Set the config to have a max frame size less than 23.
validChannelConfig.MaxFrameSize = 22
require.ErrorIs(t, validChannelConfig.Check(), ErrSmallMaxFrameSize)
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be separate tests / table tests.

mergify bot added a commit that referenced this pull request Mar 21, 2023
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.

None yet

4 participants