-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revocation List Model #37
Revocation List Model #37
Conversation
629ba44
to
b16c197
Compare
2a5ee83
to
39b9138
Compare
Hey @TimoGlastra actually, I have just checked the specs on your PR Are these the field names that should be used instead? If so I will need to update this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think overall this looks good to me, but I would like @blu3beri to also take a close look at this PR
I think the only difference is the currentAccumulator field right? |
yep, but that struct serialisation is done in Ursa. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some small cleanup thingies, nothing major. Also not too familiar with the revocation changes, but I think combined with @TimoGlastra we have a full code and spec review :).
self.revocation_list.clone() | ||
} | ||
|
||
pub fn new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I prefer to use try_new
when it returns a Result<T>
. A bit more explicit for the caller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the pattern in impl_anoncreds_object_identifier
for new()
here, I don't mind either way but we might want to align similar methods?
@blu3beri
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we can just keep it at new
. Consistency is more important IMO.
let e = match *element.as_ref() { | ||
true => 1, | ||
false => 0, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let e = match *element.as_ref() { | |
true => 1, | |
false => 0, | |
}; | |
let e = element as i32; |
Not 100% sure what e
is supposed to be. But casting to a number will convert it to 0/1.
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
formatter.write_str("a seq containing revoation state, i.e. [1, 0, 1]") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { | |
formatter.write_str("a seq containing revoation state, i.e. [1, 0, 1]") | |
} | |
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { | |
write!(f, "a seq containing revoation state, i.e. [1, 0, 1]") | |
} |
Do you know if there is a difference or will this only add string interpolation? Never used formatter.write_str
like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are the same, see https://doc.rust-lang.org/std/fmt/struct.Formatter.html#method.write_str
anoncreds/src/services/prover.rs
Outdated
IssuanceType::ISSUANCE_ON_DEMAND => { | ||
bitvec![1; list_size] | ||
} | ||
IssuanceType::ISSUANCE_BY_DEFAULT => { | ||
bitvec![0; list_size] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to implement Into<u8>
for IssuanceType
to do the conversion to 1 or 0 there.
|
||
Ok(CredentialRevocationState { | ||
witness, | ||
rev_reg: CryptoRevocationRegistry::from(rev_reg_delta.value.clone()), | ||
timestamp, | ||
rev_reg: rev_reg_list.into(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we not change the type of the state to contain just the rev_reg_list
? Now we have the timestamp in there twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rev_reg_list
is of type RevocationList
which fields such as the revocation_list
which is not needed.
CredentialRevocationState
does not contain RevocationList
so the timestamp is only there once.
Ah okay, would it be easy to just assign it to a different key? (that's what I would do in JS, but rust is different lol) |
@TimoGlastra , |
We can create PRs for Ursa with the fixes, but creating a new release would be rather difficult as the pipeline is kind of dead. We can use a git within |
But as the accum is just a property, isn't there a way to just pick the |
Because the Struct What we could do is to serialise the struct into string, deserialise into another struct that we have in this repo from string and make that field public. thoughts? |
That sounds fine to me 👍 |
Signed-off-by: bwty <whalelephant@users.noreply.github.com>
Signed-off-by: bwty <whalelephant@users.noreply.github.com>
Signed-off-by: bwty <whalelephant@users.noreply.github.com>
Signed-off-by: bwty <whalelephant@users.noreply.github.com>
Signed-off-by: bwty <whalelephant@users.noreply.github.com>
3201c90
to
3c650af
Compare
Signed-off-by: bwty <whalelephant@users.noreply.github.com>
3c650af
to
1c380ee
Compare
@TimoGlastra actually we cannot construct |
Hmm ok. Let's keep it at @whalelephant any other outstanding things, or can the PR be merged? |
Can merge I think, issue at #51 |
This is the first PR introducing RevocationList model outlined in hyperledger/anoncreds-spec#108 and #24.
RevocationList
struct with serde to match outlined json, with testscreate_or_update_revocation_state
function for prover and FFI. This now takes in either 1RevocationList
to create or optionally an old one, does a comparison and update the revocation state.anoncreds_demo
Additional documentation is added to highlight the unchecked interval, which I am looking into for #36 and #41