Skip to content
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

Updates for python wrapper adding support for revocation status list changes #145

Merged

Conversation

dbluhm
Copy link
Member

@dbluhm dbluhm commented Mar 16, 2023

Opening this early. This PR updates the python wrapper to accommodate changes made at the rust layer for revocation status lists.

Feedback and corrections welcome. I'll continue working on this by updating the test.py file to bring it in line with the anoncreds_demo.rs.

@dbluhm dbluhm force-pushed the feature/python-rev-status-lists branch from 225887e to 0d584c7 Compare March 16, 2023 18:58
@andrewwhitehead
Copy link
Member

You might want to integrate these changes as well? hyperledger/indy-shared-rs#26

@dbluhm
Copy link
Member Author

dbluhm commented Mar 16, 2023

You might want to integrate these changes as well? hyperledger/indy-shared-rs#26

That seems like a good idea! I'll check it out.

@berendsliedrecht
Copy link
Contributor

Awesome work! There was a slight misunderstanding on my side related to this work, I also made a draft for it as I was stuck on some other work. #146 is the related PR.

Maybe there are some things that you can take from my PR, but I will abandon mine so the work can continue here.

@dbluhm
Copy link
Member Author

dbluhm commented Mar 17, 2023

Shoot, apologies for the miscommunication -- duplicating work is less than ideal. It looks like you got further along than I did. I'll see what I can do to combine efforts here! Thanks for the heads up, @blu3beri

@dbluhm
Copy link
Member Author

dbluhm commented Mar 17, 2023

@blu3beri I merged in your commit from #146; I'll follow this up by integrating hyperledger/indy-shared-rs#26 as @andrewwhitehead suggested

@dbluhm
Copy link
Member Author

dbluhm commented Mar 20, 2023

@blu3beri After combining everything, demo/test.py is currently failing with the following error:

Traceback (most recent call last):
  File "/home/dbluhm/dev/anoncreds/anoncreds-rs/wrappers/python/demo/test.py", line 192, in <module>
    verified = presentation.verify(
               ^^^^^^^^^^^^^^^^^^^^
  File "/home/dbluhm/dev/anoncreds/anoncreds-rs/wrappers/python/anoncreds/types.py", line 593, in verify
    return bindings.verify_presentation(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dbluhm/dev/anoncreds/anoncreds-rs/wrappers/python/anoncreds/bindings.py", line 803, in verify_presentation
    do_call(
  File "/home/dbluhm/dev/anoncreds/anoncreds-rs/wrappers/python/anoncreds/bindings.py", line 404, in do_call
    raise get_current_error(True)
anoncreds.error.AnoncredsError: Revocation Registry not provided for ID and timestamp: RevocationRegistryId("mock:uri:revregid"), 12

To see if this was caused by a change I introduced, I checked out 4a019cb from your branch and had the same issue. Is this expected?

Update: Nevermind, I've spotted the issue and it appears to just be a typo 🙂 I'll continue working on updating the test.py

@dbluhm dbluhm marked this pull request as ready for review March 20, 2023 22:47
@dbluhm
Copy link
Member Author

dbluhm commented Mar 20, 2023

The python wrapper demo is now functioning as expected; I think this is ready for a review now. Thanks for all the feedback up to this point already 🙂

Comment on lines -78 to +85
Some(revoked.as_slice().iter().map(|r| *r as u32).collect())
} else {
None
} else {
Some(revoked.as_slice().iter().map(|r| *r as u32).collect())
};
let issued: Option<BTreeSet<u32>> = if issued.is_empty() {
Some(issued.as_slice().iter().map(|r| *r as u32).collect())
} else {
None
} else {
Some(issued.as_slice().iter().map(|r| *r as u32).collect())
Copy link
Member Author

Choose a reason for hiding this comment

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

I believe this condition was flipped around; if the revoked list was empty, return the list mapped to a BTreeSet, else, return None. So we were always getting back empty revoked lists.

Copy link
Contributor

Choose a reason for hiding this comment

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

@whalelephant I believe @dbluhm is correct here, but just to double check with you.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dbluhm @blu3beri you are correct!

Copy link
Contributor

@berendsliedrecht berendsliedrecht left a comment

Choose a reason for hiding this comment

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

LGTM! Might be good is someone from the ACA-Py team gives this a review? Maybe @andrewwhitehead ?

Comment on lines -78 to +85
Some(revoked.as_slice().iter().map(|r| *r as u32).collect())
} else {
None
} else {
Some(revoked.as_slice().iter().map(|r| *r as u32).collect())
};
let issued: Option<BTreeSet<u32>> = if issued.is_empty() {
Some(issued.as_slice().iter().map(|r| *r as u32).collect())
} else {
None
} else {
Some(issued.as_slice().iter().map(|r| *r as u32).collect())
Copy link
Contributor

Choose a reason for hiding this comment

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

@whalelephant I believe @dbluhm is correct here, but just to double check with you.

rev_status_lists,
)

print(verified)
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be removed.

@berendsliedrecht berendsliedrecht merged commit 5ac823e into hyperledger:main Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants