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

Fix revocation accum sync when endorsement txn fails #3547

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jamshale
Copy link
Contributor

@jamshale jamshale commented Feb 28, 2025

When the endorsement transaction fails, create an event in the response handler. Check the rev_reg_defs on the ledger to find the problem entry. Create a recovery transaction and update the local wallet and re-send the transaction to the endorser.

Retry the same accumulator error 5 times and then log the error.

Note: The fix-revocation-entry-state endpoint with create transaction still doesn't create an endorsed transaction. I didn't want to try a change that for this commit which needs to be backported. Also anoncreds (did:sov) likely has the same problem and this does not attempt to fix it here. Only for indy revocation.

@ianco ianco self-requested a review March 3, 2025 20:04
@jamshale jamshale force-pushed the failed-revocation-entry-with-endorser branch 2 times, most recently from 4de0aca to eb5fb83 Compare March 4, 2025 19:36
@jamshale jamshale changed the title [WIP] Fix revocation accum sync when endorsement txn fails Fix revocation accum sync when endorsement txn fails Mar 4, 2025
ianco
ianco previously approved these changes Mar 5, 2025
Copy link
Contributor

@ianco ianco left a comment

Choose a reason for hiding this comment

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

LGTM

@jamshale jamshale force-pushed the failed-revocation-entry-with-endorser branch from 2ed99c6 to d08add8 Compare March 5, 2025 17:21
Signed-off-by: jamshale <[email protected]>

Refactor cognitive complexity

Signed-off-by: jamshale <[email protected]>

Add happy path unit test

Signed-off-by: jamshale <[email protected]>

Raise a responder None error

Signed-off-by: jamshale <[email protected]>

Remove unused duplicated funtion

Signed-off-by: jamshale <[email protected]>
@jamshale jamshale force-pushed the failed-revocation-entry-with-endorser branch from bf34599 to 6afa43a Compare March 5, 2025 17:26
@jamshale
Copy link
Contributor Author

jamshale commented Mar 5, 2025

Squash rebased and added a happy path unit test.

@jamshale jamshale requested a review from esune March 5, 2025 18:06
Copy link

sonarqubecloud bot commented Mar 5, 2025

@ianco
Copy link
Contributor

ianco commented Mar 5, 2025

I'm getting weird behaviour with the alice/faber demo.

If I issue a credential and then request a proof, the proof validates. If I revoke the credential and then ask for a proof again, the proof fails (as expected).

However if I issue a second (or third) credential and then ask for a proof, the proof still fails (Proof = false) even though the holder is presenting a valid/non-revoked credential.

This is happening on the aca-py main branch as well (not just this PR) however this functionality used to work in the demo ...

Comment on lines +645 to +648
# We know this needs endorsement
endorser_did, connection = await self._get_endorser_info()
rev_reg_record, recovery_txn = await sync_accumulator(session=session)
await create_and_send_endorser_txn()
Copy link
Member

Choose a reason for hiding this comment

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

If an endorser is not required (i.e.: the agent is set-up with higher privileges than author), how is this handled? In our scenarios we will likely only ever use an endorser to get transactions approved to be written on the ledger, but I think it may not be the only scenario?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case it would go through the existing re-sync and re-try flow. Also the manual fix-revocation-state could be applied for no endorser, although it shouldn't be needed. https://github.com/openwallet-foundation/acapy/blob/main/acapy_agent/revocation/models/issuer_rev_reg_record.py#L336

Copy link
Contributor

Choose a reason for hiding this comment

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

If the endorser_did isn't configured then aca-py should try to write the ledger transaction directly.

@jamshale
Copy link
Contributor Author

jamshale commented Mar 5, 2025

I'm getting weird behaviour with the alice/faber demo.

If I issue a credential and then request a proof, the proof validates. If I revoke the credential and then ask for a proof again, the proof fails (as expected).

However if I issue a second (or third) credential and then ask for a proof, the proof still fails (Proof = false) even though the holder is presenting a valid/non-revoked credential.

This is happening on the aca-py main branch as well (not just this PR) however this functionality used to work in the demo ...

I wonder if the demo isn't selecting a valid credential anymore. I would think an automated test would have detected this scenario.

I'll try and manually test without the demo.

@ianco
Copy link
Contributor

ianco commented Mar 5, 2025

I wonder if the demo isn't selecting a valid credential anymore. I would think an automated test would have detected this scenario.

I verified that it's selecting a valid credential. I also tried manually deleting the revoked credential(s) and the proof still failed.

@jamshale
Copy link
Contributor Author

jamshale commented Mar 5, 2025

I verified that it's selecting a valid credential. I also tried manually deleting the revoked credential(s) and the proof still failed.

That's not good... I'm not sure when this happened or why a test isn't catching it.

@ianco
Copy link
Contributor

ianco commented Mar 5, 2025

I verified that it's selecting a valid credential. I also tried manually deleting the revoked credential(s) and the proof still failed.

That's not good... I'm not sure when this happened or why a test isn't catching it.

I can look into this issue, it's not related to this PR (I tested it on the aca-py main branch as well)

@jamshale
Copy link
Contributor Author

jamshale commented Mar 5, 2025

There was something merged just yesterday related to presentation. I'll try and isolate when this happened.

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.

3 participants