Repository Modernization Plan - Phase 4A: Remove Legacy dlog Scheme and weak-bb Package#78
Open
Soumya8898 wants to merge 8 commits into
Open
Repository Modernization Plan - Phase 4A: Remove Legacy dlog Scheme and weak-bb Package#78Soumya8898 wants to merge 8 commits into
Soumya8898 wants to merge 8 commits into
Conversation
added 7 commits
June 7, 2026 22:53
The weak-bb (Weak Boneh-Boyen) package was only referenced in
unreachable code paths. Both aries/revocation.go and
dlog/crypto/revocation_authority.go called WbbKeyGen in an else
branch that always returned an error ('the specified revocation
algorithm is not supported'). The only supported algorithm is
AlgNoRevocation, which never uses weak-bb.
Changes:
- Delete bccsp/schemes/weak-bb/ entirely
- Remove dead else branch from aries RevocationAuthority.Sign()
- Remove dead else branch from dlog createCRI()
- Remove weak-bb test section from dlog idemix_test.go
Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
Replace the dlog Translator interface (G1ToProto/G1FromProto) with direct G1.Bytes()/curve.NewG1FromBytes() calls. The Translator was a trivial indirection — Gurvy's G1ToProto just splits G1.Bytes() into X and Y halves, and G1FromProto concatenates them back. - handlers/nym.go: NymSecretKey, nymPublicKey, NymKeyDerivation, NymPublicKeyImporter, NymKeyImporter now use *math.Curve instead of idemix.Translator - keystore/kvsbased.go: Store nym PK as raw []byte instead of *amcl.ECP proto; remove dlog/amcl imports Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
- bccsp/bccsp.go: Delete the legacy New() factory function entirely. Simplify NewAries() to no longer take a Translator parameter. - msp/idemixmsp.go: NewIdemixMsp() now uses Aries (BBS+) directly instead of the legacy dlog scheme. NewIdemixMspAries() unchanged. Remove amcl import. - tools/idemixgen/main.go: Remove all legacy curve options, the --aries flag (always Aries now), the Translator interface, and the dlog Idemix struct usage. Aries-only with BLS12_381_BBS. - tools/idemixgen/idemixca/idemixca.go: Delete (legacy-only). The Aries variant (iedmixca_aries.go) remains. Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
Delete the entire bccsp/schemes/dlog/ directory: - bridge/ (adapter from handlers to dlog crypto) - crypto/ (core CL-signature implementation + protobuf) - crypto/translator/amcl/ (point serialization + proto types) Delete legacy integration tests: - bccsp/bccsp_test.go (tested the legacy New() factory) - bccsp/legacy_test.go (legacy-specific test scenarios) The only remaining crypto scheme is Aries (BBS+). Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
- Add bccsp/helpers_test.go with NewDummyKeyStore() helper (was previously defined in the deleted bccsp_test.go) - Update aries_test.go: remove amcl/translator import and usage, update NewAries() calls to new signature (no translator param) Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
- nymsigner_test.go: replace amcl.Fp256bn with math.Curves, update NewNymSecretKey/NewNymPublicKey calls to new signatures - signer_test.go: same pattern — remove amcl import, use BLS12_381_BBS - user_test.go: replace Translator field with Curve field, remove amcl Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
- kvsbased_test.go: use BLS12_381_BBS curve, remove Translator field, fix duplicate Curve field, update NewNymSecretKey call - perf_test.go: remove amcl import, replace idemix.New with NewAries - smartcard_test.go: use BLS12_381_BBS curve, fix NewNymPublicKey and NewNymSecretKey calls to new signatures - msp/idemixmsp_test.go: replace dlog issuer key generation with Aries issuer for the bad-IPK test case - idemixca_test.go: remove legacy TestIdemixCa test, remove dlog imports Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
- Delete msp/audit_legacy_test.go (used legacy testdata/idemix/) - Delete msp/idemixmsp_test.go (used legacy testdata/idemix/) - Delete msp/testdata/idemix/ (legacy scheme fixtures) - Add msp/helpers_test.go (setupWithTypeAndVersion, getDefaultSigner) - Delete bccsp/smartcard_test.go (used legacy FP256BN testdata) - Delete bccsp/testdata/ (legacy smartcard fixtures) - Fix user_test.go: update expected Bytes() to match BLS12_381_BBS The Aries-specific tests (idemixmsp_aries_test.go, audit_aries_test.go, schemes/aries/smartcard_test.go) provide full coverage of these paths. Signed-off-by: Soumya Mohapatra <mohapatras@microsoft.com>
2becba5 to
fc80bf5
Compare
Contributor
Author
|
@adecaro as you already raised a PR after adding the modernization, I will check like what other things that can be added in our modernization plan, so for the next subphase for this phase 4, I am not keeping that. Will ensure to add those in next phases. Already added in the description like whole plan for this sub-phase of phase 4, but if any changes that I can add here please let me know. Thanks🙏 |
Member
|
Hi @Soumya8898 , we need to pause removing these schemes because we might still need unfortunately for retro compatibility |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove Legacy dlog Scheme and weak-bb Package
Fixes #63
Motivation
The Idemix repository historically supported two cryptographic schemes:
The dlog scheme had been functionally superseded by Aries for over a year. All downstream consumers (Hyperledger Fabric) have migrated to the Aries path. Keeping dlog around meant:
Translatorabstraction layer that converted between math library types and legacy protobuf point representationsweak-bbpackage whose only call sites were unreachable dead codeWhat Was Removed
weak-bb (Weak Boneh-Boyen signatures)
A standalone package implementing
WbbKeyGen,WbbSign, andWbbVerify. It was designed for epoch-key generation in revocation. In practice, both the Aries and dlogRevocationAuthority.Sign()methods only supportedAlgNoRevocation, which uses a dummy G2 generator as the epoch key — never calling weak-bb. Theelsebranches that invokedWbbKeyGenwere guarded by error returns making them unreachable dead code.dlog scheme (CL-signature implementation)
The entire
bccsp/schemes/dlog/tree:idemix.proto)handlerspackage interface to dlog-specific crypto calls*math.G1/*math.G2and protobufECP/ECP2types. This was theTranslatorinterface used throughout handlers and keystoreLegacy factory and API surface
bccsp.New()— the factory function that wired up the dlog scheme via bridge adaptersNewIdemixMsp()previously created a dlog-backed MSP using theFP256BN_AMCLcurveidemixgenCLI supported 8 legacy curves and a--ariesflag to switch between schemesWhat Was Added/Changed to Handle the Removal
Translator elimination
The
Translatorinterface (G1ToProto/G1FromProto) was an indirection that the Aries path didn't need — for Gurvy-based curves,G1ToProtoliterally splitsG1.Bytes()into two halves, andG1FromProtoconcatenates them back. We replaced all Translator usage with directG1.Bytes()andcurve.NewG1FromBytes()calls:handlers/nym.go—NymSecretKeyandnymPublicKeynow carry a*math.Curveinstead of aTranslatorkeystore/kvsbased.go— Stores nym public keys as raw[]byteinstead of*amcl.ECPprotoSimplified API
NewAries(keyStore, curve, exportable)— no longer takes a Translator parameterNewIdemixMsp()andNewIdemixMspAries()both create Aries-backed MSP instances usingBLS12_381_BBSidemixgenCLI is Aries-only: hardcoded to BLS12_381_BBS, no curve selection, no--ariesflagRevocation cleanup
RevocationAuthority.Sign()now validatesalg == AlgNoRevocationupfront and returns the error immediately for unsupported algorithms, instead of branching into dead code paths.Test infrastructure
msp/helpers_test.goandbccsp/helpers_test.goprovide shared test setup functionsBLS12_381_BBScurve directlytestdata/idemix/) removed; Aries fixtures (testdata/aries/) provide full coverageResult
The repository now has a single crypto scheme path (Aries/BBS+), no dead code, no unnecessary abstraction layers, and all 12 test packages pass cleanly.