Commit 3833d2e6 authored by vicotor's avatar vicotor

update protocol

parent 04484d6f
...@@ -9,10 +9,11 @@ import "base/gogo.proto"; ...@@ -9,10 +9,11 @@ import "base/gogo.proto";
option (gogoproto.messagename_all) = true; option (gogoproto.messagename_all) = true;
enum TaskType { enum TaskKind {
SystemTask = 0; SystemTask = 0;
ComputeTask = 1; ComputeTask = 1;
CustomTask = 2; CustomTask = 2;
StandardTask = 3;
} }
enum BillingMethod { enum BillingMethod {
...@@ -22,38 +23,24 @@ enum BillingMethod { ...@@ -22,38 +23,24 @@ enum BillingMethod {
} }
message TaskContent { message TaskContent {
string task_uuid = 1; string task_id = 1;
TaskType task_type = 2; TaskKind task_kind = 2;
uint64 task_id = 3; uint64 task_type = 3;
string task_cmd =4; string task_cmd =4;
bytes task_param = 5; bytes task_param = 5;
uint64 task_timestamp = 6; uint64 task_timestamp = 6;
string task_callback = 7; string task_callback = 7;
string task_uid = 8; string task_uid = 8;
string task_fee = 9; string task_fee = 9;
// todo: add workload and container publickey
int64 task_workload = 10; int64 task_workload = 10;
bytes container_pubkey = 11; bytes container_pubkey = 11;
int32 task_in_len =12; int32 task_in_len =12;
} }
// CREATE TABLE 'bills' (
// id UUID,
// time TIMESTAMP,
// type symbol CAPACITY 128 CACHE INDEX CAPACITY 8192,
// uid symbol CAPACITY 128 CACHE INDEX CAPACITY 8192,
// fee INT,
// out_len INT,
// workload INT,
// duration INT,
// profit_acc symbol CAPACITY 128 CACHE INDEX CAPACITY 8192,
// worker_acc symbol CAPACITY 128 CACHE INDEX CAPACITY 8192,
// result symbol CAPACITY 128 CACHE INDEX CAPACITY 8192
// ) timestamp (time) PARTITION BY DAY WAL;
message TaskReceipt { message TaskReceipt {
string task_uuid = 1; string task_id = 1;
uint64 task_timestamp = 2; uint64 task_timestamp = 2;
uint64 task_id = 3; uint64 task_type = 3;
string task_uid = 4; string task_uid = 4;
int64 task_fee = 5; int64 task_fee = 5;
int64 task_out_len = 6; int64 task_out_len = 6;
...@@ -66,7 +53,7 @@ message TaskReceipt { ...@@ -66,7 +53,7 @@ message TaskReceipt {
} }
message TaskResponse { message TaskResponse {
string task_uuid = 1; string task_id = 1;
bytes task_result_header = 2; bytes task_result_header = 2;
bytes task_result_body = 3; bytes task_result_body = 3;
string task_uid = 4; string task_uid = 4;
......
This diff is collapsed.
...@@ -158,6 +158,7 @@ type Proof struct { ...@@ -158,6 +158,7 @@ type Proof struct {
ManagerSignature []byte `protobuf:"bytes,3,opt,name=manager_signature,json=managerSignature,proto3" json:"manager_signature,omitempty"` ManagerSignature []byte `protobuf:"bytes,3,opt,name=manager_signature,json=managerSignature,proto3" json:"manager_signature,omitempty"`
ContainerSignature []byte `protobuf:"bytes,4,opt,name=container_signature,json=containerSignature,proto3" json:"container_signature,omitempty"` ContainerSignature []byte `protobuf:"bytes,4,opt,name=container_signature,json=containerSignature,proto3" json:"container_signature,omitempty"`
MinerSignature []byte `protobuf:"bytes,5,opt,name=miner_signature,json=minerSignature,proto3" json:"miner_signature,omitempty"` MinerSignature []byte `protobuf:"bytes,5,opt,name=miner_signature,json=minerSignature,proto3" json:"miner_signature,omitempty"`
TaskType uint64 `protobuf:"varint,8,opt,name=task_type,json=taskType,proto3" json:"task_type,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
...@@ -236,6 +237,13 @@ func (m *Proof) GetMinerSignature() []byte { ...@@ -236,6 +237,13 @@ func (m *Proof) GetMinerSignature() []byte {
return nil return nil
} }
func (m *Proof) GetTaskType() uint64 {
if m != nil {
return m.TaskType
}
return 0
}
type PushProofResponse struct { type PushProofResponse struct {
Workload uint64 `protobuf:"varint,1,opt,name=workload,proto3" json:"workload,omitempty"` Workload uint64 `protobuf:"varint,1,opt,name=workload,proto3" json:"workload,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
...@@ -551,42 +559,43 @@ func init() { ...@@ -551,42 +559,43 @@ func init() {
func init() { proto.RegisterFile("witness/v1/request_response.proto", fileDescriptor_fcd71b26d9e7af56) } func init() { proto.RegisterFile("witness/v1/request_response.proto", fileDescriptor_fcd71b26d9e7af56) }
var fileDescriptor_fcd71b26d9e7af56 = []byte{ var fileDescriptor_fcd71b26d9e7af56 = []byte{
// 584 bytes of a gzipped FileDescriptorProto // 599 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdd, 0x6e, 0xd3, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdd, 0x4e, 0x13, 0x41,
0x14, 0x56, 0x9a, 0xad, 0x5d, 0xcf, 0xfe, 0x3a, 0xd3, 0x6d, 0x01, 0x84, 0x54, 0x32, 0x21, 0x8a, 0x14, 0xce, 0xb6, 0xd0, 0x9f, 0xc3, 0x5f, 0x19, 0x0b, 0xac, 0x12, 0x93, 0xba, 0xc4, 0x58, 0x63,
0x10, 0x89, 0xc2, 0xee, 0x86, 0x84, 0x44, 0x6f, 0xca, 0x04, 0x93, 0xaa, 0x4c, 0x6a, 0x27, 0x34, 0xdc, 0x4d, 0xe5, 0x0e, 0x13, 0x13, 0xb9, 0xa9, 0x44, 0x49, 0x9a, 0x62, 0x80, 0x18, 0x92, 0x66,
0xa9, 0xf2, 0x1a, 0xd3, 0x44, 0x6d, 0xe2, 0xd6, 0x76, 0x5a, 0xed, 0x11, 0x78, 0x0d, 0x2e, 0x79, 0xe8, 0x1e, 0xdb, 0x0d, 0xec, 0xce, 0x32, 0x33, 0x4b, 0xd3, 0x47, 0xf0, 0x0d, 0xbc, 0xf6, 0xd2,
0x02, 0x9e, 0x81, 0xc7, 0xe0, 0x92, 0x57, 0xe0, 0x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0x57, 0x57, 0xdf, 0x4a, 0xa0, 0x3f, 0x02, 0xa7, 0xeb, 0xfd, 0x58, 0x80, 0xeb, 0xae, 0xf7, 0xd0, 0x20, 0x18, 0xb1, 0xa0, 0xf8, 0x51, 0x5e, 0xdb, 0xe5, 0x75, 0xe7, 0x5b, 0xa9, 0x7c, 0x72,
0xb3, 0x74, 0x54, 0x80, 0xeb, 0x76, 0xa7, 0x75, 0x41, 0x04, 0x0e, 0xb0, 0xc0, 0xbf, 0x4a, 0xdb, 0x7a, 0xfa, 0xbd, 0x04, 0xf6, 0x97, 0xf0, 0x8f, 0x3b, 0x3f, 0x67, 0xe0, 0xec, 0xb8, 0xf3, 0xab,
0x3a, 0x70, 0x76, 0xd6, 0xf5, 0x6e, 0xca, 0xd2, 0xe5, 0xf4, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb4, 0x59, 0x80, 0xb3, 0x6e, 0x6f, 0xff, 0x10, 0x25, 0x0d, 0xa9, 0xa4, 0xbf, 0x4b, 0x4b, 0x36,
0xb7, 0xc2, 0xbe, 0x65, 0x9a, 0x04, 0x00, 0x00, 0xb0, 0xb7, 0x77, 0xdc, 0x39, 0xaf, 0x68, 0x97, 0xdd, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xe9,
0x2f, 0x52, 0xa9, 0xb7, 0x04, 0x00, 0x00,
} }
...@@ -72,11 +72,12 @@ message StatusResponse { ...@@ -72,11 +72,12 @@ message StatusResponse {
} }
message PushTaskMessage { message PushTaskMessage {
string task_uuid = 1; string task_id = 1;
base.v1.TaskType task_type = 2; base.v1.TaskKind task_kind = 2;
uint64 workload = 3; uint64 workload = 3;
string task_cmd = 4; // string task_cmd = 4; //
bytes task_param = 5; bytes task_param = 5;
uint64 task_type = 6;
} }
// container_signature = sign(hash(task_id+hash(task_param)+hash(task_result))) // container_signature = sign(hash(task_id+hash(task_param)+hash(task_result)))
...@@ -84,7 +85,7 @@ message PushTaskMessage { ...@@ -84,7 +85,7 @@ message PushTaskMessage {
// manager_signature = sign(hash(task_id+hash(task_param)+hash(task_result)+(reward_address).Bytes()+(miner_address).Bytes()+container_signature+miner_signature+workload)) // manager_signature = sign(hash(task_id+hash(task_param)+hash(task_result)+(reward_address).Bytes()+(miner_address).Bytes()+container_signature+miner_signature+workload))
message SubmitTaskResult { message SubmitTaskResult {
string task_uuid = 1; string task_id = 1;
bytes container_signature = 2; // 容器签名 bytes container_signature = 2; // 容器签名
bytes miner_signature = 3; // worker 签名 bytes miner_signature = 3; // worker 签名
bytes task_result_header = 4; // result headyer bytes task_result_header = 4; // result headyer
...@@ -98,7 +99,7 @@ message SubmitResourceMap { ...@@ -98,7 +99,7 @@ message SubmitResourceMap {
} }
message ProofTaskResult { message ProofTaskResult {
string task_uuid = 1; string task_id = 1;
uint64 workload = 2; uint64 workload = 2;
bytes manager_signature = 3; // nodemanager 签名 bytes manager_signature = 3; // nodemanager 签名
bytes container_pubkey = 4; bytes container_pubkey = 4;
...@@ -110,7 +111,7 @@ message DispatchTaskRequest { ...@@ -110,7 +111,7 @@ message DispatchTaskRequest {
} }
message DispatchTaskResponse { message DispatchTaskResponse {
string task_uuid = 1; string task_id = 1;
string miner = 2; string miner = 2;
} }
......
...@@ -18,12 +18,13 @@ message PushProofRequest { ...@@ -18,12 +18,13 @@ message PushProofRequest {
message Proof { message Proof {
uint64 workload = 1; uint64 workload = 1;
string task_id = 2; string task_id = 2; // uuid ? task_id ?
bytes req_hash = 6; bytes req_hash = 6;
bytes resp_hash = 7; bytes resp_hash = 7;
bytes manager_signature = 3; bytes manager_signature = 3;
bytes container_signature = 4; bytes container_signature = 4;
bytes miner_signature = 5; bytes miner_signature = 5;
uint64 task_type = 8;
} }
message PushProofResponse { message PushProofResponse {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment