Skip to content

Review: Total Ring/Kton Range #286

@aurexav

Description

@aurexav

Relate to #267.

/// A structure to demonstrate the phragmen result from the perspective of the candidate, i.e. how
/// much support each candidate is receiving.
///
/// This complements the [`PhragmenResult`] and is needed to run the equalize post-processing.
///
/// This, at the current version, resembles the `Exposure` defined in the staking SRML module, yet
/// they do not necessarily have to be the same.
#[derive(Default, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))]
pub struct Support<AccountId, RingBalance, KtonBalance> {
	/// The amount of support as the effect of self-vote.
	pub own_votes: Votes,
	pub own_ring: RingBalance,
	pub own_kton: KtonBalance,
	/// Total support.
	pub total: Votes,
	pub total_ring: RingBalance,
	pub total_kton: KtonBalance,
	/// Support from voters.
	pub others: Vec<PhragmenStakedAssignment<AccountId, RingBalance, KtonBalance>>,
}

Total Ring is around 10_000_000_000 * 10^9.
Total Kton won't grow too large in real world.

So I presume:

let total_ring/kton = own_ring/kton + others.iter().sum();
assert!(total_ring/kton < u128::max_value());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions