Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

adecaro
Copy link
Contributor

@adecaro adecaro commented Aug 13, 2025

This PR does the following:

  • It switches to Gurvy-based cuvers
  • It cleans up the deserialization process

@adecaro adecaro added this to the Q3/25 milestone Aug 13, 2025
@adecaro adecaro self-assigned this Aug 13, 2025
@adecaro adecaro added the enhancement New feature or request label Aug 13, 2025
@adecaro adecaro linked an issue Aug 13, 2025 that may be closed by this pull request
@adecaro adecaro changed the title deprecate the problematic curves, must fix the unit-tests deprecate the use of some mathlib curves #1203 Aug 13, 2025
@adecaro adecaro force-pushed the 1203-deprecate-the-use-of-some-mathlib-curves branch from ebdcc92 to a1fa6f9 Compare August 13, 2025 05:10
@adecaro
Copy link
Contributor Author

adecaro commented Aug 13, 2025

@ale-linux @mbrandenburger , after this gets in, I'll rework #1147 to test for race conditions the curves we use.

@adecaro adecaro force-pushed the 1203-deprecate-the-use-of-some-mathlib-curves branch from 87b7be1 to ee53699 Compare August 17, 2025 06:47
@adecaro adecaro marked this pull request as draft August 17, 2025 06:47
@adecaro adecaro force-pushed the 1203-deprecate-the-use-of-some-mathlib-curves branch 5 times, most recently from 0273b97 to ea48e72 Compare September 3, 2025 08:22
@adecaro adecaro marked this pull request as ready for review September 4, 2025 05:18
Copy link
Member

@mbrandenburger mbrandenburger left a comment

Choose a reason for hiding this comment

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

Great PR! Thanks @adecaro


"github.com/IBM/idemix"
math3 "github.com/IBM/mathlib"
mathlib "github.com/IBM/mathlib"
Copy link
Member

Choose a reason for hiding this comment

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

probably this alias is not even needed anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it does because the go module has mathlib but the files have math as package

DefaultTMSOpts: common.TMSOpts{TokenSDKDriver: fabtokenv1.DriverIdentifier},
SDKs: []nodepkg.SDK{&ffabtoken.SDK{}},
FSCLogSpec: "token-sdk=debug:fabric-sdk=debug:info",
// FSCLogSpec: "debug",
Copy link
Member

Choose a reason for hiding this comment

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

this looks very repetitive; maybe worth refactoring in another PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay

@@ -0,0 +1 @@
Z�QH�"��>�! C�D;�F�>cP�jy��5 No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

I am wondering why the revocation key is stored as a beautiful pem, whereas the issuer keys are dumped into the files are pure binary.

package testdata

//go:generate idemixgen ca-keygen --output ./bls12_381_bbs/ca --curve BLS12_381_BBS --aries
//go:generate idemixgen signerconfig --ca-input ./bls12_381_bbs/ca --output ./bls12_381_bbs/idemix --admin -u example.com -e alice -r 150 --curve BLS12_381_BBS --aries
Copy link
Member

Choose a reason for hiding this comment

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

--curve BLS12_381_BBS can we use the non-gurvey curve here because both are compatible?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

exactly, they are. I left like this to make sure this remains

var err error
fakeSigningIdentity = &mock.SigningIdentity{}
ipk, err := os.ReadFile("./testdata/idemix/msp/IssuerPublicKey")
ipk, err := os.ReadFile("./testdata/bls12_381_bbs/idemix/msp/IssuerPublicKey")
Copy link
Member

Choose a reason for hiding this comment

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

maybe a good idea to move ./testdata/bls12_381_bbs/idemix/ into a constant and use it throughout this test.


func prepareZKTransfer() (*transfer.Prover, *transfer.Verifier) {
pp, err := v1.Setup(32, nil, math.FP256BN_AMCL)
pp, err := v1.Setup(32, nil, math.BN254)
Copy link
Member

Choose a reason for hiding this comment

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

this might be another candidate math.BN254 to move into a constant for this package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Comment on lines +9 to +10
//go:generate idemixgen ca-keygen --output ./bls12_381_bbs/ca --curve BLS12_381_BBS --aries
//go:generate idemixgen signerconfig --ca-input ./bls12_381_bbs/ca --output ./bls12_381_bbs/idemix --admin -u example.com -e alice -r 150 --curve BLS12_381_BBS --aries
Copy link
Member

Choose a reason for hiding this comment

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

I am wondering if the auditor and the validator could share the generated testdata?

tables,
secondcache.NewTyped[bool](5000),
secondcache.NewTyped[[]byte](5000),
cache2.NewNoCache[bool](),
Copy link
Member

Choose a reason for hiding this comment

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

Just reading this line - I am a bit clueless what is instantiated here a new no cache from the cache2 package?

Copy link
Member

Choose a reason for hiding this comment

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

As this is the constructor NewCachedIdentityStore, shouldn't it use the ristretto-based cache impl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, will fix

// therefore we need to check more often before the timeout happens
dbChannel := make(chan common.StatusEvent, 1)
defer close(dbChannel)

Copy link
Member

Choose a reason for hiding this comment

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

who is closing the channel?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so, checking the documentation I found that closing should be used just for termination signaling not for resources release. So, closing earlier the channel can generate a panic on the db side when trying to push an event.

@mbrandenburger mbrandenburger self-requested a review September 5, 2025 08:18
Copy link
Member

@mbrandenburger mbrandenburger left a comment

Choose a reason for hiding this comment

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

LGTM % the my comments above :)

Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
Signed-off-by: Angelo De Caro <[email protected]>
…stener is not removed yet due to locking

Signed-off-by: Angelo De Caro <[email protected]>
@adecaro adecaro force-pushed the 1203-deprecate-the-use-of-some-mathlib-curves branch from d0f6251 to 182c8ba Compare September 7, 2025 09:07
Signed-off-by: Angelo De Caro <[email protected]>
@adecaro adecaro merged commit c7632e9 into main Sep 10, 2025
52 checks passed
@adecaro adecaro deleted the 1203-deprecate-the-use-of-some-mathlib-curves branch September 10, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deprecate the use of some mathlib curves
2 participants