Skip to content

Commit 8aa071f

Browse files
committed
fix(challenge-sdk): fix consensus test math
Vote stakes must exceed 67% threshold (2010/3000), not equal it. Changed second vote from 1000 to 1100 TAO to reach 70%.
1 parent 8bac6e9 commit 8aa071f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

crates/challenge-sdk/src/p2p_chain_storage.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,8 +1066,9 @@ mod tests {
10661066

10671067
let mut state = ProposalState::new(proposal.clone());
10681068
let total_stake = 3_000_000_000_000u64; // 3000 TAO
1069+
// Required: 3000 * 0.67 = 2010 TAO
10691070

1070-
// Add first vote (1000 TAO) - not enough
1071+
// Add first vote (1000 TAO) - not enough (1000 < 2010)
10711072
let vote1 = ProposalVote::accept(
10721073
proposal.id,
10731074
"validator1".to_string(),
@@ -1077,11 +1078,11 @@ mod tests {
10771078
state.add_vote(vote1);
10781079
assert!(state.check_consensus(total_stake, 101).is_none());
10791080

1080-
// Add second vote (1000 TAO) - now 2000/3000 = 67%
1081+
// Add second vote (1100 TAO) - now 2100/3000 = 70% > 67%
10811082
let vote2 = ProposalVote::accept(
10821083
proposal.id,
10831084
"validator2".to_string(),
1084-
1_000_000_000_000,
1085+
1_100_000_000_000,
10851086
102,
10861087
);
10871088
state.add_vote(vote2);

0 commit comments

Comments
 (0)