Skip to content

Commit 9867802

Browse files
committed
build(aggregator): add u256 values protobufs support
Signed-off-by: Joseph Livesey <[email protected]>
1 parent 48b78e4 commit 9867802

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed

tap_aggregator/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
99
tonic_build::configure().compile_protos(
1010
&[
1111
"proto/uint128.proto",
12+
"proto/uint256.proto",
1213
"proto/tap_aggregator.proto",
14+
"proto/tap_aggregator_u256.proto",
1315
"proto/v2.proto",
16+
"proto/v2_u256.proto",
1417
],
1518
&["proto"],
1619
)?;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2023-, Semiotic AI, Inc.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
syntax = "proto3";
5+
package tap_aggregator.v1_u256;
6+
7+
import "uint256.proto";
8+
9+
message Receipt {
10+
bytes allocation_id = 1;
11+
uint64 timestamp_ns = 2;
12+
uint64 nonce = 3;
13+
grpc.uint256.Uint256 value = 4;
14+
}
15+
16+
message SignedReceipt {
17+
Receipt message = 1;
18+
bytes signature = 2;
19+
}
20+
21+
message ReceiptAggregateVoucher {
22+
bytes allocation_id = 1;
23+
uint64 timestamp_ns = 2;
24+
grpc.uint256.Uint256 value_aggregate = 3;
25+
}
26+
27+
message SignedRav {
28+
ReceiptAggregateVoucher message = 1;
29+
bytes signature = 2;
30+
}
31+
32+
message RavRequest {
33+
repeated SignedReceipt receipts = 1;
34+
optional SignedRav previous_rav = 2;
35+
}
36+
37+
message RavResponse {
38+
SignedRav rav = 1;
39+
}
40+
41+
service TapAggregator {
42+
rpc AggregateReceipts(RavRequest) returns (RavResponse);
43+
}

tap_aggregator/proto/uint256.proto

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2023-, Semiotic AI, Inc.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
syntax = "proto3";
5+
package grpc.uint256;
6+
7+
message Uint256 {
8+
// Bits 192-255 of a 256 bit number.
9+
uint64 word3 = 1;
10+
// Bits 128-191 of a 256 bit number.
11+
uint64 word2 = 2;
12+
// Bits 64-127 of a 256 bit number.
13+
uint64 word1 = 3;
14+
// Bits 0-63 of a 256 bit number.
15+
uint64 word0 = 4;
16+
}

tap_aggregator/proto/v2_u256.proto

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright 2023-, Semiotic AI, Inc.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
syntax = "proto3";
5+
package tap_aggregator.v2_u256;
6+
7+
import "uint256.proto";
8+
9+
message Receipt {
10+
bytes allocation_id = 1;
11+
uint64 timestamp_ns = 2;
12+
uint64 nonce = 3;
13+
grpc.uint256.Uint256 value = 4;
14+
bytes payer = 5;
15+
bytes data_service = 6;
16+
bytes service_provider = 7;
17+
}
18+
19+
message SignedReceipt {
20+
Receipt message = 1;
21+
bytes signature = 2;
22+
}
23+
24+
message ReceiptAggregateVoucher {
25+
bytes allocation_id = 1;
26+
uint64 timestamp_ns = 2;
27+
grpc.uint256.Uint256 value_aggregate = 3;
28+
bytes payer = 4;
29+
bytes data_service = 5;
30+
bytes service_provider = 6;
31+
bytes metadata = 7;
32+
}
33+
34+
message SignedRav {
35+
ReceiptAggregateVoucher message = 1;
36+
bytes signature = 2;
37+
}
38+
39+
message RavRequest {
40+
repeated SignedReceipt receipts = 1;
41+
optional SignedRav previous_rav = 2;
42+
}
43+
44+
message RavResponse {
45+
SignedRav rav = 1;
46+
}
47+
48+
service TapAggregator {
49+
rpc AggregateReceipts(RavRequest) returns (RavResponse);
50+
}

0 commit comments

Comments
 (0)