Skip to content

Fix: remove duplicate Fabric version validation (_verifyFabricVersion is dead code)#764

Open
zyzzmohit wants to merge 1 commit into
hyperledger-labs:mainfrom
zyzzmohit:fix/remove-duplicate-fabric-version-check
Open

Fix: remove duplicate Fabric version validation (_verifyFabricVersion is dead code)#764
zyzzmohit wants to merge 1 commit into
hyperledger-labs:mainfrom
zyzzmohit:fix/remove-duplicate-fabric-version-check

Conversation

@zyzzmohit
Copy link
Copy Markdown
Contributor

Summary

Removes the redundant _verifyFabricVersion() method and its call in src/commands/validate/index.ts.

Problem

Two separate methods check the exact same condition — whether fabricVersion >= 2.0.0:

  1. _validateFabricVersion() (line 153) — emits a CRITICAL error → calls process.exit(1) immediately
  2. _verifyFabricVersion() (line 562) — emits a regular ERROR → just adds to error list

Since _validateFabricVersion is called first (line 118) and exits the process on failure, _verifyFabricVersion (called at line 150) is unreachable dead code when the version check fails.

Fix

Remove the redundant _verifyFabricVersion method (lines 562-567) and its call (line 150). The existing _validateFabricVersion already handles this correctly with a CRITICAL exit.

Testing

  • npm run test:unit — 34/34 tests pass
  • npm run lint — 0 errors, 23 warnings (same as baseline minus 1 removed warning from dead code)
  • npm run build — compiles successfully

Fixes #763

… is dead code)

_validateFabricVersion() (line 118) already checks fabricVersion >= 2.0.0
and exits with process.exit(1) via CRITICAL error type. The later
_verifyFabricVersion() (line 150) checks the same condition but only
adds a regular ERROR — making it unreachable dead code since the
process already exits before it runs.

Remove the redundant _verifyFabricVersion method and its call.

Fixes hyperledger-labs#763

Signed-off-by: zyzzmohit <mohitray949@gmail.com>
@zyzzmohit
Copy link
Copy Markdown
Contributor Author

CI Note: The 2 failing checks (test-02-raft, test-04-snapshot) appear to be pre-existing flaky E2E tests unrelated to this PR they also fail on other recent PRs (e.g. #762, #761, #760)

This PR only removes 8 lines of dead code from a validation file (src/commands/validate/index.ts) and has no impact on Docker/chaincode/network configurations. All other checks (including DCO, test-main, and 5 other E2E suites) pass cleanly ✅ :)

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.

Bug: duplicate Fabric version validation - _verifyFabricVersion is unreachable dead code

1 participant