Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed LinearSum score calculation #2910

Merged
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const FALLBACK_PROVIDER_QUORUM = 1;

export const RPC_PROVIDER_STALL_TIMEOUT = 60 * 1000;

export const UINT256_MAX_BN = BigNumber.from(2).pow(256).sub(1);
export const UINT256_MAX_BN = ethers.constants.MaxUint256;

export const UINT128_MAX_BN = BigNumber.from(2).pow(128).sub(1);

Expand All @@ -18,7 +18,7 @@ export const UINT40_MAX_BN = BigNumber.from(2).pow(40).sub(1);

export const UINT32_MAX_BN = BigNumber.from(2).pow(32).sub(1);

export const HASH_RING_SIZE = BigNumber.from(2).pow(256);
export const HASH_RING_SIZE = ethers.constants.MaxUint256;

export const STAKE_UINT256_MULTIPLIER_BN = UINT256_MAX_BN.div(500000000);

Expand Down
7 changes: 3 additions & 4 deletions src/service/proximity-scoring-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ class ProximityScoringService {
const idealMaxDistanceInNeighborhood = HASH_RING_SIZE.div(nodesNumber).mul(
Math.ceil(r2 / 2),
);
const divisor =
maxNeighborhoodDistance <= idealMaxDistanceInNeighborhood
? maxNeighborhoodDistance
: idealMaxDistanceInNeighborhood;
const divisor = maxNeighborhoodDistance.lte(idealMaxDistanceInNeighborhood)
? maxNeighborhoodDistance
: idealMaxDistanceInNeighborhood;

const maxMultiplier = UINT256_MAX_BN.div(distance);

Expand Down
Loading