chainflip-io / chainflip-backend

The Chainflip backend repo, including the Chainflip Node and CFE.
48 stars 15 forks source link

feat: bouncer can observe past events #5136

Closed j4m1ef0rd closed 4 weeks ago

j4m1ef0rd commented 1 month ago

Pull Request

Closes: PRO-1550

Checklist

Please conduct a thorough self-review before opening the PR.

Summary

@acdibble or someone from product, can you please check substrate.ts. @albert-llimos can you please check I didn't screw up your GasLimitCCM test.

Out of scope: Caching the historic events. Each observeEvents call will retrieve the events for each block from the api each time. Could be a problem if running the test on a real network or if we start to use this a lot in tests. Supporting reorgs on the event cache. Seems we are only using it on the StateChain for now. who cares about scopes anyways.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 71%. Comparing base (a49451d) to head (1855518). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #5136 +/- ## ====================================== - Coverage 71% 71% -0% ====================================== Files 458 458 Lines 82125 81981 -144 Branches 82125 81981 -144 ====================================== - Hits 58138 57939 -199 - Misses 20917 20970 +53 - Partials 3070 3072 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

martin-chainflip commented 1 month ago

cool feature!

albert-llimos commented 1 month ago

Very happy to get rid of the gas limit test's spaghetti code to handle that edge case, good stuff!

acdibble commented 1 month ago

We could probably set up an indexer docker container and then you could run SQL queries against the blocks instead

msgmaxim commented 1 month ago

We could probably set up an indexer docker container and then you could run SQL queries against the blocks instead

I like the idea, but what will happen when the protocol makes changes to the evens (or adds new ones?). Presumably we won't be able to run bouncer tests until the indexer is updated too? I'm not 100% sure how this works, but I think currently it is maintained by the product team? Of course one solution would be to make it the protocol's team responsibility to update it 🤷. Not sure, but maybe something to consider.