refactor(internal/blocktest): add package for shared test code #27270#2312
refactor(internal/blocktest): add package for shared test code #27270#2312gzliudan wants to merge 1 commit intoXinFinOrg:dev-upgradefrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR refactors shared test-only hashing logic by extracting the testHasher helper into a new internal/blocktest package and updating existing tests/benchmarks to use the centralized helper, reducing duplication across packages.
Changes:
- Add
internal/blocktest/test_hash.gowith a sharedNewHasherhelper for transaction/receipt list hashing. - Update
internal/ethapi/api_test.go,core/types/block_test.go, andcore/rawdb/accessors_indexes_test.goto useblocktest.NewHasherinstead of local duplicated implementations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| internal/ethapi/api_test.go | Removes local testHasher and switches to shared blocktest.NewHasher. |
| internal/blocktest/test_hash.go | Introduces the shared hasher implementation used by tests/benchmarks. |
| core/types/block_test.go | Removes duplicated hasher and uses blocktest.NewHasher in benchmark block creation. |
| core/rawdb/accessors_indexes_test.go | Removes duplicated hasher and uses blocktest.NewHasher via a local alias. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…um#27270 Move the testHasher helper to internal/blocktest/test_hash.go and update all usages to import from there. This reduces code duplication and improves maintainability.
Proposed changes
Move the testHasher helper to internal/blocktest/test_hash.go and update all usages to import from there. This reduces code duplication and improves maintainability.
Ref: ethereum#27270
Types of changes
What types of changes does your code introduce to XDC network?
Put an
✅in the boxes that applyImpacted Components
Which parts of the codebase does this PR touch?
Put an
✅in the boxes that applyChecklist
Put an
✅in the boxes once you have confirmed below actions (or provide reasons on not doing so) that