Skip to content

🧪 Test script for event-based rev-reg management - #1751

Merged
ff137 merged 41 commits into
masterfrom
feat/rev-reg-events
Aug 26, 2025
Merged

🧪 Test script for event-based rev-reg management#1751
ff137 merged 41 commits into
masterfrom
feat/rev-reg-events

Conversation

@ff137

@ff137 ff137 commented Jul 24, 2025

Copy link
Copy Markdown
Collaborator

Contributes a revocation registry resilience testing script, which tests the new event-driven approach (openwallet-foundation/acapy#3831).


Old NATS events related to revocation registry management:

  • anoncreds::credential-definition::finished -- Initial credential definition event that kicks off the revocation setup process
  • anoncreds::revocation-registry-definition::finished -- Successful storage event for revocation registry definition that triggers creation of revocation list (kept for backwards compatibility, no longer used)
  • anoncreds::revocation-list::finished -- Finished event for revocation list (kept for backwards compatibility, not used in state machine)

New NATS events for tracking automated revocation resource creation:

Revocation registry definition:

  • anoncreds::revocation-registry-definition::create-requested -- Event indicating that creation of a revocation registry definition resource on the ledger is requested
  • anoncreds::revocation-registry-definition::create-response -- Response event that triggers the store event for the revocation registry definition
  • anoncreds::revocation-registry-definition::store-requested -- Event requesting storage of the revocation registry definition result
  • anoncreds::revocation-registry-definition::store-response -- Response event that triggers the finished event and backup creation if it's the first registry

Reovcation list:

  • anoncreds::revocation-list::create-requested -- Event requesting creation of a revocation list
  • anoncreds::revocation-list::create-response -- Response event for revocation list creation
  • anoncreds::revocation-list::store-requested -- Event triggered by create-response to request storage of the revocation list
  • anoncreds::revocation-list::store-response -- Response event that triggers activation if it's for the first registry

Registry activation:

  • anoncreds::revocation-registry::activation-requested -- Event requesting activation of revocation registry, triggered for first registry and during full handling
  • anoncreds::revocation-registry::activation-response -- Response event for revocation registry activation

Full registry handling:

  • anoncreds::revocation-registry::full-detected -- Event indicating revocation registry is full, sets current registry to full, emits event to activate backup, and emits event to create new backup
  • anoncreds::revocation-registry::full-handling-completed -- Event emitted after current registry is set to full (backup activation and new backup creation are queued asynchronously)

Notification if maximum retries gets exceeded:

  • anoncreds::revocation-registry::intervention-required -- Event notifying issuer that manual intervention is required when retries continue to fail

The test script (app/tests/e2e/experimental/rev_reg_resilience_testing/test_rev_reg_resilience.py) is skipped by default as it's only intended for local testing.

It covers 11 different scenarios, each one interrupting the multitenant agent at a different point in the rev reg creation flow, and the test asserts that events recover properly when the agent starts up again, by revoking credentials and proving they are revoked.

The agent must be run at DEBUG log level for the monitor script to successfully detect when to interrupt the agent.

The agent's REGISTRY_SIZE env var can also be decreased to 4, to ensure that backup registries will be created and tested as well. The test script will issue and verify 10 credentials, so a REGISTRY_SIZE < 5 means that both initial registries will fill up, and backup will have to be created and used in order for tests to pass.


Includes some improvement to exception log handling for the acapy errors when agent is interrupted. Also refactors the other experimental test (test_many_revocations.py) to be up to date and usable. Common test fixtures are modularized for better reuse between these modules.

@github-actions

github-actions Bot commented Jul 24, 2025

Copy link
Copy Markdown

Coverage

EKS Regression Test Coverage
FileStmtsMissCoverMissing
app
   main.py80298%121–126
app/models
   issuer.py60198%52
   verifier.py96595%40, 63, 93, 116, 169
app/routes
   connections.py83199%194
   jsonld.py604722%21–91, 100–133
   messaging.py241154%43–52, 83–93
   revocation.py72199%274
   trust_registry.py62297%50–51
app/routes/wallet
   credentials.py855832%58–81, 106–118, 139–150, 175–189, 224–240, 273–290, 315–327, 348–359
   dids.py78396%243–252
app/services
   acapy_ledger.py24196%41
   acapy_wallet.py57493%62, 71, 150–151
   revocation_registry.py1401093%70–71, 308, 401–410
app/services/definitions
   schemas.py56198%59
app/services/issuer
   acapy_issuer_v2.py94199%116
app/services/onboarding
   tenants.py643644%31–111, 147–148
   verifier.py39197%89
app/services/trust_registry
   actors.py106992%95–100, 110, 212–213, 215–220, 287–290
   schemas.py53983%57–63, 90–100
app/services/trust_registry/util
   actor.py31294%27–28
app/services/verifier
   acapy_verifier_v2.py131398%48, 94, 141
app/util
   assert_public_did.py181233%12–32
   credentials.py13285%11, 16
   did.py18194%35
   retry_method.py342429%20–35, 67–112
   save_exchange_record.py12192%27
   string.py15473%15–16, 20, 24
   tenants.py461861%25–31, 46–47, 56–63, 95–96, 102, 132
shared
   log_config.py542063%42–95, 104–111, 153, 162–174
shared/models
   connection_record.py33682%52–61, 89
   credential_exchange.py711086%71–77, 80–82
   protocol.py10190%18
   trustregistry.py70790%22, 44, 83–91
shared/util
   api_router.py14193%17
   mock_agent_controller.py53198%27
   rich_parsing.py8538%10–16
tails/routers
   tails.py101199%27
trustregistry
   crud.py190398%268–270
   db.py39392%25–27
   main.py88891%54–56, 81–83, 120, 138
trustregistry/registry
   registry_actors.py82495%36–38, 57
waypoint
   main.py53198%70
waypoint/services
   nats_service.py139299%217–218
TOTAL461734393% 

Tests Skipped Failures Errors Time
876 48 💤 0 ❌ 0 🔥 2m 55s ⏱️

@github-actions

github-actions Bot commented Jul 24, 2025

Copy link
Copy Markdown

Coverage

EKS E2E Test Coverage
FileStmtsMissCoverMissing
app
   main.py80298%121–126
app/models
   issuer.py60198%52
   verifier.py96595%40, 63, 93, 116, 169
app/routes
   connections.py83199%194
   jsonld.py604722%21–91, 100–133
   messaging.py241154%43–52, 83–93
   revocation.py72199%274
   trust_registry.py62297%50–51
app/routes/wallet
   credentials.py855832%58–81, 106–118, 139–150, 175–189, 224–240, 273–290, 315–327, 348–359
   dids.py78396%243–252
app/services
   acapy_ledger.py24196%41
   acapy_wallet.py57493%62, 71, 150–151
   revocation_registry.py1401093%70–71, 308, 401–410
app/services/definitions
   schemas.py56198%59
app/services/issuer
   acapy_issuer_v2.py94199%116
app/services/onboarding
   tenants.py643644%31–111, 147–148
   verifier.py39197%89
app/services/trust_registry
   actors.py106992%95–100, 110, 212–213, 215–220, 287–290
   schemas.py53983%57–63, 90–100
app/services/trust_registry/util
   actor.py31294%27–28
app/services/verifier
   acapy_verifier_v2.py131398%48, 94, 141
app/util
   assert_public_did.py181233%12–32
   credentials.py13285%11, 16
   did.py18194%35
   retry_method.py342429%20–35, 67–112
   save_exchange_record.py12192%27
   tenants.py461861%25–31, 46–47, 56–63, 95–96, 102, 132
shared
   log_config.py542063%42–95, 104–111, 153, 162–174
shared/models
   connection_record.py33682%52–61, 89
   credential_exchange.py711086%71–77, 80–82
   protocol.py10190%18
   trustregistry.py70790%22, 44, 83–91
shared/util
   api_router.py14193%17
   mock_agent_controller.py53198%27
   rich_parsing.py8538%10–16
tails/routers
   tails.py101199%27
trustregistry
   crud.py190398%268–270
   db.py39392%25–27
   main.py88891%54–56, 81–83, 120, 138
trustregistry/registry
   registry_actors.py82495%36–38, 57
waypoint
   main.py53198%70
waypoint/services
   nats_service.py139299%217–218
TOTAL461733993% 

Tests Skipped Failures Errors Time
876 13 💤 0 ❌ 0 🔥 8m 4s ⏱️

@ff137
ff137 marked this pull request as ready for review August 1, 2025 11:51
@ff137
ff137 force-pushed the feat/rev-reg-events branch from 0dc3533 to 285f066 Compare August 4, 2025 19:14
@ff137
ff137 force-pushed the feat/rev-reg-events branch from 4092b1d to 0e45870 Compare August 7, 2025 18:55
ff137 added 2 commits August 12, 2025 12:59
New env vars:
- ANONCREDS_REVOCATION_SETUP_MAX_RETRY_COUNT, default 3
- ANONCREDS_REVOCATION_SETUP_RETRY_SLEEP_TIME, default 3
- Retry indefinitely, with event expiry timestamps for enhanced recovery
- Improved traceability, logging request_id
@sonarqubecloud

Copy link
Copy Markdown

@ff137 ff137 changed the title 🚧 Improved revocation registry management 🧪 Test script for event-based rev-reg management Aug 26, 2025
@ff137
ff137 requested a review from cl0ete August 26, 2025 07:47
@ff137
ff137 marked this pull request as ready for review August 26, 2025 08:00
@ff137
ff137 merged commit 344dd31 into master Aug 26, 2025
76 checks passed
@ff137
ff137 deleted the feat/rev-reg-events branch August 26, 2025 08:17
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