Make BeaconChain::kzg field mandatory#6267
Conversation
BeaconChain kzg field requiredBeaconChain::kzg field mandatory
|
This PR adds a new trusted setup, is that expected? |
|
removed the extraneous trusted setup. It looks like loading KZG has added like 5 min to a few CI test groups. I'm going to dig in there and make sure were not doing any KZG precomputation when possible. Kevs recent PR makes this easy to do |
|
There no longer seems to be any noticeable difference in CI times between this branch and unstable |
| pub struct Kzg { | ||
| trusted_setup: KzgSettings, | ||
| context: Option<DASContext>, | ||
| context: DASContext, |
There was a problem hiding this comment.
I guess we could keep this DASContext optional for the pre-peerDAS case, but then again if there's no perf impact maybe it's OK to keep it initialized
There was a problem hiding this comment.
there was no noticeable performance impact that I noticed (test-wise at least)
There was a problem hiding this comment.
This was changed to optional because it adds 550ms to startup time and 110 mb extra memory usage for an unused feature on mainnet:
#6212 (comment)
It may also impact our CI time as I imagine Kzg is loaded many times.
A profile run on our basic-sim test show that 88% of CPU time is spent on loading DASContext during startup

I think we should make this optional until PeerDAS is scheduled.
|
@mergify queue |
✅ The pull request has been merged automaticallyDetailsThe pull request has been merged automatically at b619f1a |
| } else { | ||
| KZG_NO_PRECOMP.clone() | ||
| } |
There was a problem hiding this comment.
The KZG precomputation is only used for PeerDAS.
I think we can remove this branch and default to KZG if PeerDAS is not enabled?
| } else if spec.deneb_fork_epoch.is_some() { | ||
| Kzg::new_from_trusted_setup(trusted_setup).map_err(kzg_err_msg)? | ||
| } else { | ||
| Kzg::new_from_trusted_setup_no_precomp(trusted_setup).map_err(kzg_err_msg)? |
There was a problem hiding this comment.
I think we can get rid of this new_from_trusted_setup_no_precomp branch too?
|
|
||
| /// Load the kzg trusted setup parameters from a vec of G1 and G2 points. | ||
| pub fn new_from_trusted_setup(trusted_setup: TrustedSetup) -> Result<Self, Error> { | ||
| let peerdas_trusted_setup = PeerDASTrustedSetup::from(&trusted_setup); |
There was a problem hiding this comment.
This function is now identical to new_from_trusted_setup_das_enabled.
I think maybe what we want is
- if PeerDAS scheduled, load it with DASContext
- Else load with no DASContext OR no precomputation (although I prefer the former as initilisation of
PeerDASTrustedSetupstill require cloning trusted setup bytes.
* make kzg field required * update todo * always load trusted setup WIP * fmt * use new rust_eth_kzg version * merge conlficts * add kzg fn with trusted setup disabled * as_slice * add kzg with no precomp * ignore udep for kzg * refactor kzg init * fix peerdas kzg schedule * fix * udeps * uuuudeps * merge conflict resolved * merge conflict * merge conflicts * resolve TODO * update * move kzg to a test util fn * remove trusted setup default impl * lint fmt * fix failing test * lint * fix test * Merge branch 'unstable' into beacon-chain-kzg-field-required
Issue Addressed
Closes #6260
Proposed Changes
Make the kzg field in
BeaconChainandBeaconChainBuildermandatory