Skip to content

Commit a88a47f

Browse files
authored
Merge pull request #404 from OriginTrail/test/node-scoring-tests
Node scoring tests
2 parents 7eba1f2 + 94cac37 commit a88a47f

2 files changed

Lines changed: 1523 additions & 740 deletions

File tree

contracts/RandomSampling.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,15 +422,15 @@ contract RandomSampling is INamed, IVersioned, ContractStatus, IInitializable {
422422
*/
423423
function calculateNodeScore(uint72 identityId) public view returns (uint256) {
424424
// 1. Node stake factor calculation
425-
// Formula: nodeStakeFactor = 2 * (nodeStake / 2,000,000)^2
425+
// Formula: nodeStakeFactor = 2 * (nodeStake / maximumStake)^2
426426
uint256 maximumStake = uint256(parametersStorage.maximumStake());
427427
uint256 nodeStake = uint256(stakingStorage.getNodeStake(identityId));
428428
nodeStake = nodeStake > maximumStake ? maximumStake : nodeStake;
429429
uint256 stakeRatio18 = (nodeStake * SCALE18) / maximumStake;
430430
uint256 nodeStakeFactor18 = (2 * stakeRatio18 * stakeRatio18) / SCALE18;
431431

432432
// 2. Node ask factor calculation
433-
// Formula: nodeStake * ((upperAskBound - nodeAsk) / (upperAskBound - lowerAskBound))^2 / 2,000,000
433+
// Formula: nodeStake * ((upperAskBound - nodeAsk) / (upperAskBound - lowerAskBound))^2 / maximumStake
434434
uint256 nodeAsk18 = uint256(profileStorage.getAsk(identityId)) * SCALE18;
435435
(uint256 askLowerBound18, uint256 askUpperBound18) = askStorage.getAskBounds();
436436
uint256 nodeAskFactor18;

0 commit comments

Comments
 (0)