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

Commit

Permalink
Merge pull request #995 from near/0620_add_chunk_producer_support_val…
Browse files Browse the repository at this point in the history
…idators

Show chunk produced/expected values in near cli
  • Loading branch information
mm-near authored Jun 21, 2022
2 parents 6f5882d + f3929a9 commit 2c4d469
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions utils/validators-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,18 @@ async function showValidatorsTable(near, blockNumberOrHash) {
result.protocolConfig.protocol_version);
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');
validatorsTable.setHeading('Validator Id', 'Stake', '# Seats', '% Online', 'Blocks produced', 'Blocks expected', 'Chunks produced', 'Chunks expected');
console.log(`Validators (total: ${result.current_validators.length}, seat price: ${utils.format.formatNearAmount(seatPrice, 0)}):`);
result.current_validators.forEach((validator) => {
validatorsTable.addRow(
validator.account_id,
utils.format.formatNearAmount(validator.stake, 0),
getNumberOfSeats(result.protocolConfig.protocol_version, validator.stake, seatPrice),
`${Math.floor(validator.num_produced_blocks / validator.num_expected_blocks * 10000) / 100}%`,
`${Math.floor((validator.num_produced_blocks + validator.num_produced_chunks) / (validator.num_expected_blocks + validator.num_expected_chunks) * 10000) / 100}%`,
validator.num_produced_blocks,
validator.num_expected_blocks);
validator.num_expected_blocks,
validator.num_produced_chunks,
validator.num_expected_chunks);
});
console.log(validatorsTable.toString());
}
Expand Down

0 comments on commit 2c4d469

Please sign in to comment.