Skip to content

Commit

Permalink
Rename cl group of contracts to anoncreds
Browse files Browse the repository at this point in the history
Signed-off-by: artem.ivanov <[email protected]>
  • Loading branch information
Artemkaaas committed Feb 16, 2024
1 parent dbc05c2 commit c75cef6
Show file tree
Hide file tree
Showing 40 changed files with 64 additions and 54 deletions.
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/anoncreds-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)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CL Registry
# AnonCreds Registry

## Schema

Expand Down
2 changes: 1 addition & 1 deletion docs/design/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Contract name: **transactionAllowed**
| IndyDidRegistry | deactivateDid | DID owner | Deactivate an existing DID |
| IndyDidRegistry | resolveDid | any | Resolve DID Document for a DID |

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

| Contract | Method | Required Role | Action Description |
|------------------------------|-----------------------------|-----------------------------|------------------------------------------|
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
12 changes: 6 additions & 6 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 @@
0x540b580b3d27767d2c70378e4bd313829140664cfc000ce7ff09ed92d56056bd
0xd53fd12cf304b16a69f23d51ae91f6f6e38257bb64b95da1546b10384958aa6a
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
3 changes: 1 addition & 2 deletions smart_contracts/contracts-ts/CredentialDefinitionRegistry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { concat, getBytes, keccak256, Signature, toUtf8Bytes, toUtf8String } from 'ethers'
import { signEndorsementData } from '../test/utils/contract-helpers'
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
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ 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";

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,11 +6,15 @@ 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 { 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,12 +4,12 @@ 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";

contract SchemaRegistry is SchemaRegistryInterface, ControlledUpgradeable, CLRegistry {
contract SchemaRegistry is SchemaRegistryInterface, ControlledUpgradeable, AnoncredsRegistry {
/**
* Mapping Schema ID to its Schema Details and Metadata.
*/
Expand Down
4 changes: 2 additions & 2 deletions vdr/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ pub mod test {
pub const CHAIN_ID: u64 = 1337;
pub const CONTRACTS_SPEC_BASE_PATH: &str = "../smart_contracts/artifacts/contracts/";
pub const INDY_DID_REGISTRY_PATH: &str = "did/IndyDidRegistry.sol/IndyDidRegistry.json";
pub const SCHEMA_REGISTRY_SPEC_PATH: &str = "cl/SchemaRegistry.sol/SchemaRegistry.json";
pub const SCHEMA_REGISTRY_SPEC_PATH: &str = "anoncreds/SchemaRegistry.sol/SchemaRegistry.json";
pub const CRED_DEF_REGISTRY_SPEC_PATH: &str =
"cl/CredentialDefinitionRegistry.sol/CredentialDefinitionRegistry.json";
"anoncreds/CredentialDefinitionRegistry.sol/CredentialDefinitionRegistry.json";
pub const VALIDATOR_CONTROL_PATH: &str = "network/ValidatorControl.sol/ValidatorControl.json";
pub const ROLE_CONTROL_PATH: &str = "auth/RoleControl.sol/RoleControl.json";
pub const ETHR_DID_REGISTRY_PATH: &str =
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,
},
Expand Down Expand Up @@ -184,7 +184,6 @@ pub async fn resolve_credential_definition(
) -> VdrResult<CredentialDefinition> {
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 Down Expand Up @@ -214,7 +213,7 @@ pub mod test {
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::SchemaId,
},
Expand Down Expand Up @@ -200,7 +200,9 @@ pub mod test {
mock_client, CHAIN_ID, DEFAULT_NONCE, SCHEMA_REGISTRY_ADDRESS, 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 @@ -110,7 +110,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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 @@ -218,7 +218,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
2 changes: 1 addition & 1 deletion vdr/wasm/demo/node/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const didEthrRegistryConfig = {
}
const schemaRegistryConfig = {
address: '0x0000000000000000000000000000000000005555',
specPath: '/Users/indy-besu/smart_contracts/artifacts/contracts/cl/SchemaRegistry.sol/SchemaRegistry.json'
specPath: '/Users/indy-besu/smart_contracts/artifacts/contracts/anoncreds/SchemaRegistry.sol/SchemaRegistry.json'
}


Expand Down
2 changes: 1 addition & 1 deletion vdr/wrappers/python/demo/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
schema_contact_address = '0x0000000000000000000000000000000000005555'
# Path to the compiled IndyDidRegistry smart contract
did_contact_spec_path = '/Users/indy-besu/smart_contracts/artifacts/contracts/did/EthereumExtDidRegistry.sol/EthereumExtDidRegistry.json'
schema_contact_spec_path = '/Users/indy-besu/smart_contracts/artifacts/contracts/cl/SchemaRegistry.sol/SchemaRegistry.json'
schema_contact_spec_path = '/Users/indy-besu/smart_contracts/artifacts/contracts/anoncreds/SchemaRegistry.sol/SchemaRegistry.json'
# Account address to use for sending transactions
trustee = {
"address": '0xf0e2db6c8dc6c681bb5d6ad121a107f300e9b2b5',
Expand Down

0 comments on commit c75cef6

Please sign in to comment.