v0.2.2-pre.002-fix.001
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-onchain-transport-lib/unit_tests/rpc_cluster.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
#[test]
|
||||
fn cluster_node_fixture_preserves_v4_client_id_and_optional_fields() {
|
||||
@@ -50,3 +50,64 @@ fn leader_schedule_request_encodes_current_epoch_and_slot_overloads_without_ambi
|
||||
std::vec![serde_json::json!(123), serde_json::json!({"identity":"11111111111111111111111111111111","commitment":"finalized"})]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn staged_epoch_snapshot_and_leader_helpers_preserve_wire_shapes() {
|
||||
let epoch = crate::SolanaEpochInfo::decode_wire(
|
||||
"getEpochInfo",
|
||||
serde_json::json!({"absoluteSlot":10,"blockHeight":9,"epoch":2,"slotIndex":3,"slotsInEpoch":32,"transactionCount":null}),
|
||||
)
|
||||
.expect("epoch info must decode");
|
||||
assert_eq!(epoch.transaction_count(), std::option::Option::None);
|
||||
|
||||
let schedule = crate::SolanaEpochSchedule::decode_wire(
|
||||
"getEpochSchedule",
|
||||
serde_json::json!({"firstNormalEpoch":1,"firstNormalSlot":32,"leaderScheduleSlotOffset":32,"slotsPerEpoch":64,"warmup":false}),
|
||||
)
|
||||
.expect("epoch schedule must decode");
|
||||
assert_eq!(schedule.slots_per_epoch(), 64);
|
||||
|
||||
let snapshot = crate::SolanaSnapshotSlotInfo::decode_wire("getHighestSnapshotSlot", serde_json::json!({"full":100,"incremental":null}))
|
||||
.expect("snapshot info must decode");
|
||||
assert_eq!(snapshot.full(), 100);
|
||||
assert_eq!(snapshot.incremental(), std::option::Option::None);
|
||||
|
||||
let leader = crate::SolanaLeaderSchedule::decode_wire("getLeaderSchedule", serde_json::json!({"11111111111111111111111111111111":[0,2,4]}))
|
||||
.expect("leader schedule must decode");
|
||||
assert_eq!(leader.entries().len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn staged_vote_status_and_config_helpers_preserve_wire_shapes() {
|
||||
let vote_pubkey = "11111111111111111111111111111111".parse::<ksp_core_lib::Pubkey>().expect("fixture pubkey must parse");
|
||||
let config = crate::SolanaVoteAccountsConfig::new(
|
||||
std::option::Option::Some(crate::SolanaCommitment::Finalized),
|
||||
std::option::Option::Some(vote_pubkey),
|
||||
std::option::Option::Some(true),
|
||||
std::option::Option::Some(128),
|
||||
);
|
||||
assert_eq!(
|
||||
config.to_json_value(),
|
||||
serde_json::json!({"commitment":"finalized","votePubkey":"11111111111111111111111111111111","keepUnstakedDelinquents":true,"delinquentSlotDistance":128})
|
||||
);
|
||||
|
||||
let status = crate::SolanaVoteAccountStatus::decode_wire(
|
||||
"getVoteAccounts",
|
||||
serde_json::json!({
|
||||
"current":[{
|
||||
"votePubkey":"11111111111111111111111111111111",
|
||||
"nodePubkey":"11111111111111111111111111111111",
|
||||
"activatedStake":1,
|
||||
"commission":5,
|
||||
"epochVoteAccount":true,
|
||||
"epochCredits":[],
|
||||
"lastVote":2,
|
||||
"rootSlot":1
|
||||
}],
|
||||
"delinquent":[]
|
||||
}),
|
||||
)
|
||||
.expect("vote account status must decode");
|
||||
assert_eq!(status.current().len(), 1);
|
||||
assert!(status.delinquent().is_empty());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user