-
Notifications
You must be signed in to change notification settings - Fork 1
/
controller.proto
116 lines (87 loc) · 3.44 KB
/
controller.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Copyright Rivtower Technologies LLC.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
import "common.proto";
import "blockchain.proto";
import "vm/evm.proto";
package controller;
message Flag {
bool flag = 1;
}
message BlockNumber {
uint64 block_number = 1;
}
message SystemConfig {
uint32 version = 1;
bytes chain_id = 2;
bytes admin = 3;
uint32 block_interval = 4;
repeated bytes validators = 5;
bool emergency_brake = 6;
bytes version_pre_hash = 7;
bytes chain_id_pre_hash = 8;
bytes admin_pre_hash = 9;
bytes block_interval_pre_hash = 10;
bytes validators_pre_hash = 11;
bytes emergency_brake_pre_hash = 12;
uint32 quota_limit = 13;
bytes quota_limit_pre_hash = 14;
uint32 block_limit = 15;
bytes block_limit_pre_hash = 16;
}
message TransactionIndex {
uint64 tx_index = 1;
}
message CrossChainProof {
uint32 version = 1;
bytes chain_id = 2;
common.ProposalInner proposal = 3;
evm.ReceiptProof receipt_proof = 4;
bytes proof = 5;
bytes state_root = 6;
}
service RPCService {
// flag means latest or pending.
// true means pending, false means latest.
rpc GetBlockNumber(Flag) returns (BlockNumber);
rpc SendRawTransaction(blockchain.RawTransaction) returns (common.Hash);
rpc SendRawTransactions(blockchain.RawTransactions) returns (common.Hashes);
rpc GetBlockByHash(common.Hash) returns (blockchain.CompactBlock);
rpc GetHeightByHash(common.Hash) returns (BlockNumber);
rpc GetBlockByNumber(BlockNumber) returns (blockchain.CompactBlock);
rpc GetStateRootByNumber (BlockNumber) returns (common.StateRoot);
rpc GetProofByNumber (BlockNumber) returns (common.Proof);
rpc GetBlockDetailByNumber(BlockNumber) returns (blockchain.Block);
rpc GetTransaction(common.Hash) returns (blockchain.RawTransaction);
rpc GetSystemConfig(common.Empty) returns (SystemConfig);
rpc GetSystemConfigByNumber(BlockNumber) returns (SystemConfig);
rpc GetBlockHash(BlockNumber) returns (common.Hash);
rpc GetTransactionBlockNumber(common.Hash) returns (BlockNumber);
rpc GetTransactionIndex(common.Hash) returns (TransactionIndex);
// add new node
rpc AddNode(common.NodeNetInfo) returns (common.StatusCode);
rpc GetNodeStatus(common.Empty) returns (common.NodeStatus);
rpc GetCrossChainProof(common.Hash) returns (CrossChainProof);
}
service Consensus2ControllerService {
// Consensus request a Proposal to start consensus
// ret: proposal
rpc GetProposal(common.Empty) returns (common.ProposalResponse);
// when Consensus received a new proposal from other nodes, it will ask controller to check it
// args: proposal hash
// ret: ok or not
rpc CheckProposal(common.Proposal) returns (common.StatusCode);
// after Consensus, tell controller a proposal has committed
rpc CommitBlock(common.ProposalWithProof) returns (common.ConsensusConfigurationResponse);
}