-
-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Kintsugi specs 🍵 (the Merge November sprint PR) (#3418)
* completing ethereum/consensus-specs#2617 * add TBH_ACTIVATION_EPOCH ethereum/consensus-specs#2682 * remove prepare payload specs 2682, add payload id as return to notify_forkchoice... 2711 * remove uniion from transaction (2683), fix gossip and tx size (2686), remove gas validation(2699) * remove extraneous p2p condition (2687) * params e2e test fix * update penalty params for Merge (2698) * updating spec version * spec runner merge sanity and operations fixes * removing the beacon block gossip validations as per 1.1.4 * feedback cleanup * spec v1.1.5, fixed blockhash (2710), payloadid (2711) already changed, tbh activation check(2712) already correct * kintsugi geth interop * ee test fixes * assetterminalpowblock refac and root comparision fix * runGethPreMerge test case * runGethPreMerge scenario with ignoring geth side ttd not reached error * assertvalidterminalpow block fix * tracker in comments for geth preMerge to postMerge issue * merge transition scenario with ttd > 0 check fix deployed on geth:kintsugi-spec * cleanup as merge-interop test file scenaros updated and working * handling prepare payload failure scenarios * seperating optimistic sync, fixing and testing the transaction submission/execution
- Loading branch information
Showing
44 changed files
with
488 additions
and
392 deletions.
There are no files selected for viewing
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
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
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
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
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
17 changes: 17 additions & 0 deletions
17
packages/beacon-state-transition/src/merge/block/processAttesterSlashing.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,17 @@ | ||
import {allForks, merge, phase0} from "@chainsafe/lodestar-types"; | ||
import {ForkName} from "@chainsafe/lodestar-params"; | ||
import {CachedBeaconState} from "../../allForks/util"; | ||
import {processAttesterSlashing as processAttesterSlashingAllForks} from "../../allForks/block"; | ||
|
||
export function processAttesterSlashing( | ||
state: CachedBeaconState<merge.BeaconState>, | ||
attesterSlashing: phase0.AttesterSlashing, | ||
verifySignatures = true | ||
): void { | ||
processAttesterSlashingAllForks( | ||
ForkName.merge, | ||
state as CachedBeaconState<allForks.BeaconState>, | ||
attesterSlashing, | ||
verifySignatures | ||
); | ||
} |
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
44 changes: 44 additions & 0 deletions
44
packages/beacon-state-transition/src/merge/block/processOperations.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,44 @@ | ||
import {readonlyValues} from "@chainsafe/ssz"; | ||
import {altair, merge} from "@chainsafe/lodestar-types"; | ||
|
||
import {CachedBeaconState} from "../../allForks/util"; | ||
import {processProposerSlashing} from "./processProposerSlashing"; | ||
import {processAttesterSlashing} from "./processAttesterSlashing"; | ||
import {processAttestations} from "../../altair/block/processAttestation"; | ||
import {processDeposit} from "../../altair/block/processDeposit"; | ||
import {processVoluntaryExit} from "../../altair/block/processVoluntaryExit"; | ||
import {MAX_DEPOSITS} from "@chainsafe/lodestar-params"; | ||
|
||
export function processOperations( | ||
state: CachedBeaconState<merge.BeaconState>, | ||
body: merge.BeaconBlockBody, | ||
verifySignatures = true | ||
): void { | ||
// verify that outstanding deposits are processed up to the maximum number of deposits | ||
const maxDeposits = Math.min(MAX_DEPOSITS, state.eth1Data.depositCount - state.eth1DepositIndex); | ||
if (body.deposits.length !== maxDeposits) { | ||
throw new Error( | ||
`Block contains incorrect number of deposits: depositCount=${body.deposits.length} expected=${maxDeposits}` | ||
); | ||
} | ||
|
||
for (const proposerSlashing of readonlyValues(body.proposerSlashings)) { | ||
processProposerSlashing(state, proposerSlashing, verifySignatures); | ||
} | ||
for (const attesterSlashing of readonlyValues(body.attesterSlashings)) { | ||
processAttesterSlashing(state, attesterSlashing, verifySignatures); | ||
} | ||
|
||
processAttestations( | ||
(state as unknown) as CachedBeaconState<altair.BeaconState>, | ||
Array.from(readonlyValues(body.attestations)), | ||
verifySignatures | ||
); | ||
|
||
for (const deposit of readonlyValues(body.deposits)) { | ||
processDeposit((state as unknown) as CachedBeaconState<altair.BeaconState>, deposit); | ||
} | ||
for (const voluntaryExit of readonlyValues(body.voluntaryExits)) { | ||
processVoluntaryExit((state as unknown) as CachedBeaconState<altair.BeaconState>, voluntaryExit, verifySignatures); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/beacon-state-transition/src/merge/block/processProposerSlashing.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,17 @@ | ||
import {allForks, merge, phase0} from "@chainsafe/lodestar-types"; | ||
import {ForkName} from "@chainsafe/lodestar-params"; | ||
import {CachedBeaconState} from "../../allForks/util"; | ||
import {processProposerSlashing as processProposerSlashingAllForks} from "../../allForks/block"; | ||
|
||
export function processProposerSlashing( | ||
state: CachedBeaconState<merge.BeaconState>, | ||
proposerSlashing: phase0.ProposerSlashing, | ||
verifySignatures = true | ||
): void { | ||
processProposerSlashingAllForks( | ||
ForkName.merge, | ||
state as CachedBeaconState<allForks.BeaconState>, | ||
proposerSlashing, | ||
verifySignatures | ||
); | ||
} |
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 @@ | ||
export {processSlashings} from "./processSlashings"; |
8 changes: 8 additions & 0 deletions
8
packages/beacon-state-transition/src/merge/epoch/processSlashings.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,8 @@ | ||
import {allForks, merge} from "@chainsafe/lodestar-types"; | ||
import {ForkName} from "@chainsafe/lodestar-params"; | ||
import {CachedBeaconState, IEpochProcess} from "../../allForks/util"; | ||
import {processSlashingsAllForks} from "../../allForks/epoch/processSlashings"; | ||
|
||
export function processSlashings(state: CachedBeaconState<merge.BeaconState>, epochProcess: IEpochProcess): void { | ||
processSlashingsAllForks(ForkName.merge, state as CachedBeaconState<allForks.BeaconState>, epochProcess); | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.