-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: break fraudAssessment into evaluations #442
Conversation
Break `Measurement.fraudAssessment` into two new fields: - `taskingEvaluation` for the tasking-related checks Example: DUP_INET_GROUP - `majorityEvaluation` for the result of the majority seeking process based on committees. Example: MINORITY_RESULT After this change, places filtering "accepted" measurements have to explicitly spell out how they define "accepted". - Some places are interested in tasking evaluation results only and consider minority results as "accepted" too. Example: RSR calculated from individual measurements. - Other places are stricter and want only measurements in majority. Example: which measurements to reward. Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧵 TODO items blocking the conversion from "draft" to "ready" 👇🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More TODOs 👇🏻
lib/retrieval-stats.js
Outdated
@@ -81,8 +81,9 @@ export const buildRetrievalStats = (measurements, telemetryPoint) => { | |||
const endAt = m.end_at | |||
const ttfb = startAt && firstByteAt && (firstByteAt - startAt) | |||
const duration = startAt && endAt && (endAt - startAt) | |||
const isAccepted = m.taskingEvaluation === 'OK' && m.majorityEvaluation === 'OK' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: check if we need to add a test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in c08c10a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To double check: We will now be calling measurements that will be rewarded "accepted measurements", right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is a good call! 🤔
I want to call measurements that will be rewarded "measurementsToReward"; that's what I use inside the main evaluation loop.
Everywhere else, we need to decide whether we are interested in measurements that passed tasking evaluation but may be in the minority, or whether we are interested in measurements that will be rewarded (passed the tasking evalution and are in majority).
In that light, maybe it would be better to avoid using the term "accepted measurements" altogether. Or qualify it as "measurements accepted by tasking"?
I don't have a good answer 😞
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Co-authored-by: Julian Gruber <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
lib/retrieval-stats.js
Outdated
@@ -81,8 +81,9 @@ export const buildRetrievalStats = (measurements, telemetryPoint) => { | |||
const endAt = m.end_at | |||
const ttfb = startAt && firstByteAt && (firstByteAt - startAt) | |||
const duration = startAt && endAt && (endAt - startAt) | |||
const isAccepted = m.taskingEvaluation === 'OK' && m.majorityEvaluation === 'OK' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To double check: We will now be calling measurements that will be rewarded "accepted measurements", right?
Feel free to land this work next week during my vacation, without further review by me |
Co-authored-by: Julian Gruber <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'll approve once Julians changes have been addressed.
…nDetails Signed-off-by: Miroslav Bajtoš <[email protected]>
@juliangruber @NikolasHaimerl the pull request is ready for the final review 👀 |
Signed-off-by: Miroslav Bajtoš <[email protected]>
Signed-off-by: Miroslav Bajtoš <[email protected]>
…und, retrievalMajorityFound Signed-off-by: Miroslav Bajtoš <[email protected]>
@NikolasHaimerl would you like to review the final version or can I go ahead and land the PR? |
@@ -241,6 +241,43 @@ describe('evaluate', async function () { | |||
assertPointFieldValue(point, 'total_nodes', '3i') | |||
}) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nitpick -- should rename this file from evaluate.js
to evaluate.test.js
to make things consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we have a bit of inconsistency in file naming. I am fine to rename it. Let's keep such changes out of the scope of this pull request, please.
@@ -22,8 +22,10 @@ export class Measurement { | |||
// Note: providerId is recorded by spark-publish but we don't use it for evaluations yet | |||
this.providerId = pointerize(m.provider_id) | |||
this.spark_version = pointerize(m.spark_version) | |||
/** @type {import('./typings.js').FraudAssesment} */ | |||
this.fraudAssessment = null | |||
/** @type {import('./typings.js').TaskingEvaluation} */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since initial value is set to null
by default we might should set property type to be optional, maybe something like:
/** @type {import('./typings.js').TaskingEvaluation?} */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed 👍
This pull request is not making this any worse, so let's leave such improvement out of the scope, please.
Break
Measurement.fraudAssessment
into two new fields:taskingEvaluation
for the tasking-related checksExample: DUP_INET_GROUP
consensusEvaluation
for the result of the majority seeking process based on committees.Example: MINORITY_RESULT
After this change, places filtering "accepted" measurements have to explicitly spell out how they define "accepted".
Some places are interested in tasking evaluation results only and consider minority results as "accepted" too. Example: RSR calculated from individual measurements.
Other places are stricter and want only measurements in majority. Example: which measurements to reward.
However, this pull request is intended to be pure refactoring with no change in the functionality. It should simply expand the check
fraudAssessment === 'OK'
intotaskingEvaluation === 'OK' && consensusEvaluation === 'MAJORITY_RESULT'
and surface the places where we may want to include minority measurements too. Such changes can be implement in follow-up pull requests.This is a follow-up for #396 (comment)
See also #439