Skip to content

Commit 6e47a10

Browse files
ATL-6668: Address review comments
This commit deletes references to legacy VC code in protobuf and sql definitions
1 parent bb3036a commit 6e47a10

35 files changed

+165
-341
lines changed

node/src/main/protobuf/common_models.proto

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,6 @@ message HealthCheckRequest {}
2121
*/
2222
message HealthCheckResponse {}
2323

24-
/**
25-
* Represents a date by its parts (day, month, year).
26-
*/
27-
message Date {
28-
int32 year = 1; // A positive value.
29-
int32 month = 2; // A value in the [1, 12] range.
30-
int32 day = 3; // A value in the [1, 31] range (depending on the month, the maximum value might be 28).
31-
}
32-
33-
/**
34-
* Represents a time interval between two given timestamps.
35-
* The message represents a closed interval (i.e. both ends are inclusive and mandatory).
36-
*/
37-
message TimeInterval {
38-
/**
39-
* The starting timestamp.
40-
* start_timestamp must be before or equal to end_timestamp.
41-
*/
42-
google.protobuf.Timestamp start_timestamp = 1;
43-
/**
44-
* The ending timestamp.
45-
* end_timestamp must be after or equal to start_timestamp.
46-
*/
47-
google.protobuf.Timestamp end_timestamp = 2;
48-
}
49-
50-
/**
51-
* This enum provides a way for some RPC requests to specify the direction so that the response values are sorted
52-
* the way you want them to.
53-
* Note that it specifies the direction only and doesn't say anything about a comparator
54-
* (e.g. natural order, some RPC-specific order etc).
55-
*/
56-
enum SortByDirection {
57-
SORT_BY_DIRECTION_UNKNOWN = 0; // Nothing provided, each API can define whether to fail or take a default value (commonly ASCENDING).
58-
SORT_BY_DIRECTION_ASCENDING = 1; // Sort the results in ascending order.
59-
SORT_BY_DIRECTION_DESCENDING = 2; // Sort the results in descending order.
60-
}
61-
6224
/**
6325
* The supported ledger types. Specifies which chain is used for storing transactions.
6426
*/

node/src/main/protobuf/node_api.proto

Lines changed: 25 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import "google/protobuf/timestamp.proto";
1212

1313
/**
1414
* Service for PRISM Node API. Provides a way to store, retrieve and update
15-
* Decentralized identifiers (DIDs), and Credentials' commitments into/from the underlying blockchain.
15+
* Decentralized identifiers (DIDs) into/from the underlying blockchain.
1616
*/
1717
service NodeService {
1818
/**
@@ -187,69 +187,6 @@ message GetNodeNetworkProtocolInfoResponse {
187187
ProtocolVersion current_network_protocol_version = 6; // Current network protocol version number.
188188
}
189189

190-
/**
191-
* Request to get the credential's batch state.
192-
* See NodeService.GetBatchState for more information.
193-
*/
194-
message GetBatchStateRequest {
195-
string batch_id = 1; // The batch ID.
196-
}
197-
/**
198-
* Response with the credential's batch state.
199-
* See NodeService.GetBatchState for more information.
200-
*/
201-
message GetBatchStateResponse {
202-
/**
203-
* DID suffix used to sign the IssueCredentialBatch operation.
204-
*/
205-
string issuer_did = 1;
206-
207-
/**
208-
* The Merkle root used for the IssueCredential operation.
209-
*/
210-
bytes merkle_root = 2;
211-
212-
/**
213-
* Underlying blockchain data that refers to the transaction that
214-
* contains the IssueCredential operation associated with the credential.
215-
*/
216-
LedgerData publication_ledger_data = 3;
217-
218-
/**
219-
* Underlying blockchain data that refers to the transaction that
220-
* contains the RevokeCredential operation associated with the credential.
221-
* This is optional.
222-
*/
223-
LedgerData revocation_ledger_data = 4;
224-
225-
/**
226-
* Timestamp of the latest synchronized block.
227-
*/
228-
google.protobuf.Timestamp last_synced_block_timestamp = 5;
229-
230-
/**
231-
* The hash of the credential to query about.
232-
*/
233-
bytes issuance_hash = 6;
234-
}
235-
236-
/**
237-
* Request to get the credential's revocation time.
238-
* See NodeService.GetCredentialRevocationTime for more information.
239-
*/
240-
message GetCredentialRevocationTimeRequest {
241-
string batch_id = 1; // The ID corresponding to the credential to query about.
242-
bytes credential_hash = 2; // The hash of the credential to query about.
243-
}
244-
/**
245-
* Response with the credential's revocation time.
246-
* See NodeService.GetCredentialRevocationTime for more information.
247-
*/
248-
message GetCredentialRevocationTimeResponse {
249-
LedgerData revocation_ledger_data = 1; // The ledger data when the credential was revoked. This is optional.
250-
google.protobuf.Timestamp last_synced_block_timestamp = 2; // Timestamp of the latest synchronized block.
251-
}
252-
253190
/**
254191
* Request to get the operation status.
255192
* See NodeService.GetOperationInfo for more information.
@@ -318,8 +255,6 @@ message GetScheduledOperationsRequest {
318255
AnyOperationType = 0; // Any operation
319256
CreateDidOperationOperationType = 1;
320257
UpdateDidOperationOperationType = 2;
321-
IssueCredentialBatchOperationType = 3;
322-
RevokeCredentialsOperationType = 4;
323258
ProtocolVersionUpdateOperationType = 5;
324259
}
325260
}
@@ -352,3 +287,27 @@ message GetWalletBalanceRequest {
352287
message GetWalletBalanceResponse {
353288
bytes balance = 1;
354289
}
290+
291+
// Used to encode the responses of the operations issued in an AtalaBlock.
292+
message OperationOutput {
293+
oneof result {
294+
// Represents the response provided by IssueCredentialBatchOperation.
295+
CreateDIDOutput create_did_output = 2;
296+
// Represents the response provided by UpdateDIDOperation.
297+
UpdateDIDOutput update_did_output = 3;
298+
// Represents the response provided by ProtocolVersionUpdateOperation.
299+
ProtocolVersionUpdateOutput protocol_version_update_output = 7;
300+
DeactivateDIDOutput deactivate_did_output = 8;
301+
}
302+
oneof operation_maybe {
303+
bytes operation_id = 5; // Operation identifier.
304+
string error = 6; // Error description if PRISM Node service haven't scheduled the operation.
305+
}
306+
}
307+
308+
message CreateDIDOutput {
309+
string did_suffix = 1;
310+
}
311+
message UpdateDIDOutput {}
312+
message ProtocolVersionUpdateOutput {}
313+
message DeactivateDIDOutput {}

node/src/main/protobuf/node_internal.proto

Lines changed: 0 additions & 27 deletions
This file was deleted.

node/src/main/protobuf/node_models.proto

Lines changed: 19 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -158,26 +158,6 @@ message UpdateDIDOperation {
158158
repeated UpdateDIDAction actions = 3; // The actual updates to perform on the DID.
159159
}
160160

161-
// Represents a credential's batch.
162-
//
163-
// Check the protocol docs to understand it.
164-
message CredentialBatchData {
165-
string issuer_did = 1; // The DID suffix that issues the credential's batch.
166-
bytes merkle_root = 2; // The Merkle root for the credential's batch.
167-
}
168-
169-
// Specifies the data to issue a credential batch.
170-
message IssueCredentialBatchOperation {
171-
CredentialBatchData credential_batch_data = 1; // The actual credential batch data.
172-
}
173-
174-
// Specifies the credentials to revoke (the whole batch, or just a subset of it).
175-
message RevokeCredentialsOperation {
176-
bytes previous_operation_hash = 1; // The hash of the operation that issued the batch.
177-
string credential_batch_id = 2; // The corresponding batch ID, as returned in IssueCredentialBatchResponse.
178-
repeated bytes credentials_to_revoke = 3; // The hashes of the credentials to revoke. If empty, the full batch is revoked.
179-
}
180-
181161
// Specifies the protocol version update
182162
message ProtocolVersionUpdateOperation {
183163
string proposer_did = 1; // The DID suffix that proposes the protocol update.
@@ -219,12 +199,6 @@ message AtalaOperation {
219199
// Used to update an existing public DID.
220200
UpdateDIDOperation update_did = 2;
221201

222-
// Used to issue a batch of credentials.
223-
IssueCredentialBatchOperation issue_credential_batch = 3;
224-
225-
// Used to revoke a credential batch.
226-
RevokeCredentialsOperation revoke_credentials = 4;
227-
228202
// Used to announce new protocol update
229203
ProtocolVersionUpdateOperation protocol_version_update = 5;
230204

@@ -249,38 +223,6 @@ message LedgerData {
249223
TimestampInfo timestamp_info = 3; // The timestamp of the protocol event.
250224
}
251225

252-
// Used to encode the responses of the operations issued in an AtalaBlock.
253-
message OperationOutput {
254-
oneof result {
255-
// Represents the response provided by IssueCredentialBatchOperation.
256-
IssueCredentialBatchOutput batch_output = 1;
257-
// Represents the response provided by CreateDIDOperation.
258-
CreateDIDOutput create_did_output = 2;
259-
// Represents the response provided by UpdateDIDOperation.
260-
UpdateDIDOutput update_did_output = 3;
261-
// Represents the response provided by RevokeCredentialOperation.
262-
RevokeCredentialsOutput revoke_credentials_output = 4;
263-
// Represents the response provided by ProtocolVersionUpdateOperation.
264-
ProtocolVersionUpdateOutput protocol_version_update_output = 7;
265-
DeactivateDIDOutput deactivate_did_output = 8;
266-
}
267-
oneof operation_maybe {
268-
bytes operation_id = 5; // Operation identifier.
269-
string error = 6; // Error description if PRISM Node service haven't scheduled the operation.
270-
}
271-
}
272-
273-
message IssueCredentialBatchOutput {
274-
string batch_id = 1;
275-
}
276-
message CreateDIDOutput {
277-
string did_suffix = 1;
278-
}
279-
message UpdateDIDOutput {}
280-
message RevokeCredentialsOutput {}
281-
message ProtocolVersionUpdateOutput {}
282-
message DeactivateDIDOutput {}
283-
284226
message Service {
285227
string id = 1;
286228
string type = 2;
@@ -289,3 +231,22 @@ message Service {
289231
LedgerData added_on = 4; // (when present) The ledger details related to the event that added the service.
290232
LedgerData deleted_on = 5; // (when present) The ledger details related to the event that revoked the service.
291233
}
234+
235+
/**
236+
* Represent a block that holds operations.
237+
* @exclude Intended for internal usage inside. Not publicly accessible from gRPC.
238+
*/
239+
message AtalaBlock {
240+
reserved 1; // Represents the version of the block. Deprecated
241+
repeated SignedAtalaOperation operations = 2; // A signed operation, necessary to post anything on the blockchain.
242+
}
243+
244+
/**
245+
* Wraps an AtalaBlock and its metadata.
246+
* @exclude Intended for internal usage inside. Not publicly accessible from gRPC.
247+
*/
248+
message AtalaObject {
249+
reserved 1, 2, 3; // Removed block_hash field.
250+
reserved "block_hash", "block_operation_count", "block_byte_length";
251+
AtalaBlock block_content = 4; // The block content.
252+
}

node/src/main/resources/db/migration/V1__create_tables.sql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ CREATE DOMAIN public.id_type AS text COLLATE "default" CONSTRAINT id_type_check
3737
CREATE TYPE public.key_usage AS ENUM ('MASTER_KEY', 'ISSUING_KEY', 'KEY_AGREEMENT_KEY', 'AUTHENTICATION_KEY', 'REVOCATION_KEY', 'CAPABILITY_INVOCATION_KEY', 'CAPABILITY_DELEGATION_KEY');
3838

3939

40-
CREATE DOMAIN public.merkle_root AS BYTEA CONSTRAINT merkle_root_check CHECK (length(VALUE) = 32);
41-
42-
4340
CREATE DOMAIN public.non_negative_int_type AS integer CONSTRAINT non_negative_int_type_check CHECK (VALUE >= 0);
4441

4542

node/src/main/scala/io/iohk/atala/prism/node/UnderlyingLedger.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import derevo.tagless.applyK
55
import io.iohk.atala.prism.node.models._
66
import io.iohk.atala.prism.node.cardano.models.CardanoWalletError
77
import io.iohk.atala.prism.node.models.Balance
8-
import io.iohk.atala.prism.protos.node_internal
8+
import io.iohk.atala.prism.protos.node_models
99

1010
@derive(applyK)
1111
trait UnderlyingLedger[F[_]] {
1212
def getType: Ledger
1313

1414
def publish(
15-
obj: node_internal.AtalaObject
15+
obj: node_models.AtalaObject
1616
): F[Either[CardanoWalletError, PublicationInfo]]
1717

1818
def getTransactionDetails(

node/src/main/scala/io/iohk/atala/prism/node/cardano/models/AtalaObjectMetadata.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.iohk.atala.prism.node.cardano.models
22

33
import io.circe.{ACursor, Json}
4-
import io.iohk.atala.prism.protos.node_internal
4+
import io.iohk.atala.prism.protos.node_models
55
import io.iohk.atala.prism.node.utils.BytesOps
66

77
import scala.util.Try
@@ -29,7 +29,7 @@ object AtalaObjectMetadata {
2929

3030
def fromTransactionMetadata(
3131
metadata: TransactionMetadata
32-
): Option[node_internal.AtalaObject] = {
32+
): Option[node_models.AtalaObject] = {
3333
val prismMetadata = metadata.json.hcursor
3434
.downField(METADATA_PRISM_INDEX.toString)
3535

@@ -44,7 +44,7 @@ object AtalaObjectMetadata {
4444

4545
private def fromTransactionMetadataV1(
4646
prismMetadata: ACursor
47-
): Option[node_internal.AtalaObject] = {
47+
): Option[node_models.AtalaObject] = {
4848
val bytes = prismMetadata
4949
.downField(CONTENT_KEY)
5050
.focus
@@ -56,7 +56,7 @@ object AtalaObjectMetadata {
5656
// Either the content does not exist, is not the right type, or is truly empty
5757
None
5858
} else {
59-
node_internal.AtalaObject.validate(bytes).toOption
59+
node_models.AtalaObject.validate(bytes).toOption
6060
}
6161
}
6262

@@ -68,7 +68,7 @@ object AtalaObjectMetadata {
6868
}
6969

7070
def toTransactionMetadata(
71-
atalaObject: node_internal.AtalaObject
71+
atalaObject: node_models.AtalaObject
7272
): TransactionMetadata = {
7373
TransactionMetadata(
7474
Json.obj(
@@ -101,7 +101,7 @@ object AtalaObjectMetadata {
101101
)
102102
}
103103

104-
def estimateTxMetadataSize(atalaObject: node_internal.AtalaObject): Int = {
104+
def estimateTxMetadataSize(atalaObject: node_models.AtalaObject): Int = {
105105
toTransactionMetadata(atalaObject).json.noSpaces.length
106106
}
107107
}

node/src/main/scala/io/iohk/atala/prism/node/metrics/OperationsCounters.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ object OperationsCounters {
2828

2929
// Values for operations tags
3030
private val EMPTY_OPERATION_TAG_VALUE = "empty"
31-
private val REVOKE_CREDENTIALS_TAG_VALUE = "revoke-credentials"
3231
private val CREATE_DID_TAG_VALUE = "create-did"
33-
private val ISSUE_CREDENTIAL_BATCH_TAG_VALUE = "issue-credential-batch"
3432
private val PROTOCOL_VERSION_UPDATE_OPERATION_VALUE = "protocol-version-update"
3533
private val UPDATE_DID_OPERATION_TAG_VALUE = "did-update"
3634
private val DEACTIVATE_DID_TAG_VALUE = "deactivate-did"
@@ -172,13 +170,9 @@ object OperationsCounters {
172170

173171
private def atalaOperationToTagString: PartialFunction[AtalaOperation.Operation, String] = {
174172
case AtalaOperation.Operation.Empty => EMPTY_OPERATION_TAG_VALUE
175-
case AtalaOperation.Operation.RevokeCredentials(_) =>
176-
REVOKE_CREDENTIALS_TAG_VALUE
177173
case AtalaOperation.Operation.CreateDid(_) => CREATE_DID_TAG_VALUE
178174
case AtalaOperation.Operation.DeactivateDid(_) => DEACTIVATE_DID_TAG_VALUE
179175
case AtalaOperation.Operation.ProtocolVersionUpdate(_) => PROTOCOL_VERSION_UPDATE_OPERATION_VALUE
180-
case AtalaOperation.Operation.IssueCredentialBatch(_) =>
181-
ISSUE_CREDENTIAL_BATCH_TAG_VALUE
182176
// Just in case, must be impossible
183177
case AtalaOperation.Operation.UpdateDid(_) => UPDATE_DID_OPERATION_TAG_VALUE
184178
}

0 commit comments

Comments
 (0)