Skip to content

Commit a4e2db5

Browse files
committed
add GetTwoWayPegData RPC
1 parent b23aca0 commit a4e2db5

File tree

1 file changed

+90
-4
lines changed

1 file changed

+90
-4
lines changed

proto/mainchain.proto

+90-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
syntax = "proto3";
44
package cusf.mainchain;
55

6+
enum AddressType {
7+
ADDRESS_TYPE_UNSPECIFIED = 0;
8+
ADDRESS_TYPE_DEFAULT = 1;
9+
ADDRESS_TYPE_BECH32 = 2;
10+
ADDRESS_TYPE_LEGACY = 3;
11+
ADDRESS_TYPE_P2SH_SEGWIT = 4;
12+
}
13+
614
message BlockHeaderInfo {
715
bytes block_hash = 1;
816
bytes prev_block_hash = 2;
@@ -11,10 +19,20 @@ message BlockHeaderInfo {
1119
bytes work = 4;
1220
}
1321

22+
message OutPoint {
23+
bytes txid = 1;
24+
uint32 vout = 2;
25+
}
26+
27+
message Output {
28+
bytes address = 2;
29+
uint64 value_sats = 3;
30+
}
31+
1432
message Deposit {
1533
uint64 sequence_number = 1;
16-
bytes address = 2;
17-
uint64 value = 3;
34+
OutPoint outpoint = 2;
35+
Output output = 3;
1836
}
1937

2038
enum WithdrawalBundleEventType {
@@ -28,22 +46,66 @@ message WithdrawalBundleEvent {
2846
WithdrawalBundleEventType withdrawal_bundle_event_type = 2;
2947
}
3048

49+
// Specific to an individual sidechain slot
3150
message BlockInfo {
3251
repeated Deposit deposits = 1;
3352
optional WithdrawalBundleEvent withdrawal_bundle_event = 2;
34-
repeated bytes bmm_hashes = 3;
53+
optional bytes bmm_commitment = 3;
3554
}
3655

3756
service Mainchain {
57+
rpc BroadcastWithdrawalBundle(BroadcastWithdrawalBundleRequest)
58+
returns (BroadcastWithdrawalBundleResponse);
59+
rpc CreateBmmCriticalDataTransaction(CreateBmmCriticalDataTransactionRequest)
60+
returns (CreateBmmCriticalDataTransactionResponse);
61+
rpc CreateNewAddress(CreateNewAddressRequest)
62+
returns (CreateNewAddressResponse);
63+
// Regtest only
64+
rpc GenerateBlocks(GenerateBlocksRequest)
65+
returns (GenerateBlocksResponse);
3866
rpc GetBlockHeaderInfo(GetBlockHeaderInfoRequest)
3967
returns (GetBlockHeaderInfoResponse);
4068
rpc GetBlockInfo(GetBlockInfoRequest) returns (GetBlockInfoResponse);
4169
rpc GetBmmHStarCommitments(GetBmmHStarCommitmentsRequest)
4270
returns (GetBmmHStarCommitmentsResponse);
4371
rpc GetChainTip(GetChainTipRequest) returns (GetChainTipResponse);
72+
rpc GetTwoWayPegData(GetTwoWayPegDataRequest)
73+
returns (GetTwoWayPegDataResponse);
4474
rpc SubscribeEvents(SubscribeEventsRequest) returns (stream EventResponse);
4575
}
4676

77+
message BroadcastWithdrawalBundleRequest {
78+
uint32 sidechain_id = 1;
79+
bytes transaction = 2;
80+
}
81+
message BroadcastWithdrawalBundleResponse {
82+
}
83+
84+
message CreateBmmCriticalDataTransactionRequest {
85+
uint32 sidechain_id = 1;
86+
uint64 value_sats = 2;
87+
uint32 height = 3;
88+
bytes critical_hash = 4;
89+
bytes prev_bytes = 5;
90+
}
91+
message CreateBmmCriticalDataTransactionResponse {
92+
bytes txid = 1;
93+
}
94+
95+
message CreateNewAddressRequest {
96+
optional string label = 1;
97+
AddressType address_type = 2;
98+
}
99+
message CreateNewAddressResponse {
100+
bytes address = 1;
101+
}
102+
103+
message GenerateBlocksRequest {
104+
uint32 blocks = 1;
105+
}
106+
message GenerateBlocksResponse {
107+
}
108+
47109
message GetBlockHeaderInfoRequest {
48110
bytes block_hash = 1;
49111
}
@@ -53,6 +115,7 @@ message GetBlockHeaderInfoResponse {
53115

54116
message GetBlockInfoRequest {
55117
bytes block_hash = 1;
118+
uint32 sidechain_id = 2;
56119
}
57120
message GetBlockInfoResponse {
58121
BlockHeaderInfo header_info = 1;
@@ -64,7 +127,16 @@ message GetBmmHStarCommitmentsRequest {
64127
uint32 sidechain_id = 2;
65128
}
66129
message GetBmmHStarCommitmentsResponse {
67-
repeated bytes commitments = 1;
130+
message BlockNotFoundError {
131+
bytes block_hash = 1;
132+
}
133+
message Commitments {
134+
repeated bytes commitments = 1;
135+
}
136+
oneof result {
137+
BlockNotFoundError block_not_found = 1;
138+
Commitments commitments = 2;
139+
}
68140
}
69141

70142
message GetChainTipRequest {
@@ -73,7 +145,21 @@ message GetChainTipResponse {
73145
BlockHeaderInfo block_header_info = 1;
74146
}
75147

148+
message GetTwoWayPegDataRequest {
149+
uint32 sidechain_id = 1;
150+
optional bytes start_block_hash = 2;
151+
bytes end_block_hash = 3;
152+
}
153+
message GetTwoWayPegDataResponse {
154+
message ResponseItem {
155+
BlockHeaderInfo block_header_info = 1;
156+
BlockInfo block_info = 2;
157+
}
158+
repeated ResponseItem blocks = 1;
159+
}
160+
76161
message SubscribeEventsRequest {
162+
uint32 sidechain_id = 1;
77163
}
78164
message EventResponse {
79165
message Event {

0 commit comments

Comments
 (0)