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

OriginTrail Testnet Release v6.2.0 Hotfix 12 #2985

Merged
merged 9 commits into from
Feb 14, 2024
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
Loading