Skip to content

Commit

Permalink
Merge pull request #2704 from OriginTrail/fix/revert-rounding
Browse files Browse the repository at this point in the history
Round bid suggestion for small assertions to 1KB
  • Loading branch information
NZT48 authored Sep 7, 2023
2 parents 8fa0308 + 1a9fd37 commit 40a729e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
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.0.14",
"version": "6.0.15",
"description": "OTNode V6",
"main": "index.js",
"type": "module",
Expand Down
12 changes: 3 additions & 9 deletions src/service/sharding-table-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ class ShardingTableService {
firstAssertionId,
hashFunctionId,
) {
const kbSize = assertionSize < BYTES_IN_KILOBYTE ? BYTES_IN_KILOBYTE : assertionSize;
const peerRecords = await this.findNeighbourhood(
blockchainId,
this.blockchainModuleManager.encodePacked(
Expand All @@ -177,20 +178,13 @@ class ShardingTableService {

const r0 = await this.blockchainModuleManager.getR0(blockchainId);

const minBidSuggestion = this.blockchainModuleManager
.toBigNumber(blockchainId, '1')
.mul(epochsNumber)
.mul(r0);

const bidSuggestion = this.blockchainModuleManager
.toBigNumber(blockchainId, this.blockchainModuleManager.convertToWei(blockchainId, ask))
.mul(assertionSize)
.mul(kbSize)
.mul(epochsNumber)
.mul(r0)
.div(BYTES_IN_KILOBYTE);
return bidSuggestion.lte(minBidSuggestion)
? minBidSuggestion.toString()
: bidSuggestion.toString();
return bidSuggestion.toString();
}

async findEligibleNodes(neighbourhood, bid, r1, r0) {
Expand Down

0 comments on commit 40a729e

Please sign in to comment.