-
-
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: Add 100% test coverage to tevm/utils #1303
✅ Test: Add 100% test coverage to tevm/utils #1303
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 086c017 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThe changeset focuses on achieving 100% test coverage in 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
packages/utils/src/__snapshots__/createMemoryDb.spec.ts.snap
is excluded by!**/*.snap
Files selected for processing (7)
- .changeset/forty-rice-invent.md (1 hunks)
- packages/utils/src/Bloom.spec.ts (1 hunks)
- packages/utils/src/createMemoryDb.js (1 hunks)
- packages/utils/src/createMemoryDb.spec.ts (1 hunks)
- packages/utils/src/invariant.spec.ts (1 hunks)
- packages/utils/src/invariant.ts (1 hunks)
- packages/utils/src/prefundedAccounts.spec.ts (1 hunks)
Files skipped from review due to trivial changes (1)
- .changeset/forty-rice-invent.md
Additional comments not posted (16)
packages/utils/src/invariant.ts (1)
3-3
: Enhance type safety for theerror
parameter.The change to explicitly specify the type of the
error
parameter asError
improves type safety and clarity.packages/utils/src/prefundedAccounts.spec.ts (1)
1-21
: Comprehensive tests for prefunded accounts.The tests thoroughly validate the constants for prefunded accounts and their keys, ensuring consistency and correctness.
packages/utils/src/createMemoryDb.js (1)
49-49
: Improved error handling in thebatch
method.The change to return a rejected promise with the error object instead of throwing an
UnreachableCodeError
aligns with promise-based error handling and improves consistency.Ensure that all function calls to
createMemoryDb
are updated accordingly.Verification successful
All function calls to
createMemoryDb
are updated accordingly.The search did not reveal any external calls to
createMemoryDb
, implying that no further updates are needed.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `createMemoryDb` are updated accordingly. # Test: Search for the function usage. Expect: Only occurrences of the updated error handling. rg --type js -A 5 $'createMemoryDb'Length of output: 1931
Script:
#!/bin/bash # Description: Search for all function calls to `createMemoryDb` across the entire codebase. # Test: Search for the function usage in all files. Expect: Occurrences of the updated error handling. rg 'createMemoryDb' -t jsLength of output: 941
packages/utils/src/invariant.spec.ts (1)
1-33
: Comprehensive tests for theinvariant
function.The tests thoroughly cover various scenarios and error handling for the
invariant
function, ensuring it behaves correctly with different inputs.packages/utils/src/createMemoryDb.spec.ts (6)
14-23
: LGTM!The test case for basic CRUD operations is well-written and comprehensive.
25-35
: LGTM!The test case for encoding
Uint8Array
keys is well-written and comprehensive.
37-49
: LGTM!The test case for creating a shallow copy of the database is well-written and comprehensive.
51-59
: LGTM!The test case for handling batch operations is well-written and comprehensive.
61-66
: LGTM!The test case for throwing an
UnreachableCodeError
for unknown batch operation types is well-written and comprehensive.
68-70
: LGTM!The test case for resolving the
open
method is well-written and comprehensive.packages/utils/src/Bloom.spec.ts (6)
7-10
: LGTM!The test case for initializing with zeros if no bitvector is provided is well-written and comprehensive.
12-15
: LGTM!The test case for throwing an error if bitvector length is not 256 is well-written and comprehensive.
17-31
: LGTM!The test case for adding an element to the bloom filter is well-written and comprehensive.
34-41
: LGTM!The test case for checking if an element is in the bloom filter is well-written and comprehensive.
43-52
: LGTM!The test case for checking if multiple topics are in the bloom filter is well-written and comprehensive.
54-61
: LGTM!The test case for throwing a
DefensiveNullCheckError
if an item is undefined in theor
method is well-written and comprehensive.
## Description _Concise description of proposed changes_ ## Testing Explain the quality checks that have been done on the code changes ## Additional Information - [ ] I read the [contributing docs](../docs/contributing.md) (if this is your first contribution) Your ENS/address: <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling in the `createMemoryDb` function for better user experience. - **Tests** - Introduced comprehensive test suites for: - `Bloom` class functionalities. - `createMemoryDb` function, including various operations and error handling. - `invariant` function behavior under different conditions. - Prefunded accounts functionality and associated constants. - **Refactor** - Updated `invariant` function signature for clearer error parameter specification. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: William Cory <[email protected]>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[]: - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[]: - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - [#1306](#1306) [`e19fc84`](e19fc84) Thanks [@roninjin10](https://github.com/roninjin10)! - - Increased unit test coverage of tevm/actions to 87% - fixed bug where we weren't properly returning tracing and access list information any errors happen during evm execution. Returning this information helps make debugging easier for users of tevm - Fixed bug in callHandler where some validation errors were being swallowed - fixed bug in setAccount and getAccount where some validation errors were being swallowed - fixed bug with evm not reforking state manager in situation where forkUrl is set and blockTag for a call is before - fixed bug with vm blockchainManager not being updated where forkUrl is set and blockTag for a call is before. This could cause state to leak from this call to the cannonical blockchain - fixed bug with a bad blockTag causing an unexpected `InternalError` rather than `ForkError` to be thrown - Fixed issue with stateOverrides not respecting the `code` property - fixed issue where block.cliqueSigner() on forked blocks not properly throwing an error for not being a POA network - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[]: - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - [#1303](#1303) [`277ed48`](277ed48) Thanks [@roninjin10](https://github.com/roninjin10)! - Fixed some very minor bugs in tevm/utils based on adding 100% test coverage - [#1306](#1306) [`e19fc84`](e19fc84) Thanks [@roninjin10](https://github.com/roninjin10)! - - Increased unit test coverage of tevm/actions to 87% - fixed bug where we weren't properly returning tracing and access list information any errors happen during evm execution. Returning this information helps make debugging easier for users of tevm - Fixed bug in callHandler where some validation errors were being swallowed - fixed bug in setAccount and getAccount where some validation errors were being swallowed - fixed bug with evm not reforking state manager in situation where forkUrl is set and blockTag for a call is before - fixed bug with vm blockchainManager not being updated where forkUrl is set and blockTag for a call is before. This could cause state to leak from this call to the cannonical blockchain - fixed bug with a bad blockTag causing an unexpected `InternalError` rather than `ForkError` to be thrown - Fixed issue with stateOverrides not respecting the `code` property - fixed issue where block.cliqueSigner() on forked blocks not properly throwing an error for not being a POA network ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] ## @tevm/[email protected] ### Patch Changes - Updated dependencies \[]: - @tevm/[email protected] - @tevm/[email protected] ## [email protected] ### Patch Changes - Updated dependencies \[[`277ed48`](277ed48), [`e19fc84`](e19fc84)]: - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] - @tevm/[email protected] Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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
Bug Fixes
createMemoryDb
function for better user experience.Tests
Bloom
class functionalities.createMemoryDb
function, including various operations and error handling.invariant
function behavior under different conditions.Refactor
invariant
function signature for clearer error parameter specification.