mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
Tree hash caching and optimisations for Altair (#2459)
## Proposed Changes Remove the remaining Altair `FIXME`s from consensus land. 1. Implement tree hash caching for the participation lists. This required some light type manipulation, including removing the `TreeHash` bound from `CachedTreeHash` which was purely descriptive. 2. Plumb the proposer index through Altair attestation processing, to avoid calculating it for _every_ attestation (potentially 128ms on large networks). This duplicates some work from #2431, but with the aim of getting it in sooner, particularly for the Altair devnets. 3. Removes two FIXMEs related to `superstruct` and cloning, which are unlikely to be particularly detrimental and will be tracked here instead: https://github.com/sigp/superstruct/issues/5
This commit is contained in:
@@ -67,13 +67,19 @@ impl<E: EthSpec> Operation<E> for Attestation<E> {
|
||||
state: &mut BeaconState<E>,
|
||||
spec: &ChainSpec,
|
||||
) -> Result<(), BlockProcessingError> {
|
||||
let proposer_index = state.get_beacon_proposer_index(state.slot(), spec)? as u64;
|
||||
match state {
|
||||
BeaconState::Base(_) => {
|
||||
base::process_attestations(state, &[self.clone()], VerifySignatures::True, spec)
|
||||
}
|
||||
BeaconState::Altair(_) => {
|
||||
altair::process_attestation(state, self, 0, VerifySignatures::True, spec)
|
||||
}
|
||||
BeaconState::Altair(_) => altair::process_attestation(
|
||||
state,
|
||||
self,
|
||||
0,
|
||||
proposer_index,
|
||||
VerifySignatures::True,
|
||||
spec,
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user