-
-
Notifications
You must be signed in to change notification settings - Fork 330
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: chunkIntoN to chunk correctly #6035
Conversation
* FIX: fixed chunkIntoN to chunk correctly chunkIntoN was chunking into N chunks, however it is used to chunk eth_getCode and eth_getProof responses into chunks of 2, so the desired action should be to chunk into chunks of length N https://github.com/ChainSafe/lodestar/blob/unstable/packages/prover/src/utils/evm.ts#L105 Because the current tests work on chunking array of length 4 into 2 the previous behavior was working and passing tests. When there are 6 requests the current behavior no longer works * Fix strings in test
output: [[1, 2, 3], [4]], | ||
}, | ||
{ | ||
title: "when data have different order", |
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.
Does this test case make sense? it makes it seem like the type of elements are relevant, rather would add 1-2 tests cases that show that it works with any type of elements, e.g. objects or nested arrays
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.
Yes just want to make sure doing chunk does not change the order.
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.
All the other existing test cases already assert that.
My point is that why would the values of elements impact that?
data have different order
Makes it sounds like this chunkIntoN
inspects the value of elements, which it does not. IMO better way to prove this is to use different types of elements.
Performance Report✔️ no performance regression detected Full benchmark results
|
output: [[1, 2, 3], [4]], | ||
}, | ||
{ | ||
title: "when data have different order", |
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.
All the other existing test cases already assert that.
My point is that why would the values of elements impact that?
data have different order
Makes it sounds like this chunkIntoN
inspects the value of elements, which it does not. IMO better way to prove this is to use different types of elements.
Co-authored-by: Nico Flaig <[email protected]>
@nflaig When reading the test we should read in full context from the description. So I believe current pattern feels more natural to read. |
🎉 This PR is included in v1.12.0 🎉 |
Motivation
Fix the chunk size helper.
Description
Steps to test or reproduce
Run all tests