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

Ban solvers based on the settlements success rate #3263

Merged
merged 120 commits into from
Feb 26, 2025

Conversation

squadgazzz
Copy link
Contributor

@squadgazzz squadgazzz commented Jan 31, 2025

Description

Another follow-up to #3257, which implements a suggested statistic-based approach #3257 (comment).

Changes

Introduces an additional DB-based validator, which searches for solvers with less than 10%(configurable) of successful settlements among 100 last auctions(configurable).

  • Updated config.
  • New notification details.
  • Some refactoring.

How to test

A new SQL query test.

Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

Looks okay. I'm mostly curious if the no-settlement mode could be merged into the low-settlement mode.

Comment on lines +279 to +280
pub struct NonSettlingSolversFinderConfig {
/// Enables search of non-settling solvers.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need the non-settling version if the low-settling version could be configured to cover that as well? (e.g. ban if 0% of all solutions went through)

Copy link
Contributor Author

@squadgazzz squadgazzz Feb 24, 2025

Choose a reason for hiding this comment

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

The low-settling version cannot quickly ban the solver if it has 3 consecutive failed settlements since the logic is focused more on a zoomed-out picture. For example, if a solver had 90% of successful settlements and suddenly shut down, the low-settling metric would require much more time to ban this solver, whereas the non-settling guard would do that right after the 3 consecutive failures.

)
SELECT solver
FROM solver_settlement_counts
WHERE (1 - (total_settlements::decimal / NULLIF(total_wins, 0))) > $3;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does the NULLIF here cause the WHERE clause to not match if the solver didn't win any auction at all in the time frame?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no way to have a settlement without winning it, right?

# Conflicts:
#	crates/autopilot/src/infra/persistence/mod.rs
# Conflicts:
#	crates/autopilot/src/infra/solvers/mod.rs
#	crates/driver/src/infra/api/routes/mod.rs
# Conflicts:
#	crates/autopilot/src/domain/competition/participation_guard/db.rs
#	crates/autopilot/src/infra/mod.rs
# Conflicts:
#	crates/autopilot/src/domain/competition/participation_guard/db.rs
#	crates/autopilot/src/domain/competition/participation_guard/mod.rs
#	crates/autopilot/src/domain/competition/participation_guard/onchain.rs
Base automatically changed from notify-banned-solvers to main February 26, 2025 11:47
# Conflicts:
#	crates/autopilot/src/domain/competition/participation_guard/db.rs
#	crates/autopilot/src/infra/mod.rs
#	crates/autopilot/src/infra/solvers/dto/notify.rs
#	crates/autopilot/src/infra/solvers/mod.rs
#	crates/driver/src/infra/api/routes/notify/dto/notify_request.rs
#	crates/driver/src/infra/notify/notification.rs
#	crates/driver/src/infra/solver/dto/notification.rs
#	crates/solvers-dto/src/notification.rs
@squadgazzz squadgazzz merged commit 04d502b into main Feb 26, 2025
11 checks passed
@squadgazzz squadgazzz deleted the db-statistics-based-guard branch February 26, 2025 12:00
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants