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

op-batcher: Fix intermittency in TestChannelBuilder_PendingFrames_TotalFrames #5989

Merged
merged 3 commits into from
Jun 12, 2023

Conversation

ajsutton
Copy link
Contributor

Description

Fix intermittency in TestChannelBuilder_PendingFrames_TotalFrames.

Different random seeds would result in varying compression levels in the generated blocks. When the expected compression ratio wasn't reached, the channel may use more frames than the target resulting in a test failure.

Test now uses a fixed seed for the rng and InsecureRandomKey is now deterministic.

InsecureRandomKey used to use ecdsa.GenerateKey but the Go authors in their infinite wisdom 🙄 made it explicitly non-deterministic even when the rng input is constant - even within the same process. So now it randomly (using the supplied rng) selects a key from a set of 300 hard coded keys.

Having unit tests be repeatable is a key requirement for stable builds - if we want to fuzz test, we should explicitly use fuzz testing utils which ensure the entropy seed is clearly logged on a failure so the failing case can be reproduced and debugged.

…alFrames

Different random seeds would result in varying compression levels which caused intermittency. Now uses a fixed seed for the rng and InsecureRandomKey is now deterministic.
@ajsutton ajsutton requested a review from a team as a code owner June 12, 2023 00:10
@netlify
Copy link

netlify bot commented Jun 12, 2023

Deploy Preview for opstack-docs canceled.

Name Link
🔨 Latest commit 0c1c291
🔍 Latest deploy log https://app.netlify.com/sites/opstack-docs/deploys/64877d96a39e800007ff6122

@changeset-bot
Copy link

changeset-bot bot commented Jun 12, 2023

⚠️ No Changeset found

Latest commit: 0c1c291

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

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

❗ No coverage uploaded for pull request base (develop@b317dde). Click here to learn what that means.
The diff coverage is 50.00%.

❗ Current head b2f24a1 differs from pull request most recent head 0c1c291. Consider uploading reports for the commit 0c1c291 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             develop    #5989   +/-   ##
==========================================
  Coverage           ?   40.68%           
==========================================
  Files              ?      319           
  Lines              ?    26142           
  Branches           ?        0           
==========================================
  Hits               ?    10637           
  Misses             ?    14524           
  Partials           ?      981           
Flag Coverage Δ
bedrock-go-tests 40.68% <50.00%> (?)

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

Impacted Files Coverage Δ
op-node/testutils/random.go 89.26% <50.00%> (ø)

@mergify
Copy link
Contributor

mergify bot commented Jun 12, 2023

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

@mergify
Copy link
Contributor

mergify bot commented Jun 12, 2023

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

@mergify
Copy link
Contributor

mergify bot commented Jun 12, 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 Jun 12, 2023
@mergify
Copy link
Contributor

mergify bot commented Jun 12, 2023

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

@mergify
Copy link
Contributor

mergify bot commented Jun 12, 2023

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

1 similar comment
@mergify
Copy link
Contributor

mergify bot commented Jun 12, 2023

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

@OptimismBot OptimismBot merged commit 8b11e73 into develop Jun 12, 2023
8 of 9 checks passed
@OptimismBot OptimismBot deleted the aj/deterministic-test branch June 12, 2023 20:31
@mergify mergify bot removed the on-merge-train label Jun 12, 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