-
Notifications
You must be signed in to change notification settings - Fork 597
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
refactor(twap): add sanity check in updateRecord
to compare record
time and height against ctx
#2686
Comments
ctx.BlockTime
record
time and height against ctx
record
time and height against ctx
record
time and height against ctx
record
time and height against ctx
updateRecord
to compare record
time and height against ctx
osmosis/x/twap/listeners_test.go Line 26 in 1111d84
@p0mvn We have an exception here. With sanity check added, swap on pool creation block should return err. What do u think about that? |
|
I think we should discuss with @mattverse owning this commit |
@hieuvubk What causes the error? At a light glance, I don't see anything calling |
Sr to bother , I checked actually this comes from |
@p0mvn @mattverse Reopend this pr cause its still available for issue. Could u review it? Thanksss |
Background
This was observed during testing of
updateRecords
. It is possible to set up a testing environment in such a way as to be able to insert a record between the existing records.For example, assume a two-asset pool and 2 records at the times
t
andt + 2
. If I set upctx.BlockTime
to bet + 1
, I can insert a new record in-between without error.While this should not be possible to reproduce in real environment, having a sanity check in
updateRecord
to ensure the following invariants would be useful:ctx.BlockTime
>record.Time
ctx.BlockHeight
>record.Height
updateRecord
andupdateRecords
should be returning an error in these cases.Suggested Design
Return error if any of the above invariants are not satisfied.
Acceptance Criteria
updateRecord
updateRecord
are covered by testsupdateRecords
tests are refactored / adjusted to cover the new behaviorThe text was updated successfully, but these errors were encountered: