Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Fix for https://github.com/near/near-shell/issues/385 #398

Merged
merged 2 commits into from
Jun 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions utils/validators-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async function showValidatorsTable(near, epochId) {
result.current_validators = result.current_validators.sort((a, b) => -new BN(a.stake).cmp(new BN(b.stake)));
var validatorsTable = new AsciiTable();
validatorsTable.setHeading('Validator Id', 'Stake', '# Seats', '% Online', 'Blocks produced', 'Blocks expected');
console.log(`Validators (total: ${result.current_validators.length}, seat price: ${utils.format.formatNearAmount(seatPrice, 0)}):`);
console.log(`Validators (total: ${result.current_validators.length}, seat price: ${utils.format.formatNearAmount(seatPrice.toString(), 0)}):`);
result.current_validators.forEach((validator) => {
validatorsTable.addRow(
validator.account_id,
Expand All @@ -34,7 +34,7 @@ async function showNextValidatorsTable(near) {
const nextSeatPrice = validators.findSeatPrice(result.next_validators, result.numSeats);
result.next_validators = result.next_validators.sort((a, b) => -new BN(a.stake).cmp(new BN(b.stake)));
const diff = validators.diffEpochValidators(result.current_validators, result.next_validators);
console.log(`\nNext validators (total: ${result.next_validators.length}, seat price: ${utils.format.formatNearAmount(nextSeatPrice, 0)}):`);
console.log(`\nNext validators (total: ${result.next_validators.length}, seat price: ${utils.format.formatNearAmount(nextSeatPrice.toString(), 0)}):`);
let nextValidatorsTable = new AsciiTable();
nextValidatorsTable.setHeading('Status', 'Validator', 'Stake', '# Seats');
diff.newValidators.forEach((validator) => nextValidatorsTable.addRow(
Expand Down Expand Up @@ -66,7 +66,7 @@ async function showProposalsTable(near) {
const combinedProposals = combineValidatorsAndProposals(result.current_validators, proposals);
const expectedSeatPrice = validators.findSeatPrice(combinedProposals, result.numSeats);
const combinedPassingProposals = combinedProposals.filter((p) => new BN(p.stake).gte(expectedSeatPrice));
console.log(`Proposals for the epoch after next (new: ${proposals.size}, passing: ${combinedPassingProposals.length}, expected seat price = ${utils.format.formatNearAmount(expectedSeatPrice, 0)})`);
console.log(`Proposals for the epoch after next (new: ${proposals.size}, passing: ${combinedPassingProposals.length}, expected seat price = ${utils.format.formatNearAmount(expectedSeatPrice.toString(), 0)})`);
const proposalsTable = new AsciiTable();
proposalsTable.setHeading('Status', 'Validator', 'Stake => New Stake', '# Seats');
combinedProposals.sort((a, b) => -new BN(a.stake).cmp(new BN(b.stake))).forEach((proposal) => {
Expand Down