-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
I10-unconfirmedIssue might be valid, but it's not yet known.Issue might be valid, but it's not yet known.I2-bugThe node fails to follow expected behavior.The node fails to follow expected behavior.
Description
Is there an existing issue?
- I have searched the existing issues
Experiencing problems? Have you tried our Stack Exchange first?
- This is not a support question.
Description of bug
The benchmarking case for the vote extrinsic in pallet-ranked-collective
were consistently failing due to manual input of VoteWeight
. The issue manifested as assertion failures where the expected event tally values did not match the actual values generated during benchmark execution while configuring the Ambassador Collective
.
Steps to Reproduce
Compile the current configuration for the Ambassador collective which includes a modified VoteWeight
converter.
Open the compiled pallet-ranked-collective crate in your editor(i.e ~/.cargo/registry/src/index.crates.io-hash/pallet-ranked-collective-version/src/benchmarking.rs), add this logging for VoteWeight
Converter and observe the different VoteWeight
/ Tally
from the hard coded value.
#[benchmark]
fn vote() -> Result<(), BenchmarkError> {
log::info!(target: BENCHMARK_LOG_TARGET, "Starting vote benchmark");
....
// Simulate the rank_to_votes conversion process
let vote_weight = if let Some(ref class) = class {
let min_rank = T::MinRankOfClass::convert(class.clone());
// Get the member's actual rank
let member_rank = Members::<T, I>::get(&caller)
.map(|m| m.rank)
.unwrap_or_else(|| {
log::error!(target: BENCHMARK_LOG_TARGET, "Member not found: {:?}", caller);
0
});
log::info!(target: BENCHMARK_LOG_TARGET, "Member rank: {}, Min rank required: {}", member_rank, min_rank);
// Calculate excess rank
let excess = member_rank.checked_sub(min_rank).unwrap_or_else(|| {
log::error!(target: BENCHMARK_LOG_TARGET, "Rank too low: {} < {}", member_rank, min_rank);
0
});
log::info!(target: BENCHMARK_LOG_TARGET, "Excess rank: {}", excess);
// Convert excess rank to votes
let votes = T::VoteWeight::convert(excess);
log::info!(target: BENCHMARK_LOG_TARGET, "Converted excess rank {} to votes: {}", excess, votes);
votes
} else {
log::warn!(target: BENCHMARK_LOG_TARGET, "No class available, using 0 votes");
0
};
....
Metadata
Metadata
Assignees
Labels
I10-unconfirmedIssue might be valid, but it's not yet known.Issue might be valid, but it's not yet known.I2-bugThe node fails to follow expected behavior.The node fails to follow expected behavior.