Skip to content

Conversation

@mbrandenburger
Copy link
Member

@mbrandenburger mbrandenburger commented Jan 8, 2026

This PR reduces FSC’s dependency on github.com/hyperledger/fabric by refactoring and moving the required Fabric code into platform/fabric. Fabric is not designed or versioned as a reusable Go library, and depending on its internal packages introduces instability, misleading dependency alerts, and maintenance challenges.

By internalizing the required functionality, FSC gains fine-grained control over the code it depends on, at the cost of needing to explicitly track and maintain compatibility with Fabric protocol changes. This is a deliberate trade-off.

Additionally, removing direct Fabric dependencies eliminates false-positive Dependabot alerts caused by Fabric’s non-semantic Go module versioning, which incorrectly associates current Fabric releases with older versions such as 1.4 or 2.2.

TODOs:

  • github.com/hyperledger/fabric/core/chaincode/platforms/util
  • github.com/hyperledger/fabric/protoutil
  • github.com/hyperledger/fabric/discovery/client
  • github.com/hyperledger/fabric/core/common/ccprovider
  • github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/rwsetutil
  • github.com/hyperledger/fabric/common/configtx
  • github.com/hyperledger/fabric/common/channelconfig
  • github.com/hyperledger/fabric/msp
  • github.com/hyperledger/fabric/core/ledger/pvtdatastorage
  • github.com/hyperledger/fabric/core/ledger/kvledger/txmgmt/statedb/statecouchdb

@mbrandenburger mbrandenburger self-assigned this Jan 8, 2026
@mbrandenburger mbrandenburger added cleanup Something needs some cleanup Fabric Related to Fabric dependencies Pull requests that update a dependency file labels Jan 8, 2026
@mbrandenburger mbrandenburger force-pushed the refactor-fabric-imports branch 11 times, most recently from a5e4044 to 41464a2 Compare January 15, 2026 14:36
This commit moves the utility functions imported from fabric into the
local package, including tests.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@mbrandenburger mbrandenburger force-pushed the refactor-fabric-imports branch 3 times, most recently from 2952587 to 6cce9ea Compare January 16, 2026 11:25
@mbrandenburger mbrandenburger marked this pull request as ready for review January 16, 2026 12:24
@adecaro
Copy link
Contributor

adecaro commented Jan 16, 2026

Great effort, @mbrandenburger . Very useful.

One suggestion: Could we move platform/fabric/msp and platform/fabric/protoutils under plaftorm/fabric/core?
The rational being that these packages are used by the core package alone and we don't recommend the developers to access them directly.

Thanks.

Copy link
Contributor

@adecaro adecaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This commit bundles the dependency on prototuils imported from fabric in
a single package.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
This commit moves the discovery client imported from fabric into a local
package, including tests.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
This commit moves the rwsetutils imported from fabric into a local
package, including tests.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
This commit adds UnmarshalConfigEnvelope to our local protoutils

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
This commit moves common/channelconfig imported from fabric into a local
package, including tests.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@mbrandenburger mbrandenburger force-pushed the refactor-fabric-imports branch 2 times, most recently from 5091465 to d841d6e Compare January 19, 2026 08:44
@mbrandenburger
Copy link
Member Author

One suggestion: Could we move platform/fabric/msp and platform/fabric/protoutils under plaftorm/fabric/core? The rational being that these packages are used by the core package alone and we don't recommend the developers to access them directly.

@adecaro good idea - I moved the packages as you suggested.

This commit moves msp imported from fabric into a local
package, including tests.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
This commit moves protoutils imported from fabric into a local
package, including tests.

Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
@mbrandenburger mbrandenburger force-pushed the refactor-fabric-imports branch from d841d6e to 359e531 Compare January 19, 2026 08:59
Copy link
Contributor

@AkramBitar AkramBitar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far so good :-)
LGTM

Copy link
Contributor

@SaidAltury-ibm SaidAltury-ibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great effort @mbrandenburger! LGTM

@mbrandenburger mbrandenburger merged commit 34ab571 into hyperledger-labs:main Jan 19, 2026
23 checks passed
@mbrandenburger mbrandenburger deleted the refactor-fabric-imports branch January 19, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Something needs some cleanup dependencies Pull requests that update a dependency file Fabric Related to Fabric

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants