-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Embedded mainnet genesis state + load genesis.ssz from file #8614
Conversation
…t do not support mainnet genesis values
beacon-chain/db/iface/interface.go
Outdated
@@ -99,6 +99,11 @@ type HeadAccessDatabase interface { | |||
// Block related methods. | |||
HeadBlock(ctx context.Context) (*eth.SignedBeaconBlock, error) | |||
SaveHeadBlockRoot(ctx context.Context, blockRoot [32]byte) error | |||
|
|||
// Genesis operations. | |||
LoadGenesisFromFile(ctx context.Context, filePath string) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use io.Reader here or ReadCloser, makes it more extensible. Imagine in the future someone wants to read the genesis state from some other source that isn't a file
Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
beacon-chain/db/kv/genesis.go
Outdated
return errors.Wrap(err, "could not save genesis block root") | ||
} | ||
|
||
genesisCheckpoint := ð.Checkpoint{Root: genesisBlkRoot[:]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be careful here. There's two types of genesis checkpoint:
ð.Checkpoint{Root: genesisBlkRoot[:]}
ð.Checkpoint{Root: params.BeaconConfig().ZeroHash}
I forgot which is used for peering (i think 2?)
cc @nisdas for feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was meant to be genesisState.FinalizedCheckpoint()
prysm/beacon-chain/blockchain/service.go
Line 373 in beadec3
genesisCheckpoint := genesisState.FinalizedCheckpoint() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a disparity between interop and blockchain production routine. I will use the production path instead of the interop path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, looks like i can remove all of this checkpoint stuff. It wasn't used in production, only in interop for some reason
traceutil.AnnotateError(span, err) | ||
return nil, err | ||
} | ||
span.AddAttributes(trace.BoolAttribute("cache_hit", cached != nil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of span attribute!
Co-authored-by: terence tsao <terence@prysmaticlabs.com>
What type of PR is this?
Feature
What does this PR do? Why is it needed?
This feature allows users to skip generating the genesis state for mainnet, which often takes several hours of reading eth1 deposit data.
Which issues(s) does this PR fix?
Fixes #8209
Other notes for review
Summary of key changes:
--genesis-state=/path/to/genesis.ssz
flag to load a file from genesis. This functionality has some UX features such as checking the genesis state matches the beacon config and acting as a no-op when the user has initialized the genesis state already with the same state.Note: github review UI says that ssz files are empty, they are not empty.