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

Add DNC-based implementation, update tests and overrides #2

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

mark-moir
Copy link
Owner

The main purpose of this PR is to add a second implementation of CryptoInterface based on the DockNetwork crypto (DNC) library, thus evaluating the ability of our abstraction to be supported over another library. It is mostly successful, in that almost all features can be supported by both the cryptography library for AnonCreds v2 (AC2C) and DNC (exceptions noted below).

We also override some tests (more detail below) due to differences between the CryptoInterfaces implemented over AC2C and DNC, respectively:

  • AC2C does not yet fully support Verifiable Encryption (in particular, decryption and verification of decryption are not yet implemented). For this reason, tests involving Verifiable Encryption are overridden to Fail for now. Although the tests would fail even if not overridden, overriding them saves testing time, and enables us to filter out expected test failures and provide tailored explanation about the reason for failure in test output.
  • AC2C panics in some cases when (deliberately) misused by our tests, such as failing to provide a required accumulator witness. The panic causes the tests to fail, but the main purpose of the test (in this example) is to show that a Prover who lacks an updated witness cannot create a proof and convince a Verifier; the panic might be undesirable from a usability perspective, but it does not represent a failure in terms of the main purpose of the test. Such tests are therefore overridden to Skip.
  • DNC has changed to interpret ranges as right-open (see this discussion), so that a range from n to n+1 is now considered to include only n. This caused DNC tests to fail because it refuses to create a range proof for such intervals. This highlights that our original abstraction is not sufficiently flexible to accommodate underlying cryptographic libraries that interpret ranges differently. We plan to address this in future work. In the meantime, the relevant test is overridden to Skip.

This PR also includes:

  • some refactoring for readability
  • some renaming for clarity
  • some improvements to our test framework and its documentation, including about overriding tests
  • modified tests, particularly to eliminate tests that include range proofs that specify ranges that include only a single value (ZKPs make no sense in this case because the single-value range reveals the value of any attribute that satisfies it)
  • added tests of revocation and subsequent witness update for unrevoked credentials

* Add DNC-based implementation, update tests and overrides

* Pre-release tweaks (#177)

* Review: small cleanups in comments and imports

* Remove redundant serde_cbor import

* new module structure (#183)

* vcp/impl submodules : zkp_backends and common

* reorganize tests/vcp (#184)

* also fix failing catch_unwind_test.rs (failed because of module location change)

* more reorg of tests/vcp (#187)

* move stuff from tests/vcp/direct_test.rs and tests/vcp/test_framework/utils.rs into new tests/vcp/run_json_tests.rs

* renamed:    tests/vcp/direct_test.rs -> tests/vcp/per_crypto_library_test.rs

* renamed    tests/vcp/impl/zkp_backends/ac2c/direct_test.rs -> tests/vcp/per_crypto_library_test_ac2c.rs

* moved stuff in direct_test_handler.rs to tests/vcp/per_crypto_library_test.rs

* renamed    tests/vcp/test_framework/test_framework_test.rs -> tests/vcp/test_framework_test.rs

* add 'pub' to a module (consistency and to prepare for future use)

* moved things out of tests/vcp/test_framework_test.rs into tests/vcp/test_framework_test_ac2c.rs test result: ok. 107 passed; 0 failed; 6 ignored; 0 measured; 7 filtered out; finished in 1698.49s

* added tests/vcp/test_framework_test_dnc.rs
test result: ok. 113 passed; 0 failed; 6 ignored; 0 measured; 7 filtered out; finished in 1716.75s
(previously 107 passed)

* move existing files into new dirs: tests/vcp/test_framework/tests tests/vcp/zkp_functionality_tests

* renames

* move tests/util/mod.rs into tests/vcp/api_test.rs

* renamed:    tests/vcp/test_data.rs -> tests/vcp/data_for_tests.rs

* renames

* split zkp_functionality_tests/run_json_tests.rs into ../run_json_tests_ac2c.rs and ../run_json_tests_dnc.rs

* move run_json_test_ac2c out of tests/vcp/zkp_functionality_tests/run_json_tests_ac2c.rs into new tests/vcp/zkp_functionality_tests/run_json_tests_ac2c.rs (because it is used in different tests in different modules)

* move run_json_test_dnc out of tests/vcp/zkp_functionality_tests/run_json_tests_dnc.rs into new tests/vcp/zkp_functionality_tests/run_json_tests_dnc.rs (because it is used in different tests in different modules)

* removed unnecessary internal modules in tests/vcp/zkp_functionality_tests/run_json_tests_[ac2c|dnd].rs

* cleaned up tests/vcp/json_test_runner_[ac2c|dnc].rs

* reverted run_json_framework_tests_[ac2c|dnc] to run_json_tests_[ac2c|dnc]

* Updated README with new info and locations (#188)

* Updated README with new info and locations (still more TODO, e.g., range MAX)

* Address review comments on #188, and remaining TODOs (#190)

* Address review comments on PR #188, address remaining TODOs

* Review: self-review of my own review fixes

* Re-export to markdown

---------

Co-authored-by: mark-moir <[email protected]>
Co-authored-by: Mark Moir <[email protected]>

---------

Co-authored-by: Harold Carr <[email protected]>

Signed-off-by: Mark Moir <[email protected]>
@mark-moir mark-moir merged commit 98a34a5 into vcp-main Feb 10, 2025
@mark-moir mark-moir deleted the add-dnc-support-improve-tests branch February 10, 2025 20:36
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.

1 participant