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

feat: implement ciphertext cache preload upon restart #187

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

david-zk
Copy link
Collaborator

This implements routine that upon blockchain restart inspects the in state blockchain queue of ciphertexts to be computed in the future block and synchronously computes the entire queue before processing blocks.

This is done because in initialization stage we have chance of doing the most efficient possible batch computation where executor would figure out all the dependencies possibly using previous block inputs in future blocks in one request.

@antoniupop @dartdart26 @goshawk-3

@david-zk david-zk force-pushed the davidk/ciphertext-preload branch from 5305268 to 4f29096 Compare December 13, 2024 07:30
@david-zk david-zk changed the title Implement ciphertext cache preload upon restart feat: implement ciphertext cache preload upon restart Dec 13, 2024
case FheNeg, FheNot:
return true
case FheAdd, FheBitAnd, FheBitOr, FheBitXor, FheDiv, FheEq, FheGe, FheGt, FheLe, FheLt, FheMax, FheMin, FheMul, FheNe, FheRem, FheRotl, FheRotr, FheShl, FheShr, FheSub, FheCast, FheRand, FheRandBounded, FheIfThenElse, TrivialEncrypt:
return false
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for nitpicking - but might even drop the false branch and leave it to default :)

If we don't have ternary ops we might otherwise just implement binary as !unary, but that's not essential.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I wish it was more like rust, where we would have to list all the cases or its a compile time error, we might forget an operand 🤔

@david-zk david-zk merged commit 6be5c69 into main Dec 13, 2024
2 of 3 checks passed
@david-zk david-zk deleted the davidk/ciphertext-preload branch December 13, 2024 10:54
@dartdart26
Copy link
Collaborator

in the future block and synchronously computes the entire queue before processing blocks.

I guess when a node is catching up after being down for some time, it would be receiving blocks continuously, without having a block time between them. If we run computations as per normal, that would mess up the schedule as we'd be assuming block times and when the commit block comes in, it would actually be earlier than as if the node was executing normally.

Wondering what the right approach is here, because if we execute the whole queue, we'd add more delay and we'd have to catch up more blocks instead of being "in sync" with consensus. Or maybe it doesn't matter and we just need to ensure that when catching up, we take into account block time is not there... It's an issue that I don't think we've thought about. Wdyt?

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