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

Bug: function get_all_sources returns 0 elements for a given future pair_id/expiration timestamp #117

Open
JordyRo1 opened this issue Jul 23, 2024 · 2 comments · May be fixed by #116
Open
Assignees

Comments

@JordyRo1
Copy link
Contributor

Actual behavior

  • Upon calling get_all_sources for a future entry, the output is correct if the expiry timestamp is set to 0, but this function returns an empty array in case where the expiry is not null

Expected behaviour

  • This function should return the expected list of sources even when an expiry is provided.
@JordyRo1
Copy link
Contributor Author

JordyRo1 commented Aug 7, 2024

Report on the impact on the codebase

To begin with, crash tests were initiated using the test_update_oracle function from the sdk. The test tried to update the oracle contract on a fork mainnet, and tried to call get_data for a list of spot assets. As expected, we had an error which is 'No publisher for source. Since the mapping for oracle_list_of_publishers_for_sources_storagechanged, the signature associated to this storage slot changed too. Since the new signature has been generated after the update, no publishers information can be retrieved at this point.
IMPACT: After the update, get_data will return the error: No publisher for source until publishers publish their next prices. Once they publish their next price, the oracle_list_of_publishers_for_sources_storagewill be updated.
REMEDIATION: Adjust with the publishers to publish as soon as the update goes through to avoid downtime.
However, this solution is not enough, because oracle_data_entry_storage storage slot signature is not changed, so upon publishing data, the latest stored entry timestamp will be !=0, thus we will not make the necessary changes on oracle_list_of_publishers_for_sources_storage (cf: https://github.com/astraly-labs/pragma-oracle/blob/main/src/oracle/oracle.cairo#L1160)

@EvolveArt
Copy link
Contributor

The best solution is to publish data in the same tx as the upgrade

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 a pull request may close this issue.

2 participants