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

Make metrics bad token detector configurable #3176

Merged
merged 42 commits into from
Dec 23, 2024

Conversation

squadgazzz
Copy link
Contributor

@squadgazzz squadgazzz commented Dec 20, 2024

This is a follow-up to #3172, which makes the metrics bad token detector configurable. Uses the same default values. simulation_bad_token_max_age remains global config, while everything else bad-token related is now configured per solver since conditions may change from solver to solver.

@squadgazzz squadgazzz requested a review from a team as a code owner December 20, 2024 10:21
crates/driver/src/domain/competition/bad_tokens/metrics.rs Outdated Show resolved Hide resolved
Comment on lines 66 to 70
let metrics_bad_token_detector = bad_tokens::metrics::Detector::new(
self.bad_token_detection.metrics_bad_token_failure_ratio,
self.bad_token_detection
.metrics_bad_token_required_measurements,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Different solver instances must not share the same metrics based detector all of them need to have their own.
The reason they should share the simulation detector is that it's predictable. All solvers running the simulation detector should come to the same conclusions about all tested tokens.
The metrics based approach is unique to each solver. Some solvers do support trading fee on transfer tokens. For those solvers the failure measurements for fee-on-transfer tokens will be significantly less than on solvers that don't support them correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, makes sense, thanks. Fixed this.

crates/driver/src/infra/config/file/mod.rs Outdated Show resolved Hide resolved

impl Default for BadTokenDetectionConfig {
fn default() -> Self {
serde_json::from_str("{}").expect("BadTokenDetectionConfig uses default values")
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting idea to avoid duplicating default definitions.

@squadgazzz squadgazzz marked this pull request as draft December 20, 2024 14:41
# Conflicts:
#	crates/driver/src/domain/competition/bad_tokens/cache.rs
#	crates/driver/src/domain/competition/bad_tokens/metrics.rs
#	crates/driver/src/domain/competition/bad_tokens/mod.rs
#	crates/driver/src/domain/competition/bad_tokens/simulation.rs
#	crates/driver/src/domain/competition/mod.rs
#	crates/driver/src/infra/api/mod.rs
#	crates/driver/src/infra/config/file/load.rs
#	crates/driver/src/infra/config/file/mod.rs
#	crates/driver/src/infra/solver/mod.rs
@squadgazzz squadgazzz force-pushed the configurable-metrics-bad-token branch from c639068 to 5cbccd4 Compare December 20, 2024 18:22
@squadgazzz squadgazzz marked this pull request as ready for review December 20, 2024 18:31
Base automatically changed from bad-token/metrics to main December 23, 2024 12:26
# Conflicts:
#	crates/driver/src/domain/competition/bad_tokens/metrics.rs
#	crates/driver/src/infra/api/mod.rs
#	crates/driver/src/infra/config/file/load.rs
#	crates/driver/src/infra/config/file/mod.rs
#	crates/driver/src/infra/solver/mod.rs
@squadgazzz squadgazzz merged commit d331509 into main Dec 23, 2024
11 checks passed
@squadgazzz squadgazzz deleted the configurable-metrics-bad-token branch December 23, 2024 12:46
@github-actions github-actions bot locked and limited conversation to collaborators Dec 23, 2024
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.

4 participants