Repository navigation
Feat: fpc-fsc extension submodule - #957
mbrandenburger merged 36 commits into
Conversation
|
Addressing the protobuf namespace conflict ( The CI failure in the IRB and echo integration tests is caused by a protobuf namespace conflict. Two packages define the same proto message types and end up in the same binary:
Added |
CI Failure: Orderer Config Incompatibility (FSC v0.11.0 ↔ Fabric 2.5.9)The IRB demo integration test panics during orderer startup: failed to parse config: Error unmarshalling config into struct: 1 error(s) decoding:
Root causeFSC General:
Throttling:
Rate: 0
InactivityTimeout: 5s
Backoff:
BaseDelay: 1s
Multiplier: 1.6
MaxDelay: 2mThese keys were introduced for Fabric v3.x. FPC's CI currently pins to Fabric 2.5.9 (config.mk, utils/docker/dev/Dockerfile) which does not recognize them -> causing the orderer to refuse startup. Why we can't just pin FSC to an older version
They came together. Pinning to an older FSC means shipping an integration against a version where FSC still contains FPC internals - defeating the purpose of this PR. Fix requiredUpgrade FPC's pinned Fabric binary from 2.5.9 → 3.1.4 in:
The echo integration test was already validated locally against Fabric 3.1.4: This upgrade is the correct long-term move to align FPC with FSC v0.11.0+, but since it touches all of FPC's CI (not just the new tests), it warrants a deliberate review decision. Happy to include it in this PR or track it as a follow-up looking for guidance. |
fcaee2c to
124409d
Compare
mbrandenburger
left a comment
There was a problem hiding this comment.
Thank you @PsychoPunkSage for working on this! This is a great step forward! I left you a few comments; Please have a look.
| //lint:ignore SA1019 v1 protos required for compatibility with internal/protos/fpc.pb.go generated types | ||
| protoV1 "github.com/golang/protobuf/proto" |
There was a problem hiding this comment.
I am wondering if we can re-compile the protos with the new protobuf. WDYT?
There was a problem hiding this comment.
Well the comment seems to be wrong,
I just checked internal/protos/fpc.pb.go and fabric-protos-go-apiv2's generated files, and both are already generated by the modern protoc-gen-go
|
Hi @mbrandenburger, Recreate:make all
|
@samuelvenzi would it be reasonable to update cc-tools to the v2 API? |
Yes, I think so. I would only need to know whether this breaks deployments in older Fabric versions such as v2.2. @PsychoPunkSage Can you maybe investigate that? |
hi @samuelvenzi Wire format check (i.e. diff between
|
|
Hi @samuelvenzi, following up on this: I opened an issue and a PR on cc-tools to unblock it.
The PR migrates cc-tools to Whenever you get a chance, could you take a look and give it a test on your side? Happy to rework anything if you'd prefer a different approach, for example keeping the v1 line maintained on a branch alongside v2. |
|
It seems that this work got merged; I believe the next step is to import the corresponding versions in of cc-tools in this PR? |
|
Could you rebase your branch on top of latest main please. |
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
…haincode-go/v2, fabric-lib-go, fabric-protos-go-apiv2 Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
…d fabric-protos-go-apiv2 Signed-off-by: Abhinav Prakash <abhinav.prakash319@gmail.com>
- the-simple-testing-network: register the FPC platform factory via network.StartCMDPostNew. FSC v0.11.0 no longer ships the FPC NWO extension, so the stock network command never deployed ERCC or the FPC chaincodes. Also add the missing go.sum entries for FSC v0.11.0 and pin github.com/ugorji/go/codec to resolve an ambiguous import. - initEnclave: register the endpoint of the peer that runs __initEnclave rather than the first ERCC peer, which may belong to another organization. - validateSGXDevicesPaths: reject device paths that do not exist; errors.Wrapf wrapped a nil error, so validation always passed. - Remove the no-op peer loop in GenerateArtifacts. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
- Share one argsToStrings helper across invoke/query/endorse and reuse StringsToArgs in contract.go. - Remove unimplemented panic stubs, no-op methods, IsPrivate, the unused GetChannel and the unused NWO ChannelProvider/Contract/Transaction. - Log query args at debug level. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
- Bump the dev container and the ccapi image to Go 1.26.3, as required by all go.mod files; official golang images run with GOTOOLCHAIN=local and refuse older toolchains. Update the setup docs. - Build the ccapi image from the FPC repository root. ccapi's go.mod replaces fabric-private-chaincode with ../../../, which was outside the sample's build context, so go mod download failed. Copy only the root go.mod/go.sum, client_sdk, internal and the ccapi sources; a Dockerfile-specific ignore file keeps the context small without touching the root .dockerignore used by the peer images. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
Restores the behavior of Fabric's WriteFileToPackage so the same chaincode yields the same package ID on every machine. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
NewIdentityFromMSP loaded the first file in keystore, so a stray file or an old key could be loaded instead of the key. Require exactly one key file; hidden entries and directories are ignored, e.g., the ..data entries of a keystore mounted from a Kubernetes secret. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
Drops the deprecated golang/protobuf v1 calls and SA1019 ignores. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
…eway The Fabric Gateway routes requests by organization, not by peer, so __initEnclave and __invoke could reach a peer in the right org that does not host the enclave. That registered a wrong endpoint at ercc, or failed invocations in orgs with several peers. Send both directly to the enclave peer using the peer's endorser gRPC API, as the Fabric Admin SDK does: __invoke to the endpoints from the enclave registry, __initEnclave to EnclavePeerEndpoint. The proposal is built by the gateway contract and signed by the caller's identity. Registry queries and the __endorse submit stay on the gateway. Also fix the peer endpoint cache of contractImpl: guard it with a mutex, as contracts are shared between goroutines, and do not cache the empty result returned before an enclave is registered, which was cached as [""] and never refreshed. Update the integration tests, samples and the helloworld tutorial. The integration utils map the registered enclave peer of the test network to its local address; simple-cli-go and ccapi dial their configured peer; simple-go looks up peers in its connection profile. BREAKING CHANGE: gateway.GetContract and resmgmt.New take the signing function of the gateway identity and a PeerDialer, which returns a gRPC connection to a peer given its endpoint as registered at the enclave registry. The SDK does not cache these connections. Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
|
I pushed 7 commits on top of
Everything builds, vets and passes the unit tests, including under |
The crash test registers its enclave via the peer CLI under localhost:7051, while Setup registers jdoe_test.sampleorg.example.com. The test network has a single peer, so connect to it for any endpoint instead of failing with "unknown peer localhost:7051". Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
Hi @mbrandenburger
|
mbrandenburger
left a comment
There was a problem hiding this comment.
Thank you @PsychoPunkSage
What this PR does / why we need it:
This PR migrates all FPC-related FSC (Fabric Smart Client) code out of the FSC repository and into FPC as a new
extension/fscsubmodule, resolving the cyclic dependency introduced by FSC importing parts of the FPC client SDK.The changes include:
extension/fscsubmodule: Hosts the FPC platform services (platform/fabric/services/fpc/) and NWO integration helpers (integration/nwo/fabric/fpc/,integration/nwo/fabric/topology/) previously living inside FSC.integration/go_chaincode/echo/): End-to-end test that exercises the new extension submodule.topology.gofiles acrossauction,kv_test,simulation, IRB demo, and the simple testing network now import FPC topology helpers fromextension/fscinstead of FSC internals. SDK import path updated fromplatform/fabric/sdktoplatform/fabric/sdk/digto align with post-PR-696 FSC structure.ii.RegisterPlatformFactory(fpcnwo.NewPlatformFactory())since FSC PR Go support #696 removed the built-in FPC platform registration from FSC.fabric-smart-client/platform/fabric/services/fpctoextension/fsc/platform/fabric/services/fpc.go.modfiles:extension/fscadded as a direct dependency with localreplacedirectives pointing to the post-PR-696 FSC clone until the upstream commit is available via a real pseudo-version.After this PR, users who want to use FPC with FSC applications simply import FSC core + the
extension/fscsubmodule and wire it in viatopology.go, no FPC code lives in FSC anymore.Which issue(s) this PR fixes:
Fixes #784
Special notes for your reviewer:
remove fpc). That PR is now merged and released asv0.11.0, allgo.modfiles in this PR reference the real upstream version; no localreplacedirectives for FSC remain.extension/fscis a standalone Go module (go.modatextension/fsc/go.mod) - Dependabot will not see it from the root. Keep this in mind for future dependency bumps.integration/go_chaincode/echo/test is the primary validation path for this migration; it exercises the full extension wiring end-to-end.go mod tidyon all affected modules auto-upgraded the Go toolchain requirement to1.26.3(minimum required by FSCv0.11.0).How I tested:
Ran the echo FSC integration test from
integration/go_chaincode/with Fabric binaries (FAB_BINS) pointing to Fabric v3.1.4:Result:
Does this PR introduce a user-facing changes and/or breaks backward compatability?:
Yes. Any user currently using FPC with FSC must update their code:
Import paths - FPC service and topology helpers have moved out
of FSC:
github.com/hyperledger-labs/fabric-smart-client/platform/fabric/services/fpcgithub.com/hyperledger/fabric-private-chaincode/extension/fsc/platform/fabric/services/fpcgithub.com/hyperledger-labs/fabric-smart-client/integration/nwo/fabric/topology(FPC helpers)github.com/hyperledger/fabric-private-chaincode/extension/fsc/integration/nwo/fabric/topologygithub.com/hyperledger-labs/fabric-smart-client/platform/fabric/sdkgithub.com/hyperledger-labs/fabric-smart-client/platform/fabric/sdk/digNew dependency - Add
extension/fscto yourgo.mod: require github.com/hyperledger/fabric-private-chaincode/extension/fsc vPlatform factory registration - Tests must now explicitly register the FPC platform factory (previously done implicitly by FSC):
where fpcnwo is:
import fpcnwo "github.com/hyperledger/fabric-private-chaincode/extension/fsc/integration/nwo/fabric/fpc"