Skip to content

Commit

Permalink
Merge pull request #2982 from OriginTrail/v6/develop
Browse files Browse the repository at this point in the history
OriginTrail Devnet Prerelease v6.2.0 Hotfix 12
  • Loading branch information
NZT48 authored Feb 14, 2024
2 parents 7e0207e + fc2d418 commit 9be7a2d
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
1 change: 0 additions & 1 deletion config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,6 @@
"config": {
"hubContractAddress": "0xbEF14fc04F870c2dD65c13Df4faB6ba01A9c746b",
"gasPriceOracleLink": "https://api.gnosisscan.io/api?module=proxy&action=eth_gasPrice",
"rpcEndpoints": ["https://rpc.gnosischain.com/"],
"operatorFee": 0
}
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "origintrail_node",
"version": "6.2.0",
"version": "6.2.0+hotfix.12",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down
6 changes: 6 additions & 0 deletions src/service/proximity-scoring-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,19 @@ class ProximityScoringService {

let normalizedDistance = scaledDistance.div(adjustedDivisor);
if (normalizedDistance.gt(UINT64_MAX_BN)) {
this.logger.warn(
`Invalid normalized distance: ${normalizedDistance.toString()}. Max value: ${UINT64_MAX_BN.toString()}`,
);
normalizedDistance = normalizedDistance.mod(UINT64_MAX_BN.add(1));
}

let normalizedStake = stakeScaleFactor
.mul(mappedStake.sub(mappedMinStake))
.div(mappedMaxStake.sub(mappedMinStake));
if (normalizedStake.gt(UINT64_MAX_BN)) {
this.logger.warn(
`Invalid normalized stake: ${normalizedDistance.toString()}. Max value: ${UINT64_MAX_BN.toString()}`,
);
normalizedStake = normalizedStake.mod(UINT64_MAX_BN.add(1));
}

Expand Down
11 changes: 5 additions & 6 deletions src/service/service-agreement-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ class ServiceAgreementService {
);
let maxNeighborhoodDistance;
if (neighbourhoodEdges) {
maxNeighborhoodDistance = await this.proximityScoringService.callProximityFunction(
blockchainId,
proximityScoreFunctionsPairId,
neighbourhoodEdges.leftEdge[hashFunctionName],
neighbourhoodEdges.rightEdge[hashFunctionName],
);
maxNeighborhoodDistance = neighbourhoodEdges.leftEdge.distance.gt(
neighbourhoodEdges.rightEdge.distance,
)
? neighbourhoodEdges.leftEdge.distance
: neighbourhoodEdges.rightEdge.distance;
}

return this.proximityScoringService.callScoreFunction(
Expand Down
5 changes: 2 additions & 3 deletions src/service/sharding-table-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class ShardingTableService {
const hashFunctionName = this.hashingService.getHashFunctionName(hashFunctionId);
const peersWithDistance = await Promise.all(
peers.map(async (peer) => ({
peer,
...peer,
distance: await this.proximityScoringService.callProximityFunction(
blockchainId,
proximityScoreFunctionsPairId,
Expand All @@ -158,8 +158,7 @@ class ShardingTableService {
}
return 0;
});
const result = peersWithDistance.slice(0, count).map((pd) => pd.peer);
return result;
return peersWithDistance.slice(0, count);
}

async getBidSuggestion(
Expand Down

0 comments on commit 9be7a2d

Please sign in to comment.