-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gen 672 bug inconsistent winners #26
Conversation
GEN-672 BUG: inconsistent winners
This is draw 7, which closed at block 109344984. Sep-09-2023 07:45:45 PM +UTC Draw 7 end timestamp was 1694286000
The isWinner went from true to false at block 109347939 (timestamp 1694294655) newest total supply twab observation timestamp 109344984 = 1694285541 (before period on or end) newest total supply twab observation timestamp 109347939 = 1694294655 (after period on or end) twab time range: 1694199600 - 1694286000 The V5 draw results were changing. Draw results at first: GenerationSoftware/pt-v5-draw-results-beta@1ab7124 Draw results after: GenerationSoftware/pt-v5-draw-results-beta@82391e5 It does appear that there is a problem with the Twab Controller, because the twab total supply changed. |
2f9d736
to
b0a9f93
Compare
LCOV of commit
|
LCOV of commit
|
@@ -102,8 +102,8 @@ contract TwabController { | |||
event ObservationRecorded( | |||
address indexed vault, | |||
address indexed user, | |||
uint112 balance, | |||
uint112 delegateBalance, | |||
uint96 balance, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will need to update this to uint96
in the Vault.
src/TwabController.sol
Outdated
if (_timestamp < PERIOD_OFFSET) { | ||
return PERIOD_OFFSET; | ||
} | ||
if ((_timestamp - PERIOD_OFFSET) % PERIOD_LENGTH == 0) { | ||
return _timestamp; | ||
return uint32(_timestamp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to cast it here?
It should pass in the first condition and return PERIOD_OFFSET
if _timestamp
is greater than PERIOD_OFFSET
which is of uint32
type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm; no I don't think we do. I'll do some checks
src/libraries/ObservationLib.sol
Outdated
@@ -4,6 +4,8 @@ pragma solidity ^0.8.19; | |||
|
|||
import "ring-buffer-lib/RingBufferLib.sol"; | |||
|
|||
// import "./OverflowSafeComparatorLib.sol"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be removed.
LCOV of commit
|
LCOV of commit
|
Big changes: