Skip to content

tests: tighten coverage by retiring unreachable defensive code (wave 2)#2

Merged
TeoSlayer merged 1 commit into
mainfrom
coverage-housekeeping-wave2
May 28, 2026
Merged

tests: tighten coverage by retiring unreachable defensive code (wave 2)#2
TeoSlayer merged 1 commit into
mainfrom
coverage-housekeeping-wave2

Conversation

@TeoSlayer
Copy link
Copy Markdown
Contributor

Summary

Deletions

  • saveEVMSigner (pkg/evm/key.go): json.MarshalIndent error branch on the all-strings identityFile struct — cannot fail.
  • saveLocalSigner (pkg/wallet/signer.go): identical pattern for the Ed25519 identityFile.

Test additions

  • TestEVMAccessors_WithBinding: drives the non-nil-evm branch of EVMAddress / EVMChainID / EVMToken so the accessors are covered beyond the nil-binding shortcut.
  • TestHexHelpers_ErrorPaths: covers every rejection branch of hexToUint64 / hexToBigInt.

Coverage

  • Before: 84.4%
  • After: 85.3%

The 88% target wasn't reached without compromising the conservative bar — most of the remaining uncovered code is real input-validation in crypto/financial paths (signatures, EIP-712 typed-data, ABI encoding) that catches malformed operator input. Those are exactly the defenses the playbook says to leave.

Test plan

  • go test -race -count=1 -timeout 120s ./... passes across all 4 packages
  • Coverage moved honestly without gold-plating

Source changes:
  - saveEVMSigner (pkg/evm/key.go): identityFile struct is all strings
    — drop the json.MarshalIndent error branch with a comment.
  - saveLocalSigner (pkg/wallet/signer.go): identical to above for the
    Ed25519 identityFile.

Test additions:
  - TestEVMAccessors_WithBinding (pkg/wallet/zz_helpers_test.go): drives
    the non-nil-evm branch of EVMAddress / EVMChainID / EVMToken so the
    accessors are covered beyond the nil-binding shortcut.
  - TestHexHelpers_ErrorPaths (pkg/evm/rpc_test.go): covers every
    rejection branch of hexToUint64 / hexToBigInt (missing 0x prefix,
    non-hex chars, value too large for uint64, empty-after-prefix).

Coverage: 84.4% → 85.3%. The remaining gap is largely input-validation
in crypto/financial code that fires on bad operator input — left as-is.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@TeoSlayer TeoSlayer merged commit ed10007 into main May 28, 2026
3 checks passed
@TeoSlayer TeoSlayer deleted the coverage-housekeeping-wave2 branch May 28, 2026 03:31
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