Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
fmt:
cargo +nightly fmt

clippy:
cargo +nightly clippy --all-targets --all-features

build:
cargo build

test:
cargo nextest run
2 changes: 1 addition & 1 deletion tap_aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tokio.workspace = true
tonic = { version = "0.12.3", features = ["transport", "zstd"] }
tower = { version = "0.5.2", features = ["util", "steer"] }
tracing-subscriber = "0.3.17"
tap_graph = { version = "0.2.0", path = "../tap_graph" }
tap_graph = { version = "0.2.0", path = "../tap_graph", features = ["v2"] }

[build-dependencies]
tonic-build = "0.12.3"
Expand Down
10 changes: 9 additions & 1 deletion tap_aggregator/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR not set by Cargo");
println!("OUT_DIR: {}", out_dir); // This should print the output directory

tonic_build::compile_protos("./proto/tap_aggregator.proto")?;
tonic_build::configure().compile_protos(
&[
"proto/uint128.proto",
"proto/tap_aggregator.proto",
"proto/v2.proto",
],
&["proto"],
)?;

Ok(())
}
13 changes: 4 additions & 9 deletions tap_aggregator/proto/tap_aggregator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
syntax = "proto3";
package tap_aggregator.v1;

import "uint128.proto";

message Receipt {
bytes allocation_id = 1;
uint64 timestamp_ns = 2;
uint64 nonce = 3;
Uint128 value = 4;
grpc.uint128.Uint128 value = 4;
}

message SignedReceipt {
Expand All @@ -19,7 +21,7 @@ message SignedReceipt {
message ReceiptAggregateVoucher {
bytes allocation_id = 1;
uint64 timestamp_ns = 2;
Uint128 value_aggregate = 3;
grpc.uint128.Uint128 value_aggregate = 3;
}

message SignedRav {
Expand All @@ -39,10 +41,3 @@ message RavResponse {
service TapAggregator {
rpc AggregateReceipts(RavRequest) returns (RavResponse);
}

message Uint128 {
// Highest 64 bits of a 128 bit number.
uint64 high = 1;
// Lowest 64 bits of a 128 bit number.
uint64 low = 2;
}
12 changes: 12 additions & 0 deletions tap_aggregator/proto/uint128.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2023-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

syntax = "proto3";
package grpc.uint128;

message Uint128 {
// Highest 64 bits of a 128 bit number.
uint64 high = 1;
// Lowest 64 bits of a 128 bit number.
uint64 low = 2;
}
51 changes: 51 additions & 0 deletions tap_aggregator/proto/v2.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright 2023-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

syntax = "proto3";
package tap_aggregator.v2;

import "uint128.proto";

message Receipt {
bytes allocation_id = 1;
bytes payer = 2;
bytes data_service = 3;
bytes service_provider = 4;
uint64 timestamp_ns = 5;
uint64 nonce = 6;
grpc.uint128.Uint128 value = 7;
}

message SignedReceipt {
Receipt message = 1;
bytes signature = 2;
}

message ReceiptAggregateVoucher {
bytes allocation_id = 1;
bytes payer = 2;
bytes data_service = 3;
bytes service_provider = 4;
uint64 timestamp_ns = 5;
grpc.uint128.Uint128 value_aggregate = 6;
bytes metadata = 7;
}

message SignedRav {
ReceiptAggregateVoucher message = 1;
bytes signature = 2;
}

message RavRequest {
repeated SignedReceipt receipts = 1;
optional SignedRav previous_rav = 2;
}

message RavResponse {
SignedRav rav = 1;
}

service TapAggregator {
rpc AggregateReceipts(RavRequest) returns (RavResponse);
}

Loading