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

Ocean: fix active price #3126

Merged
merged 17 commits into from
Nov 26, 2024
Merged

Ocean: fix active price #3126

merged 17 commits into from
Nov 26, 2024

Conversation

canonbrother
Copy link
Contributor

@canonbrother canonbrother commented Nov 19, 2024

Summary

Fix missing active price - main issues are wrong key sort ac54bdd and index_block_<start/end> flow ff02de3

  • missing active price & next price
  • re-correct index_block_<start/end> flow
  • db endiannesss conversion
  • optimize prices index
  • fix /rpc response

Verified

➜  testnet3 curl -s http://localhost:3002/v0/testnet/prices/DFI-USD/feed/active
➜  testnet3 curl -s http://localhost:3002/v0/testnet/prices/DFI-USD/feed/active
{"data":[{"id":"DFI-USD-654840","key":"DFI-USD","sort":"0009fdf8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"2b1792dc6689f327e446991150939d6cf25d9f28b1db8aea81e184603f88528d","height":654840,"time":1633207650,"medianTime":1633207623}},{"id":"DFI-USD-651000","key":"DFI-USD","sort":"0009eef8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"e981648862d05fc58a64ec0465d522fc99fce3fd46658bd8a8d1cb78ac8de4cd","height":651000,"time":1633096024,"medianTime":1633095988}},{"id":"DFI-USD-647160","key":"DFI-USD","sort":"0009dff8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"dc59a91e1d5c0fa92cfdd48f9f9296c76a6dbb52642278f203d978fa3f275615","height":647160,"time":1632970159,"medianTime":1632969655}},{"id":"DFI-USD-643320","key":"DFI-USD","sort":"0009d0f8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"1308accb340961f265926075528fbac18e1098b8736de253f42107d45b38b95b","height":643320,"time":1632860925,"medianTime":1632860863}},{"id":"DFI-USD-639480","key":"DFI-USD","sort":"0009c1f8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"ef067091496da6e99e82a292a90bfee227cd5962a1fd0ad4ccd0aa77479a4aeb","height":639480,"time":1632722886,"medianTime":1632722838}},{"id":"DFI-USD-635640","key":"DFI-USD","sort":"0009b2f8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"9cefc556f58cc01886fa19cde82ba17d058cd598c33540edaae87256a6836bf6","height":635640,"time":1632609633,"medianTime":1632609411}},{"id":"DFI-USD-631800","key":"DFI-USD","sort":"0009a3f8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"62d92115fc7a8950812ccef5810de6895e214742ab003142161807bf94079696","height":631800,"time":1632492848,"medianTime":1632492756}},{"id":"DFI-USD-627960","key":"DFI-USD","sort":"000994f8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"349aa974d8d3ac80f67728ab0a5c6dee657839a181ad6db7fb43450d03689ad4","height":627960,"time":1632377677,"medianTime":1632377646}},{"id":"DFI-USD-674040","key":"DFI-USD","sort":"000a48f8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"9a5915ed8e014fc0c339cfe3c7b798aa74da93521a804b57dabd56a81ef9a849","height":674040,"time":1633780003,"medianTime":1633779941}},{"id":"DFI-USD-670200","key":"DFI-USD","sort":"000a39f8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"615e002c5ea8b236097260ec5fc7bc60c0e259806de0ed488a0427fa01372c8c","height":670200,"time":1633662815,"medianTime":1633662645}},{"id":"DFI-USD-666360","key":"DFI-USD","sort":"000a2af8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"0c08092a56177daf3c4008b855b2b76394a907bce0e15aab94a2d6a73f6bf2fa","height":666360,"time":1633548086,"medianTime":1633547892}},{"id":"DFI-USD-662520","key":"DFI-USD","sort":"000a1bf8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"c13f594c535e47dfeaee5679ba92817aeacba81c9d06808e6044e99d357c1b1a","height":662520,"time":1633433281,"medianTime":1633433271}},{"id":"DFI-USD-658680","key":"DFI-USD","sort":"000a0cf8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"3a2bd2418d93f390b005c40b98e72300463ca7bf83f99be89f8317148cd61993","height":658680,"time":1633316465,"medianTime":1633315994}},{"id":"DFI-USD-653040","key":"DFI-USD","sort":"0009f6f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"64a7fa1ac841bb377544e6d3899003c60eb1b5ac91cfdd70e212df1b0e30fefe","height":653040,"time":1633148189,"medianTime":1633147908}},{"id":"DFI-USD-649200","key":"DFI-USD","sort":"0009e7f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"c529e775897f952d014d57ce1907ce557c6568da08241e1b29daa0980b6d0bb7","height":649200,"time":1633038296,"medianTime":1633037956}},{"id":"DFI-USD-645360","key":"DFI-USD","sort":"0009d8f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"d867bb2cace07a32c12d4f5d45c9ce70f085ed20308cbb2e6e9a43cd39afbf66","height":645360,"time":1632912095,"medianTime":1632911899}},{"id":"DFI-USD-641520","key":"DFI-USD","sort":"0009c9f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"d7dad187df494796e1ea78f8ed42fa07c6750fb3a969e61db8303886073f0d1a","height":641520,"time":1632793425,"medianTime":1632793044}},{"id":"DFI-USD-637680","key":"DFI-USD","sort":"0009baf0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"83b769ad6c8aa8b104eb2fb7b9c595d2bb7b8e95fa067f97014f0294c5627cf9","height":637680,"time":1632670696,"medianTime":1632670214}},{"id":"DFI-USD-633840","key":"DFI-USD","sort":"0009abf0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"49808fb49f9c3e6ce20225abf9f289633ef189f5c99347adc21921db5e7b43d2","height":633840,"time":1632555647,"medianTime":1632555433}},{"id":"DFI-USD-630000","key":"DFI-USD","sort":"00099cf0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"eb86e2e8fcdfbcbf8ba1aa102e7aaade3544adc72e884d916fbc353155389fac","height":630000,"time":1632438857,"medianTime":1632438464}},{"id":"DFI-USD-626160","key":"DFI-USD","sort":"00098df0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"8ef8907b60e7e1193fa7cf6e282a2b968812827a8c421e864dfd0df31a6d850d","height":626160,"time":1632323371,"medianTime":1632323077}},{"id":"DFI-USD-676080","key":"DFI-USD","sort":"000a50f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"271437e4de6bedbc96d5bb511061b064a25c3fcfe25fcad01cd8d5b85d6ecc5f","height":676080,"time":1633841156,"medianTime":1633840721}},{"id":"DFI-USD-672240","key":"DFI-USD","sort":"000a41f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"3235b69e1cc9e6ea2081aada638b3558ad947b12ab2e017dddb61a76b901c8d4","height":672240,"time":1633726141,"medianTime":1633725825}},{"id":"DFI-USD-668400","key":"DFI-USD","sort":"000a32f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"88194681a009e28ff59010df511d6df39555db5cab78b25c3a6bb99a54f16842","height":668400,"time":1633611928,"medianTime":1633611783}},{"id":"DFI-USD-664560","key":"DFI-USD","sort":"000a23f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"3aeaec9b9e56108ead6c52811d500c4460b324f13b33c04ee24d8830009e3b86","height":664560,"time":1633495324,"medianTime":1633495198}},{"id":"DFI-USD-660720","key":"DFI-USD","sort":"000a14f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"57e5bca0eb7c3b68e5e8714183c88c36e97185af4ee71dc0def34274c4951f87","height":660720,"time":1633376981,"medianTime":1633376840}},{"id":"DFI-USD-656880","key":"DFI-USD","sort":"000a05f0","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"0afaef6d2fe80e0daaa22ae7106fc09743614a3bb60d2c35562660d6b04cfde6","height":656880,"time":1633263364,"medianTime":1633262731}},{"id":"DFI-USD-655080","key":"DFI-USD","sort":"0009fee8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"8ac19bf56000d3b6d467ade79ebbeb73d0e100f69902a755994e49f35b0dff59","height":655080,"time":1633213533,"medianTime":1633213486}},{"id":"DFI-USD-651240","key":"DFI-USD","sort":"0009efe8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"2c36cef617ddf2678ba55d6cd86ffaeb8003f6a0f571d5e7602259a09f593d0c","height":651240,"time":1633099561,"medianTime":1633099505}},{"id":"DFI-USD-647400","key":"DFI-USD","sort":"0009e0e8","active":{"amount":"21176.67000000","weightage":20.0,"oracles":{"active":2,"total":2}},"next":null,"isLive":false,"block":{"hash":"a23dfb48c7989bc4bca7bab94edc72ec3de2277cb053e3888916d51c0c204c4b","height":647400,"time":1632983352,"medianTime":1632983341}}],"page":{"next":"0009e0e8"}}

@canonbrother canonbrother mentioned this pull request Nov 19, 2024
7 tasks
@canonbrother canonbrother self-assigned this Nov 19, 2024
@canonbrother canonbrother force-pushed the canonbrother/ocean-fix-active-price branch from 7d79dd1 to e0f557a Compare November 21, 2024 15:39
@canonbrother canonbrother force-pushed the canonbrother/ocean-fix-active-price branch 2 times, most recently from b34fed5 to a759734 Compare November 22, 2024 03:35
@canonbrother canonbrother requested a review from Jouzo November 22, 2024 07:28
@canonbrother canonbrother force-pushed the canonbrother/ocean-fix-active-price branch from 0a4fde9 to 1b58ee9 Compare November 25, 2024 07:54
@canonbrother canonbrother force-pushed the canonbrother/ocean-fix-active-price branch from dc495bf to 08c7f7d Compare November 26, 2024 04:29
@canonbrother canonbrother marked this pull request as ready for review November 26, 2024 05:27
@Jouzo Jouzo merged commit 997a654 into master Nov 26, 2024
16 of 28 checks passed
@Jouzo Jouzo deleted the canonbrother/ocean-fix-active-price branch November 26, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants