-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Review bigint usage #5892
Comments
Some tests using BigInt vector vs Number vector Number version export const Slashings = new VectorBasicType(UintNum64, EPOCHS_PER_HISTORICAL_VECTOR); BigInt version (as in unstable up until today), or refer to v1.12 https://github.com/ChainSafe/lodestar/blob/v1.12.0/packages/types/src/phase0/sszTypes.ts#L251 export const Slashings = new VectorBasicType(Gwei, EPOCHS_PER_SLASHINGS_VECTOR); function getProcessSlashingsTestData(indicesToSlashLen: number): {
state: CachedBeaconStateAllForks;
cache: EpochTransitionCache;
} {
const state = generatePerfTestCachedStatePhase0({goBackOneSlot: true});
const cache = beforeProcessEpoch(state);
state.slashings.set(0, indicesToSlashLen * MAX_EFFECTIVE_BALANCE);
for (let i = 1; i < state.slashings.length; i++) {
state.slashings.set(i, MAX_EFFECTIVE_BALANCE);
}
state.commit();
cache.indicesToSlash = linspace(indicesToSlashLen);
return {
state,
cache,
};
}
This is an example showing both memory and performance issue using BigInt |
@tuyennhv thanks! results definitely show a penalty of using bigints. However I find it hard to believe that we have millions of instances of bigints in a Lodestar BeaconNode. Can you try to proof and count what's the upper bound of bigint instances possible? If we use a regular number to represent total slashed balance the max ETH slashed we can represent is 9007199254740991 / 1e9 = 9,007,199 or 281474 validators. If for some reason more than those validators are slashed in a single epoch, Lodestar will suffer a consensus failure. |
@dapplion the main thing of this issue is to prove the memory and performance issue of bigint and I used unrealistic number to do it. Yes I also don't believe we have that many instances of bigins in our beacon node.
we'll discuss this in #6121 but thanks for the idea, will investigate it 👍 |
closing as fixed/stale |
Describe the bug
As noted here using bigint causes more memory (rss + process_heap_bytes) in lodestar
ChainSafe/js-libp2p-gossipsub#327 (comment)
Expected behavior
we should review all of bigint usages in lodestar and do not use it unless it's really necessary
Steps to reproduce
No response
Additional context
No response
Operating system
Linux
Lodestar version or commit hash
unstable
The text was updated successfully, but these errors were encountered: