Skip to content

Commit

Permalink
dev(better_theoros): last commit - assert that the checkpoint is the …
Browse files Browse the repository at this point in the history
…same
  • Loading branch information
akhercha committed Nov 2, 2024
1 parent 28a5ad8 commit f5f568f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion rust/theoros/src/types/calldata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ impl Calldata {
let checkpoints = state.storage.signed_checkpoints().get(&validators, update_info.nonce).await;
anyhow::ensure!(!checkpoints.is_empty(), "No signatures found");

// Ensure all nonce have the same checkpoint
let nonce_checkpoint = &checkpoints[0].1.value;
anyhow::ensure!(
checkpoints.iter().all(|(_, checkpoint)| &(checkpoint.value) == nonce_checkpoint),
"Inconsistent checkpoint values found"
);

let validator_index_map: HashMap<Felt, u8> = validators_with_indices.into_iter().collect();
let signatures: Vec<ValidatorSignature> = checkpoints
.iter()
Expand All @@ -62,7 +69,7 @@ impl Calldata {
};

let payload = Payload {
checkpoint: checkpoints[0].1.value.clone(),
checkpoint: nonce_checkpoint.clone(),
num_updates: 1,
proof_len: 0,
proof: vec![],
Expand Down

0 comments on commit f5f568f

Please sign in to comment.