Skip to content

Commit

Permalink
patch issue with failover
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Feb 23, 2023
1 parent 58022cd commit e3e62ac
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,24 +165,27 @@ module EpochBoundary {
fun propose_new_set(vm: &signer, outgoing_compliant_set: &vector<address>): vector<address>
{
let proposed_set = Vector::empty<address>();


print(&800601);
// If we are in recovery mode, we use the recovery set.
if (RecoveryMode::is_recovery()) {
print(&80060101);
let recovery_vals = RecoveryMode::get_debug_vals();
if (Vector::length(&recovery_vals) > 0) {
proposed_set = recovery_vals
}
} else { // Default case: Proof of Fee
//// V6 ////
print(&80060102);
// CONSENSUS CRITICAL
// pick the validators based on proof of fee.
let (auction_winners, price) = ProofOfFee::fill_seats_and_get_price(MOCK_VAL_SIZE, outgoing_compliant_set);
// TODO: Don't use copy above, do a borrow.
print(&800700);
print(&80060103);

// charge the validators for the proof of fee in advance of the epoch
DiemAccount::vm_multi_pay_fee(vm, &auction_winners, price, &b"proof of fee");
print(&800800);
print(&80060104);

proposed_set = auction_winners
};
Expand Down
23 changes: 20 additions & 3 deletions diem-move/diem-framework/DPN/sources/0L/ProofOfFee.move
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,12 @@ address DiemFramework {
public fun fill_seats_and_get_price(set_size: u64, proven_nodes: &vector<address>): (vector<address>, u64) acquires ProofOfFeeAuction {
let seats_to_fill = Vector::empty<address>();
// print(&set_size);
print(&8006010201);
let max_unproven = set_size / 3;

let num_unproven_added = 0;

print(&8006010202);
let sorted_vals_by_bid = get_sorted_vals();

// print(&sorted_vals_by_bid);
Expand All @@ -180,29 +182,44 @@ address DiemFramework {
// fail fast if the validator is jailed.
// NOTE: epoch reconfigure needs to reset the jail
// before calling the proof of fee.
if (Jail::is_jailed(*val)) continue;

if (!Vouch::unrelated_buddies_above_thresh(*val)) continue;
print(&8006010203);
if (Jail::is_jailed(*val)) {
i = i + 1;
continue
};
print(&8006010204);
if (!Vouch::unrelated_buddies_above_thresh(*val)) {
i = i + 1;
continue
};

// check if a proven node
if (Vector::contains(proven_nodes, val)) {
print(&8006010205);
// print(&01);
Vector::push_back(&mut seats_to_fill, *val);
} else {
print(&8006010206);
// print(&02);
// for unproven nodes, push it to list if we haven't hit limit
if (num_unproven_added < max_unproven ) {
// print(&03);
Vector::push_back(&mut seats_to_fill, *val);
};
// print(&04);
print(&8006010207);
num_unproven_added = num_unproven_added + 1;
};
i = i + 1;
};
// print(&05);
print(&8006010208);
print(&seats_to_fill);

if (Vector::is_empty(&seats_to_fill)) {
return (seats_to_fill, 0)
};

let lowest_bidder = Vector::borrow(&seats_to_fill, Vector::length(&seats_to_fill) - 1);

let (lowest_bid, _) = current_bid(*lowest_bidder);
Expand Down

0 comments on commit e3e62ac

Please sign in to comment.