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

2.0.16 #13

Closed
wants to merge 77 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
651310c
use yellowstone-proto v1.13.0+solana.1.17.28
grooviegermanikus Apr 10, 2024
c1ca3e2
1.13 with buffer window size
grooviegermanikus Apr 11, 2024
1d2937a
clippy
grooviegermanikus Apr 16, 2024
e9eb3ec
relax yellowstone dependencies
grooviegermanikus Apr 16, 2024
7f115fb
Adding notify channel to stop tasks
godmodegalactus Mar 27, 2024
280f03d
Changing Notify channel to broadcast channel
godmodegalactus Apr 2, 2024
e000a96
bump version to 0.10.5
grooviegermanikus Apr 16, 2024
aad4baf
cargo
grooviegermanikus Apr 16, 2024
fef2e70
cleanup
grooviegermanikus Apr 16, 2024
dd18a20
use dedicated AST
grooviegermanikus Apr 16, 2024
85d04ac
export GeyserGrpcClient, GeyserGrpcClientResult, GeyserGrpcClientError
grooviegermanikus Apr 16, 2024
20f29c1
bump version to 0.10.6
grooviegermanikus Apr 16, 2024
1245d8b
Merge branch 'main' into release/v0.10.x+yellowstone.1.13
grooviegermanikus Apr 18, 2024
dd78804
clarify await_or_exit behavior on channel close
grooviegermanikus Apr 29, 2024
1d1a01c
clarify await_or_exit behavior on channel close
grooviegermanikus Apr 29, 2024
929b20e
setup simple account subscription
grooviegermanikus Apr 29, 2024
f280f90
cleanup
grooviegermanikus Apr 29, 2024
e09e5e2
collectors
grooviegermanikus Apr 29, 2024
1393527
calculate delta
grooviegermanikus Apr 29, 2024
edd3a1a
histogram
grooviegermanikus Apr 29, 2024
eb964e3
log deltas
grooviegermanikus Apr 29, 2024
28c3041
log blocktime
grooviegermanikus Apr 29, 2024
2d65f2d
flip delta time
grooviegermanikus Apr 29, 2024
1e83353
document on slot delta
grooviegermanikus Apr 29, 2024
8e5b1b8
log update span
grooviegermanikus Apr 30, 2024
a6cb6bb
mock correct size distribution
grooviegermanikus May 2, 2024
39199b8
stream token accounts
grooviegermanikus May 3, 2024
2cef5ef
token account
grooviegermanikus May 3, 2024
1b536cb
build map of mint+owner
grooviegermanikus May 3, 2024
e278c14
build simple map
grooviegermanikus May 3, 2024
f60e9f2
timestamp tagging
grooviegermanikus May 6, 2024
e4bb528
configure logger
grooviegermanikus May 6, 2024
09d4700
parse logs
grooviegermanikus May 7, 2024
b64f700
args
grooviegermanikus May 7, 2024
1b5d4f4
provide logs as args
grooviegermanikus May 7, 2024
087625d
track phoenix orderbook
grooviegermanikus May 7, 2024
88f8d71
count data
grooviegermanikus May 7, 2024
193a1b6
make SubscribeRequest forward-compatible
grooviegermanikus May 8, 2024
bd439a3
Merge branch 'release/v0.10.x+yellowstone.1.13' into groovie/performa…
grooviegermanikus May 8, 2024
78b8197
calc delta using two slot sources
grooviegermanikus May 8, 2024
86412cf
define AtomicSlot
grooviegermanikus May 8, 2024
430847b
debounce update log
grooviegermanikus May 8, 2024
61b202a
stop subscribing blocks meta
grooviegermanikus May 8, 2024
6ffc8d0
bench ONLY spl accounts
grooviegermanikus May 8, 2024
32aeb33
try to enable compression
grooviegermanikus May 8, 2024
f620664
fix ordering of slot change
grooviegermanikus May 10, 2024
4157779
subscribe to all accounts
grooviegermanikus May 10, 2024
03b3d14
add x-token for slot1+slot2
grooviegermanikus May 13, 2024
08f17d3
account to CSV
grooviegermanikus May 13, 2024
71d49a5
token accounts logging
grooviegermanikus May 14, 2024
5710402
parse for time tagged log files
grooviegermanikus May 17, 2024
e366b59
read only vote transactions
grooviegermanikus Jun 6, 2024
a57860e
calculate vote timestamp spread
grooviegermanikus Jun 6, 2024
beeca85
fix account bench
grooviegermanikus Jun 7, 2024
759170c
collect hashes
grooviegermanikus Jun 7, 2024
af17800
xor+lz4
grooviegermanikus Jun 7, 2024
460ca4c
data delta
grooviegermanikus Jun 12, 2024
238f44a
fix compile
grooviegermanikus Jun 13, 2024
3fd7e6d
enable slot check
grooviegermanikus Jun 13, 2024
6319612
smarter lag logging
grooviegermanikus Jun 13, 2024
a4a93de
allow for mock reset
grooviegermanikus Jun 13, 2024
c096a04
set nodelay + add env for window+biffer sizes
grooviegermanikus Jun 14, 2024
0604573
log if env config missing
grooviegermanikus Jun 14, 2024
1724047
compare account subscription with confirmation
grooviegermanikus Aug 12, 2024
c239e1b
clarify
grooviegermanikus Aug 12, 2024
18729e8
dump
grooviegermanikus Nov 5, 2024
8574783
wip
grooviegermanikus Nov 5, 2024
c71cbbe
accounts stream from da11 ledger-tool
grooviegermanikus Nov 12, 2024
6e97616
subscripbe accounts
grooviegermanikus Nov 14, 2024
ce03864
Update to 2.0.16
Nov 20, 2024
e10e3f4
Applied cargo fmt
Nov 20, 2024
214886a
Integrates groovies stuff
Nov 25, 2024
e90ecd1
Applies PR feedback and some clippy fixes
Nov 26, 2024
9ce723f
Makes clippy happy
Nov 26, 2024
88ebcea
fix rust+deps version
grooviegermanikus Dec 9, 2024
8acb7d3
comment on loop break
grooviegermanikus Dec 9, 2024
89f27a3
comment on yellowstone version
grooviegermanikus Dec 9, 2024
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
2,124 changes: 1,165 additions & 959 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "geyser-grpc-connector"
version = "0.10.1+yellowstone.1.12"
version = "2.0.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have same naming convention

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you eleborate on this naming convention - I don't understand what 0.10.1+yellowstone.1.12 means

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.10.1 is the version of the connector. "1.12" is the yellowstone-proto (protobuf) wire format version

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay that sounds like we want 0.11.0+yellowstone.2.0.0 for this

Copy link

@mschneider mschneider Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prefer 0.11.0+solana-2.0.16 or 0.11.0+yellowstone-2.0.0+solana-2.0.16, the solana dependency is the main thing people will want to look out for when using this package, but if there's a good reason for yellowstone tags, then let's do both. yellowstone-2.0.0 unfortunately supports many solana versions

edition = "2021"

description = "Multiplexing and Reconnection on Yellowstone gRPC Geyser client streaming"
Expand All @@ -9,12 +9,12 @@ authors = ["GroovieGermanikus <[email protected]>"]
repository = "https://github.com/blockworks-foundation/geyser-grpc-connector"

[dependencies]
yellowstone-grpc-client = { version = "1.13.0+solana.1.17.15", git = "https://github.com/rpcpool/yellowstone-grpc.git", tag = "v1.12.0+solana.1.17.15" }
yellowstone-grpc-proto = { version = "1.12.0+solana.1.17.15", git = "https://github.com/rpcpool/yellowstone-grpc.git", tag = "v1.12.0+solana.1.17.15" }
yellowstone-grpc-client = { version = "2.0.0", git = "https://github.com/rpcpool/yellowstone-grpc.git", tag = "v2.0.0+solana.2.0.16" }
yellowstone-grpc-proto = { version = "2.0.0", git = "https://github.com/rpcpool/yellowstone-grpc.git", tag = "v2.0.0+solana.2.0.16" }


# required for CommitmentConfig
solana-sdk = "~1.17.15"
solana-sdk = "2.0.16"
This conversation was marked as resolved.
Show resolved Hide resolved

url = "2.5.0"
async-stream = "0.3.5"
Expand All @@ -32,6 +32,10 @@ bincode = "1.3.3"

csv = "1.3.0"

[dev-dependencies]
#[dev-dependencies]
tracing-subscriber = "0.3.16"
solana-logger = "1"
solana-logger = "2.0.16"

[patch.crates-io.curve25519-dalek]
git = "https://github.com/anza-xyz/curve25519-dalek.git"
rev = "b500cdc2a920cd5bff9e2dd974d7b97349d61464"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ These are the currently maintained versions of the library: [see Wiki](https://g
```cargo add geyser-grpc-connector ```


An example how to use the library is provided in `stream_blocks_mainnet.rs`.
An example how to use the library is provided in `stream_blocks_mainnet_stream.rs`.

## Known issues
* Library does not support other data than Blocks/Slots very well.
Expand Down
4 changes: 2 additions & 2 deletions ci/rust-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
if [[ -n $RUST_STABLE_VERSION ]]; then
stable_version="$RUST_STABLE_VERSION"
else
stable_version=1.70.0
stable_version=1.81.0
This conversation was marked as resolved.
Show resolved Hide resolved
fi

if [[ -n $RUST_NIGHTLY_VERSION ]]; then
Expand Down Expand Up @@ -91,7 +91,7 @@ export rust_nightly_docker_image=solanalabs/rust-nightly:"$nightly_version"
if [[ -n $RUST_STABLE_VERSION ]]; then
stable_version="$RUST_STABLE_VERSION"
else
stable_version=1.70.0
stable_version=1.81.0
fi

if [[ -n $RUST_NIGHTLY_VERSION ]]; then
Expand Down
3 changes: 1 addition & 2 deletions examples/dump_slots_stream_samples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@
///
/// we want to see if there is a difference in timing of "processed accounts" in the mix with slot vs "only processed accounts"
use log::{info, warn};
use solana_sdk::clock::Slot;

Check warning on line 10 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `solana_sdk::clock::Slot`

Check warning on line 10 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `solana_sdk::clock::Slot`

Check warning on line 10 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `solana_sdk::clock::Slot`

Check warning on line 10 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `solana_sdk::clock::Slot`
use solana_sdk::commitment_config::{CommitmentConfig, CommitmentLevel};
use std::collections::HashMap;
use std::env;
use std::str::FromStr;

Check warning on line 14 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `std::str::FromStr`

Check warning on line 14 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `std::str::FromStr`

Check warning on line 14 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `std::str::FromStr`
use std::time::SystemTime;

use base64::Engine;

Check warning on line 17 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `base64::Engine`

Check warning on line 17 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `base64::Engine`

Check warning on line 17 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `base64::Engine`
use csv::ReaderBuilder;

Check warning on line 18 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `csv::ReaderBuilder`

Check warning on line 18 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `csv::ReaderBuilder`

Check warning on line 18 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `csv::ReaderBuilder`
use itertools::Itertools;

Check warning on line 19 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `itertools::Itertools`

Check warning on line 19 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `itertools::Itertools`

Check warning on line 19 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `itertools::Itertools`
use solana_sdk::borsh0_10::try_from_slice_unchecked;
/// This file mocks the core model of the RPC server.
use solana_sdk::compute_budget;

Check warning on line 21 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `solana_sdk::compute_budget`
use solana_sdk::compute_budget::ComputeBudgetInstruction;

Check warning on line 22 in examples/dump_slots_stream_samples.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `solana_sdk::compute_budget::ComputeBudgetInstruction`
use solana_sdk::hash::Hash;
use solana_sdk::instruction::CompiledInstruction;
use solana_sdk::message::v0::MessageAddressTableLookup;
Expand Down Expand Up @@ -167,7 +166,7 @@
.expect("valid commitment level")
}

#[tokio::main]
#[tokio::main(flavor = "current_thread")]
pub async fn main() {
tracing_subscriber::fmt::init();

Expand Down
2 changes: 1 addition & 1 deletion examples/stream_blocks_autoconnect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum TestCases {
}
const TEST_CASE: TestCases = TestCases::Basic;

#[tokio::main]
#[tokio::main(flavor = "current_thread")]
pub async fn main() {
// RUST_LOG=info,stream_blocks_mainnet=debug,geyser_grpc_connector=trace
tracing_subscriber::fmt::init();
Expand Down
82 changes: 24 additions & 58 deletions examples/stream_blocks_mainnet_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ use std::pin::pin;
use base64::Engine;
use itertools::Itertools;
use solana_sdk::borsh0_10::try_from_slice_unchecked;
/// This file mocks the core model of the RPC server.
use solana_sdk::compute_budget;
use solana_sdk::compute_budget::ComputeBudgetInstruction;
use solana_sdk::hash::Hash;
use solana_sdk::instruction::CompiledInstruction;
use solana_sdk::message::v0::MessageAddressTableLookup;
use solana_sdk::message::{v0, MessageHeader, VersionedMessage};
use solana_sdk::pubkey::Pubkey;
/// This file mocks the core model of the RPC server.
use solana_sdk::{borsh1, compute_budget};

use solana_sdk::signature::Signature;
use solana_sdk::transaction::TransactionError;
Expand Down Expand Up @@ -97,7 +97,7 @@ impl FromYellowstoneExtractor for BlockMetaExtractor {
}
}

#[tokio::main]
#[tokio::main(flavor = "current_thread")]
pub async fn main() {
// RUST_LOG=info,stream_blocks_mainnet=debug,geyser_grpc_connector=trace
tracing_subscriber::fmt::init();
Expand Down Expand Up @@ -298,66 +298,32 @@ pub fn map_produced_block(
.collect(),
});

let legacy_compute_budget: Option<(u32, Option<u64>)> =
message.instructions().iter().find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
{
if let Ok(ComputeBudgetInstruction::RequestUnitsDeprecated {
units,
additional_fee,
}) = try_from_slice_unchecked(i.data.as_slice())
{
if additional_fee > 0 {
return Some((
units,
Some(((units * 1000) / additional_fee) as u64),
));
} else {
return Some((units, None));
}
}
}
None
});

let legacy_cu_requested = legacy_compute_budget.map(|x| x.0);
let legacy_prioritization_fees = legacy_compute_budget.map(|x| x.1).unwrap_or(None);

let cu_requested = message
.instructions()
.iter()
.find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
let cu_requested = message.instructions().iter().find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
{
if let Ok(ComputeBudgetInstruction::SetComputeUnitLimit(limit)) =
borsh1::try_from_slice_unchecked(i.data.as_slice())
{
if let Ok(ComputeBudgetInstruction::SetComputeUnitLimit(limit)) =
try_from_slice_unchecked(i.data.as_slice())
{
return Some(limit);
}
return Some(limit);
}
None
})
.or(legacy_cu_requested);

let prioritization_fees = message
.instructions()
.iter()
.find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
}
None
});

let prioritization_fees = message.instructions().iter().find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
{
if let Ok(ComputeBudgetInstruction::SetComputeUnitPrice(price)) =
borsh1::try_from_slice_unchecked(i.data.as_slice())
{
if let Ok(ComputeBudgetInstruction::SetComputeUnitPrice(price)) =
try_from_slice_unchecked(i.data.as_slice())
{
return Some(price);
}
return Some(price);
}
}

None
})
.or(legacy_prioritization_fees);
None
});

Some(TransactionInfo {
signature: signature.to_string(),
Expand Down
82 changes: 24 additions & 58 deletions examples/stream_blocks_mainnet_task.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
use futures::Stream;

Check warning on line 1 in examples/stream_blocks_mainnet_task.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `futures::Stream`
use log::{info, warn};
use solana_sdk::clock::Slot;
use solana_sdk::commitment_config::CommitmentConfig;
use std::env;
use std::pin::pin;

Check warning on line 6 in examples/stream_blocks_mainnet_task.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `std::pin::pin`

use base64::Engine;
use itertools::Itertools;
use solana_sdk::borsh0_10::try_from_slice_unchecked;

Check warning on line 10 in examples/stream_blocks_mainnet_task.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `solana_sdk::borsh0_10::try_from_slice_unchecked`

Check warning on line 10 in examples/stream_blocks_mainnet_task.rs

View workflow job for this annotation

GitHub Actions / test

use of deprecated function `solana_sdk::borsh0_10::try_from_slice_unchecked`: Please upgrade to Borsh 1.X and use `borsh1::try_from_slice_unchecked` instead
/// This file mocks the core model of the RPC server.
use solana_sdk::compute_budget;
use solana_sdk::compute_budget::ComputeBudgetInstruction;
use solana_sdk::hash::Hash;
use solana_sdk::instruction::CompiledInstruction;
use solana_sdk::message::v0::MessageAddressTableLookup;
use solana_sdk::message::{v0, MessageHeader, VersionedMessage};
use solana_sdk::pubkey::Pubkey;
/// This file mocks the core model of the RPC server.
use solana_sdk::{borsh1, compute_budget};

use solana_sdk::signature::Signature;
use solana_sdk::transaction::TransactionError;
Expand All @@ -23,10 +23,10 @@
use yellowstone_grpc_proto::geyser::SubscribeUpdateBlock;

use geyser_grpc_connector::grpc_subscription_autoreconnect_tasks::{
create_geyser_autoconnection_task, create_geyser_autoconnection_task_with_mpsc,

Check warning on line 26 in examples/stream_blocks_mainnet_task.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `create_geyser_autoconnection_task`
};
use geyser_grpc_connector::grpcmultiplex_fastestwins::{
create_multiplexed_stream, FromYellowstoneExtractor,

Check warning on line 29 in examples/stream_blocks_mainnet_task.rs

View workflow job for this annotation

GitHub Actions / test

unused import: `create_multiplexed_stream`
};
use geyser_grpc_connector::{GeyserFilter, GrpcConnectionTimeouts, GrpcSourceConfig, Message};
use tokio::time::{sleep, Duration};
Expand Down Expand Up @@ -93,7 +93,7 @@
}
}

#[tokio::main]
#[tokio::main(flavor = "current_thread")]
pub async fn main() {
// RUST_LOG=info,stream_blocks_mainnet=debug,geyser_grpc_connector=trace
tracing_subscriber::fmt::init();
Expand Down Expand Up @@ -268,66 +268,32 @@
.collect(),
});

let legacy_compute_budget: Option<(u32, Option<u64>)> =
message.instructions().iter().find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
let cu_requested = message.instructions().iter().find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
{
if let Ok(ComputeBudgetInstruction::SetComputeUnitLimit(limit)) =
borsh1::try_from_slice_unchecked(i.data.as_slice())
{
if let Ok(ComputeBudgetInstruction::RequestUnitsDeprecated {
units,
additional_fee,
}) = try_from_slice_unchecked(i.data.as_slice())
{
if additional_fee > 0 {
return Some((
units,
Some(((units * 1000) / additional_fee) as u64),
));
} else {
return Some((units, None));
}
}
return Some(limit);
}
None
});

let legacy_cu_requested = legacy_compute_budget.map(|x| x.0);
let legacy_prioritization_fees = legacy_compute_budget.map(|x| x.1).unwrap_or(None);

let cu_requested = message
.instructions()
.iter()
.find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
{
if let Ok(ComputeBudgetInstruction::SetComputeUnitLimit(limit)) =
try_from_slice_unchecked(i.data.as_slice())
{
return Some(limit);
}
}
None
})
.or(legacy_cu_requested);

let prioritization_fees = message
.instructions()
.iter()
.find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
}
None
});

let prioritization_fees = message.instructions().iter().find_map(|i| {
if i.program_id(message.static_account_keys())
.eq(&compute_budget::id())
{
if let Ok(ComputeBudgetInstruction::SetComputeUnitPrice(price)) =
borsh1::try_from_slice_unchecked(i.data.as_slice())
{
if let Ok(ComputeBudgetInstruction::SetComputeUnitPrice(price)) =
try_from_slice_unchecked(i.data.as_slice())
{
return Some(price);
}
return Some(price);
}
}

None
})
.or(legacy_prioritization_fees);
None
});

Some(TransactionInfo {
signature: signature.to_string(),
Expand Down
22 changes: 14 additions & 8 deletions examples/stream_blocks_single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use futures::{Stream, StreamExt};
use log::info;
use solana_sdk::clock::Slot;
use solana_sdk::commitment_config::CommitmentConfig;
use solana_sdk::pubkey::Pubkey;
use std::env;
use std::pin::pin;
use solana_sdk::pubkey::Pubkey;

use csv::Writer;
use geyser_grpc_connector::grpc_subscription_autoreconnect_streams::create_geyser_reconnecting_stream;
use geyser_grpc_connector::grpcmultiplex_fastestwins::FromYellowstoneExtractor;
use geyser_grpc_connector::{GeyserFilter, GrpcConnectionTimeouts, GrpcSourceConfig, Message};
Expand All @@ -14,7 +15,6 @@ use tracing::warn;
use yellowstone_grpc_proto::geyser::subscribe_update::UpdateOneof;
use yellowstone_grpc_proto::geyser::SubscribeUpdate;
use yellowstone_grpc_proto::prost::Message as _;
use csv::Writer;

#[allow(dead_code)]
fn start_example_blockmini_consumer(
Expand Down Expand Up @@ -68,7 +68,7 @@ impl FromYellowstoneExtractor for BlockMiniExtractor {
}
}

#[tokio::main]
#[tokio::main(flavor = "current_thread")]
pub async fn main() {
// RUST_LOG=info,stream_blocks_mainnet=debug,geyser_grpc_connector=trace
tracing_subscriber::fmt::init();
Expand Down Expand Up @@ -114,10 +114,13 @@ pub async fn main() {
Some(UpdateOneof::Account(update)) => {
let account_info = update.account.unwrap();
let account_pk = Pubkey::try_from(account_info.pubkey).unwrap();
info!("got account update (green)!!! {} - {:?} - {} bytes",
update.slot, account_pk, account_info.data.len());
let bytes: [u8; 32] =
account_pk.to_bytes();
info!(
"got account update (green)!!! {} - {:?} - {} bytes",
update.slot,
account_pk,
account_info.data.len()
);
let bytes: [u8; 32] = account_pk.to_bytes();
}
_ => {}
}
Expand All @@ -138,7 +141,10 @@ pub async fn main() {
Message::GeyserSubscribeUpdate(subscriber_update) => {
let mapped = extractor.map_yellowstone_update(*subscriber_update);
if let Some((slot, block_mini)) = mapped {
info!("got update (blue)!!! block: {} - {} bytes", slot, block_mini.blocksize);
info!(
"got update (blue)!!! block: {} - {} bytes",
slot, block_mini.blocksize
);
}
}
Message::Connecting(attempt) => {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.73.0"
channel = "1.81.0"
Loading
Loading