Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add block-cache-proto crate #102

Merged
merged 12 commits into from
Jun 1, 2024
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
130 changes: 117 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
members = [
"geyser-plugin-runner",
"geyser-plugin-runner/demo-plugin",
"old-faithful-proto",
"txstatus",
]
resolver = "2"
Expand All @@ -18,7 +19,8 @@ crc = "3.0.1"
crossbeam-channel = "0.5.8"
fnv = "1.0.7"
multihash = "0.19.1"
prost = "0.11.9"
prost = { package = "prost", version = "0.12.6" }
prost_011 = { package = "prost", version = "0.11.9" }
protobuf-src = "1.1.0"
serde = "1.0.188"
serde_cbor = "0.11"
Expand All @@ -31,7 +33,8 @@ solana-rpc = "~1.18.1"
solana-sdk = "~1.18.1"
solana-storage-proto = "~1.18.1"
solana-transaction-status = "~1.18.1"
tonic-build = "0.9.2"
tonic = "0.11.0"
tonic-build = "0.11.0"
tracing = "0.1.40"
zstd = "0.13.0"

Expand Down
2 changes: 1 addition & 1 deletion geyser-plugin-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crc = { workspace = true }
crossbeam-channel = { workspace = true }
fnv = { workspace = true }
multihash = { workspace = true }
prost = { workspace = true }
prost_011 = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_cbor = { workspace = true }
serde_json = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions geyser-plugin-runner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let decompressed = utils::decompress_zstd(reassembled_metadata.clone())?;

let metadata: solana_storage_proto::convert::generated::TransactionStatusMeta =
prost::Message::decode(decompressed.as_slice()).map_err(|err| {
prost_011::Message::decode(decompressed.as_slice()).map_err(|err| {
Box::new(std::io::Error::new(
std::io::ErrorKind::Other,
std::format!("Error decoding metadata: {:?}", err),
Expand Down Expand Up @@ -219,7 +219,7 @@ fn main() -> Result<(), Box<dyn Error>> {

let decompressed = utils::decompress_zstd(reassembled)?;

this_block_rewards = prost::Message::decode(decompressed.as_slice()).map_err(|err| {
this_block_rewards = prost_011::Message::decode(decompressed.as_slice()).map_err(|err| {
Box::new(std::io::Error::new(
std::io::ErrorKind::Other,
std::format!("Error decoding rewards: {:?}", err),
Expand Down
14 changes: 14 additions & 0 deletions old-faithful-proto/Cargo.toml
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 }
5 changes: 5 additions & 0 deletions old-faithful-proto/build.rs
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(())
}
46 changes: 46 additions & 0 deletions old-faithful-proto/proto/old-faithful.proto
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
}
5 changes: 5 additions & 0 deletions old-faithful-proto/src/lib.rs
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");
}
Loading