Skip to content

Commit

Permalink
WIP: latest status
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Nov 1, 2022
1 parent 04e6561 commit 65c174a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
14 changes: 7 additions & 7 deletions proof_of_stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,15 +912,15 @@ pub trait PosBase {
// For active validators, this would only ever happen until all the
// validator slots are filled with non-0 voting power validators, but we
// still need to guard against it.
let active_validators = cur_validators.active.iter().filter_map(
let active_validators = cur_validators.consensus.iter().filter_map(
|validator: &WeightedValidator<_>| {
// If the validators set from previous epoch contains the same
// validator, it means its voting power hasn't changed and hence
// doesn't need to updated.
if let (Some(prev_epoch), Some(prev_validators)) =
(previous_epoch, prev_validators)
{
if prev_validators.active.contains(validator) {
if prev_validators.consensus.contains(validator) {
println!(
"skipping validator update, still the same {}",
validator.address
Expand Down Expand Up @@ -1019,7 +1019,7 @@ pub trait PosBase {

// Get total stake of the consensus validator set
// TODO: does this need to account for rewards prodcuts?
let total_active_stake = validators.active.iter().fold(
let total_active_stake = validators.consensus.iter().fold(
0_u64,
|sum,
WeightedValidator {
Expand Down Expand Up @@ -1076,7 +1076,7 @@ pub trait PosBase {
let mut validator_accumulators = self
.read_consensus_validator_rewards_accumulator()
.unwrap_or_default();
for validator in validators.active.iter() {
for validator in validators.consensus.iter() {
let mut rewards_frac = Decimal::default();
let stake: Decimal = validator.bonded_stake.into();

Expand Down Expand Up @@ -1445,7 +1445,7 @@ where
None => break,
}
}
let validator_set = ValidatorSet { active, inactive };
let validator_set = ValidatorSet { consensus, below_capacity, below_threshold };
let validator_set = Epoched::init_at_genesis(validator_set, current_epoch);
let total_bonded_delta =
EpochedDelta::init_at_genesis(total_bonded_delta, current_epoch);
Expand Down Expand Up @@ -1653,9 +1653,9 @@ where
bonded_stake: 0,
address: address.clone(),
};
if validator_set.active.len() < params.max_validator_slots as usize
if validator_set.consensus.len() < params.max_validator_slots as usize
{
validator_set.active.insert(validator);
validator_set.consensus.insert(validator);
} else {
validator_set.inactive.insert(validator);
}
Expand Down
10 changes: 5 additions & 5 deletions proof_of_stake/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,14 +429,14 @@ where
for epoch in Epoch::iter_range(current_epoch, unbonding_offset + 1) {
if let Some(post) = post.get_at_epoch(epoch) {
// Check that active validators length is not over the limit
if post.active.len() > params.max_validator_slots as usize {
if post.consensus.len() > params.max_validator_slots as usize {
errors.push(Error::TooManyActiveValidators)
}
// Check that all active have voting power >= any inactive
if let (
Some(max_inactive_validator),
Some(min_active_validator),
) = (post.inactive.last_shim(), post.active.first_shim())
) = (post.inactive.last_shim(), post.consensus.first_shim())
{
if max_inactive_validator.bonded_stake
> min_active_validator.bonded_stake
Expand All @@ -456,7 +456,7 @@ where
.map(Cow::Borrowed)
.unwrap_or_else(|| Cow::Owned(HashMap::default()));
// Check active validators
for validator in &post.active {
for validator in &post.consensus {
match total_stakes.get(&validator.address) {
Some((_stake_pre, stake_post)) => {
// Any validator who's total deltas changed,
Expand All @@ -476,7 +476,7 @@ where
// Others must be have the same voting power
// as in pre (active or inactive), or be a
// newly added validator
if !pre.active.contains(validator)
if !pre.consensus.contains(validator)
&& !pre.inactive.contains(validator)
&& !new_validators
.contains_key(&validator.address)
Expand Down Expand Up @@ -545,7 +545,7 @@ where
// Others must be have the same voting power
// as in pre (active or inactive), or be a
// newly added validator
if !pre.active.contains(validator)
if !pre.consensus.contains(validator)
&& !pre.inactive.contains(validator)
&& !new_validators
.contains_key(&validator.address)
Expand Down
34 changes: 17 additions & 17 deletions wasm/checksums.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"tx_bond.wasm": "tx_bond.acbac392f0241cd69b8decb1b14101c39f172e99cdf69bbab81ac9f1d1535683.wasm",
"tx_from_intent.wasm": "tx_from_intent.d7977ef830aa14c8edb8882d5734939f9f2a0aea72c912badee3448b54cb21bc.wasm",
"tx_ibc.wasm": "tx_ibc.151d34d541eb8725f5fcf9bdaff6c05fd5da1b04e164e3e6fd7b813bbd9748ff.wasm",
"tx_init_account.wasm": "tx_init_account.15af8abe24208d055816c6c62cd533d3d3375fa18ce20940d4801a41f1a6a159.wasm",
"tx_init_nft.wasm": "tx_init_nft.8d96bdaf449f529180fbb7166c149d7ba2ef5d899067518ec646e37af05668fd.wasm",
"tx_init_proposal.wasm": "tx_init_proposal.20a5a16150933b8e87e2a5b2f78af6dd5920ca732e18c3451601a19d7b3b093f.wasm",
"tx_init_validator.wasm": "tx_init_validator.db107f7443e44823d390fdddc8809a9e5efd784d13f274b9c19b47496f8fa70a.wasm",
"tx_mint_nft.wasm": "tx_mint_nft.1792973eaa7310b9f0df062a8d285758fa164e4951e85d5d308164019e587d5f.wasm",
"tx_transfer.wasm": "tx_transfer.381b739356f4a2455834b775e739c3878190c594bc976478ff9b805d96b6894c.wasm",
"tx_unbond.wasm": "tx_unbond.29589eae5d0eac8710572dcf6feb5ed695d62bdb632162d0ad3acc12a25571ef.wasm",
"tx_update_vp.wasm": "tx_update_vp.1fe62e1e24b7fdac1b06ecf4c89da0b29692d7a9e12b972222dda9b619127235.wasm",
"tx_vote_proposal.wasm": "tx_vote_proposal.3b4ad1fddf806a0ea37a186c187a9d6baf8cc65453750a20c20cf002be6f980b.wasm",
"tx_withdraw.wasm": "tx_withdraw.bf7a15237f43575d0a9664544ef47103a6c2dc0fd4771e37fa00df7d0ed109b1.wasm",
"vp_nft.wasm": "vp_nft.1c36c0239dce09a7ed0bf5c2131275c98925e0f1b2b233827c2664438a5f2a37.wasm",
"vp_testnet_faucet.wasm": "vp_testnet_faucet.a5da01cfd9cc39ae59921dff9ef4b10db110447eba5c3ffa1c0682eb256bae22.wasm",
"vp_token.wasm": "vp_token.acce2e5291c4d6600fd8d3f88fdeb4811d63ea3086bfe64526c5f4c526d8e21b.wasm",
"vp_user.wasm": "vp_user.ab03bb1dbe4f54306a13455c6354f3f1ff4eb2a48006c7a3a1906efc0eafa3e4.wasm"
"tx_bond.wasm": "tx_bond.dde5e970ee1a01ba4735d247e9cc2e004a79eca10ef314f6e9d3a5567b562768.wasm",
"tx_from_intent.wasm": "tx_from_intent.4dc7c8297b64e5a2b2706c99030a7a4f4fccd0249b65945681b3313cbf3220f3.wasm",
"tx_ibc.wasm": "tx_ibc.86cee5a52fbab199f19f413c3efd95a5c0d269bcf80ffe5663400990eaa33984.wasm",
"tx_init_account.wasm": "tx_init_account.8f3d3f259dd31951470d9927a70559cb1d241435c1ce5ec0900beea70230f698.wasm",
"tx_init_nft.wasm": "tx_init_nft.68cb966f08114092918f64e47b25574ee2a062386e38a0d3faeda29b9ff289f8.wasm",
"tx_init_proposal.wasm": "tx_init_proposal.e98076a7ec495908c1eb05ea232bf05af2076049b0b7cadb43511c2d3925d043.wasm",
"tx_init_validator.wasm": "tx_init_validator.5d30769b4c0629e3fff360a0bdf98cf137799a230bb2642d17dc3a21e8d175f2.wasm",
"tx_mint_nft.wasm": "tx_mint_nft.ef93c00a3fd0597e3551e81b4abc7fcd7e7a5f890705839d578189d11f5091ff.wasm",
"tx_transfer.wasm": "tx_transfer.db5b0fbdceae27477cc99099e6df46475bc58a393640a733d51ce53f862ba414.wasm",
"tx_unbond.wasm": "tx_unbond.7bab99cc9c9f5da072e088dacbfa7989d9d6dfa4effbbd16c92ff48ad65d907a.wasm",
"tx_update_vp.wasm": "tx_update_vp.c6c19e02e92a9db78476907daca57aad1357a940963c24a11a820e509159ea7a.wasm",
"tx_vote_proposal.wasm": "tx_vote_proposal.3c79473918dd70ddca736766a28dbae655c6ddf10e96a6da2174306dea3ceb99.wasm",
"tx_withdraw.wasm": "tx_withdraw.f56e80bd2b0baa922a0c89f89118b6ede0ecfcaea09e4f2e8712ef6d60a80477.wasm",
"vp_nft.wasm": "vp_nft.ca95f995ebe0854f3c8501abcd9d65babc0040bf55554612a8509e7642b8296b.wasm",
"vp_testnet_faucet.wasm": "vp_testnet_faucet.edb6f03f94b7ed4c646bdf3287c14be140fbe97ecfcc812ce5588799fa74e55f.wasm",
"vp_token.wasm": "vp_token.fc02a4a3bde83d6634f037cd354c377818642a90e4febe169794ef3b0f4a9300.wasm",
"vp_user.wasm": "vp_user.c0bd2a5809d2ebc315257f9c38130f718a266fb1f40a7a970cd3fb6d9ad3ad3c.wasm"
}

0 comments on commit 65c174a

Please sign in to comment.