From 8bd4d5b76e330626c892a95ffbedbd9104285122 Mon Sep 17 00:00:00 2001 From: brennan lamey Date: Mon, 27 Nov 2023 14:12:37 -0600 Subject: [PATCH 01/17] removed ping from the admin service. it now will simply use the ping rpc from the txsvc --- kwil/admin/v0/messages.proto | 8 -------- kwil/admin/v0/service.proto | 6 ------ 2 files changed, 14 deletions(-) diff --git a/kwil/admin/v0/messages.proto b/kwil/admin/v0/messages.proto index e9cadf0..365591b 100644 --- a/kwil/admin/v0/messages.proto +++ b/kwil/admin/v0/messages.proto @@ -2,14 +2,6 @@ syntax = "proto3"; package admin; option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/admin/v0;admpb"; -message PingRequest { - string message = 1; -} - -message PingResponse { - string message = 1; -} - message VersionRequest {} message VersionResponse { string version_string = 1; diff --git a/kwil/admin/v0/service.proto b/kwil/admin/v0/service.proto index e003302..c33577f 100644 --- a/kwil/admin/v0/service.proto +++ b/kwil/admin/v0/service.proto @@ -7,12 +7,6 @@ import "kwil/admin/v0/messages.proto"; import "google/api/annotations.proto"; service AdminService { - rpc Ping(PingRequest) returns (PingResponse) { - option (google.api.http) = { - get: "/api/v0/ping" - }; - } - rpc Version(VersionRequest) returns (VersionResponse) { option (google.api.http) = { get: "/api/v0/version" From 56108f4ecb72c5b1ce2a1b68e71be44e1c18b349 Mon Sep 17 00:00:00 2001 From: brennan lamey Date: Mon, 27 Nov 2023 14:57:23 -0600 Subject: [PATCH 02/17] added validator rpcs to admin (for remote signing) --- kwil/admin/v0/messages.proto | 34 ++++++++++++++++++++++++----- kwil/admin/v0/service.proto | 42 ++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/kwil/admin/v0/messages.proto b/kwil/admin/v0/messages.proto index 365591b..1dc29ad 100644 --- a/kwil/admin/v0/messages.proto +++ b/kwil/admin/v0/messages.proto @@ -16,7 +16,7 @@ message StatusRequest {} message StatusResponse { NodeInfo node = 1; SyncInfo sync = 2; - ValidatorInfo validator = 3; + Validator validator = 3; } message NodeInfo { @@ -38,10 +38,9 @@ message SyncInfo { bool syncing = 5; } -message ValidatorInfo { - bytes pubkey = 1; - string pubkey_type = 2 [json_name = "pubkey_type"]; - int64 power = 3; +message Validator { + bytes pubkey = 1; // ED25519 PubKey + int64 power = 2; } message Peer { @@ -54,3 +53,28 @@ message PeersRequest {} message PeersResponse { repeated Peer peers = 1; } + +// the following are all transactions, and therefore return a tx.BroadcastResponse +message ApproveRequest { + bytes pubkey = 1; +} +message JoinRequest {} +message LeaveRequest {} +message RemoveRequest { + bytes pubkey = 1; +} + +message JoinStatusRequest { + bytes pubkey = 1; +} + +message JoinStatusResponse { + repeated bytes approved_validators = 1 [json_name = "approved_validators"]; + repeated bytes pending_validators = 2 [json_name = "pending_validators"]; + int64 power = 3; +} + +message ListValidatorsRequest {} +message ListValidatorsResponse { + repeated Validator validators = 1; +} \ No newline at end of file diff --git a/kwil/admin/v0/service.proto b/kwil/admin/v0/service.proto index c33577f..421adbe 100644 --- a/kwil/admin/v0/service.proto +++ b/kwil/admin/v0/service.proto @@ -3,6 +3,7 @@ package admin; option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/admin/v0;admpb"; import "kwil/admin/v0/messages.proto"; +import "kwil/tx/v1/broadcast.proto"; import "google/api/annotations.proto"; @@ -24,4 +25,45 @@ service AdminService { get: "/api/v0/peers" }; } + + rpc Approve(ApproveRequest) returns (tx.BroadcastResponse) { + option (google.api.http) = { + post: "/api/v0/approve" + body: "*" + }; + } + + rpc Join(JoinRequest) returns (tx.BroadcastResponse) { + option (google.api.http) = { + post: "/api/v0/join" + body: "*" + }; + } + + rpc Leave(LeaveRequest) returns (tx.BroadcastResponse) { + option (google.api.http) = { + post: "/api/v0/leave" + body: "*" + }; + } + + rpc Remove(RemoveRequest) returns (tx.BroadcastResponse) { + option (google.api.http) = { + post: "/api/v0/remove" + body: "*" + }; + } + + rpc JoinStatus(JoinStatusRequest) returns (JoinStatusResponse) { + option (google.api.http) = { + post: "/api/v0/joinstatus" + body: "*" + }; + } + + rpc ListValidators(ListValidatorsRequest) returns (ListValidatorsResponse) { + option (google.api.http) = { + get: "/api/v0/validators" + }; + } } From ae9ba2a9a6a221e8a650ad38bf83004152841462 Mon Sep 17 00:00:00 2001 From: brennan lamey Date: Mon, 27 Nov 2023 18:20:34 -0600 Subject: [PATCH 03/17] added expiration got join status --- kwil/admin/v0/messages.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/kwil/admin/v0/messages.proto b/kwil/admin/v0/messages.proto index 1dc29ad..7178627 100644 --- a/kwil/admin/v0/messages.proto +++ b/kwil/admin/v0/messages.proto @@ -72,6 +72,7 @@ message JoinStatusResponse { repeated bytes approved_validators = 1 [json_name = "approved_validators"]; repeated bytes pending_validators = 2 [json_name = "pending_validators"]; int64 power = 3; + int64 expiration = 4; } message ListValidatorsRequest {} From 21f130b689cda04aa5dc4419e555934ce76a3680 Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Tue, 28 Nov 2023 21:25:19 -0600 Subject: [PATCH 04/17] removed unused description field from message call --- kwil/tx/v1/call.proto | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kwil/tx/v1/call.proto b/kwil/tx/v1/call.proto index 9f7484d..30306a7 100644 --- a/kwil/tx/v1/call.proto +++ b/kwil/tx/v1/call.proto @@ -4,8 +4,7 @@ option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/tx/v1;txpb"; message CallRequest { message Body{ - string description = 1; - bytes payload = 2; + bytes payload = 1; } Body body = 1; From 21994d101cbf2e8f78119d705f8897f5988886ea Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Tue, 28 Nov 2023 21:57:12 -0600 Subject: [PATCH 05/17] added foreign keys to schema --- kwil/tx/v1/dataset.proto | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kwil/tx/v1/dataset.proto b/kwil/tx/v1/dataset.proto index 07ab1b2..e0ffded 100644 --- a/kwil/tx/v1/dataset.proto +++ b/kwil/tx/v1/dataset.proto @@ -22,6 +22,7 @@ message Table { string name = 1; repeated Column columns = 2; repeated Index indexes = 3; + repeated ForeignKey foreign_keys = 4 [json_name = "foreign_keys"]; } message Column { @@ -59,4 +60,16 @@ message Extensions { string name = 1; repeated ExtensionConfig initialization = 2; string alias = 3; +} + +message ForeignKey { + repeated string child_keys = 1 [json_name = "child_keys"]; + repeated string parent_keys = 2 [json_name = "parent_keys"]; + string parent_table = 3 [json_name = "parent_table"]; + repeated ForeignKeyAction actions = 4; +} + +message ForeignKeyAction { + string on = 1; + string do = 2; } \ No newline at end of file From 6a9783aae2ab715d634cd9e0b97d8c13d89148f1 Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Tue, 28 Nov 2023 23:07:43 -0600 Subject: [PATCH 06/17] moved VerifySignature to its own service --- kwil/function/v0/messages.proto | 16 ++++++++++++++++ kwil/function/v0/service.proto | 16 ++++++++++++++++ kwil/tx/v1/service.proto | 8 -------- kwil/tx/v1/signature.proto | 11 ----------- 4 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 kwil/function/v0/messages.proto create mode 100644 kwil/function/v0/service.proto diff --git a/kwil/function/v0/messages.proto b/kwil/function/v0/messages.proto new file mode 100644 index 0000000..cc8a034 --- /dev/null +++ b/kwil/function/v0/messages.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package function; +option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/functions/v0;functionpb"; + +import "kwil/tx/v1/signature.proto"; + +message VerifySignatureRequest { + tx.Signature signature = 1; + bytes sender = 2; + bytes msg = 3; + } + + message VerifySignatureResponse { + bool valid = 1; + string error = 2; + } \ No newline at end of file diff --git a/kwil/function/v0/service.proto b/kwil/function/v0/service.proto new file mode 100644 index 0000000..80aa3ee --- /dev/null +++ b/kwil/function/v0/service.proto @@ -0,0 +1,16 @@ +syntax = "proto3"; +package function; +option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/functions/v0;functionpb"; + +import "kwil/function/v0/messages.proto"; + +import "google/api/annotations.proto"; + +service FunctionService { + rpc VerifySignature(VerifySignatureRequest) returns (VerifySignatureResponse) { + option (google.api.http) = { + post: "/api/v1/verify_signature", + body: "*" + }; + }; +} \ No newline at end of file diff --git a/kwil/tx/v1/service.proto b/kwil/tx/v1/service.proto index eb8564c..fbf120b 100644 --- a/kwil/tx/v1/service.proto +++ b/kwil/tx/v1/service.proto @@ -16,7 +16,6 @@ import "kwil/tx/v1/dataset.proto"; import "kwil/tx/v1/call.proto"; import "kwil/tx/v1/validator.proto"; import "kwil/tx/v1/tx_query.proto"; -import "kwil/tx/v1/signature.proto"; service TxService { rpc ChainInfo(ChainInfoRequest) returns (ChainInfoResponse) { @@ -122,11 +121,4 @@ service TxService { body: "*" }; } - - rpc VerifySignature(VerifySignatureRequest) returns (VerifySignatureResponse) { - option (google.api.http) = { - post: "/api/v1/verify_signature", - body: "*" - }; - } } \ No newline at end of file diff --git a/kwil/tx/v1/signature.proto b/kwil/tx/v1/signature.proto index dc2a0dd..d13d0fb 100644 --- a/kwil/tx/v1/signature.proto +++ b/kwil/tx/v1/signature.proto @@ -5,15 +5,4 @@ option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/tx/v1;txpb"; message Signature { bytes signature_bytes = 1 [json_name = "signature_bytes"]; string signature_type = 2 [json_name = "signature_type"]; -} - -message VerifySignatureRequest { - Signature signature = 1; - bytes sender = 2; - bytes msg = 3; -} - -message VerifySignatureResponse { - bool valid = 1; - string error = 2; } \ No newline at end of file From 6bb9ed332a5f85fefb0ccdada4d16dfbaad92c33 Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Tue, 28 Nov 2023 23:13:20 -0600 Subject: [PATCH 07/17] fixed naming typo --- kwil/function/v0/messages.proto | 2 +- kwil/function/v0/service.proto | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kwil/function/v0/messages.proto b/kwil/function/v0/messages.proto index cc8a034..cc7425e 100644 --- a/kwil/function/v0/messages.proto +++ b/kwil/function/v0/messages.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package function; -option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/functions/v0;functionpb"; +option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/function/v0;functionpb"; import "kwil/tx/v1/signature.proto"; diff --git a/kwil/function/v0/service.proto b/kwil/function/v0/service.proto index 80aa3ee..48cfa94 100644 --- a/kwil/function/v0/service.proto +++ b/kwil/function/v0/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; package function; -option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/functions/v0;functionpb"; +option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/function/v0;functionpb"; import "kwil/function/v0/messages.proto"; From 001fe7452803d8ed2127691330dd68a1c46b4b18 Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Tue, 28 Nov 2023 23:49:19 -0600 Subject: [PATCH 08/17] removed validator commands from txsvc --- kwil/tx/v1/service.proto | 34 -------------------- kwil/tx/v1/validator.proto | 64 -------------------------------------- 2 files changed, 98 deletions(-) delete mode 100644 kwil/tx/v1/validator.proto diff --git a/kwil/tx/v1/service.proto b/kwil/tx/v1/service.proto index fbf120b..e104c16 100644 --- a/kwil/tx/v1/service.proto +++ b/kwil/tx/v1/service.proto @@ -14,7 +14,6 @@ import "kwil/tx/v1/config.proto"; import "kwil/tx/v1/list.proto"; import "kwil/tx/v1/dataset.proto"; import "kwil/tx/v1/call.proto"; -import "kwil/tx/v1/validator.proto"; import "kwil/tx/v1/tx_query.proto"; service TxService { @@ -75,39 +74,6 @@ service TxService { }; } - rpc ApproveValidator(ValidatorApprovalRequest) returns (ValidatorApprovalResponse) { - option (google.api.http) = { - post: "/api/v1/approve_validator", - body: "*" - }; - } - - rpc ValidatorJoin(ValidatorJoinRequest) returns (ValidatorJoinResponse) { - option (google.api.http) = { - post: "/api/v1/validator_join", - body: "*" - }; - } - - rpc ValidatorLeave(ValidatorLeaveRequest) returns (ValidatorLeaveResponse) { - option (google.api.http) = { - post: "/api/v1/validator_leave", - body: "*" - }; - } - - rpc ValidatorJoinStatus(ValidatorJoinStatusRequest) returns (ValidatorJoinStatusResponse) { - option (google.api.http) = { - get: "/api/v1/validator_join_status/{pubkey}" - }; - } - - rpc CurrentValidators(CurrentValidatorsRequest) returns (CurrentValidatorsResponse) { - option (google.api.http) = { - get: "/api/v1/current_validators" - }; - } - rpc Call(CallRequest) returns (CallResponse) { option (google.api.http) = { post: "/api/v1/call", diff --git a/kwil/tx/v1/validator.proto b/kwil/tx/v1/validator.proto deleted file mode 100644 index 08d91e4..0000000 --- a/kwil/tx/v1/validator.proto +++ /dev/null @@ -1,64 +0,0 @@ -syntax = "proto3"; -package tx; -option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/tx/v1;txpb"; - - -import "kwil/tx/v1/tx.proto"; - -message Validator { - bytes pubkey = 1; // ED25519 PubKey - int64 power = 2; -} - -enum RequestStatus { - OK = 0; - ERROR = 1; -} - -message ValidatorApprovalRequest { - bytes PubKey = 1; // ED25519 PubKey -} - -message ValidatorApprovalResponse { - RequestStatus status = 1; - string log = 2; -} - -/* - If power is 0, the validator will be removed from the validator set - If power is > 0, if the validator is in the approved validator list, validator will be added to the validator set - Base64 encoded both pubkey and validator power -*/ -// TODO: these should not wrap Transactions; all of these should just get forwarded to the broadcast endpoint -message ValidatorJoinRequest { - tx.Transaction tx = 1; -} - -message ValidatorJoinResponse { - tx.TransactionStatus receipt = 1; -} - -message ValidatorLeaveRequest { - tx.Transaction tx = 1; -} - -message ValidatorLeaveResponse { - tx.TransactionStatus receipt = 1; -} - -message CurrentValidatorsRequest { -} - -message CurrentValidatorsResponse { - repeated Validator validators = 1; -} - -message ValidatorJoinStatusRequest { - bytes pubkey = 1; // ED25519 PubKey -} - -message ValidatorJoinStatusResponse { - repeated bytes approved_validators = 1 [json_name = "approved_validators"]; - repeated bytes pending_validators = 2 [json_name = "pending_validators"]; - int64 power = 3; -} From 847a7ddf5c262a1530c7caaaa799b6027d6d6cb0 Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Sun, 3 Dec 2023 17:46:00 -0600 Subject: [PATCH 09/17] added info endpoint --- kwil/tx/v1/info.proto | 12 ++++++++++++ kwil/tx/v1/service.proto | 7 +++++++ 2 files changed, 19 insertions(+) create mode 100644 kwil/tx/v1/info.proto diff --git a/kwil/tx/v1/info.proto b/kwil/tx/v1/info.proto new file mode 100644 index 0000000..5f3b871 --- /dev/null +++ b/kwil/tx/v1/info.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package tx; +option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/tx/v1;txpb"; + +// InfoRequest requests a node's information. +message InfoRequest {} + +// InfoResponse is a node's information. +message InfoResponse { + bytes public_key = 1 [json_name = "public_key"]; + string p2p_address = 2 [json_name = "p2p_address"]; +} \ No newline at end of file diff --git a/kwil/tx/v1/service.proto b/kwil/tx/v1/service.proto index e104c16..fa6c7fa 100644 --- a/kwil/tx/v1/service.proto +++ b/kwil/tx/v1/service.proto @@ -15,6 +15,7 @@ import "kwil/tx/v1/list.proto"; import "kwil/tx/v1/dataset.proto"; import "kwil/tx/v1/call.proto"; import "kwil/tx/v1/tx_query.proto"; +import "kwil/tx/v1/info.proto"; service TxService { rpc ChainInfo(ChainInfoRequest) returns (ChainInfoResponse) { @@ -23,6 +24,12 @@ service TxService { }; } + rpc Info(InfoRequest) returns (InfoResponse) { + option (google.api.http) = { + get: "/api/v1/info", + }; + } + rpc Broadcast(BroadcastRequest) returns (BroadcastResponse) { option (google.api.http) = { post: "/api/v1/broadcast", From 238fc20be3e9fc8cf4cbd8cb7ba9964968a2df91 Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Sun, 3 Dec 2023 18:13:53 -0600 Subject: [PATCH 10/17] added node id to info --- kwil/tx/v1/info.proto | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kwil/tx/v1/info.proto b/kwil/tx/v1/info.proto index 5f3b871..6a9851f 100644 --- a/kwil/tx/v1/info.proto +++ b/kwil/tx/v1/info.proto @@ -7,6 +7,7 @@ message InfoRequest {} // InfoResponse is a node's information. message InfoResponse { - bytes public_key = 1 [json_name = "public_key"]; - string p2p_address = 2 [json_name = "p2p_address"]; + string node_id = 1 [json_name = "node_id"]; + bytes public_key = 2 [json_name = "public_key"]; + string p2p_address = 3 [json_name = "p2p_address"]; } \ No newline at end of file From dfdf1c17d8864a94789563c012eadfaf79e1ea0b Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Sun, 3 Dec 2023 18:35:46 -0600 Subject: [PATCH 11/17] renamed node info --- kwil/tx/v1/info.proto | 8 ++++---- kwil/tx/v1/service.proto | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kwil/tx/v1/info.proto b/kwil/tx/v1/info.proto index 6a9851f..748ad50 100644 --- a/kwil/tx/v1/info.proto +++ b/kwil/tx/v1/info.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package tx; option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/tx/v1;txpb"; -// InfoRequest requests a node's information. -message InfoRequest {} +// NodeInfoRequest requests a node's information. +message NodeInfoRequest {} -// InfoResponse is a node's information. -message InfoResponse { +// NodeInfoResponse is a node's information. +message NodeInfoResponse { string node_id = 1 [json_name = "node_id"]; bytes public_key = 2 [json_name = "public_key"]; string p2p_address = 3 [json_name = "p2p_address"]; diff --git a/kwil/tx/v1/service.proto b/kwil/tx/v1/service.proto index fa6c7fa..311d5c5 100644 --- a/kwil/tx/v1/service.proto +++ b/kwil/tx/v1/service.proto @@ -24,9 +24,9 @@ service TxService { }; } - rpc Info(InfoRequest) returns (InfoResponse) { + rpc NodeInfo(NodeInfoRequest) returns (NodeInfoResponse) { option (google.api.http) = { - get: "/api/v1/info", + get: "/api/v1/node_info", }; } From c16794b22f474d2a64ad3523d54ad36fbf38d5ce Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Mon, 4 Dec 2023 11:02:22 -0600 Subject: [PATCH 12/17] removed info --- kwil/tx/v1/info.proto | 13 ------------- kwil/tx/v1/service.proto | 7 ------- 2 files changed, 20 deletions(-) delete mode 100644 kwil/tx/v1/info.proto diff --git a/kwil/tx/v1/info.proto b/kwil/tx/v1/info.proto deleted file mode 100644 index 748ad50..0000000 --- a/kwil/tx/v1/info.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package tx; -option go_package = "github.com/kwilteam/kwil-db/core/rpc/protobuf/tx/v1;txpb"; - -// NodeInfoRequest requests a node's information. -message NodeInfoRequest {} - -// NodeInfoResponse is a node's information. -message NodeInfoResponse { - string node_id = 1 [json_name = "node_id"]; - bytes public_key = 2 [json_name = "public_key"]; - string p2p_address = 3 [json_name = "p2p_address"]; -} \ No newline at end of file diff --git a/kwil/tx/v1/service.proto b/kwil/tx/v1/service.proto index 311d5c5..e104c16 100644 --- a/kwil/tx/v1/service.proto +++ b/kwil/tx/v1/service.proto @@ -15,7 +15,6 @@ import "kwil/tx/v1/list.proto"; import "kwil/tx/v1/dataset.proto"; import "kwil/tx/v1/call.proto"; import "kwil/tx/v1/tx_query.proto"; -import "kwil/tx/v1/info.proto"; service TxService { rpc ChainInfo(ChainInfoRequest) returns (ChainInfoResponse) { @@ -24,12 +23,6 @@ service TxService { }; } - rpc NodeInfo(NodeInfoRequest) returns (NodeInfoResponse) { - option (google.api.http) = { - get: "/api/v1/node_info", - }; - } - rpc Broadcast(BroadcastRequest) returns (BroadcastResponse) { option (google.api.http) = { post: "/api/v1/broadcast", From e5cde7a9d94d77f4fdc7f7280959d8e88a5cda6b Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:56:52 -0600 Subject: [PATCH 13/17] added ability to list pending joins --- kwil/admin/v0/messages.proto | 10 ++++++++-- kwil/admin/v0/service.proto | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/kwil/admin/v0/messages.proto b/kwil/admin/v0/messages.proto index 7178627..be3be02 100644 --- a/kwil/admin/v0/messages.proto +++ b/kwil/admin/v0/messages.proto @@ -68,14 +68,20 @@ message JoinStatusRequest { bytes pubkey = 1; } -message JoinStatusResponse { +message PendingJoinRequest { repeated bytes approved_validators = 1 [json_name = "approved_validators"]; repeated bytes pending_validators = 2 [json_name = "pending_validators"]; int64 power = 3; int64 expiration = 4; + bytes pubkey = 5; } message ListValidatorsRequest {} message ListValidatorsResponse { repeated Validator validators = 1; -} \ No newline at end of file +} + +message ListJoinRequestsRequest {} +message ListJoinRequestsResponse { + repeated PendingJoinRequest join_requests = 1 [json_name = "join_requests"]; +} diff --git a/kwil/admin/v0/service.proto b/kwil/admin/v0/service.proto index 421adbe..e3b3561 100644 --- a/kwil/admin/v0/service.proto +++ b/kwil/admin/v0/service.proto @@ -54,7 +54,7 @@ service AdminService { }; } - rpc JoinStatus(JoinStatusRequest) returns (JoinStatusResponse) { + rpc JoinStatus(JoinStatusRequest) returns (PendingJoinRequest) { option (google.api.http) = { post: "/api/v0/joinstatus" body: "*" @@ -66,4 +66,10 @@ service AdminService { get: "/api/v0/validators" }; } + + rpc ListPendingJoins(ListJoinRequestsRequest) returns (ListJoinRequestsResponse) { + option (google.api.http) = { + get: "/api/v0/pendingjoins" + }; + } } From 58458490f1f4e076b8e707bf8be14d9093ea3cd9 Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:59:39 -0600 Subject: [PATCH 14/17] renaming to avoid confusion --- kwil/admin/v0/messages.proto | 7 +++++-- kwil/admin/v0/service.proto | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/kwil/admin/v0/messages.proto b/kwil/admin/v0/messages.proto index be3be02..676ca1b 100644 --- a/kwil/admin/v0/messages.proto +++ b/kwil/admin/v0/messages.proto @@ -67,8 +67,11 @@ message RemoveRequest { message JoinStatusRequest { bytes pubkey = 1; } +message JoinStatusResponse { + PendingJoin join_request = 1 [json_name = "join_request"]; +} -message PendingJoinRequest { +message PendingJoin { repeated bytes approved_validators = 1 [json_name = "approved_validators"]; repeated bytes pending_validators = 2 [json_name = "pending_validators"]; int64 power = 3; @@ -83,5 +86,5 @@ message ListValidatorsResponse { message ListJoinRequestsRequest {} message ListJoinRequestsResponse { - repeated PendingJoinRequest join_requests = 1 [json_name = "join_requests"]; + repeated PendingJoin join_requests = 1 [json_name = "join_requests"]; } diff --git a/kwil/admin/v0/service.proto b/kwil/admin/v0/service.proto index e3b3561..78477bb 100644 --- a/kwil/admin/v0/service.proto +++ b/kwil/admin/v0/service.proto @@ -54,7 +54,7 @@ service AdminService { }; } - rpc JoinStatus(JoinStatusRequest) returns (PendingJoinRequest) { + rpc JoinStatus(JoinStatusRequest) returns (JoinStatusResponse) { option (google.api.http) = { post: "/api/v0/joinstatus" body: "*" From c5a892f75dbd8025a870019010006b6fa31a56a8 Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:22:26 -0600 Subject: [PATCH 15/17] changed pending join to better reflect Kwils types struct --- kwil/admin/v0/messages.proto | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kwil/admin/v0/messages.proto b/kwil/admin/v0/messages.proto index 676ca1b..e71fac9 100644 --- a/kwil/admin/v0/messages.proto +++ b/kwil/admin/v0/messages.proto @@ -72,11 +72,11 @@ message JoinStatusResponse { } message PendingJoin { - repeated bytes approved_validators = 1 [json_name = "approved_validators"]; - repeated bytes pending_validators = 2 [json_name = "pending_validators"]; - int64 power = 3; - int64 expiration = 4; - bytes pubkey = 5; + bytes candidate = 1; // ED25519 PubKey + int64 power = 2; + int64 expires_at = 3 [json_name = "expires_at"]; + repeated bytes board = 4; // all validators + repeated bool approved = 5; // whether each validator has approved } message ListValidatorsRequest {} From 3b6d97a240857b28f6c7c701a52f2e9be3be193e Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Mon, 4 Dec 2023 23:29:16 -0600 Subject: [PATCH 16/17] upgrade returned dataset info to account for returning all databases --- kwil/tx/v1/list.proto | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kwil/tx/v1/list.proto b/kwil/tx/v1/list.proto index 93cfb92..c160c21 100644 --- a/kwil/tx/v1/list.proto +++ b/kwil/tx/v1/list.proto @@ -7,5 +7,11 @@ message ListDatabasesRequest { } message ListDatabasesResponse { - repeated string databases = 1; + repeated DatasetInfo databases = 1; +} + +message DatasetInfo { + string name = 1; + bytes owner = 2; + string dbid = 3; } \ No newline at end of file From 9a836553c13f1f176c3249849ed5bb489e446f7a Mon Sep 17 00:00:00 2001 From: Brennan Lamey <66885902+brennanjl@users.noreply.github.com> Date: Tue, 5 Dec 2023 00:51:44 -0600 Subject: [PATCH 17/17] added get config rpc for debugging --- kwil/admin/v0/messages.proto | 5 +++++ kwil/admin/v0/service.proto | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/kwil/admin/v0/messages.proto b/kwil/admin/v0/messages.proto index e71fac9..bdae7d9 100644 --- a/kwil/admin/v0/messages.proto +++ b/kwil/admin/v0/messages.proto @@ -88,3 +88,8 @@ message ListJoinRequestsRequest {} message ListJoinRequestsResponse { repeated PendingJoin join_requests = 1 [json_name = "join_requests"]; } + +message GetConfigRequest {} +message GetConfigResponse { + bytes config = 1; // due to the size of the config, and how often it is updated, doing this for now +} \ No newline at end of file diff --git a/kwil/admin/v0/service.proto b/kwil/admin/v0/service.proto index 78477bb..1e8e863 100644 --- a/kwil/admin/v0/service.proto +++ b/kwil/admin/v0/service.proto @@ -72,4 +72,10 @@ service AdminService { get: "/api/v0/pendingjoins" }; } + + rpc GetConfig(GetConfigRequest) returns (GetConfigResponse) { + option (google.api.http) = { + get: "/api/v0/config" + }; + } }