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

Add block range, bonding pool and vouch queries #19

Merged
merged 13 commits into from
Sep 12, 2024

Conversation

harisang
Copy link
Contributor

@harisang harisang commented Sep 9, 2024

This PR migrates queries 3333356 and 1541516 to the repo. There are also some changes proposed for 1541516, that get rid of the parameter that passes the list of full bonding pools, and proposes instead to use a new query 4056263 to hardcode the full bonding pools.

@harisang harisang requested a review from fhenneke September 9, 2024 16:15
@harisang
Copy link
Contributor Author

harisang commented Sep 9, 2024

Tested them and they seem to work.

Copy link
Contributor

@fhenneke fhenneke left a comment

Choose a reason for hiding this comment

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

We could merge this after adding more documentation.

I have not checked the logic of the vouching query.

How would I test that those queries work as intended?

Comment on lines 3 to 6
last_block_before_timestamp as (
select max(number) from ethereum.blocks
where time < cast('{{end_time}}' as timestamp)
),
Copy link
Contributor

Choose a reason for hiding this comment

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

This could in principle call out to query 3333356. Then it would be easier to make sure that the convention on which boundary points are included is consistent across queries.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah thought about it. There is a start_time in query query 3333356, but i guess i could hardcode some very old one to work around it.

@harisang
Copy link
Contributor Author

We could merge this after adding more documentation.

I have not checked the logic of the vouching query.

How would I test that those queries work as intended?

Good question. Ok so 2 of the 3 queries are very straightforward and easy to test. The vouching query is essentially the one we currently use, but i believe it actually might not be 100% correct, as it might not take into account cases where a solver left a bonding pool and then rejoined during the accounting period we are interested in.

I will open an issue for this one, as i don't have the capacity to fix this at the moment.

@harisang
Copy link
Contributor Author

Opened issue #21 in order to revisit the logic of the vouching query.

@harisang
Copy link
Contributor Author

@fhenneke I did some review of the query and it makes sense. I am not very comfortable with the rank() over commands used in 58-61 and 71-74 but overall it looks ok.

Let me know if you want to do another pass

Copy link
Contributor

Choose a reason for hiding this comment

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

We can add this as is to stay compatible with its current function.

An alternative, which I prefer, is to simplify it to just get the latest pool and reward address, irrespective of any invalidations later on. Solvers changing bonding pools or getting unvouched before running the script have been a pain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to clarify, are you saying we should simply fetch the latest vouching event of every solver, and then don't worry about the rest, as in case the solver is later unvouched, we will have in any case blacklisted as well and then that solver would have no effect in the competition?

Copy link
Contributor

Choose a reason for hiding this comment

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

As far as uses in solver rewards, I think we should only care about latest reward addresses (and bonding pools). If a solver gets blacklisted and removed, solver rewards should still be rewarded as if they had not been removed. Blacklisting should take care of barring solvers from gaining additional rewards if they are not eligible.

Other places might use that query differently. But for our main use case, this simplification should be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah makes sense, will proceed with the simplification

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, i think i changed my mind on this again. This query also shows in the main dashboard, and i think it is nice to be able to see all "active" solvers, with their names etc. So if you don't mind, i would keep it as is and would actually even revert to the previous state where there are two views of the results, so that we can use the other view in the main dashboard.

@harisang harisang merged commit cceeac1 into main Sep 12, 2024
1 check passed
@harisang harisang deleted the add_time_interval_query_and_vouching_query branch September 12, 2024 13:22
harisang added a commit that referenced this pull request Sep 12, 2024
* add block range, bonding pool and vouch queries

* small fix

* bug fixing

* add description to block range query

* add description to full bonding pools query

* Add descritpion to vouch registry query

* small updates

* Update cowprotocol/accounting/rewards/mainnet/.sqlfluff

Co-authored-by: Felix Henneke <[email protected]>

* add hardcoded timestamps

* add back alternative view

* fix typo

* bug fixes

* minor edits

---------

Co-authored-by: Felix Henneke <[email protected]>
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.

3 participants