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

Rename cl group of contracts to anoncreds #27

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- Identity:
- [DID Methods](design/did-methods.md) - Supported DID method
- [IndyBesu DID Registry](design/indybesu-did-registry.md) - `indybesu` DID Registry
- [CL Registry](design/cl-registry.md)
- [Anoncreds Registry](design/cl-registry.md)
- [Client](design/vdr.md) - design of VDR library

### Migration documents
Expand All @@ -27,7 +27,7 @@
### Development designs

- [Roadmap](./roadmap.md)
- [DID and CL registers approach](./design/registry.md)
- [DID and Anoncreds registers approach](./design/registry.md)
- [Transaction Endorsement](./design/endorsement.md)
- [Contract upgradability](./design/upgradability.md)
- [Legacy identifiers support](./design/legacy-identifiers-support.md)
2 changes: 1 addition & 1 deletion docs/design/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Contract name: **transactionAllowed**
| EthereumExtDidRegistry | changed | any | Get block number of latest DID change |
| EthereumExtDidRegistry | nonce | any | Get nonce to signe for endorsing |

### CL Registry management
### Anoncreds Registry management

| Contract | Method | Required Role | Action Description |
|------------------------------|----------------------------------|-----------------------------|-------------------------------------------------|
Expand Down
2 changes: 1 addition & 1 deletion docs/design/cl-registry.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CL Registry
# AnonCreds Registry

## Schema

Expand Down
Binary file modified docs/design/contracts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/design/contracts.puml
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ package "Smart Contracts" {
component [Universal Did Resolver]
note bottom of [Universal Did Resolver]
Resolve Issuer DID from various DID registries
- used by CL contracts to verify did existence and owner
- used by AnonCreds contracts to verify did existence and owner
end note
}

package "CL" {
package "Anoncreds" {

component [Schema Registry]
note bottom of [Schema Registry]
Store CL schemas
Store AnonCreds schemas
end note

component [Credential Definition Registry]
note top of [Credential Definition Registry]
Store CL Credential Definitions
Store AnonCreds Credential Definitions
end note
}

Expand Down
2 changes: 1 addition & 1 deletion docs/design/did-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Out of box Ledger provides an ability to use one of two supported DID methods: `did:ethr` or `did:indybesu`.

Contracts implementing both methods are deployed on the network and integrated with `CL Registry`.
Contracts implementing both methods are deployed on the network and integrated with `Anoncreds Registry`.

Ledger `permission` related modules are implemented in a way to use **account address** but not a DID.

Expand Down
2 changes: 1 addition & 1 deletion docs/design/endorsement.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function changeOwnerSigned(address identity, uint8 sigV, bytes32 sigR, bytes32 s

TO BE defined later.

### CL Registry (Schema / Credential Definition)
### Anoncreds Registry (Schema / Credential Definition)

#### Flow

Expand Down
2 changes: 1 addition & 1 deletion docs/design/registry.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## DID/CL Registries approach
## DID/Anoncreds Registries approach

General design for smart contracts oriented for storing objects like DID Document, Schema, Credential Definition.
The main question is whether we need to validate storing object or not?
Expand Down
10 changes: 5 additions & 5 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Note: Right now we have finished PoC implementation. Roadmap tasks and their pri
* Network identity implementation:
* Indy2 DID method
* Basic DID Document validation
* CL Registry:
* Anoncreds Registry:
* Schema and Credential Definition registries with basic validation
* Migration:
* Design of migration from legacy (Indy) network
Expand All @@ -23,7 +23,7 @@ Note: Right now we have finished PoC implementation. Roadmap tasks and their pri
* VDR:
* Client library preparing and executing Ledger transactions (native part)
* Support Indy2 DID Method
* CL Anoncreds entities (schema, credential definition)
* Anoncreds Anoncreds entities (schema, credential definition)
* CI/CD
* Basic pipelines
* Docs
Expand All @@ -33,8 +33,8 @@ Note: Right now we have finished PoC implementation. Roadmap tasks and their pri

* Network identity implementation:
* Deprecate Indy2 method in favor of using `did:ethr` contract and specification
* CL Registry: implement event approach matching to `did:ethr` design
* Endorsement support for DID Documents and CL entities
* Anoncreds Registry: implement event approach matching to `did:ethr` design
* Endorsement support for DID Documents and Anoncreds entities
* Network Permission implementation:
* Restrict execution of transactions exclusively to users with specific roles
* Network configuration
Expand Down Expand Up @@ -80,7 +80,7 @@ Note: Right now we have finished PoC implementation. Roadmap tasks and their pri
* Support Indy 2.0 in ACA-Py
* Migration:
* Process finalization
* CL Registry:
* Anoncreds Registry:
* Revocation entities support
* Command Line Interface
* CI/CD
Expand Down
4 changes: 2 additions & 2 deletions network/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"address": "0x0000000000000000000000000000000000003333"
},
"schemaRegistry": {
"specPath": "smart_contracts/artifacts/contracts/cl/SchemaRegistry.sol/SchemaRegistry.json",
"specPath": "smart_contracts/artifacts/contracts/anoncreds/SchemaRegistry.sol/SchemaRegistry.json",
"address": "0x0000000000000000000000000000000000005555"
},
"credDefRegistry": {
"specPath": "smart_contracts/artifacts/contracts/cl/CredentialDefinitionRegistry.sol/CredentialDefinitionRegistry.json",
"specPath": "smart_contracts/artifacts/contracts/anoncreds/CredentialDefinitionRegistry.sol/CredentialDefinitionRegistry.json",
"address": "0x0000000000000000000000000000000000004444"
},
"legacyMappingRegistry": {
Expand Down
18 changes: 9 additions & 9 deletions network/config/besu/genesis.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion network/config/nodes/validator5/key
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0x93945e32f8cb4afb4275cb014b363ccc794b0991eeab810ceadcaedf400d8c28
0x172c22cdceb87c56ef30c9b4cd34b20c3c63c19cc6bd7b7d12c2dfd2179b3f86
4 changes: 2 additions & 2 deletions smart_contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ The following folders should be generated as the result:
* [IndyDidRegistry TS contract wrapper class](./contracts-ts/IndyDidRegistry.ts)
* [EthereumExtDidRegistry](./contracts/did/EthereumExtDidRegistry.sol) - [Ethereum DID Registry](https://github.com/uport-project/ethr-did-registry/tree/master) extended with permission checks
* [DidRegistry TS contract wrapper class](./contracts-ts/EthereumDIDRegistry.ts)
* [SchemaRegistry](./contracts/cl/SchemaRegistryInterface.sol) - contract to manage Schemas
* [SchemaRegistry](contracts/anoncreds/SchemaRegistryInterface.sol) - contract to manage Schemas
* [SchemaRegistry TS contract wrapper class](./contracts-ts/SchemaRegistry.ts)
* [CredentialDefinitionRegistry](./contracts/cl/CredentialDefinitionRegistryInterface.sol) - contract to manage CL Credential Definitions
* [CredentialDefinitionRegistry](contracts/anoncreds/CredentialDefinitionRegistryInterface.sol) - contract to manage Credential Definitions
* [CredentialDefinitionRegistry TS contract wrapper class](./contracts-ts/CredentialDefinitionRegistry.ts)
* [ValidatorControl](./contracts/network/ValidatorControlInterface.sol) - contract to manage network validator nodes.
* [ValidatorControl TS contract wrapper class](./contracts-ts/ValidatorControl.ts)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { concat, getBytes, keccak256, Signature, toUtf8Bytes, toUtf8String } from 'ethers'
import { CredentialDefinitionMetadataStruct } from '../typechain-types/contracts/cl/CredentialDefinitionRegistry'
import { CredentialDefinitionMetadataStruct } from '../typechain-types/contracts/anoncreds/CredentialDefinitionRegistry'
import { Contract } from '../utils/contract'

export type CredentialDefinitionRecord = {
Expand Down
2 changes: 1 addition & 1 deletion smart_contracts/contracts-ts/SchemaRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { concat, getBytes, keccak256, Signature, toUtf8Bytes, toUtf8String } from 'ethers'
import { SchemaMetadataStruct } from '../typechain-types/contracts/cl/SchemaRegistry'
import { SchemaMetadataStruct } from '../typechain-types/contracts/anoncreds/SchemaRegistry'
import { Contract } from '../utils/contract'

export type SchemaRecord = {
Expand Down
2 changes: 1 addition & 1 deletion smart_contracts/contracts-ts/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from './AccountControl'
export * from './CredentialDefinitionRegistry'
export * from './IndyDidRegistry'
export * from './EthereumDIDRegistry'
export * from './EthereumDidRegistry'
export * from './RoleControl'
export * from './SchemaRegistry'
export * from './UniversalDidReolver'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { DidNotFound, IncorrectDid, NotIdentityOwner } from "../did/DidErrors.so
import { DidMetadata } from "../did/DidTypes.sol";
import { UniversalDidResolverInterface } from "../did/UniversalDidResolverInterface.sol";
import { Errors } from "../utils/Errors.sol";
import { InvalidIssuerId, IssuerHasBeenDeactivated, IssuerNotFound } from "./ClErrors.sol";
import { InvalidIssuerId, IssuerHasBeenDeactivated, IssuerNotFound } from "./AnoncredsErrors.sol";
import { RoleControlInterface } from "../auth/RoleControl.sol";

contract CLRegistry {
contract AnoncredsRegistry {
/**
* @dev Reference to the contract that resolves DIDs
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ import { ControlledUpgradeable } from "../upgrade/ControlledUpgradeable.sol";

import { CredentialDefinitionRecord } from "./CredentialDefinitionTypes.sol";
import { CredentialDefinitionRegistryInterface } from "./CredentialDefinitionRegistryInterface.sol";
import { CredentialDefinitionAlreadyExist, CredentialDefinitionNotFound } from "./ClErrors.sol";
import { CredentialDefinitionAlreadyExist, CredentialDefinitionNotFound } from "./AnoncredsErrors.sol";
import { SchemaRegistryInterface } from "./SchemaRegistryInterface.sol";
import { RoleControlInterface } from "../auth/RoleControl.sol";
import { CLRegistry } from "./CLRegistry.sol";
import { AnoncredsRegistry } from "./AnoncredsRegistry.sol";

contract CredentialDefinitionRegistry is CredentialDefinitionRegistryInterface, ControlledUpgradeable, CLRegistry {
contract CredentialDefinitionRegistry is
CredentialDefinitionRegistryInterface,
ControlledUpgradeable,
AnoncredsRegistry
{
/**
* @dev Reference to the contract that manages AnonCreds schemas
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ pragma solidity ^0.8.20;
import { UniversalDidResolverInterface } from "../did/UniversalDidResolverInterface.sol";
import { ControlledUpgradeable } from "../upgrade/ControlledUpgradeable.sol";

import { SchemaAlreadyExist, SchemaNotFound } from "./ClErrors.sol";
import { SchemaAlreadyExist, SchemaNotFound } from "./AnoncredsErrors.sol";
import { SchemaRegistryInterface } from "./SchemaRegistryInterface.sol";
import { SchemaRecord } from "./SchemaTypes.sol";
import { CLRegistry } from "./CLRegistry.sol";
import { AnoncredsRegistry } from "./AnoncredsRegistry.sol";
import { RoleControlInterface } from "../auth/RoleControl.sol";

contract SchemaRegistry is SchemaRegistryInterface, ControlledUpgradeable, CLRegistry {
contract SchemaRegistry is SchemaRegistryInterface, ControlledUpgradeable, AnoncredsRegistry {
/**
* Mapping Schema ID to its Schema Details and Metadata.
*/
Expand Down
7 changes: 4 additions & 3 deletions smart_contracts/test/utils/contract-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getBytes } from 'ethers'
import {
CredentialDefinitionRegistry,
EthereumExtDidRegistry,
IndyDidRegistry,
LegacyMappingRegistry,
RoleControl,
Expand All @@ -15,9 +16,9 @@ import { getTestAccounts, ZERO_ADDRESS } from './test-entities'
export const testActorAddress = '0x2036C6CD85692F0Fb2C26E6c6B2ECed9e4478Dfd'
export const testActorPrivateKey = getBytes('0xa285ab66393c5fdda46d6fbad9e27fafd438254ab72ad5acb681a0e9f20f5d7b')

export class EthereumDIDRegistry extends testableContractMixin(Contract) {
export class TestableEthereumDIDRegistry extends testableContractMixin(Contract) {
constructor() {
super(EthereumDIDRegistry.name)
super(EthereumExtDidRegistry.name)
}
}

Expand Down Expand Up @@ -62,7 +63,7 @@ export async function deployIndyDidRegistry() {

export async function deployUniversalDidResolver() {
const { roleControl, indyDidRegistry, testAccounts } = await deployIndyDidRegistry()
const ethereumDIDRegistry = await new EthereumDIDRegistry().deploy()
const ethereumDIDRegistry = await new TestableEthereumDIDRegistry().deploy()

const universalDidResolver = await new TestableUniversalDidResolver().deployProxy({
params: [ZERO_ADDRESS, indyDidRegistry.address, ethereumDIDRegistry.address],
Expand Down
1 change: 1 addition & 0 deletions vdr/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ impl LedgerClient {
pub(crate) fn chain_id(&self) -> u64 {
self.chain_id
}

pub(crate) fn network(&self) -> Option<&String> {
self.network.as_ref()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use log_derive::{logfn, logfn_inputs};

use crate::{
client::LedgerClient,
contracts::cl::types::{
contracts::anoncreds::types::{
credential_definition::{CredentialDefinition, CredentialDefinitionRecord},
credential_definition_id::{CredentialDefinitionId, ParsedCredentialDefinitionId},
},
Expand Down Expand Up @@ -188,7 +188,6 @@ pub async fn resolve_credential_definition(

let transaction = build_resolve_credential_definition_transaction(client, id).await?;
let response = client.submit_transaction(&transaction).await?;

if response.is_empty() {
return Err(VdrError::ClientInvalidResponse(format!(
"Credential Definition not found for id: {:?}",
Expand All @@ -215,7 +214,7 @@ pub mod test {
use crate::{
client::client::test::{mock_client, CONFIG, DEFAULT_NONCE, TEST_ACCOUNT, TRUSTEE_ACCOUNT},
contracts::{
cl::types::{
anoncreds::types::{
credential_definition::test::{
credential_definition, credential_definition_value, CREDENTIAL_DEFINITION_TAG,
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use log_derive::{logfn, logfn_inputs};

use crate::{
client::LedgerClient,
contracts::cl::types::{
contracts::anoncreds::types::{
schema::{Schema, SchemaRecord},
schema_id::{ParsedSchemaId, SchemaId},
},
Expand Down Expand Up @@ -206,7 +206,9 @@ pub mod test {
use crate::{
client::client::test::{mock_client, CONFIG, DEFAULT_NONCE, TEST_ACCOUNT},
contracts::{
cl::types::schema::test::{schema, SCHEMA_ATTRIBUTES, SCHEMA_NAME, SCHEMA_VERSION},
anoncreds::types::schema::test::{
schema, SCHEMA_ATTRIBUTES, SCHEMA_NAME, SCHEMA_VERSION,
},
did::types::{did::DID, did_doc::test::TEST_ETHR_DID},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
CredentialDefinitionId, VdrResult,
};

use crate::contracts::{cl::types::schema_id::SchemaId, did::types::did::DID};
use crate::contracts::{anoncreds::types::schema_id::SchemaId, did::types::did::DID};
use serde_derive::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
Expand Down Expand Up @@ -135,7 +135,9 @@ impl TryFrom<ContractOutput> for CredentialDefinitionRecord {
pub mod test {
use super::*;
use crate::{
contracts::{cl::types::schema::test::SCHEMA_ID, did::types::did_doc::test::TEST_ETHR_DID},
contracts::{
anoncreds::types::schema::test::SCHEMA_ID, did::types::did_doc::test::TEST_ETHR_DID,
},
utils::rand_string,
};
use serde_json::json;
Expand Down
2 changes: 1 addition & 1 deletion vdr/src/contracts/migration/legacy_mapping_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub async fn build_create_resource_mapping_transaction(
}

/// Prepared data for execution of LegacyMappingRegistry.createResourceMapping contract method to
/// endorse a new CL mapping.
/// endorse a new resource mapping.
///
/// #Params
/// - `client` client connected to the network where contract will be executed
Expand Down
6 changes: 4 additions & 2 deletions vdr/src/contracts/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
pub mod anoncreds;
pub mod auth;
pub mod cl;
pub mod did;
pub mod migration;
pub mod network;

pub use anoncreds::{
credential_definition_registry, schema_registry, CredentialDefinition, Schema,
};
pub use auth::{role_control, Role};
pub use cl::{credential_definition_registry, schema_registry, CredentialDefinition, Schema};
pub use did::*;
pub use migration::legacy_mapping_registry;
pub use network::validator_control;
4 changes: 2 additions & 2 deletions vdr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ mod test;

pub use client::{Client, Contract, LedgerClient};
pub use contracts::{
auth::{role_control, Role},
cl::{
anoncreds::{
credential_definition_registry, schema_registry,
types::{
credential_definition::CredentialDefinition,
credential_definition_id::CredentialDefinitionId, schema::Schema, schema_id::SchemaId,
},
},
auth::{role_control, Role},
did::{
did_ethr_registry, did_indy_registry, did_resolver,
types::{
Expand Down
6 changes: 4 additions & 2 deletions vdr/src/test.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use crate::{
client::client::test::{client, TRUSTEE_ACCOUNT},
contracts::{
anoncreds::types::{
credential_definition::test::credential_definition, schema::test::schema,
},
auth::{role_control, Role},
cl::types::{credential_definition::test::credential_definition, schema::test::schema},
did::{did_indy_registry, types::did_doc::test::did_doc, DidRecord, DID, ETHR_DID_METHOD},
},
signer::basic_signer::{test::basic_signer, BasicSigner},
Expand Down Expand Up @@ -775,7 +777,7 @@ mod mapping {
use crate::{
client::client::test::client,
contracts::{
cl::types::schema::test::{SCHEMA_NAME, SCHEMA_VERSION},
anoncreds::types::schema::test::{SCHEMA_NAME, SCHEMA_VERSION},
migration::types::did::{LegacyDid, LegacyVerkey},
},
legacy_mapping_registry, Ed25519Signature, ResourceIdentifier, SchemaId,
Expand Down
Loading