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

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

merged 2 commits into from
Jun 5, 2020

Conversation

june07
Copy link
Contributor

@june07 june07 commented Jun 4, 2020

Should be passing a string here...

/**
 * Convert account balance value from internal indivisible units to NEAR. 1 NEAR is defined by {@link NEAR_NOMINATION}.
 * Effectively this divides given amount by {@link NEAR_NOMINATION}.
 *
 * @param balance decimal string representing balance in smallest non-divisible NEAR units (as specified by {@link NEAR_NOMINATION})
 * @param fracDigits number of fractional digits to preserve in formatted string. Balance is rounded to match given number of digits.
 * @returns Value in Ⓝ
 */
function formatNearAmount(balance, fracDigits = exports.NEAR_NOMINATION_EXP) {

@janedegtiareva janedegtiareva self-assigned this Jun 5, 2020
@janedegtiareva janedegtiareva self-requested a review June 5, 2020 02:32
@janedegtiareva
Copy link
Contributor

janedegtiareva commented Jun 5, 2020

Do you mind providing some details on how you tested this? (e.g. test cases tried, which environment, etc)
Thank you!

@janedegtiareva
Copy link
Contributor

For easy navigation: This is a fix for #385

@june07
Copy link
Contributor Author

june07 commented Jun 5, 2020

Sure, I changed the numSeats filtered the current_validators to match the conditions as given by @mfornet in #385. Some examples of output:

Using options: {
networkId: 'betanet',
nodeUrl: 'https://rpc.betanet.near.org',
contractName: undefined,
walletUrl: 'https://wallet.betanet.near.org',
helperUrl: 'https://helper.betanet.near.org',
useLedgerKey: "44'/397'/0'/0'/1'",
epoch: 'current',
initialBalance: null
}
Validators (total: 3, seat price: 50,000,259):

Validator Id Stake # Seats % Online Blocks produced Blocks expected
node0 50,000,259 1 0% 0 2
node2 50,000,259 1 0% 0 1
node3 50,000,259 1 0% 0 3

And currently comparing a run on betanet (note the seat column):

Without fix:

Validator Id Stake # Seats % Online Blocks produced Blocks expected
yyyyyyyyyyyyy1 84,522 0 NaN% 0 0

With fix:

Validator Id Stake # Seats % Online Blocks produced Blocks expected
yyyyyyyyyyyyy1 84,522 1 NaN% 0 0

Further looking at the comments of the function that is being called, it seems clear that it is not being called correctly. Someone with more familiarity with the code base (than myself) should be able to better confirm the validity of the fix. Otherwise, don't see that any testing framework is in use...

@janedegtiareva janedegtiareva merged commit 1128106 into near:master Jun 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants