Skip to content

refactor: remaining coverage#178

Open
alexbarnsley wants to merge 22 commits intofeat/mainsailfrom
refactor/remaining-coverage
Open

refactor: remaining coverage#178
alexbarnsley wants to merge 22 commits intofeat/mainsailfrom
refactor/remaining-coverage

Conversation

@alexbarnsley
Copy link
Member

@alexbarnsley alexbarnsley commented Jun 16, 2025

Summary

https://app.clickup.com/t/86dwdky8k

requires #176

I've separated the pestphp upgrade into #179

Checklist

  • Documentation (if necessary)
  • Tests (if necessary)
  • Ready to be merged

Base automatically changed from test/remaining-utils-coverage to feat/mainsail July 11, 2025 09:57
@alexbarnsley alexbarnsley marked this pull request as ready for review March 4, 2026 19:10
Copilot AI review requested due to automatic review settings March 4, 2026 19:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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., AbstractNetwork static-call forwarding removal; writeUInt256 input 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 where is_numeric($value) is true. This rejects otherwise parseable GMP inputs like hex strings with a 0x prefix (which gmp_init() can handle with base autodetection) and narrows behavior vs the documented string|int|\GMP parameter. If hex inputs should be supported, explicitly allow them (e.g. 0x-prefixed hex) and call gmp_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.

alexbarnsley and others added 3 commits March 5, 2026 11:53
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants