sample usage assertion error
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 9
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
hi, getSampledUsage function was working normally, but nowadays i only get assertion error from it.
What might be the reason, is there way that i can solve this? if not, what default values that i can use for Uint128 cpu and net values that returns from sample usage method that is used for cpu and net price calculations.
if none of these works, is there any other way that i can get cpuPrice, netPrice of the current state?
const eosResources = new Resources({
api: apiClient,
});
const powerup = await eosResources.v1.powerup.get_state();
let sampleUsage: SampleUsage;
try {
sampleUsage = await eosResources.getSampledUsage();
} catch (error) {
sampleUsage = defaultSampleUsage();
}
error: Assertion failed
stack: 'Error: Assertion failed\n at assert (/Users/dante/Documents/Codes/eos/node_modules/bn.js/lib/bn.js:6:21)\n at BN.divmod (/Users/dante/Documents/Codes/eos/node_modules/bn.js/lib/bn.js:2342:5)\n at BN.div (/Users/dante/Documents/Codes/eos/node_modules/bn.js/lib/bn.js:2438:17)\n at divCeil (/Users/dante/Documents/Codes/eos/node_modules/@wharfkit/resources/src/index.ts:80:21)\n at Resources.<anonymous> (/Users/dante/Documents/Codes/eos/node_modules/@wharfkit/resources/src/index.ts:73:18)\n at Generator.next (<anonymous>)\n at fulfilled (/Users/dante/Documents/Codes/eos/node_modules/@wharfkit/resources/node_modules/tslib/tslib.js:166:62)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)'
thanks, dante
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Resources.getSampledUsage and the divCeil call shown at @wharfkit/resources/src/index.ts:80, then trace the BN.divmod assertion in bn.js. Reproduce the failure with the provided getSampledUsage example and inspect the Uint128 CPU and NET values involved. Done means the cause and a supported resolution or fallback behavior are established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100