Skip to content

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

Merged

Conversation

damiramirez
Copy link

@damiramirez damiramirez commented Apr 29, 2025

Example of the aggreagtor using the new task processor

Comment on lines +43 to +91
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,
};

Copy link
Author

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

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.

Copy link

@maximopalopoli maximopalopoli left a 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.

@damiramirez damiramirez merged commit f29d375 into feat/generic-task-processor Apr 30, 2025
8 of 11 checks passed
@damiramirez damiramirez deleted the feat/example-generic-task-processor branch April 30, 2025 15:29
pablodeymo added a commit to Layr-Labs/eigensdk-rs that referenced this pull request Apr 30, 2025
### 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants