mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
Use head state for exit verification (#4183)
## Issue Addressed NA ## Proposed Changes Similar to #4181 but without the version bump and a more nuanced fix. Patches the high CPU usage seen after the Capella fork which was caused by processing exits when there are skip slots. ## Additional Info ~~This is an imperfect solution that will cause us to drop some exits at the fork boundary. This is tracked at #4184.~~
This commit is contained in:
@@ -978,8 +978,14 @@ async fn fork_spanning_exit() {
|
||||
let head = harness.chain.canonical_head.cached_head();
|
||||
let head_state = &head.snapshot.beacon_state;
|
||||
assert!(head_state.current_epoch() < spec.altair_fork_epoch.unwrap());
|
||||
verify_exit(head_state, &signed_exit, VerifySignatures::True, &spec)
|
||||
.expect("phase0 exit verifies against phase0 state");
|
||||
verify_exit(
|
||||
head_state,
|
||||
None,
|
||||
&signed_exit,
|
||||
VerifySignatures::True,
|
||||
&spec,
|
||||
)
|
||||
.expect("phase0 exit verifies against phase0 state");
|
||||
|
||||
/*
|
||||
* Ensure the exit verifies after Altair.
|
||||
@@ -992,8 +998,14 @@ async fn fork_spanning_exit() {
|
||||
let head_state = &head.snapshot.beacon_state;
|
||||
assert!(head_state.current_epoch() >= spec.altair_fork_epoch.unwrap());
|
||||
assert!(head_state.current_epoch() < spec.bellatrix_fork_epoch.unwrap());
|
||||
verify_exit(head_state, &signed_exit, VerifySignatures::True, &spec)
|
||||
.expect("phase0 exit verifies against altair state");
|
||||
verify_exit(
|
||||
head_state,
|
||||
None,
|
||||
&signed_exit,
|
||||
VerifySignatures::True,
|
||||
&spec,
|
||||
)
|
||||
.expect("phase0 exit verifies against altair state");
|
||||
|
||||
/*
|
||||
* Ensure the exit no longer verifies after Bellatrix.
|
||||
@@ -1009,6 +1021,12 @@ async fn fork_spanning_exit() {
|
||||
let head = harness.chain.canonical_head.cached_head();
|
||||
let head_state = &head.snapshot.beacon_state;
|
||||
assert!(head_state.current_epoch() >= spec.bellatrix_fork_epoch.unwrap());
|
||||
verify_exit(head_state, &signed_exit, VerifySignatures::True, &spec)
|
||||
.expect_err("phase0 exit does not verify against bellatrix state");
|
||||
verify_exit(
|
||||
head_state,
|
||||
None,
|
||||
&signed_exit,
|
||||
VerifySignatures::True,
|
||||
&spec,
|
||||
)
|
||||
.expect_err("phase0 exit does not verify against bellatrix state");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user