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

hyperledger / fabric-x-common / 40699903758
81%

Build:
DEFAULT BRANCH: main
Ran 28 Oct 2026 01:51PM UTC
Jobs 1
Files 184
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

28 Oct 2026 01:48PM UTC coverage: 81.284% (+0.008%) from 81.276%
40699903758

push

github

web-flow
[protoutil] Avoid allocations and the echoed TxID in CheckTxID (#232)

#### 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

---------

Signed-off-by: Yoav Tock <TOCK@il.ibm.com>

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

12621 of 15527 relevant lines covered (81.28%)

0.81 hits per line

Jobs
ID Job ID Ran Files Coverage
1 40699903758.1 28 Oct 2026 01:51PM UTC 184
81.28
GitHub Action Run
Source Files on build 40699903758
  • Tree
  • List 184
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • c08246e6 on github
  • Prev Build on main (#40642003290)
  • Next Build on main (#40830300313)
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