-
Notifications
You must be signed in to change notification settings - Fork 250
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
Lazy crypto [alt design #1369] #1371
Conversation
As a first impression, it's mechanically messier but isolates it better, while being conceptually cleaner. Avoiding a constantly, even if slowly, growing memory usage source and point of indirection does have value. I'd be concerned somewhat about the extent to which it's dependent on specifics of old case objects, which I'm fine with in general but also upon which it seems worth considering increasing dependence. Not a major risk, as we have an existence proof of at least one other way to achieve similar ends. Furthermore, as I recall, there might be other reasons we already depend on Also, precisely because it does fool the compiler with Finally, it's not clear to me how/if it avoids the deposits issue where searching for a pubkey in That said, I do, overall, prefer this design abstractly, as an interface for non |
This is a reboot of #457 which was abandoned because of noSideEffect limitations in Nim 0.20 and the old nim-blscurve (status-im/nim-blscurve#27).
This is an alternative to #1369 (comment).
Unfortunately there is no free lunch and this has tradeoffs somewhat similar to copy-on-write schemes:
Also with regards to serialization and compared to #1369 it's stateless. This is the main difference between both PR:
Stateful requires yet another table, increasing memory usage and complicating threading in the future. It also requires more hashing, indirection and copy to manipulate both cached and non-cached BLS objects.
Stateless (this PR) tricks the compiler with pointers but uses significantly less memory and has no indirection.
It will have to deserialize objects that are received multiple times in different contexts (for example a public key from the network which may be received multiple times).
I.e. in terms of perf, the main difference is deserializing a public key vs looking it up in a table.
The full impact depends on how often we receive the same object in an unrelated context
Both should solve the loading latency from BeaconChainDB.