-
-
Notifications
You must be signed in to change notification settings - Fork 282
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
Add merge transition/finalization banners #3963
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
packages/lodestar/src/chain/blocks/utils/pandaMergeTransitionBanner.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* eslint-disable no-useless-escape */ | ||
export const POS_PANDA_MERGE_TRANSITION_BANNER = ` | ||
_,..._,m, |, _,..._,m, |, | ||
,/' '""; | |, /' '""; | |, | ||
/ ". ". | ||
,'mmmMMMMmm. \ -|-_" 'mmmMMMMmm. \ -|-_" | ||
_/-"^^^^^"""%#%mm, ; | _ o /-"^^^^^"""%#%mm, ; | _ o | ||
,m,_,' "###) ;, m,_,' "###) ;, | ||
(###% \#/ ;##mm. (###% \#/ ;##mm. | ||
^#/__ ___ ; (######) #/__ ___ ; (######) | ||
; //.\\ //.\\ ; \####/ //.\\ //.\\ ; \####/ | ||
_; (#\"// \\"/#) ; ,/ _; (#\"// \\"/#) ; ,/ | ||
@##\ \##/ = "=" ,;mm/ @##\ \##/ = "=" ,;mm/ | ||
\##>.____,...,____,<####@ \##>.____,...,____,<####@ | ||
""' ""' | ||
_______ ______ ______ ______ __ __ | ||
/ \ / \ / \ / \ / | / | | ||
$$$$$$$ | ______ ______ ______ /$$$$$$ | ______ /$$$$$$ | /$$$$$$ |_$$ |_ ______ $$ | __ ______ | ||
$$ |__$$ |/ \ / \ / \ $$ |_ $$/ / \ $$ |_ $$/ $$ \__$$// $$ | / \ $$ | / | / \ | ||
$$ $$//$$$$$$ |/$$$$$$ |/$$$$$$ |$$ | /$$$$$$ |$$ | $$ \$$$$$$/ $$$$$$ |$$ |_/$$/ /$$$$$$ | | ||
$$$$$$$/ $$ | $$/ $$ | $$ |$$ | $$ |$$$$/ $$ | $$ |$$$$/ $$$$$$ | $$ | __ / $$ |$$ $$< $$ $$ | | ||
$$ | $$ | $$ \__$$ |$$ \__$$ |$$ | $$ \__$$ |$$ | / \__$$ | $$ |/ |/$$$$$$$ |$$$$$$ \ $$$$$$$$/ | ||
$$ | $$ | $$ $$/ $$ $$/ $$ | $$ $$/ $$ | $$ $$/ $$ $$/ $$ $$ |$$ | $$ |$$ | | ||
$$/ $$/ $$$$$$/ $$$$$$/ $$/ $$$$$$/ $$/ $$$$$$/ $$$$/ $$$$$$$/ $$/ $$/ $$$$$$$/ | ||
|
||
|
||
|
||
______ __ __ __ __ | ||
/ \ / | / | / | / | | ||
/$$$$$$ | _______ _$$ |_ $$/ __ __ ______ _$$ |_ ______ ____$$ | | ||
$$ |__$$ | / |/ $$ | / |/ \ / |/ \ / $$ | / \ / $$ | | ||
$$ $$ |/$$$$$$$/ $$$$$$/ $$ |$$ \ /$$/ $$$$$$ |$$$$$$/ /$$$$$$ |/$$$$$$$ | | ||
$$$$$$$$ |$$ | $$ | __ $$ | $$ /$$/ / $$ | $$ | __ $$ $$ |$$ | $$ | | ||
$$ | $$ |$$ \_____ $$ |/ |$$ | $$ $$/ /$$$$$$$ | $$ |/ |$$$$$$$$/ $$ \__$$ | | ||
$$ | $$ |$$ | $$ $$/ $$ | $$$/ $$ $$ | $$ $$/ $$ |$$ $$ | | ||
$$/ $$/ $$$$$$$/ $$$$/ $$/ $/ $$$$$$$/ $$$$/ $$$$$$$/ $$$$$$$/ `; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ import {FullyVerifiedBlock, PartiallyVerifiedBlock} from "./types"; | |
import {ExecutePayloadStatus} from "../../executionEngine/interface"; | ||
import {byteArrayEquals} from "../../util/bytes"; | ||
import {IEth1ForBlockProduction} from "../../eth1"; | ||
import {POS_PANDA_MERGE_TRANSITION_BANNER} from "./utils/pandaMergeTransitionBanner"; | ||
|
||
export type VerifyBlockModules = { | ||
bls: IBlsVerifier; | ||
|
@@ -43,14 +44,13 @@ export async function verifyBlock( | |
): Promise<FullyVerifiedBlock> { | ||
const parentBlock = verifyBlockSanityChecks(chain, partiallyVerifiedBlock); | ||
|
||
const {postState, executionStatus} = await verifyBlockStateTransition(chain, partiallyVerifiedBlock, opts); | ||
const processedBlockData = await verifyBlockStateTransition(chain, partiallyVerifiedBlock, opts); | ||
|
||
return { | ||
block: partiallyVerifiedBlock.block, | ||
postState, | ||
parentBlock, | ||
skipImportingAttestations: partiallyVerifiedBlock.skipImportingAttestations, | ||
executionStatus, | ||
...processedBlockData, | ||
}; | ||
} | ||
|
||
|
@@ -151,7 +151,6 @@ export async function verifyBlockStateTransition( | |
chain.metrics | ||
); | ||
|
||
// TODO: Review mergeBlock conditions | ||
/** Not null if execution is enabled */ | ||
const executionPayloadEnabled = | ||
bellatrix.isBellatrixStateType(postState) && | ||
|
@@ -317,5 +316,24 @@ export async function verifyBlockStateTransition( | |
}); | ||
} | ||
|
||
// All checks have passed, if this is a merge transition block we can log | ||
if (isMergeTransitionBlock) { | ||
logOnPowBlock(chain, block); | ||
} | ||
|
||
return {postState, executionStatus}; | ||
} | ||
|
||
function logOnPowBlock(chain: VerifyBlockModules, block: allForks.SignedBeaconBlock): void { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be safer to have function logOnPowBlock(chain: VerifyBlockModules, block: bellatrix.BeaconBlock): void and do the casting right below |
||
const mergeBlock = block.message as bellatrix.BeaconBlock; | ||
const mergeBlockHash = toHexString(chain.config.getForkTypes(mergeBlock.slot).BeaconBlock.hashTreeRoot(mergeBlock)); | ||
const mergeExecutionHash = toHexString(mergeBlock.body.executionPayload.blockHash); | ||
const mergePowHash = toHexString(mergeBlock.body.executionPayload.parentHash); | ||
chain.logger.info(POS_PANDA_MERGE_TRANSITION_BANNER); | ||
chain.logger.info("Execution transitioning from PoW to PoS!!!"); | ||
chain.logger.info("Importing block referencing terminal PoW block", { | ||
blockHash: mergeBlockHash, | ||
executionHash: mergeExecutionHash, | ||
powHash: mergePowHash, | ||
}); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why this change? Being explicit and not doing the spread feels more readable in my opinion