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

chore: update protobuf files and wasm client #46

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
aws-region: "eu-west-1"
- uses: NillionNetwork/nillion-setup-action@main
with:
version: "v0.7.0"
version: "v0.9.0-rc.17"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
Expand Down
4 changes: 4 additions & 0 deletions client-vms/proto/nillion/membership/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ package nillion.membership.v1;

import "google/protobuf/empty.proto";
import "nillion/membership/v1/cluster.proto";
import "nillion/membership/v1/version.proto";

// Exposes information about a node's membership.
service Membership {
// Get the definition of the cluster the node queried is part of.
rpc Cluster(google.protobuf.Empty) returns (cluster.Cluster);

// Get the node's version.
rpc NodeVersion(google.protobuf.Empty) returns (version.NodeVersion);
}

30 changes: 30 additions & 0 deletions client-vms/proto/nillion/membership/v1/version.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
syntax = "proto3";

package nillion.membership.v1.version;

// The node's version.
message NodeVersion {
// The node's version.
SemverVersion version = 1;

// The built git commit hash.
string git_hash = 2;
}

// A semver version.
message SemverVersion {
// The major version.
uint64 major = 1;

// The minor version.
uint64 minor = 2;

// The patch version.
uint64 patch = 3;

// The optional pre-release version.
string pre_release = 4;
}



33 changes: 33 additions & 0 deletions client-vms/proto/nillion/payments/v1/balance.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";

package nillion.payments.v1.balance;

import "google/protobuf/timestamp.proto";
import "nillion/auth/v1/user.proto";

// A response to a request to get the user account's balance.
message AccountBalanceResponse {
// The account balance, in unil.
uint64 balance = 1;

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

// A request to add funds to a user's account.
message AddFundsRequest {
// The serialized `AddFunds` payload.
bytes payload = 1;

// The nilchain transaction hash that proves this payment was made.
string tx_hash = 2;
}

// The payload sent as part of an add funds request.
message AddFundsPayload {
// The user the funds are being given to.
nillion.auth.v1.user.UserId recipient = 1;

// A 32 byte nonce that is used to add entropy to the hash of this message and to prevent duplicate spending.
bytes nonce = 2;
}
10 changes: 10 additions & 0 deletions client-vms/proto/nillion/payments/v1/config.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
syntax = "proto3";

package nillion.payments.v1.config;

// A response to a payments configuration request.
message PaymentsConfigResponse {
// The minimum amount of unil that can be added in a `Payments.add_funds` request.
uint64 minimum_add_funds_payment = 1;
}

53 changes: 22 additions & 31 deletions client-vms/proto/nillion/payments/v1/quote.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package nillion.payments.v1.quote;
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "nillion/preprocessing/v1/element.proto";
import "nillion/preprocessing/v1/material.proto";

// A price quote request.
message PriceQuoteRequest {
Expand Down Expand Up @@ -60,41 +61,18 @@ message PriceQuote {

// The preprocessing requirements for this operation.
repeated PreprocessingRequirement preprocessing_requirements = 5;

// The auxiliary material requirements for this operation.
repeated AuxiliaryMaterialRequirement auxiliary_material_requirements = 6;
}

// The fees associated with a quote.
//
// All fees are in "unil" units.
message QuoteFees {
// The sum of all the fees.
reserved 2 to 6;
// The total fee for this quote.
uint64 total = 1;

// The base fee.
//
// This is a flat fee based on the operation being ran.
uint64 base = 2;

// The congestion fee.
//
// This depends on how congested the network is.
uint64 congestion = 3;

// The storage fee.
//
// This depends on how much data is being stored, in case the operation being quoted stores data.
uint64 storage = 4;

// The preprocessing fee.
//
// This is only valid for compute operations and accounts for any preprocessing material needed
// to execute the program being invoked.
uint64 preprocessing = 5;

// The compute fee.
//
// This fee is only valid for compute operations and depends on the complexity of the program
// being invoked.
uint64 compute = 6;
}

// A store program operation.
Expand Down Expand Up @@ -125,9 +103,12 @@ message ProgramMetadata {

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

// The auxiliary material requirements.
repeated AuxiliaryMaterialRequirement auxiliary_material_requirements = 6;
}

// A number of preprocessing elements required for a program.
// The number of preprocessing elements required for a program.
message PreprocessingRequirement {
// The preprocessing element.
nillion.preprocessing.v1.element.PreprocessingElement element = 1;
Expand All @@ -136,6 +117,17 @@ message PreprocessingRequirement {
uint64 count = 2;
}

// The auxiliary material required for a program.
message AuxiliaryMaterialRequirement {
// The preprocessing element.
nillion.preprocessing.v1.material.AuxiliaryMaterial material = 1;

// The version needed.
//
// This field is used internally and should be ignored by the client.
uint32 version = 2;
}

// A retrieve values operation.
message RetrieveValues {
// The identifier to be retrieved.
Expand All @@ -162,8 +154,7 @@ message UpdatePermissions {

// A store values operation.
message StoreValues {
// The number of particles being stored.
uint64 particles_count = 1;
reserved 1;

// The number of secret shared secrets being stored.
//
Expand Down
15 changes: 15 additions & 0 deletions client-vms/proto/nillion/payments/v1/receipt.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
import "nillion/payments/v1/quote.proto";
import "nillion/preprocessing/v1/element.proto";
import "nillion/preprocessing/v1/material.proto";

// A request to get a payment receipt for a paid operation.
message PaymentReceiptRequest {
// The quote that the user paid for.
quote.SignedQuote signed_quote = 1;

// The nilchain transaction hash that proves this payment was made.
//
// Not setting this field indicates the payment should be subtracted from the user's account balance.
string tx_hash = 2;
}

Expand Down Expand Up @@ -76,6 +79,9 @@ message InvokeComputeMetadata {

// The selected preprocessing offsets for this operation.
repeated SelectedPreprocessingOffsets offsets = 2;

// The auxiliary material needed for this operation.
repeated SelectedAuxiliaryMaterial auxiliary_materials = 3;
}

// The selected offsets for a preprocessing element.
Expand All @@ -95,3 +101,12 @@ message SelectedPreprocessingOffsets {
uint64 batch_size = 4;
}

// The selected auxiliary material.
message SelectedAuxiliaryMaterial {
// The material type.
nillion.preprocessing.v1.material.AuxiliaryMaterial material = 1;

// the material version.
uint32 version = 2;
}

12 changes: 12 additions & 0 deletions client-vms/proto/nillion/payments/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ syntax = "proto3";

package nillion.payments.v1;

import "google/protobuf/empty.proto";
import "nillion/payments/v1/balance.proto";
import "nillion/payments/v1/config.proto";
import "nillion/payments/v1/quote.proto";
import "nillion/payments/v1/receipt.proto";

Expand All @@ -12,6 +15,15 @@ service Payments {

// Get a payment receipt for a paid operation.
rpc PaymentReceipt(receipt.PaymentReceiptRequest) returns (receipt.SignedReceipt);

// Get the payments configuration for this network.
rpc PaymentsConfig(google.protobuf.Empty) returns (config.PaymentsConfigResponse);

// Get the user account's balance.
rpc AccountBalance(google.protobuf.Empty) returns (balance.AccountBalanceResponse);

// Add funds to a user account's balance.
rpc AddFunds(balance.AddFundsRequest) returns (google.protobuf.Empty);
}


6 changes: 2 additions & 4 deletions client-vms/proto/nillion/preprocessing/v1/element.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@ package nillion.preprocessing.v1.element;

// A preprocessing element.
enum PreprocessingElement {
ALPHA = 0;
LAMBDA = 1;
reserved 1, 6;
RANDOM_BOOLEAN = 0;
COMPARE = 2;
DIVISION_SECRET_DIVISOR = 3;
EQUALITY_SECRET_OUTPUT = 4;
EQUALITY_PUBLIC_OUTPUT = 5;
SHARE_TO_PARTICLE = 6;
MODULO = 7;
TRUNC = 8;
TRUNC_PR = 9;
RANDOM_INTEGER = 10;
RANDOM_BOOLEAN = 11;
}
3 changes: 3 additions & 0 deletions client-vms/proto/nillion/preprocessing/v1/generate.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ message GenerateAuxiliaryMaterialRequest {

// The material we want to generate.
material.AuxiliaryMaterial material = 2;

// The version of the material to generate.
uint32 version = 3;
}

/// A response to a request to generate auxiliary material.
Expand Down
14 changes: 13 additions & 1 deletion client-vms/src/gen-proto/nillion/membership/v1/service_pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import type { EmptySchema } from "@bufbuild/protobuf/wkt";
import { file_google_protobuf_empty } from "@bufbuild/protobuf/wkt";
import type { ClusterSchema } from "./cluster_pb";
import { file_nillion_membership_v1_cluster } from "./cluster_pb";
import type { NodeVersionSchema } from "./version_pb";
import { file_nillion_membership_v1_version } from "./version_pb";

/**
* Describes the file nillion/membership/v1/service.proto.
*/
export const file_nillion_membership_v1_service: GenFile = /*@__PURE__*/
fileDesc("CiNuaWxsaW9uL21lbWJlcnNoaXAvdjEvc2VydmljZS5wcm90bxIVbmlsbGlvbi5tZW1iZXJzaGlwLnYxMlcKCk1lbWJlcnNoaXASSQoHQ2x1c3RlchIWLmdvb2dsZS5wcm90b2J1Zi5FbXB0eRomLm5pbGxpb24ubWVtYmVyc2hpcC52MS5jbHVzdGVyLkNsdXN0ZXJCnwEKGWNvbS5uaWxsaW9uLm1lbWJlcnNoaXAudjFCDFNlcnZpY2VQcm90b1ABogIDTk1YqgIVTmlsbGlvbi5NZW1iZXJzaGlwLlYxygIVTmlsbGlvblxNZW1iZXJzaGlwXFYx4gIhTmlsbGlvblxNZW1iZXJzaGlwXFYxXEdQQk1ldGFkYXRh6gIXTmlsbGlvbjo6TWVtYmVyc2hpcDo6VjFiBnByb3RvMw", [file_google_protobuf_empty, file_nillion_membership_v1_cluster]);
fileDesc("CiNuaWxsaW9uL21lbWJlcnNoaXAvdjEvc2VydmljZS5wcm90bxIVbmlsbGlvbi5tZW1iZXJzaGlwLnYxMqoBCgpNZW1iZXJzaGlwEkkKB0NsdXN0ZXISFi5nb29nbGUucHJvdG9idWYuRW1wdHkaJi5uaWxsaW9uLm1lbWJlcnNoaXAudjEuY2x1c3Rlci5DbHVzdGVyElEKC05vZGVWZXJzaW9uEhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5GioubmlsbGlvbi5tZW1iZXJzaGlwLnYxLnZlcnNpb24uTm9kZVZlcnNpb25CnwEKGWNvbS5uaWxsaW9uLm1lbWJlcnNoaXAudjFCDFNlcnZpY2VQcm90b1ABogIDTk1YqgIVTmlsbGlvbi5NZW1iZXJzaGlwLlYxygIVTmlsbGlvblxNZW1iZXJzaGlwXFYx4gIhTmlsbGlvblxNZW1iZXJzaGlwXFYxXEdQQk1ldGFkYXRh6gIXTmlsbGlvbjo6TWVtYmVyc2hpcDo6VjFiBnByb3RvMw", [file_google_protobuf_empty, file_nillion_membership_v1_cluster, file_nillion_membership_v1_version]);

/**
* Exposes information about a node's membership.
Expand All @@ -31,6 +33,16 @@ export const Membership: GenService<{
input: typeof EmptySchema;
output: typeof ClusterSchema;
},
/**
* Get the node's version.
*
* @generated from rpc nillion.membership.v1.Membership.NodeVersion
*/
nodeVersion: {
methodKind: "unary";
input: typeof EmptySchema;
output: typeof NodeVersionSchema;
},
}> = /*@__PURE__*/
serviceDesc(file_nillion_membership_v1_service, 0);

Loading
Loading