-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
✅ Test: MOre stateManager test coverage #1299
✅ Test: MOre stateManager test coverage #1299
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Warning Rate limit exceeded@roninjin10 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 54 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThis update enhances and expands the test coverage for numerous functions within the Changes
Possibly related issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @roninjin10 and the rest of your teammates on Graphite |
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
packages/state/src/utils/stripZeros.js (1)
1-1
: Improve error message detail.Consider providing a more detailed error message to aid debugging.
- throw new InternalError('Unexpected type') + throw new InternalError(`Unexpected type: expected Uint8Array but received ${typeof bytes}`)
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (6)
packages/state/src/actions/__snapshots__/commit.spec.ts.snap
is excluded by!**/*.snap
packages/state/src/actions/__snapshots__/deepCopy.spec.ts.snap
is excluded by!**/*.snap
packages/state/src/actions/__snapshots__/generateCannonicalGenesis.spec.ts.snap
is excluded by!**/*.snap
packages/state/src/actions/__snapshots__/getAccount.spec.ts.snap
is excluded by!**/*.snap
packages/state/src/actions/__snapshots__/getContractStorage.spec.ts.snap
is excluded by!**/*.snap
packages/state/src/actions/__snapshots__/putContractStorage.spec.ts.snap
is excluded by!**/*.snap
Files selected for processing (12)
- packages/state/src/actions/commit.js (1 hunks)
- packages/state/src/actions/commit.spec.ts (1 hunks)
- packages/state/src/actions/deepCopy.spec.ts (2 hunks)
- packages/state/src/actions/generateCannonicalGenesis.spec.ts (1 hunks)
- packages/state/src/actions/getAccount.spec.ts (2 hunks)
- packages/state/src/actions/getContractStorage.js (2 hunks)
- packages/state/src/actions/getContractStorage.spec.ts (1 hunks)
- packages/state/src/actions/getForkBlockTag.spec.ts (1 hunks)
- packages/state/src/actions/putContractStorage.js (1 hunks)
- packages/state/src/actions/putContractStorage.spec.ts (1 hunks)
- packages/state/src/utils/stripZeros.js (1 hunks)
- packages/state/src/utils/stripZeros.spec.ts (1 hunks)
Files skipped from review due to trivial changes (2)
- packages/state/src/actions/commit.js
- packages/state/src/actions/putContractStorage.js
Additional context used
Biome
packages/state/src/actions/putContractStorage.spec.ts
[error] 15-15: This variable implicitly has the any type.
Variable declarations without type annotation and initialization implicitly have the any type. Declare a type or initialize the variable with some value.
(lint/suspicious/noImplicitAnyLet)
Additional comments not posted (31)
packages/state/src/utils/stripZeros.js (1)
7-12
: LGTM!The function implementation is correct and efficiently removes leading zeros from a
Uint8Array
.packages/state/src/actions/getForkBlockTag.spec.ts (1)
1-42
: Comprehensive test cases forgetForkBlockTag
.The test cases cover various scenarios and ensure robust functionality of the
getForkBlockTag
function.packages/state/src/utils/stripZeros.spec.ts (1)
1-34
: Comprehensive test cases forstripZeros
.The test cases cover various scenarios and ensure robust functionality of the
stripZeros
function.packages/state/src/actions/generateCannonicalGenesis.spec.ts (1)
1-38
: Comprehensive test cases forgenerateCanonicalGenesis
.The test cases cover various scenarios and ensure robust functionality of the
generateCanonicalGenesis
function.packages/state/src/actions/getContractStorage.js (1)
Line range hint
6-21
:
LGTM! Verify usage ofInternalError
.The addition of
InternalError
for invalid storage key lengths enhances error handling.Ensure that
InternalError
is correctly defined and used across the codebase.packages/state/src/actions/putContractStorage.spec.ts (6)
33-36
: Test case approved.The test case correctly verifies that the value is added to the cache for the account at the provided key.
38-43
: Test case approved.The test case ensures that leading zeros are stripped from the value before storing it.
45-50
: Test case approved.The test case correctly verifies that an
InternalError
is thrown when the key is not 32 bytes long.
52-57
: Test case approved.The test case correctly verifies that an
InternalError
is thrown when the account does not exist.
59-63
: Test case approved.The test case ensures that the value is deleted when it is empty.
65-69
: Test case approved.The test case ensures that the value is deleted when it is filled with zeros.
packages/state/src/actions/getAccount.spec.ts (6)
10-12
: Test case approved.The test case correctly verifies that the account is retrievable from the base state.
57-60
: Test case approved.The test case correctly verifies that the account is retrievable with forking enabled.
62-64
: Test case approved.The test case correctly verifies that an undefined account is returned when no fork transport is provided.
66-68
: Test case approved.The test case correctly verifies that an undefined account is returned when fetching from fork is skipped.
70-78
: Test case approved.The test case correctly verifies that the account is fetched from a remote provider and cached.
80-105
: Test case approved.The test case correctly verifies that an undefined account is cached when fetched from a remote provider.
packages/state/src/actions/getContractStorage.spec.ts (6)
35-37
: Test case approved.The test case correctly verifies that the storage value is retrievable for the provided address and key.
39-42
: Test case approved.The test case correctly verifies that an empty
Uint8Array
is returned when the storage does not exist.
44-49
: Test case approved.The test case correctly verifies that an error is thrown when the key is not 32 bytes long.
51-55
: Test case approved.The test case correctly verifies that an empty
Uint8Array
is returned when the account is not a contract.
80-87
: Test case approved.The test case correctly verifies that the storage value is fetched from a remote provider and cached.
89-96
: Test case approved.The test case correctly verifies that an empty
Uint8Array
is returned when the account does not exist and no fork transport is provided.packages/state/src/actions/commit.spec.ts (5)
1-7
: Imports look good!The added imports are necessary for the new test cases.
11-32
: Test case for clearing storage entries is comprehensive.The test case covers the necessary scenarios for clearing storage entries and includes appropriate assertions.
50-62
: Test case for committing to existing state root is well-structured.The test case includes all necessary assertions to verify the correct behavior of committing to an existing state root.
64-78
: Test case for committing to a new state root is comprehensive.The test case includes all necessary assertions to verify the correct behavior of committing to a new state root.
80-87
: Test case for handling onCommit callback is well-structured.The test case includes all necessary assertions to verify the correct behavior of the
commit
function with the onCommit callback.packages/state/src/actions/deepCopy.spec.ts (3)
11-11
: Import ofInternalError
looks good!The added import is necessary for the new test case.
Line range hint
1-45
:
Test case for creating a copy of the state is comprehensive.The test case covers the necessary scenarios for creating a copy of the state and includes appropriate assertions.
46-67
: Test case for throwing error on uncommitted state is well-structured.The test case includes all necessary assertions to verify that the
deepCopy
function throws anInternalError
when called on an uncommitted state.
882aa2e
to
ef08bab
Compare
c23dc81
to
a783e06
Compare
Description
Concise description of proposed changes
Testing
Explain the quality checks that have been done on the code changes
Additional Information
Your ENS/address:
Summary by CodeRabbit
New Features
generateCanonicalGenesis
,getContractStorage
,getForkBlockTag
, andputContractStorage
functions.stripZeros
utility to remove leading zeros fromUint8Array
.Improvements
getContractStorage
by introducingInternalError
for specific invalid conditions.Refactor
stripZeros
function with an imported version from a utility module for cleaner code reuse.