mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-16 20:39:10 +00:00
Add Proposer Cache Pruning & POS Activated Banner (#3109)
## Issue Addressed The proposers cache wasn't being pruned. Also didn't have a celebratory banner for the merge 😄 ## Banner 
This commit is contained in:
@@ -59,7 +59,7 @@ use fork_choice::{ForkChoice, ForkChoiceStore, PayloadVerificationStatus};
|
||||
use parking_lot::RwLockReadGuard;
|
||||
use proto_array::Block as ProtoBlock;
|
||||
use safe_arith::ArithError;
|
||||
use slog::{debug, error, Logger};
|
||||
use slog::{debug, error, info, Logger};
|
||||
use slot_clock::SlotClock;
|
||||
use ssz::Encode;
|
||||
use state_processing::per_block_processing::is_merge_transition_block;
|
||||
@@ -81,6 +81,30 @@ use types::{
|
||||
SignedBeaconBlock, SignedBeaconBlockHeader, Slot,
|
||||
};
|
||||
|
||||
const POS_PANDA_BANNER: &str = r#"
|
||||
,,, ,,, ,,, ,,,
|
||||
;" ^; ;' ", ;" ^; ;' ",
|
||||
; s$$$$$$$s ; ; s$$$$$$$s ;
|
||||
, ss$$$$$$$$$$s ,' ooooooooo. .oooooo. .oooooo..o , ss$$$$$$$$$$s ,'
|
||||
;s$$$$$$$$$$$$$$$ `888 `Y88. d8P' `Y8b d8P' `Y8 ;s$$$$$$$$$$$$$$$
|
||||
$$$$$$$$$$$$$$$$$$ 888 .d88'888 888Y88bo. $$$$$$$$$$$$$$$$$$
|
||||
$$$$P""Y$$$Y""W$$$$$ 888ooo88P' 888 888 `"Y8888o. $$$$P""Y$$$Y""W$$$$$
|
||||
$$$$ p"$$$"q $$$$$ 888 888 888 `"Y88b $$$$ p"$$$"q $$$$$
|
||||
$$$$ .$$$$$. $$$$ 888 `88b d88'oo .d8P $$$$ .$$$$$. $$$$
|
||||
$$DcaU$$$$$$$$$$ o888o `Y8bood8P' 8""88888P' $$DcaU$$$$$$$$$$
|
||||
"Y$$$"*"$$$Y" "Y$$$"*"$$$Y"
|
||||
"$b.$$" "$b.$$"
|
||||
|
||||
.o. . o8o . .o8
|
||||
.888. .o8 `"' .o8 "888
|
||||
.8"888. .ooooo. .o888oooooo oooo ooo .oooo. .o888oo .ooooo. .oooo888
|
||||
.8' `888. d88' `"Y8 888 `888 `88. .8' `P )88b 888 d88' `88bd88' `888
|
||||
.88ooo8888. 888 888 888 `88..8' .oP"888 888 888ooo888888 888
|
||||
.8' `888. 888 .o8 888 . 888 `888' d8( 888 888 .888 .o888 888
|
||||
o88o o8888o`Y8bod8P' "888"o888o `8' `Y888""8o "888"`Y8bod8P'`Y8bod88P"
|
||||
|
||||
"#;
|
||||
|
||||
/// Maximum block slot number. Block with slots bigger than this constant will NOT be processed.
|
||||
const MAXIMUM_BLOCK_SLOT_NUMBER: u64 = 4_294_967_296; // 2^32
|
||||
|
||||
@@ -1118,9 +1142,13 @@ impl<'a, T: BeaconChainTypes> FullyVerifiedBlock<'a, T> {
|
||||
// early.
|
||||
// - Doing the check here means we can keep our fork-choice implementation "pure". I.e., no
|
||||
// calls to remote servers.
|
||||
if is_merge_transition_block(&state, block.message().body()) {
|
||||
validate_merge_block(chain, block.message())?
|
||||
}
|
||||
let valid_merge_transition_block =
|
||||
if is_merge_transition_block(&state, block.message().body()) {
|
||||
validate_merge_block(chain, block.message())?;
|
||||
true
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
// The specification declares that this should be run *inside* `per_block_processing`,
|
||||
// however we run it here to keep `per_block_processing` pure (i.e., no calls to external
|
||||
@@ -1264,6 +1292,14 @@ impl<'a, T: BeaconChainTypes> FullyVerifiedBlock<'a, T> {
|
||||
});
|
||||
}
|
||||
|
||||
if valid_merge_transition_block {
|
||||
info!(chain.log, "{}", POS_PANDA_BANNER);
|
||||
info!(chain.log, "Proof of Stake Activated"; "slot" => block.slot());
|
||||
info!(chain.log, ""; "Terminal POW Block Hash" => ?block.message().execution_payload()?.parent_hash.into_root());
|
||||
info!(chain.log, ""; "Merge Transition Block Root" => ?block.message().tree_hash_root());
|
||||
info!(chain.log, ""; "Merge Transition Execution Hash" => ?block.message().execution_payload()?.block_hash.into_root());
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
block,
|
||||
block_root,
|
||||
|
||||
Reference in New Issue
Block a user