Open
Conversation
…ng-utils-coverage
There was a problem hiding this comment.
Pull request overview
This PR focuses on pushing the remaining code paths to full test coverage, primarily by adding/adjusting unit tests across transactions, ABI encoding, ByteBuffer utilities, and identity validation, plus a couple of small production/config changes to support coverage goals.
Changes:
- Add new unit tests covering additional edge/error cases (ABI tuple encoding, deserializer input handling, uint256 read/write, builder value setting, address validation, etc.).
- Adjust test/configuration to enforce 100% coverage (
composer.json) and simplify PHPUnit suite configuration (phpunit.xml). - Minor production refactors (e.g.,
AbstractNetworkstatic-call forwarding removal;writeUInt256input validation tweak).
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/Utils/TransactionUtilsTest.php | Expands coverage for 0x-prefixed transaction fields. |
| tests/Unit/Utils/AbiEncoderTest.php | Adds missing negative test for tuple components without names. |
| tests/Unit/Transactions/DeserializerTest.php | Adds coverage for constructor buffer initialization paths and decodePayload null cases. |
| tests/Unit/Transactions/Builder/ValidatorRegistrationBuilderTest.php | Adds coverage for setting transaction value. |
| tests/Unit/Identities/AddressTest.php | Adds coverage for Address::validate true/false outcomes. |
| tests/Unit/Enums/AbiFunctionTest.php | New test for enum-to-transaction-class mapping. |
| tests/Unit/ByteBuffer/Concerns/Writes/UnsignedIntegerTest.php | Adds coverage for writeUInt256 and error paths. |
| tests/Unit/ByteBuffer/Concerns/Reads/UnsignedIntegerTest.php | Adds coverage for readUInt256. |
| tests/Unit/ByteBuffer/ByteBufferTest.php | Adds coverage for fill() with non-zero start offset. |
| src/Networks/AbstractNetwork.php | Removes __callStatic forwarding and minor formatting. |
| src/ByteBuffer/Concerns/Writes/UnsignedInteger.php | Tightens writeUInt256 numeric validation. |
| phpunit.xml | Consolidates test suites into a single suite covering ./tests. |
| composer.json | Raises Pest coverage minimum from 96% to 100%. |
Comments suppressed due to low confidence (1)
src/ByteBuffer/Concerns/Writes/UnsignedInteger.php:82
writeUInt256()now only accepts values whereis_numeric($value)is true. This rejects otherwise parseable GMP inputs like hex strings with a0xprefix (whichgmp_init()can handle with base autodetection) and narrows behavior vs the documentedstring|int|\GMPparameter. If hex inputs should be supported, explicitly allow them (e.g.0x-prefixed hex) and callgmp_init($value, 0); otherwise update the doc/error message to clarify that only base-10 numeric strings are accepted.
if (is_numeric($value)) {
$gmpValue = gmp_init($value);
} elseif ($value instanceof \GMP) {
$gmpValue = $value;
} else {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
https://app.clickup.com/t/86dwdky8k
requires #176
I've separated the pestphp upgrade into #179
Checklist