diff --git a/datatrails-common-api/assets/v2/assets/eventresponse.proto b/datatrails-common-api/assets/v2/assets/eventresponse.proto index 4666c8d..24f0066 100644 --- a/datatrails-common-api/assets/v2/assets/eventresponse.proto +++ b/datatrails-common-api/assets/v2/assets/eventresponse.proto @@ -173,11 +173,14 @@ message EventResponse { // record. We anticipate at least two proof mechs: merkle_log and // verkle_log. We use oneof to avoid repeating the scattering of randomly // re-purposed fields we currently have for simple hash vs khipu. - oneof proof_details { - MerkleLogEntry merklelog_entry = 19 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { - description: - "verifiable merkle mmr log entry details" - max_length: 1024 - }]; - }; + + + // proof details for proof_mechanism MERKLE_LOG + MerkleLogEntry merklelog_entry = 19 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { + description: + "verifiable merkle mmr log entry details", + // see https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-openapiv2/options/openapiv2.proto + // for specific types. + type: OBJECT + }]; } \ No newline at end of file diff --git a/datatrails-common-api/assets/v2/assets/merklelogentry.proto b/datatrails-common-api/assets/v2/assets/merklelogentry.proto index 0c0fe31..580b80d 100644 --- a/datatrails-common-api/assets/v2/assets/merklelogentry.proto +++ b/datatrails-common-api/assets/v2/assets/merklelogentry.proto @@ -8,12 +8,32 @@ import "google/protobuf/timestamp.proto"; // MerkeLogCommit provides the log entry details for a single mmr leaf. message MerkleLogCommit { /* The mmr index */ - uint64 index = 3; + uint64 index = 1; /* The mmr *leaf* index */ - uint64 leaf_index = 4; // TBD: this may be redundant. + uint64 leaf_index = 2; // TBD: this may be redundant. /* time ordered and strictly unique per tenant. system wide * unique with very reasonable operational assumptions. */ - fixed64 idtimestamp = 5; + fixed64 idtimestamp = 3; +} + +message MerkleLogCommitMongoDB { + + // Note that should we ever have more than 2^63 events in a tenant log, the + // index and leaf_index fields will not persist to mongo. + + /* The mmr index */ + uint64 index = 1; + /* The mmr *leaf* index */ + uint64 leaf_index = 2; // TBD: this may be redundant. + + /* time ordered and strictly unique per tenant. system wide + * unique with very reasonable operational assumptions. + * + * EXPRESSED AS A 16 character padded hex string because mongo db does not + * support unsigned integers and we need all 64 bits to get a sensible epoch + * duration. + */ + string idtimestamp = 3; } // The message sent from forestrie to avid notifying that the corresponding @@ -42,8 +62,10 @@ message MerkleLogEntry { uint32 log_version = 1; uint32 log_epoch = 2; - // Event trust level commited fields - MerkleLogCommit commit = 3; + // Event trust level commited fields. Note that we have to use a special + // message because mongo db does not support unsigned integers. If/when we + // move away from that, we can move this ordinal safely into a oneof + MerkleLogCommitMongoDB commit = 3; // TODO: Event trust level confirmed fields