Skip to content

Commit

Permalink
Improve key rotation / historical updates test
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolacy committed Sep 11, 2023
1 parent ce698d8 commit c66e999
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions contracts/provider/external-staking/src/crdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,13 @@ mod tests {
crdt.add_validator(
&mut storage,
"alice",
mock_update_pubkey("alice_pubkey_2", 201),
mock_update_pubkey("alice_pubkey_2", 202),
)
.unwrap();
crdt.add_validator(
&mut storage,
"alice",
mock_update_pubkey("alice_pubkey_3", 203),
)
.unwrap();

Expand All @@ -288,15 +294,15 @@ mod tests {
})
);

// query at update height
// query at 2nd update height
let alice = crdt
.active_validator_at_height(&storage, "alice", 201)
.active_validator_at_height(&storage, "alice", 202)
.unwrap();
assert_eq!(
alice,
Some(ValUpdate {
pub_key: "alice_pubkey_2".to_string(),
start_height: 201,
start_height: 202,
start_time: 1687339542,
})
);
Expand All @@ -308,8 +314,8 @@ mod tests {
assert_eq!(
alice,
Some(ValUpdate {
pub_key: "alice_pubkey_2".to_string(),
start_height: 201,
pub_key: "alice_pubkey_3".to_string(),
start_height: 203,
start_time: 1687339542,
})
);
Expand Down

0 comments on commit c66e999

Please sign in to comment.