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

fixes to deal with the limitations of mongodb, grpc-gatway and bson #12

Merged
merged 1 commit into from
Jan 19, 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
17 changes: 10 additions & 7 deletions datatrails-common-api/assets/v2/assets/eventresponse.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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) = {
robinbryce marked this conversation as resolved.
Show resolved Hide resolved
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
}];
}
32 changes: 27 additions & 5 deletions datatrails-common-api/assets/v2/assets/merklelogentry.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
honourfish marked this conversation as resolved.
Show resolved Hide resolved

// 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
honourfish marked this conversation as resolved.
Show resolved Hide resolved
* 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
Expand Down Expand Up @@ -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

Expand Down
Loading