Skip to content

getApproxHint: numTrials parameter overestimates required trials #1180

Open

Description

@infalliblePirate

In /bold/contracts/utils/hintExamples.js, the numTrials parameter in the call to HintHelper.getApproxHint is currently set as numTroves * 15. According to the function’s documentation, the intended formula is:

numTrials = k * sqrt(length), with k = 15

  // Get an approximate address hint from the deployed HintHelper contract. Use (15 * number of troves) trials
  // to get an approx. hint that is close to the right position.
  let numTroves = await sortedTroves.getSize();
  let numTrials = numTroves.mul(toBN("15"));
  let { 0: approxHint } = await hintHelpers.getApproxHint(NICR, numTrials, 42); // random seed of 42

Compute numTrials as 15 * sqrt(numTroves) instead of 15 * numTroves

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions