Skip to content

Commit 6b0c3f7

Browse files
committed
sim-rs: only vote for EBs that reference certified EBs
1 parent a7a1b5b commit 6b0c3f7

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

sim-rs/sim-core/src/model.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ pub enum NoVoteReason {
233233
ExtraIB,
234234
MissingIB,
235235
MissingEB,
236+
UncertifiedEBReference,
236237
}
237238

238239
#[derive(Clone, Debug, Serialize)]

sim-rs/sim-core/src/sim/node.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,17 @@ impl Node {
14201420
}
14211421
}
14221422
}
1423+
1424+
// If this EB _does_ reference other EBs, make sure we trust them
1425+
for referenced_eb in &eb.ebs {
1426+
let Some(votes) = self.leios.votes_by_eb.get(referenced_eb) else {
1427+
return Err(NoVoteReason::UncertifiedEBReference);
1428+
};
1429+
let vote_count = votes.values().copied().sum::<usize>() as u64;
1430+
if vote_count < self.sim_config.vote_threshold {
1431+
return Err(NoVoteReason::UncertifiedEBReference);
1432+
}
1433+
}
14231434
Ok(())
14241435
}
14251436

0 commit comments

Comments
 (0)