Skip to content

Commit 59f8b97

Browse files
committed
add GetTwoWayPegData RPC
1 parent b23aca0 commit 59f8b97

File tree

1 file changed

+87
-4
lines changed

1 file changed

+87
-4
lines changed

proto/mainchain.proto

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

6+
enum AddressType {
7+
ADDRESS_TYPE_UNSPECIFIED = 0;
8+
ADDRESS_TYPE_LEGACY = 1;
9+
}
10+
611
message BlockHeaderInfo {
712
bytes block_hash = 1;
813
bytes prev_block_hash = 2;
@@ -11,10 +16,20 @@ message BlockHeaderInfo {
1116
bytes work = 4;
1217
}
1318

19+
message OutPoint {
20+
bytes txid = 1;
21+
uint32 vout = 2;
22+
}
23+
24+
message Output {
25+
bytes address = 2;
26+
uint64 value_sats = 3;
27+
}
28+
1429
message Deposit {
1530
uint64 sequence_number = 1;
16-
bytes address = 2;
17-
uint64 value = 3;
31+
OutPoint outpoint = 2;
32+
Output output = 3;
1833
}
1934

2035
enum WithdrawalBundleEventType {
@@ -28,22 +43,66 @@ message WithdrawalBundleEvent {
2843
WithdrawalBundleEventType withdrawal_bundle_event_type = 2;
2944
}
3045

46+
// Specific to an individual sidechain slot
3147
message BlockInfo {
3248
repeated Deposit deposits = 1;
3349
optional WithdrawalBundleEvent withdrawal_bundle_event = 2;
34-
repeated bytes bmm_hashes = 3;
50+
optional bytes bmm_commitment = 3;
3551
}
3652

3753
service Mainchain {
54+
rpc BroadcastWithdrawalBundle(BroadcastWithdrawalBundleRequest)
55+
returns (BroadcastWithdrawalBundleResponse);
56+
rpc CreateBmmCriticalDataTransaction(CreateBmmCriticalDataTransactionRequest)
57+
returns (CreateBmmCriticalDataTransactionResponse);
58+
rpc CreateNewAddress(CreateNewAddressRequest)
59+
returns (CreateNewAddressResponse);
60+
// Regtest only
61+
rpc GenerateBlocks(GenerateBlocksRequest)
62+
returns (GenerateBlocksResponse);
3863
rpc GetBlockHeaderInfo(GetBlockHeaderInfoRequest)
3964
returns (GetBlockHeaderInfoResponse);
4065
rpc GetBlockInfo(GetBlockInfoRequest) returns (GetBlockInfoResponse);
4166
rpc GetBmmHStarCommitments(GetBmmHStarCommitmentsRequest)
4267
returns (GetBmmHStarCommitmentsResponse);
4368
rpc GetChainTip(GetChainTipRequest) returns (GetChainTipResponse);
69+
rpc GetTwoWayPegData(GetTwoWayPegDataRequest)
70+
returns (GetTwoWayPegDataResponse);
4471
rpc SubscribeEvents(SubscribeEventsRequest) returns (stream EventResponse);
4572
}
4673

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

54113
message GetBlockInfoRequest {
55114
bytes block_hash = 1;
115+
uint32 sidechain_id = 2;
56116
}
57117
message GetBlockInfoResponse {
58118
BlockHeaderInfo header_info = 1;
@@ -64,7 +124,16 @@ message GetBmmHStarCommitmentsRequest {
64124
uint32 sidechain_id = 2;
65125
}
66126
message GetBmmHStarCommitmentsResponse {
67-
repeated bytes commitments = 1;
127+
message BlockNotFoundError {
128+
bytes block_hash = 1;
129+
}
130+
message Commitments {
131+
repeated bytes commitments = 1;
132+
}
133+
oneof result {
134+
BlockNotFoundError block_not_found = 1;
135+
Commitments commitments = 2;
136+
}
68137
}
69138

70139
message GetChainTipRequest {
@@ -73,7 +142,21 @@ message GetChainTipResponse {
73142
BlockHeaderInfo block_header_info = 1;
74143
}
75144

145+
message GetTwoWayPegDataRequest {
146+
uint32 sidechain_id = 1;
147+
optional bytes start_block_hash = 2;
148+
bytes end_block_hash = 3;
149+
}
150+
message GetTwoWayPegDataResponse {
151+
message ResponseItem {
152+
BlockHeaderInfo block_header_info = 1;
153+
BlockInfo block_info = 2;
154+
}
155+
repeated ResponseItem blocks = 1;
156+
}
157+
76158
message SubscribeEventsRequest {
159+
uint32 sidechain_id = 1;
77160
}
78161
message EventResponse {
79162
message Event {

0 commit comments

Comments
 (0)