Skip to content

Commit

Permalink
Merge pull request #58 from amilbourne/v1.14
Browse files Browse the repository at this point in the history
Updated for compatibility with v1.14 Geyser API
  • Loading branch information
nyetwurk authored Feb 24, 2023
2 parents 67a328f + f4ea83a commit 340afd6
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 22 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
prost = "0.11"
rdkafka = { version = "0.29", features = ["ssl-vendored", "sasl"] }
solana-geyser-plugin-interface = { version = "=1.11.3" }
solana-logger = { version = "=1.11.3" }
solana-program = { version = "=1.11.3" }
solana-transaction-status = { version = "=1.11.3" }
log = "0.4"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
solana-geyser-plugin-interface = { version = "=1.14.16" }
solana-logger = { version = "=1.14.16" }
solana-program = { version = "=1.14.16" }
solana-transaction-status = { version = "=1.14.16" }
log = "0.4.17"
serde_json = "1.0.85"
serde = { version = "1.0.145", features = ["derive"] }
simple-error = "0.3.0"

[build-dependencies]
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Config is specified via the plugin's JSON config file.

```json
{
"libpath": "/solana/target/release/libsolana_accountsdb_plugin_kafka.so",
"libpath": "target/release/libsolana_accountsdb_plugin_kafka.so",
"kafka": {
"bootstrap.servers": "localhost:9092",
"request.required.acks": "1",
Expand All @@ -41,6 +41,7 @@ Config is specified via the plugin's JSON config file.
"shutdown_timeout_ms": 30000,
"update_account_topic": "solana.testnet.account_updates",
"slot_status_topic": "solana.testnet.slot_status",
"transaction_topic": "solana.testnet.transactions",
"publish_all_accounts": false,
"program_ignores": [
"Sysvar1111111111111111111111111111111111111",
Expand Down
8 changes: 7 additions & 1 deletion proto/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ message V0Message {
message V0LoadedMessage {
V0Message message_ = 1;
LoadedAddresses loaded_adresses = 2;
repeated bool is_writable_account_cache = 3;
}

message LegacyMessage {
Expand All @@ -103,9 +104,14 @@ message LegacyMessage {
repeated CompiledInstruction instructions = 4;
}

message LegacyLoadedMessage {
LegacyMessage message_ = 1;
repeated bool is_writable_account_cache = 2;
}

message SanitizedMessage {
oneof message_payload {
LegacyMessage legacy = 1;
LegacyLoadedMessage legacy = 1;
V0LoadedMessage v0 = 2;
}
}
Expand Down
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.60.0
36 changes: 23 additions & 13 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,20 +305,27 @@ impl KafkaPlugin {
message: Some(SanitizedMessage {
message_payload: Some(match transaction.message() {
solana_program::message::SanitizedMessage::Legacy(lv) => {
sanitized_message::MessagePayload::Legacy(LegacyMessage {
header: Some(Self::build_message_header(&lv.header)),
account_keys: lv
.account_keys
.clone()
.into_iter()
.map(|k| k.as_ref().into())
.collect(),
instructions: lv
.instructions
.iter()
.map(Self::build_compiled_instruction)
sanitized_message::MessagePayload::Legacy(LegacyLoadedMessage {
message: Some(LegacyMessage {
header: Some(Self::build_message_header(&lv.message.header)),
account_keys: lv
.message
.account_keys
.clone()
.into_iter()
.map(|k| k.as_ref().into())
.collect(),
instructions: lv
.message
.instructions
.iter()
.map(Self::build_compiled_instruction)
.collect(),
recent_block_hash: lv.message.recent_blockhash.as_ref().into(),
}),
is_writable_account_cache: (0..(lv.account_keys().len() - 1))
.map(|i: usize| lv.is_writable(i))
.collect(),
recent_block_hash: lv.recent_blockhash.as_ref().into(),
})
}
solana_program::message::SanitizedMessage::V0(v0) => {
Expand Down Expand Up @@ -375,6 +382,9 @@ impl KafkaPlugin {
.map(|x| x.as_ref().into())
.collect(),
}),
is_writable_account_cache: (0..(v0.account_keys().len() - 1))
.map(|i: usize| v0.is_writable(i))
.collect(),
})
}
}),
Expand Down

0 comments on commit 340afd6

Please sign in to comment.