Skip to content

Commit

Permalink
solana: update to v2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Oct 14, 2024
1 parent e10d379 commit b6c039a
Show file tree
Hide file tree
Showing 11 changed files with 1,180 additions and 1,166 deletions.
2,284 changes: 1,142 additions & 1,142 deletions Cargo.lock

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
resolver = "2"

[workspace.dependencies]
agave-geyser-plugin-interface = "~2.0.13"
anyhow = "1.0.79"
base64 = "0.21.5"
bincode = "1.3.3"
Expand All @@ -26,14 +27,14 @@ protobuf-src = "1.1.0"
serde = "1.0.188"
serde_cbor = "0.11"
serde_json = "1.0.108"
solana-accounts-db = "~1.18.1"
solana-entry = "~1.18.1"
solana-geyser-plugin-interface = "~1.18.1"
solana-geyser-plugin-manager = "~1.18.1"
solana-rpc = "~1.18.1"
solana-sdk = "~1.18.1"
solana-storage-proto = "~1.18.1"
solana-transaction-status = "~1.18.1"
solana-accounts-db = "~2.0.13"
solana-entry = "~2.0.13"
solana-geyser-plugin-manager = "~2.0.13"
solana-rpc = "~2.0.13"
solana-runtime = "~2.0.13"
solana-sdk = "~2.0.13"
solana-storage-proto = "~2.0.13"
solana-transaction-status = "~2.0.13"
tonic = "0.11.0"
tonic-build = "0.11.0"
tracing = "0.1.40"
Expand Down
1 change: 1 addition & 0 deletions geyser-plugin-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ solana-accounts-db = { workspace = true }
solana-entry = { workspace = true }
solana-geyser-plugin-manager = { workspace = true }
solana-rpc = { workspace = true }
solana-runtime = { workspace = true }
solana-sdk = { workspace = true }
solana-storage-proto = { workspace = true }
solana-transaction-status = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion geyser-plugin-runner/demo-plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ publish = false
crate-type = ["cdylib", "rlib"]

[dependencies]
agave-geyser-plugin-interface = { workspace = true }
colored = { workspace = true }
solana-geyser-plugin-interface = { workspace = true }
tracing = { workspace = true }

[package.metadata.docs.rs]
Expand Down
6 changes: 4 additions & 2 deletions geyser-plugin-runner/demo-plugin/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use {
colored::Colorize,
solana_geyser_plugin_interface::geyser_plugin_interface::{
agave_geyser_plugin_interface::geyser_plugin_interface::{
GeyserPlugin, ReplicaAccountInfoVersions, ReplicaBlockInfoVersions,
ReplicaEntryInfoVersions, ReplicaTransactionInfoVersions, Result, SlotStatus,
},
colored::Colorize,
tracing::info,
};

Expand Down Expand Up @@ -161,11 +161,13 @@ impl GeyserPlugin for GeyserPluginDemo {
ReplicaBlockInfoVersions::V0_0_1(block_info) => block_info.slot,
ReplicaBlockInfoVersions::V0_0_2(block_info) => block_info.slot,
ReplicaBlockInfoVersions::V0_0_3(block_info) => block_info.slot,
ReplicaBlockInfoVersions::V0_0_4(block_info) => block_info.slot,
},
match _block_info {
ReplicaBlockInfoVersions::V0_0_1(block_info) => block_info.block_time,
ReplicaBlockInfoVersions::V0_0_2(block_info) => block_info.block_time,
ReplicaBlockInfoVersions::V0_0_3(block_info) => block_info.block_time,
ReplicaBlockInfoVersions::V0_0_4(block_info) => block_info.block_time,
},
);
Ok(())
Expand Down
27 changes: 16 additions & 11 deletions geyser-plugin-runner/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use {
crossbeam_channel::unbounded,
demo_rust_ipld_car::{node, utils},
solana_accounts_db::stake_rewards::RewardInfo,
solana_rpc::optimistically_confirmed_bank_tracker::SlotNotification,
solana_sdk::reward_type::RewardType,
solana_runtime::bank::KeyedRewardsAndNumPartitions,
solana_sdk::{reward_info::RewardInfo, reward_type::RewardType},
std::{
collections::HashSet,
convert::{TryFrom, TryInto},
env::args,
error::Error,
str::FromStr,
sync::RwLock,
},
};

Expand Down Expand Up @@ -98,11 +98,13 @@ fn main() -> Result<(), Box<dyn Error>> {
message_hash,
false,
dummy_address_loader,
&HashSet::default(),
)
},
solana_sdk::transaction::TransactionVersion::Legacy(_legacy)=> {
solana_sdk::transaction::SanitizedTransaction::try_from_legacy_transaction(
parsed.into_legacy_transaction().unwrap() ,
parsed.into_legacy_transaction().unwrap(),
&HashSet::default(),
)
},
};
Expand Down Expand Up @@ -160,7 +162,7 @@ fn main() -> Result<(), Box<dyn Error>> {
if block_meta_notifier_maybe.is_none() {
return Ok(());
}
let rewards = RwLock::new(vec![]);
let mut keyed_rewards = Vec::with_capacity(this_block_rewards.rewards.len());
{
// convert this_block_rewards to rewards
for this_block_reward in this_block_rewards.rewards.iter() {
Expand All @@ -180,20 +182,23 @@ fn main() -> Result<(), Box<dyn Error>> {
Err(_err) => None,
},
};
rewards.write().unwrap().push((solana_sdk::pubkey::Pubkey::from_str(&this_block_reward.pubkey)?, reward));
keyed_rewards.push((solana_sdk::pubkey::Pubkey::from_str(&this_block_reward.pubkey)?, reward));
}
}
// if rewards.read().unwrap().len() > 0 {
// panic!("___ Rewards: {:?}", rewards.read().unwrap());
// if keyed_rewards.read().unwrap().len() > 0 {
// panic!("___ Rewards: {:?}", keyed_rewards.read().unwrap());
// }
let block_meta_notifier = block_meta_notifier_maybe.as_ref().unwrap();
block_meta_notifier
.notify_block_metadata(
block.meta.parent_slot,
todo_previous_blockhash.to_string().as_str(),
block.meta.parent_slot,
todo_previous_blockhash.to_string().as_str(),
block.slot,
todo_latest_entry_blockhash.to_string().as_str(),
&rewards,
&KeyedRewardsAndNumPartitions {
keyed_rewards,
num_partitions: None
},
Some(block.meta.blocktime as i64) ,
block.meta.block_height,
this_block_executed_transaction_count,
Expand Down
1 change: 1 addition & 0 deletions old-faithful-proto/proto/old-faithful.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ message BlockResponse {
uint64 block_height = 6;
repeated Transaction transactions = 7;
bytes rewards = 8; // protobuf or bincode (or empty)
optional uint64 num_partitions = 9;
}

message BlockTimeRequest {
Expand Down
1 change: 1 addition & 0 deletions old-faithful-proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub mod decode {
.map(versioned_transaction)
.collect::<Result<Vec<_>, _>>()?,
rewards,
num_partitions: block.num_partitions,
block_time: Some(block.block_time),
block_height: Some(block.block_height),
})
Expand Down
2 changes: 2 additions & 0 deletions old-faithful-proto/tests/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct FixtureConfirmedBlock {
transactions: Vec<FixtureConfirmedTransactionInner>,
#[serde(deserialize_with = "deserialize_hex")]
rewards: Vec<u8>,
num_partitions: Option<u64>,
}

impl From<FixtureConfirmedBlock> for proto::BlockResponse {
Expand All @@ -39,6 +40,7 @@ impl From<FixtureConfirmedBlock> for proto::BlockResponse {
block_height: data.block_height,
transactions: data.transactions.into_iter().map(Into::into).collect(),
rewards: data.rewards,
num_partitions: data.num_partitions,
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion old-faithful-proto/tests/decode_confirmed_block.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"meta": "0a0f0a0d0800000002190000001e00000010f8551a5ce8d1b2930789b985c2aa0280eaf50280fa65f0bb7cc0d2910bc0bcbbe606a1e0d0ee18f0bb7cc0bcfbd901c099db01f0bb7cc0bcfbd901f0bb7c80ace0070189b4f6e0bd0c8098b4bd03c0d545cbc895f005c0d54500c0d545e09a59225cf0fbb1930789b985c2aa0280eaf50280fa65f0bb7cc0d2910bc0bcbbe606a1e0d0ee18f0bb7cc0bcfbd901c099db01f0bb7cc0bcfbd901f0bb7c80ace0070189b4f6e0bd0c8098b4bd03c0d545cbc895f005c0d54500c0d545e09a592a2f0802122b08141212110213050e0d01120a0c0906040815070b001a11090027b92900000000292c4dd9f52e03002002323e50726f6772616d20436f6d7075746542756467657431313131313131313131313131313131313131313131313131313131313120696e766f6b65205b315d323b50726f6772616d20436f6d707574654275646765743131313131313131313131313131313131313131313131313131313131312073756363657373323e50726f6772616d20436f6d7075746542756467657431313131313131313131313131313131313131313131313131313131313120696e766f6b65205b315d323b50726f6772616d20436f6d707574654275646765743131313131313131313131313131313131313131313131313131313131312073756363657373323f50726f6772616d20444d564a6478566754326932726d6f4b383263515a544637574872795543526f7158396e6e546f5653614c5220696e766f6b65205b315d321e50726f6772616d206c6f673a20496e737472756374696f6e3a2053776170323f50726f6772616d203637356b5058394d48546a53327a7431716672314e5948757a654c5866514d394832347746535574314d703820696e766f6b65205b325d326250726f6772616d206c6f673a207261795f6c6f673a204177416e75536b41414141414b53784e32665575417741424141414141414141414445537459304241414141413041684479504d4d41475a50694b6f4567414141465473594130506f674941323250726f6772616d206c6f673a204572726f723a2065786365656473206465736972656420736c697070616765206c696d6974325b50726f6772616d203637356b5058394d48546a53327a7431716672314e5948757a654c5866514d394832347746535574314d703820636f6e73756d6564203136333136206f662035343330383020636f6d7075746520756e697473325750726f6772616d203637356b5058394d48546a53327a7431716672314e5948757a654c5866514d394832347746535574314d7038206661696c65643a20637573746f6d2070726f6772616d206572726f723a2030783165325b50726f6772616d20444d564a6478566754326932726d6f4b383263515a544637574872795543526f7158396e6e546f5653614c5220636f6e73756d6564203732393336206f662035393937303020636f6d7075746520756e697473325750726f6772616d20444d564a6478566754326932726d6f4b383263515a544637574872795543526f7158396e6e546f5653614c52206661696c65643a20637573746f6d2070726f6772616d206572726f723a20307831653ab2010801122b536f31313131313131313131313131313131313131313131313131313131313131313131313131313131321a2609fc4c41a75508544010091a0b3830313330323237383635220c38302e313330323237383635222c3551353434664b72466f65367473456244375338456d7847544a59414b745456684157355135706765346a312a2b546f6b656e6b65675166655a79694e77414a624e62474b50465843577542766639537336323356513544413a95010804122c4557486369547a34583751617374436d4e46694533574d586d474e586146507143793347534b535475356f321a0810091a0130220130222c385477533870424137706577567258654c72735165565365734733737a6d6863317464375154526d747575312a2b546f6b656e6b65675166655a79694e77414a624e62474b50465843577542766639537336323356513544413ab0010807122b536f31313131313131313131313131313131313131313131313131313131313131313131313131313131321a2409d404f63d8fb01a4010091a0a36363732343231343235220b362e363732343231343235222c46364a666f7a7674346a31627456563762373974736a363745723348315938594469774d7a45766d706473732a2b546f6b656e6b65675166655a79694e77414a624e62474b50465843577542766639537336323356513544413a94010808122b536f31313131313131313131313131313131313131313131313131313131313131313131313131313131321a0810091a0130220130222c385477533870424137706577567258654c72735165565365734733737a6d6863317464375154526d747575312a2b546f6b656e6b65675166655a79694e77414a624e62474b50465843577542766639537336323356513544413a9501080b122c4557486369547a34583751617374436d4e46694533574d586d474e586146507143793347534b535475356f321a0810091a0130220130222c46364a666f7a7674346a31627456563762373974736a363745723348315938594469774d7a45766d706473732a2b546f6b656e6b65675166655a79694e77414a624e62474b50465843577542766639537336323356513544413abf01080d122c4557486369547a34583751617374436d4e46694533574d586d474e586146507143793347534b535475356f321a32096fac7a2f6174944110091a113835373932383433383639373938343033221238353739323834332e383639373938343033222c3551353434664b72466f65367473456244375338456d7847544a59414b745456684157355135706765346a312a2b546f6b656e6b65675166655a79694e77414a624e62474b504658435775427666395373363233565135444142b2010801122b536f31313131313131313131313131313131313131313131313131313131313131313131313131313131321a2609fc4c41a75508544010091a0b3830313330323237383635220c38302e313330323237383635222c3551353434664b72466f65367473456244375338456d7847544a59414b745456684157355135706765346a312a2b546f6b656e6b65675166655a79694e77414a624e62474b50465843577542766639537336323356513544414295010804122c4557486369547a34583751617374436d4e46694533574d586d474e586146507143793347534b535475356f321a0810091a0130220130222c385477533870424137706577567258654c72735165565365734733737a6d6863317464375154526d747575312a2b546f6b656e6b65675166655a79694e77414a624e62474b504658435775427666395373363233565135444142b0010807122b536f31313131313131313131313131313131313131313131313131313131313131313131313131313131321a2409d404f63d8fb01a4010091a0a36363732343231343235220b362e363732343231343235222c46364a666f7a7674346a31627456563762373974736a363745723348315938594469774d7a45766d706473732a2b546f6b656e6b65675166655a79694e77414a624e62474b50465843577542766639537336323356513544414294010808122b536f31313131313131313131313131313131313131313131313131313131313131313131313131313131321a0810091a0130220130222c385477533870424137706577567258654c72735165565365734733737a6d6863317464375154526d747575312a2b546f6b656e6b65675166655a79694e77414a624e62474b5046584357754276663953733632335651354441429501080b122c4557486369547a34583751617374436d4e46694533574d586d474e586146507143793347534b535475356f321a0810091a0130220130222c46364a666f7a7674346a31627456563762373974736a363745723348315938594469774d7a45766d706473732a2b546f6b656e6b65675166655a79694e77414a624e62474b504658435775427666395373363233565135444142bf01080d122c4557486369547a34583751617374436d4e46694533574d586d474e586146507143793347534b535475356f321a32096fac7a2f6174944110091a113835373932383433383639373938343033221238353739323834332e383639373938343033222c3551353434664b72466f65367473456244375338456d7847544a59414b745456684157355135706765346a312a2b546f6b656e6b65675166655a79694e77414a624e62474b50465843577542766639537336323356513544417801800194bc04",
"index": 0
}],
"rewards": "0a400a2c3550487370394a5a74583533317a6435353652796b696b6e6f55615271477a6e366154693752537550656d4b10b6ef9be90218eea190a10b20042a0231300a400a2c4533796850733550504e34525a683846624a6f32657174647241594b434b394837706353443176434e435034109ec981f70618d6e8ed9d1620042a023130"
"rewards": "0a400a2c3550487370394a5a74583533317a6435353652796b696b6e6f55615271477a6e366154693752537550656d4b10b6ef9be90218eea190a10b20042a0231300a400a2c4533796850733550504e34525a683846624a6f32657174647241594b434b394837706353443176434e435034109ec981f70618d6e8ed9d1620042a023130",
"num_partitions": null
}
}]
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.75.0"
channel = "1.78.0"
components = ["rustfmt", "clippy"]

0 comments on commit b6c039a

Please sign in to comment.