Skip to content

lint(fabtoken): split gocognit fixes out of #2327 - #2529

Open
EaswarKilari wants to merge 1 commit into
LFDT-Panurus:mainfrom
EaswarKilari:2379-gocognit-fabtoken
Open

EaswarKilari wants to merge 1 commit into
LFDT-Panurus:mainfrom
EaswarKilari:2379-gocognit-fabtoken

Conversation

@EaswarKilari

@EaswarKilari EaswarKilari commented Oct 24, 2026 •

Copy link
Copy Markdown

Fixes #2379

Part of the gocognit cleanup in #2377, same approach as #2390 and #2394.

Eight functions in token/core/fabtoken were over the complexity limit of 15. I split them into smaller helpers without changing behaviour. The checks, their order and the error messages are the same as before.

  1. validator/validator_transfer.go
    1. TransferHTLCValidate (55) -> validateHTLCInput, validateHTLCOutput
    2. TransferSignatureValidate (34) -> ownerVerifier, hasRedeemOutput, redeemIssuerSignature
    3. TransferBalanceValidate (23) -> sumInputs, sumOutputs
  2. transfer.go
    1. TransferService.Transfer (33) -> transferInputsMetadata, transferOutputsMetadata, outputReceivers
    2. TransferService.VerifyTransfer (29) -> sumTransferInputs, verifyTransferOutput
  3. issue.go
    1. IssueService.VerifyIssue (23) -> verifyIssueOutput
    2. IssueService.Issue (19) -> validateIssueArgs, issueOutput
  4. actions/transfer.go
    1. TransferAction.Validate (22) -> validateTransferInput, validateTransferOutput

The highest score among the changed functions is now 13.. No nolint directives were added.

Tested with:

  1. go test and go test -race on ./token/core/fabtoken/...
  2. golangci-lint with gocognit enabled (0 issues)
  3. the fabtoken validator fuzz targets

Integration tests were not run locally.

Bring token/core/fabtoken under the gocognit limit (15) by extracting the flagged functions into named helpers. No behaviour change.

Fixes LFDT-Panurus#2379

Signed-off-by: Easwar Kilari <81870353+EaswarKilari@users.noreply.github.com>
@EaswarKilari
EaswarKilari force-pushed the 2379-gocognit-fabtoken branch from 90a08a4 to 32c7593 Compare October 31, 2026 09:56

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gocognit split: token/core/fabtoken

2 participants