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

Cleanup score #2585

Merged
merged 15 commits into from
Apr 5, 2024
Merged

Cleanup score #2585

merged 15 commits into from
Apr 5, 2024

Conversation

sunce86
Copy link
Contributor

@sunce86 sunce86 commented Apr 1, 2024

Description

Fixes #2493
Fixes #1494

Important notes:

  1. Removed risk parameter config from solvers - requires cleanup of "riskParameters" in infrastructure repo - will be done in a separate PR
  2. Solvers api "score" field is optional until solvers update their responses - will be removed completely chore: Remove unused "score" field from solvers API #2588.

Follow ups:

  1. cleanup of "riskParameters" in infrastructure repo
  2. Update gnosis solvers response https://github.com/gnosis/solvers/blob/main/src/api/routes/solve/dto/solution.rs - Clean-up score gnosis/solvers#10
  3. Add more score errors to notify endpoint - chore: Add more notify call for scoring #2597

How to test

Existing tests. No change in behaviour is expected.

@sunce86 sunce86 self-assigned this Apr 1, 2024
@sunce86 sunce86 changed the title [DRAFT] Cleanup score Cleanup score Apr 1, 2024
@sunce86 sunce86 marked this pull request as ready for review April 1, 2024 11:38
@sunce86 sunce86 requested a review from a team as a code owner April 1, 2024 11:38
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.

My understanding is that unfortunately the correct bidding behavior still requires the risk parameters to adjust the computed solution / reported score based on the revert risk (see slack).

@sunce86
Copy link
Contributor Author

sunce86 commented Apr 2, 2024

My understanding is that unfortunately the correct bidding behavior still requires the risk parameters to adjust the computed solution / reported score based on the revert risk (see slack).

Thanks. I reverted everything related to risk parameters. Asked in slack to define how are we supposed to use risk parameters to adjust the reported fee of the solution (This is not strictly related to this PR since this PR refactors the score).

score::Error::RiskAdjusted(score::risk::Error::Boundary(_)) => return,
score::Error::Boundary(_) => return,
score::Error::Scoring(_) => return, // TODO: should we notify?
_ => return,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we keep listing all other variants explicitly? That would help to avoid mistakes in the future if a new variant is added, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I simplified the error enum and listed all of them. Can be additionally cleaned up as part of
#2597

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 forgot to commit 😶‍🌫️ will do it in a follow up PR

Comment on lines +52 to +53
/// No clearing prices are present for all trades.
InvalidClearingPrices,
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 enum? Can we use Kind::ScoringFailed directly without inner value?

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 we don't need it but I guessed it's less work to leave it like this since we will add more variants in #2597

Copy link
Contributor

@squadgazzz squadgazzz left a comment

Choose a reason for hiding this comment

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

Only nits above

@squadgazzz
Copy link
Contributor

Is it still used?

/// Parameters used to calculate the revert risk of a solution.
risk: domain::Risk,

@MartinquaXD
Copy link
Contributor

My understanding is that unfortunately the correct bidding behavior still requires the risk parameters to adjust the computed solution / reported score based on the revert risk

Since the consensus on slack seems to be that the risk parameters can be replaced by offsetting the settlement gas cost it can be removed as well after all. Sorry for the back and forth. 😅

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.

Actually the risk parameters can also be removed in a separate PR. Might be nicer for reviewing purposes and in case one of these has to be reverted.

@sunce86 sunce86 merged commit 0adc355 into main Apr 5, 2024
9 checks passed
@sunce86 sunce86 deleted the refactor-score branch April 5, 2024 07:51
@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 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.

chore: Cleanup driver score function Don't rely on legacy code for solution scoring in driver
3 participants