Skip to content

Commit

Permalink
Merge pull request #67 from NillionNetwork/chore/update-nada-value-proto
Browse files Browse the repository at this point in the history
chore: add support for value protobuf
  • Loading branch information
pablojhl authored Jan 20, 2025
2 parents 62616c6 + e86bc10 commit 8ae34be
Show file tree
Hide file tree
Showing 27 changed files with 1,351 additions and 200 deletions.
8 changes: 8 additions & 0 deletions client-vms/proto/nillion/compute/v1/invoke.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package nillion.compute.v1.invoke;

import "nillion/payments/v1/receipt.proto";
import "nillion/auth/v1/user.proto";
import "nillion/values/v1/value.proto";

// A request to invoke a computation.
message InvokeComputeRequest {
Expand All @@ -16,13 +17,20 @@ message InvokeComputeRequest {
repeated bytes value_ids = 2;

// The values being used as compute-time parameters, encoded in bincode format.
//
// Only one of `bincode_values` and `values` can be set.
bytes bincode_values = 3;

// The bindings that define which input party in the program is which user in the network.
repeated InputPartyBinding input_bindings = 4;

// The bindings that define which output party in the program is which users in the network.
repeated OutputPartyBinding output_bindings = 5;

// The values being used as compute-time parameters
//
// Only one of `bincode_values` and `values` can be set.
repeated nillion.values.v1.value.NamedValue values = 6;
}

// A response to a request to invoke a computation.
Expand Down
8 changes: 6 additions & 2 deletions client-vms/proto/nillion/compute/v1/retrieve.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package nillion.compute.v1.retrieve;

import "google/protobuf/empty.proto";
import "nillion/values/v1/value.proto";

// A request to retrieve the results of a computation.
message RetrieveResultsRequest {
Expand All @@ -28,6 +29,9 @@ message RetrieveResultsResponse {

// The result of a computation.
message ComputationResult {
// The computation results, encoded in bincode.
bytes bincode_values = 1;
// The computation results, encoded in bincode.
bytes bincode_values = 1;

// The computation results.
repeated nillion.values.v1.value.NamedValue values = 2;
}
3 changes: 3 additions & 0 deletions client-vms/proto/nillion/leader_queries/v1/pool_status.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ message PoolStatusResponse {

// Whether preprocessing is active (at least one element type is being generated).
bool preprocessing_active = 2;

// Whether auxiliary material has been generated.
bool auxiliary_material_available = 3;
}

// The offsets for a preprocessing element.
Expand Down
3 changes: 3 additions & 0 deletions client-vms/proto/nillion/payments/v1/balance.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ message AccountBalanceResponse {

// The timestamp at which this balance was last updated.
google.protobuf.Timestamp last_updated = 2;

// The timestamp at which this balance will expire.
google.protobuf.Timestamp expires_at = 3;
}

// A request to add funds to a user's account.
Expand Down
14 changes: 7 additions & 7 deletions client-vms/proto/nillion/payments/v1/quote.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message PriceQuote {
PriceQuoteRequest request = 3;

// The point in time at which this quote is no longer valid.
google.protobuf.Timestamp expires_at = 4;
google.protobuf.Timestamp expires_at = 4;

// The preprocessing requirements for this operation.
repeated PreprocessingRequirement preprocessing_requirements = 5;
Expand All @@ -79,7 +79,7 @@ message QuoteFees {
message StoreProgram {
// The program's metadata.
ProgramMetadata metadata = 1;

// A sha256 hash of the compiled program.
bytes contents_sha256 = 2;

Expand All @@ -100,7 +100,7 @@ message ProgramMetadata {

// The number of instructions per type.
map<string, uint64> instructions = 4;

// The preprocessing requirements.
repeated PreprocessingRequirement preprocessing_requirements = 5;

Expand Down Expand Up @@ -131,13 +131,13 @@ message AuxiliaryMaterialRequirement {
// A retrieve values operation.
message RetrieveValues {
// The identifier to be retrieved.
bytes values_id = 1;
bytes values_id = 1;
}

// A retrieve permissions operation.
message RetrievePermissions {
// The identifier of the values entity to be retrieved.
bytes values_id = 1;
bytes values_id = 1;
}

// An overwrite permissions operation.
Expand Down Expand Up @@ -166,7 +166,7 @@ message StoreValues {
uint64 public_values_count = 3;

// The number of days to persist these secrets for.
uint32 ttl_days = 4;
optional uint32 ttl_days = 4;

// The size of the payload to be stored.
uint64 payload_size = 5;
Expand All @@ -184,5 +184,5 @@ message InvokeCompute {
string program_id = 1;

// The size of the compute time values being sent as part of this operation.
uint64 values_payload_size = 2;
uint64 values_payload_size = 2;
}
4 changes: 4 additions & 0 deletions client-vms/proto/nillion/values/v1/retrieve.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ syntax = "proto3";
package nillion.values.v1.retrieve;

import "nillion/payments/v1/receipt.proto";
import "nillion/values/v1/value.proto";

// A request to retrieve a set of stored values.
message RetrieveValuesRequest {
Expand All @@ -16,4 +17,7 @@ message RetrieveValuesRequest {
message RetrieveValuesResponse {
// The values encoded in bincode format.
bytes bincode_values = 1;

// The values.
repeated value.NamedValue values = 2;
}
8 changes: 8 additions & 0 deletions client-vms/proto/nillion/values/v1/store.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package nillion.values.v1.store;

import "nillion/payments/v1/receipt.proto";
import "nillion/permissions/v1/permissions.proto";
import "nillion/values/v1/value.proto";

// A request to store a set of values.
message StoreValuesRequest {
Expand All @@ -13,6 +14,8 @@ message StoreValuesRequest {
nillion.payments.v1.receipt.SignedReceipt signed_receipt = 1;

// The values encoded in bincode format.
//
// Only one of `bincode_values` and `values` can be set.
bytes bincode_values = 2;

// The permissions to set for these values.
Expand All @@ -29,6 +32,11 @@ message StoreValuesRequest {
// Setting this identifier will effectively turn this operation into an update for an existing set of
// values.
bytes update_identifier = 4;

// The values to be stored.
//
// Only one of `bincode_values` and `values` can be set.
repeated value.NamedValue values = 5;
}

// A response to a request to store values the network.
Expand Down
183 changes: 183 additions & 0 deletions client-vms/proto/nillion/values/v1/value.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
syntax = "proto3";

package nillion.values.v1.value;

import "google/protobuf/empty.proto";

// A named value.
message NamedValue {
// The name of this value.
string name = 1;

// The value itself.
Value value = 2;
}

// A value.
message Value {
oneof value {
// A public boolean.
PublicInteger public_boolean = 1;

// A public integer.
PublicInteger public_integer = 2;

// A public unsigned integer.
PublicInteger public_unsigned_integer = 3;

// A shamir share of a secret boolean value.
ShamirShare shamir_share_boolean = 4;

// A shamir share of a secret integer value.
ShamirShare shamir_share_integer = 5;

// A shamir share of a secret unsigned integer value.
ShamirShare shamir_share_unsigned_integer = 6;

// An array.
Array array = 7;

// A tuple.
Tuple tuple = 8;

// A secret shared blob.
ShamirSharesBlob shamir_shares_blob = 9;

// An ECDSA private key share.
EcdsaPrivateKeyShare ecdsa_private_key_share = 10;

// An ECDSA signature share.
EcdsaSignatureShare ecdsa_signature_share = 11;

// The digest of a message.
EcdsaMessageDigest ecdsa_message_digest = 12;
}
}

// A public integer.
message PublicInteger {
// The integer value, encoded in little endian.
bytes value = 1;
}

// A shamir share.
message ShamirShare {
// The value, encoded in little endian.
bytes value = 1;
}

// An array.
message Array {
// The array values.
//
// All the values must be of the same type.
repeated Value values = 1;

// The type of all elements in this array.
ValueType inner_type = 2;
}

// A tuple.
message Tuple {
// The left value.
Value left = 1;

// The right value.
Value right = 2;
}

// An ECDSA private key share.
message EcdsaPrivateKeyShare {
// Index of local party in key generation protocol.
uint32 i = 1;

// The secret share x.
bytes x = 2;

// Public key corresponding to shared secret key, in compressed form.
bytes shared_public_key = 3;

// Public shares of all signers sharing the key, in compressed form.
repeated bytes public_shares = 4;
}

// An ECDSA signature share.
message EcdsaSignatureShare {
// r component of signature share
bytes r = 1;

// sigma component of partial signature share.
bytes sigma = 2;
}

// The digest of a message.
message EcdsaMessageDigest {
// The digest.
bytes digest = 1;
}

// Shamir shares of a blob.
message ShamirSharesBlob {
// The shares.
repeated ShamirShare shares = 1;

// The original size of the blob before secret sharing.
uint64 original_size = 2;
}

// A type of a value.
message ValueType {
oneof value_type {
// A public integer.
google.protobuf.Empty public_integer = 1;

// A public unsigned integer.
google.protobuf.Empty public_unsigned_integer = 2;

// A public boolean.
google.protobuf.Empty public_boolean = 3;

// A shamir share of an integer.
google.protobuf.Empty shamir_share_integer = 4;

// A shamir share of an unsigned integer.
google.protobuf.Empty shamir_share_unsigned_integer = 5;

// A shamir share of a boolean.
google.protobuf.Empty shamir_share_boolean = 6;

// An array.
ArrayType array = 7;

// A tuple.
TupleType tuple = 8;

// An ECDSA private key share.
google.protobuf.Empty ecdsa_private_key_share = 9;

// An ECDSA message digest.
google.protobuf.Empty ecdsa_message_digest = 10;

// An ECDSA signature share.
google.protobuf.Empty ecdsa_signature_share = 11;
}
}

// An array.
message ArrayType {
// The type of each element in the array.
ValueType inner_type = 1;

// The array size.
uint64 size = 2;
}

// A tuple.
message TupleType {
// The type of the left element in the tuple.
ValueType left = 1;

// The type of the right element in the tuple.
ValueType right = 2;
}

15 changes: 14 additions & 1 deletion client-vms/src/gen-proto/nillion/compute/v1/invoke_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import type { SignedReceipt } from "../../payments/v1/receipt_pb";
import { file_nillion_payments_v1_receipt } from "../../payments/v1/receipt_pb";
import type { UserId } from "../../auth/v1/user_pb";
import { file_nillion_auth_v1_user } from "../../auth/v1/user_pb";
import type { NamedValue } from "../../values/v1/value_pb";
import { file_nillion_values_v1_value } from "../../values/v1/value_pb";
import type { Message } from "@bufbuild/protobuf";

/**
* Describes the file nillion/compute/v1/invoke.proto.
*/
export const file_nillion_compute_v1_invoke: GenFile = /*@__PURE__*/
fileDesc("Ch9uaWxsaW9uL2NvbXB1dGUvdjEvaW52b2tlLnByb3RvEhluaWxsaW9uLmNvbXB1dGUudjEuaW52b2tlIpMCChRJbnZva2VDb21wdXRlUmVxdWVzdBJCCg5zaWduZWRfcmVjZWlwdBgBIAEoCzIqLm5pbGxpb24ucGF5bWVudHMudjEucmVjZWlwdC5TaWduZWRSZWNlaXB0EhEKCXZhbHVlX2lkcxgCIAMoDBIWCg5iaW5jb2RlX3ZhbHVlcxgDIAEoDBJECg5pbnB1dF9iaW5kaW5ncxgEIAMoCzIsLm5pbGxpb24uY29tcHV0ZS52MS5pbnZva2UuSW5wdXRQYXJ0eUJpbmRpbmcSRgoPb3V0cHV0X2JpbmRpbmdzGAUgAygLMi0ubmlsbGlvbi5jb21w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bmcSMwoGdmFsdWVzGAYgAygLMiMubmlsbGlvbi52YWx1ZXMudjEudmFsdWUuTmFtZWRWYWx1ZSIrChVJbnZva2VDb21wdXRlUmVzcG9uc2USEgoKY29tcHV0ZV9pZBgBIAEoDCJTChFJbnB1dFBhcnR5QmluZGluZxISCgpwYXJ0eV9uYW1lGAEgASgJEioKBHVzZXIYAiABKAsyHC5uaWxsaW9uLmF1dGgudjEudXNlci5Vc2VySWQiVQoST3V0cHV0UGFydHlCaW5kaW5nEhIKCnBhcnR5X25hbWUYASABKAkSKwoFdXNlcnMYAiADKAsyHC5uaWxsaW9uLmF1dGgudjEudXNlci5Vc2VySWRCtAEKHWNvbS5uaWxsaW9uLmNvbXB1dGUudjEuaW52b2tlQgtJbnZva2VQcm90b1ABogIETkNWSaoCGU5pbGxpb24uQ29tcHV0ZS5WMS5JbnZva2XKAhlOaWxsaW9uXENvbXB1dGVcVjFcSW52b2tl4gIlTmlsbGlvblxDb21wdXRlXFYxXEludm9rZVxHUEJNZXRhZGF0YeoCHE5pbGxpb246OkNvbXB1dGU6OlYxOjpJbnZva2ViBnByb3RvMw", [file_nillion_payments_v1_receipt, file_nillion_auth_v1_user, file_nillion_values_v1_value]);

/**
* A request to invoke a computation.
Expand All @@ -41,6 +43,8 @@ export type InvokeComputeRequest = Message<"nillion.compute.v1.invoke.InvokeComp
/**
* The values being used as compute-time parameters, encoded in bincode format.
*
* Only one of `bincode_values` and `values` can be set.
*
* @generated from field: bytes bincode_values = 3;
*/
bincodeValues: Uint8Array;
Expand All @@ -58,6 +62,15 @@ export type InvokeComputeRequest = Message<"nillion.compute.v1.invoke.InvokeComp
* @generated from field: repeated nillion.compute.v1.invoke.OutputPartyBinding output_bindings = 5;
*/
outputBindings: OutputPartyBinding[];

/**
* The values being used as compute-time parameters
*
* Only one of `bincode_values` and `values` can be set.
*
* @generated from field: repeated nillion.values.v1.value.NamedValue values = 6;
*/
values: NamedValue[];
};

/**
Expand Down
Loading

0 comments on commit 8ae34be

Please sign in to comment.