Skip to content

fix: changed decay logic#673

Merged
Mikelle merged 5 commits intomainfrom
fix/change-decay-logic
May 1, 2025
Merged

fix: changed decay logic#673
Mikelle merged 5 commits intomainfrom
fix/change-decay-logic

Conversation

@Mikelle
Copy link
Copy Markdown
Contributor

@Mikelle Mikelle commented Apr 29, 2025

Describe your changes

If a provider commits to a bid before the decay start time, it counts as fully decayed. It should instead not decay at all in this case. It is also realistic that providers may commit before, especially since we describe in the docs as a good practice for bidders to add ~300 ms to the current time to the start to not have any decay if providers commit "immediately".

Checklist before requesting a review

  • I have added tests that prove my fix is effective or that my feature works
  • I have made corresponding changes to the documentation

@Mikelle Mikelle self-assigned this Apr 29, 2025
Comment thread oracle/pkg/updater/updater_test.go Outdated
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
got := u.ComputeResidualAfterDecay(tc.start, tc.end, tc.commit)
if tc.name == "Commit Very Close To End" {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aloknerurkar not sure - why does the computeResidualAfterDecay function use float64 instead of big.Int? Is it because float64 is simpler or faster? If there’s no strong reason, I could refactor the decay calculation to use big.Int.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, with current implementation, this test gives flaky result

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use big.Int no issues.

@Mikelle Mikelle force-pushed the fix/change-decay-logic branch from 522247e to a76a527 Compare May 1, 2025 14:26
@Mikelle Mikelle merged commit 63d3673 into main May 1, 2025
6 checks passed
@Mikelle Mikelle deleted the fix/change-decay-logic branch May 1, 2025 16:07
aloknerurkar pushed a commit that referenced this pull request May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants