Skip to content
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

fix: Error on too few snapshots and too short #223

Merged
merged 3 commits into from
Jul 3, 2023

Conversation

apollo-sturdy
Copy link
Contributor

window size

Base automatically changed from feat/min-epoch-duration to release/neutron June 29, 2023 13:34
@@ -174,6 +174,12 @@ impl PriceSourceUnchecked<WasmPriceSourceChecked, Empty> for WasmPriceSourceUnch
&route_assets,
)?;

if window_size <= 1 {
Copy link
Contributor

@pacmanifold pacmanifold Jun 29, 2023

Choose a reason for hiding this comment

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

set this either as const MIN_WINDOW_SIZE or config item?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could set it as a const if you prefer, but it shouldn't be changeable. Its just that the logic breaks (subtraction underflow) if you set it to 1 or less.

@@ -307,6 +313,10 @@ fn query_astroport_twap_price(
.may_load(deps.storage, denom)?
.ok_or(ContractError::NoSnapshots {})?;

if snapshots.len() < 2 {
Copy link
Contributor

@pacmanifold pacmanifold Jun 29, 2023

Choose a reason for hiding this comment

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

set as either const MIN_NUM_OF_SNAPSHOTS or config item?

@apollo-sturdy apollo-sturdy merged commit 86233f9 into release/neutron Jul 3, 2023
6 checks passed
@apollo-sturdy apollo-sturdy deleted the dev/twap-params-validation branch July 3, 2023 14:08
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.

4 participants