Skip to content

fix(oracle): use Math.trunc in bucketStartFor to prevent boundary drift - #632

Merged
nonsobethel0-dev merged 1 commit into
Parashield-Protocol:mainfrom
Chucks1093:fix/519-520-521-522
Sep 25, 2026
Merged

nonsobethel0-dev merged 1 commit into
Parashield-Protocol:mainfrom
Chucks1093:fix/519-520-521-522

Conversation

@Chucks1093

Copy link
Copy Markdown
Contributor

Closes #521
Closes #522
Closes #520
Closes #519

Summary

  • In OracleService.bucketStartFor, added Math.trunc before the * 1000 conversion so that a float timestamp fractionally below a bucket boundary (e.g. 10:59:59.9999) correctly maps to the earlier bucket instead of slipping into the next one due to floating-point multiplication noise
  • Added two regression tests in oracle.service.spec.ts: one verifying a float just below a boundary stays in the earlier bucket, and one confirming a timestamp exactly at a boundary opens the new bucket

…ft (Parashield-Protocol#521)

A float timestamp very close to a bucket boundary (e.g. 10:59:59.9999)
could produce a ms value just above the boundary after multiplication,
causing it to map to the next bucket instead of the current one.
Truncating to whole seconds before conversion makes the result
deterministic regardless of sub-second float noise.
Adds two regression tests covering the just-before and at-boundary cases.

Closes Parashield-Protocol#521
Closes Parashield-Protocol#522
Closes Parashield-Protocol#520
Closes Parashield-Protocol#519
@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

@Chucks1093 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@nonsobethel0-dev
nonsobethel0-dev merged commit 8dd25f3 into Parashield-Protocol:main Sep 25, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment