• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hyperledger / fabric-x-common / 40230048789
82%
main: 82%

Build:
Build:
LAST BUILD BRANCH: issue-231-checktxid
DEFAULT BRANCH: main
Ran 25 Oct 2026 08:18PM UTC
Jobs 1
Files 200
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

25 Oct 2026 08:16PM UTC coverage: 82.197% (+0.009%) from 82.188%
40230048789

Pull #232

github

tock-ibm
[protoutil] Avoid allocations and the echoed TxID in CheckTxID

#### Type of change

- Improvement (improvement to code, performance, etc)

#### Description

- `ComputeTxID` and `CheckTxID` hash and hex-encode into stack buffers. `ComputeTxID` keeps its signature, and the returned string is its only allocation. `CheckTxID` no longer allocates.
- `CheckTxID` rejects a TxID that isn't `2*sha256.Size` characters long before hashing.
- On mismatch, `CheckTxID` returns the new sentinel `protoutil.ErrInvalidTxID` ("invalid txid"). The error no longer includes the received or expected TxID, so callers that matched on the old message should use `errors.Is` instead.
- `proputils.go` now uses `github.com/cockroachdb/errors` instead of `github.com/pkg/errors`.

#### Additional details (Optional)

Benchmarks added in `proputils_test.go`, with a 24-byte nonce and a 1,000-byte creator (before → after):

| case | before | after |
|---|---|---|
| `ComputeTxID` | 2,990 ns, 160 B, 3 allocs | 2,880 ns, 64 B, 1 alloc |
| `CheckTxID`, valid TxID | 3,040 ns, 160 B, 3 allocs | 2,830 ns, 0 B, 0 allocs |
| `CheckTxID`, wrong TxID, 64 chars | 3,950 ns, 672 B, 9 allocs | 2,830 ns, 0 B, 0 allocs |
| `CheckTxID`, wrong TxID, 1 MB | 744 µs, 2.1 MB, 12 allocs | 2.8 ns, 0 B, 0 allocs |

#### Related issues

- resolves #231

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Yoav Tock <TOCK@il.ibm.com>
Pull Request #232: [protoutil] Avoid allocations and the echoed TxID in CheckTxID

16 of 16 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

13837 of 16834 relevant lines covered (82.2%)

0.82 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
94.19
-1.16% common/deliverclient/blocksprovider/block_receiver.go
Jobs
ID Job ID Ran Files Coverage
1 40230048789.1 25 Oct 2026 08:18PM UTC 200
82.2
GitHub Action Run
Source Files on build 40230048789
  • Tree
  • List 200
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Pull Request #232
  • PR Base - main (#39950840754)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc