ChainSafe / ChainSafe/ssz

Add ByteVectorShared - optimize validator object memory

Open
#226 0 comments 0 reactions 0 assignees View on GitHub
meta-investigate prio-low scope-memory
Dominant language
TypeScript
Stars
61
Forks
26
Avg merge
3h 20m
Merged PRs (30d)
6

Description

NodeJS represents Uint8Arrays inefficiently when they have small sizes. The validators object have pubkey and withdrawal_credentials that can be thought as an append-only list which take ~140MB in a single state.

An optimization to reduce their memory cost is to keep them in bigger Uint8Arrays that are shared for multiple pubkeys. This is possible as quickly tested in https://github.com/ChainSafe/ssz/tree/dapplion/byteVectorImmutable

Since validator objects are already represented as values internally inside a node the validator object could be a custom class instance with getters for pubkey and withdrawal_credentials that slice a Uint8Array of the shared one.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.