Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions finalizer/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,10 @@ impl<
let height = self.canonical_state.get_latest_height();
let _ = sender.send(ConsensusStateResponse::LatestHeight(height));
}
ConsensusStateRequest::GetLatestEpoch => {
let epoch = self.canonical_state.get_epoch();
let _ = sender.send(ConsensusStateResponse::LatestEpoch(epoch));
}
ConsensusStateRequest::GetValidatorBalance(public_key) => {
let mut key_bytes = [0u8; 32];
key_bytes.copy_from_slice(&public_key);
Expand Down
18 changes: 18 additions & 0 deletions finalizer/src/ingress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ impl<S: Scheme, B: ConsensusBlock + Committable> FinalizerMailbox<S, B> {
height
}

pub async fn get_latest_epoch(&self) -> u64 {
let (response, rx) = oneshot::channel();
let request = ConsensusStateRequest::GetLatestEpoch;
let _ = self
.sender
.clone()
.send(FinalizerMessage::QueryState { request, response })
.await;

let res = rx
.await
.expect("consensus state query response sender dropped");
let ConsensusStateResponse::LatestEpoch(epoch) = res else {
unreachable!("request and response variants must match");
};
epoch
}

pub async fn get_validator_balance(&self, public_key: PublicKey) -> Option<u64> {
let (response, rx) = oneshot::channel();
let request = ConsensusStateRequest::GetValidatorBalance(public_key);
Expand Down
5 changes: 5 additions & 0 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ name = "stake-and-checkpoint"
path = "src/bin/stake_and_checkpoint.rs"
required-features = ["e2e"]

[[bin]]
name = "stake-and-join-with-outdated-checkpoint"
path = "src/bin/stake_and_join_with_outdated_ckpt.rs"
required-features = ["e2e"]

[[bin]]
name = "withdraw-and-exit"
path = "src/bin/withdraw_and_exit.rs"
Expand Down
Loading