orru
запушил(а) mu/draft-v3 в SigmaProtocol/cmz
5ac5c724ce chore: patch sigma-compiler, sigma-proofs and spongefish to their mu/draft-v3 branches
8a7d44d201 fix: omit the client proof when the statement has no content
d9752fdad1 feat: share the issuer pubkey element between show and issue scopes
The issuer public key component for a given (credential type, attribute)
is one value, but the show scope and the issue scope mint separate
identifiers for it (`X_show_Hattr_*` and `X_iss_Hattr_*`), so a protocol
that shows and issues the same credential type carried it twice -- two
compressions and two 32-byte encodings per relation, for one value.
The first scope to declare it now owns the element and later ones are
tagged `dedup`, sharing it whenever the values agree at run time. They
need not: `handle_update` gives the shown credential the caller's old
public key and the issued one the server's current key, so a rotation
makes them genuinely different, and then each simply keeps its own
element.
For a three-attribute credential shown and reissued, this is three
elements per client relation, on both sides.
Requires the `dedup` tag from sigma-compiler, and changes the encoded
instance, hence the challenge: prover and verifier must be upgraded
together.
09fd602c41 feat: declare B_generator as the group generator
sigma-proofs reserves element index 0 of every instance for
`G::generator()`, which it validates but never serializes. `B_generator`
*is* `G::generator()` (`CMZBasepoints::init` sets it so), but it was
allocated an ordinary element, so every relation cmz emits paid a point
compression and 32 bytes of instance encoding for it -- on every prove
and every verify, while the reserved slot sat unused.
Declare it `generator` and it lands on index 0 instead. It keeps `cind`:
the range-proof transform takes the first two `cind` points, sorted, as
its Pedersen bases, and those are `A_generator` and `B_generator`.
It stays an `Instance` field, deliberately. The generated code still
assigns it, and `LinearRelation::set_element` rejects an assignment that
conflicts with the generator already at index 0 -- so if `B_generator`
ever stops being the generator, it fails loudly instead of silently
proving a different statement.
Requires the `generator` tag from sigma-compiler, and changes the encoded
instance, hence the challenge: prover and verifier must be upgraded
together.
db5a2b8552 refactor: build the basepoints only on the call that loads them
`cmz_group_init` built a `CMZBasepoints` and handed it to `load_bp`, which
then dropped it on the floor unless the map was empty -- and `load_bp`
cloned it when it was not. Callers invoke this on every request, so take
a closure and construct only on the call that actually populates the map.
By itself that is a shape fix, not a measured win: `wnaf_is_constant_time`
is not a default feature and nothing enables it, so `CMZBasepoints` is
`{A_, B_}` and construction plus clone costs about 8ns. It matters under
that feature, where construction is two WnafBase tables.
The cost callers actually pay is the argument, not the call:
`cmz_group_init(G::hash_from_bytes::<Sha512>(...))` evaluates the
hash-to-curve eagerly, at roughly 4.7us per request, and nothing on the
callee side can reach it. So `cmz_group_init_with` takes the generator as
a closure too, and the hash happens once, on the call that initializes.
Both sides of a round trip call this, so it is roughly 9us a round trip
for a one-word change at each call site. `cmz_group_init` is unchanged.
3 недель назад