-
Notifications
You must be signed in to change notification settings - Fork 0
feat(v2): example generic task processor #10
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
feat(v2): example generic task processor #10
Conversation
let contract_task = ContractTask { | ||
numberToBeSquared: task.input, | ||
taskCreatedBlock: task.task_created_block, | ||
quorumNumbers: task.quorum_numbers, | ||
quorumThresholdPercentage: task.quorum_threshold_percentage, | ||
}; | ||
|
||
let contract_response = ContractTaskResponse { | ||
numberSquared: response.response, | ||
referenceTaskIndex: response.task_index, | ||
}; | ||
|
||
let apk_g2 = G2Point { | ||
X: non_signer_stakes_and_signature.apkG2.X, | ||
Y: non_signer_stakes_and_signature.apkG2.Y, | ||
}; | ||
|
||
let sigma = G1Point { | ||
X: non_signer_stakes_and_signature.sigma.X, | ||
Y: non_signer_stakes_and_signature.sigma.Y, | ||
}; | ||
|
||
let quorum_apks = non_signer_stakes_and_signature | ||
.quorumApks | ||
.iter() | ||
.map(|apk| G1Point { X: apk.X, Y: apk.Y }) | ||
.collect(); | ||
|
||
let non_signer_pubkeys = non_signer_stakes_and_signature | ||
.nonSignerPubkeys | ||
.iter() | ||
.map(|pubkey| G1Point { | ||
X: pubkey.X, | ||
Y: pubkey.Y, | ||
}) | ||
.collect(); | ||
|
||
let non_signer_stakes_and_signature = ContractNonSignerStakesAndSignature { | ||
nonSignerStakeIndices: non_signer_stakes_and_signature.nonSignerStakeIndices, | ||
nonSignerQuorumBitmapIndices: non_signer_stakes_and_signature | ||
.nonSignerQuorumBitmapIndices, | ||
quorumApkIndices: non_signer_stakes_and_signature.quorumApkIndices, | ||
totalStakeIndices: non_signer_stakes_and_signature.totalStakeIndices, | ||
apkG2: apk_g2, | ||
quorumApks: quorum_apks, | ||
nonSignerPubkeys: non_signer_pubkeys, | ||
sigma, | ||
}; | ||
|
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.
We have to find a way to avoid this
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.
Due to the simplicity, we could expose this functionality as a declarative macro.
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.
Maybe we could reuse the incredible squaring task manager binding reducing the amount of lines of code.
f29d375
into
feat/generic-task-processor
### What Changed? Rewrite aggregator logic. - Added a generic `TaskProcessor` trait to encapsulate custom task handling logic. - Added a contract wrapper interface `TaskManagerContract` to simplify integration with the user’s binding. - Made both `Task` and `TaskResponse` generic - Provided an `IndexingTaskProcessor` struct that implements `TaskProcessor` out of the box. Note: This PR currently breaks the example, it no longer compiles due to changes in the aggregator logic. We should merge the [example PR](lambdaclass#10) here. ### Reviewer Checklist - [ ] New features are tested and documented - [ ] PR updates the changelog with a description of changes - [ ] PR has one of the `changelog-X` labels (if applies) - [ ] Code deprecates any old functionality before removing it --------- Co-authored-by: Pablo Deymonnaz <deymonnaz@gmail.com> Co-authored-by: Pablo Deymonnaz <pdeymon@fi.uba.ar>
Example of the aggreagtor using the new task processor