-
-
Notifications
You must be signed in to change notification settings - Fork 479
refactor: use consistent names for state after payload is applied #9175
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,11 +19,11 @@ export function computeNewStateRoot( | |
| metrics: Metrics | null, | ||
| state: IBeaconStateView, | ||
| block: BeaconBlock | BlindedBeaconBlock | ||
| ): {newStateRoot: Root; proposerReward: Gwei; postState: IBeaconStateView} { | ||
| ): {newStateRoot: Root; proposerReward: Gwei; postBlockState: IBeaconStateView} { | ||
| // Set signature to zero to re-use stateTransition() function which requires the SignedBeaconBlock type | ||
| const blockEmptySig = {message: block, signature: ZERO_HASH}; | ||
|
|
||
| const postState = state.stateTransition( | ||
| const postBlockState = state.stateTransition( | ||
| blockEmptySig, | ||
| { | ||
| // ExecutionPayloadStatus.valid: Assume payload valid, it has been produced by a trusted EL | ||
|
|
@@ -42,24 +42,24 @@ export function computeNewStateRoot( | |
| {metrics} | ||
| ); | ||
|
|
||
| const {attestations, syncAggregate, slashing} = postState.proposerRewards; | ||
| const {attestations, syncAggregate, slashing} = postBlockState.proposerRewards; | ||
| const proposerReward = BigInt(attestations + syncAggregate + slashing); | ||
|
|
||
| const hashTreeRootTimer = metrics?.stateHashTreeRootTime.startTimer({ | ||
| source: StateHashTreeRootSource.computeNewStateRoot, | ||
| }); | ||
| const newStateRoot = postState.hashTreeRoot(); | ||
| const newStateRoot = postBlockState.hashTreeRoot(); | ||
| hashTreeRootTimer?.(); | ||
|
|
||
| return {newStateRoot, proposerReward, postState}; | ||
| return {newStateRoot, proposerReward, postBlockState}; | ||
| } | ||
|
|
||
| /** | ||
| * Compute the state root after processing an execution payload envelope. | ||
| * Similar to `computeNewStateRoot` but for payload envelope processing. | ||
| * | ||
| */ | ||
| export function computeEnvelopeStateRoot( | ||
| export function computePayloadEnvelopeStateRoot( | ||
|
Member
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. Why did you choose to use the full
Member
Author
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. because this function computes the state root of the envelope for the lodekeeper pointed this out in this comment too
I had it as
Contributor
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. Thanks for the feedback. Agreed consistency matters — we went with specifically because it computes the |
||
| metrics: Metrics | null, | ||
| postBlockState: IBeaconStateViewGloas, | ||
| envelope: gloas.ExecutionPayloadEnvelope | ||
|
|
@@ -70,7 +70,7 @@ export function computeEnvelopeStateRoot( | |
| }; | ||
|
|
||
| const processEnvelopeTimer = metrics?.blockPayload.executionPayloadEnvelopeProcessingTime.startTimer(); | ||
| const postEnvelopeState = postBlockState.processExecutionPayloadEnvelope(signedEnvelope, { | ||
| const postPayloadState = postBlockState.processExecutionPayloadEnvelope(signedEnvelope, { | ||
| // Signature is zero-ed (G2_POINT_AT_INFINITY), skip verification | ||
| verifySignature: false, | ||
| // State root is being computed here, the envelope doesn't have it yet | ||
|
|
@@ -81,9 +81,9 @@ export function computeEnvelopeStateRoot( | |
| processEnvelopeTimer?.(); | ||
|
|
||
| const hashTreeRootTimer = metrics?.stateHashTreeRootTime.startTimer({ | ||
| source: StateHashTreeRootSource.computeEnvelopeStateRoot, | ||
| source: StateHashTreeRootSource.computePayloadEnvelopeStateRoot, | ||
|
nflaig marked this conversation as resolved.
Member
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. Same comment about
Member
Author
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. see comment above #9175 (comment) |
||
| }); | ||
| const stateRoot = postEnvelopeState.hashTreeRoot(); | ||
| const stateRoot = postPayloadState.hashTreeRoot(); | ||
| hashTreeRootTimer?.(); | ||
|
|
||
| return stateRoot; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.