-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Wilfred Almeida <[email protected]>
- Loading branch information
0 parents
commit 4afbc12
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "old-faithful-proto" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
prost = { workspace = true } | ||
tonic = { workspace = true } | ||
|
||
[build-dependencies] | ||
anyhow = { workspace = true } | ||
protobuf-src = { workspace = true } | ||
tonic-build = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fn main() -> anyhow::Result<()> { | ||
std::env::set_var("PROTOC", protobuf_src::protoc()); | ||
tonic_build::compile_protos("proto/old-faithful.proto")?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
syntax = "proto3"; | ||
|
||
package OldFaithful; | ||
|
||
service OldFaithful { | ||
rpc GetVersion(VersionRequest) returns (VersionResponse); | ||
|
||
rpc GetBlock(BlockRequest) returns (BlockResponse); | ||
rpc GetTransaction(TransactionRequest) returns (TransactionResponse); | ||
} | ||
|
||
message VersionRequest {} | ||
|
||
message VersionResponse { | ||
string version = 1; | ||
} | ||
|
||
message BlockRequest { | ||
uint64 slot = 1; | ||
} | ||
|
||
message BlockResponse { | ||
bytes previous_blockhash = 1; | ||
bytes blockhash = 2; | ||
uint64 parent_slot = 3; | ||
uint64 slot = 4; | ||
int64 block_time = 5; | ||
uint64 block_height = 6; | ||
repeated Transaction transactions = 7; | ||
repeated bytes rewards = 8; | ||
} | ||
|
||
message TransactionRequest { | ||
bytes signature = 1; | ||
} | ||
|
||
message TransactionResponse { | ||
Transaction transaction = 1; | ||
uint64 slot = 2; | ||
int64 block_time = 3; | ||
} | ||
|
||
message Transaction { | ||
bytes transaction = 1; | ||
bytes meta = 2; // bincode or protobuf | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pub use {prost, tonic}; | ||
|
||
pub mod proto { | ||
tonic::include_proto!("old_faithful"); | ||
} |