-
Notifications
You must be signed in to change notification settings - Fork 747
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
Make BeaconChain::kzg
field mandatory
#6267
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 |
@@ -51,18 +51,41 @@ impl From<c_kzg::Error> for Error { | |||
#[derive(Debug)] | |||
pub struct Kzg { | |||
trusted_setup: KzgSettings, | |||
context: Option<DASContext>, | |||
context: DASContext, |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there was no noticeable performance impact that I noticed (test-wise at least)
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 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 automaticallyThe pull request has been merged automatically at b619f1a |
} else { | ||
KZG_NO_PRECOMP.clone() | ||
} |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
PeerDASTrustedSetup
still require cloning trusted setup bytes.
Issue Addressed
Closes #6260
Proposed Changes
Make the kzg field in
BeaconChain
andBeaconChainBuilder
mandatory