Skip to content
This repository was archived by the owner on Mar 11, 2024. It is now read-only.
This repository was archived by the owner on Mar 11, 2024. It is now read-only.

About the generation witness for multiple credentials #201

@xvllinihao

Description

@xvllinihao

#Hi there! I am a newbie in Rust and Ursa. Now I am trying to test the revocation part of ursa. I have some trouble issuing multiple credentials. I want to issue two credentials and watch their witness. But I find that the second witness is always generated wrong.

I use 'ursa::cl::mod::Witness::new()' to generate new witness. I checked its source code and find some possible issues.

    let mut issued = if issuance_by_default {
        (1..=max_cred_num)
            .filter(|idx| !rev_reg_delta.revoked.contains(idx))
            .collect::<BTreeSet<u32>>()
    } else {
        BTreeSet::from_iter(rev_reg_delta.issued.iter().cloned())
    };

    issued.remove(&rev_idx);
    for j in issued.iter() {
        let index = max_cred_num + 1 - j + rev_idx;
        rev_tails_accessor.access_tail(index, &mut |tail| {
            omega = omega.add(tail).unwrap();
        })?;
    }

This is the code from 'ursa::cl::mod::Witness::new()' line 693 to line 707. To generate a new witness, we should use all issued credentials ' tails. However, I find that 'rev_reg_delta.issued' only contains the recently issused credential.

    let rev_reg_delta = if issuance_by_default {
        None
    } else {
        let prev_acc = rev_reg.accum;

        rev_tails_accessor.access_tail(index, &mut |tail| {
            rev_reg.accum = rev_reg.accum.add(tail).unwrap();
        })?;

        Some(RevocationRegistryDelta {
            prev_accum: Some(prev_acc),
            accum: rev_reg.accum,
            issued: hashset![rev_idx],
            revoked: HashSet::new(),
        })
    };

This is the code from 'ursa::cl::issuer::Issuer::_new_non_revocation_credential' line 1376-line 1393. The new generated revocation registry delta only contains one issued credential.
image
And here is a screenshot about my output, I issued two credentials (0,1), but the second revocation registry delta only contains one issued credential (1).

So every time I call the function 'Witness::new()', I get the same witness value:

' Witness { omega: PointG2 { point: 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 2 095E45DDF417D05FB10933FFC63D474548B7FFFF7888802F07FFFFFF7D07A8A8 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 1 0000000000000000000000000000000000000000000000000000000000000000 } } '

How can I fix this problem? Can you help me? And If I am wrong, please tell me. Many thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions