@lodestar/state-transition 1.39.0-dev.882891d89c → 1.39.0-dev.90334173dc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/block/index.d.ts.map +1 -1
- package/lib/block/index.js +4 -2
- package/lib/block/index.js.map +1 -1
- package/lib/block/isValidIndexedAttestation.d.ts +4 -5
- package/lib/block/isValidIndexedAttestation.d.ts.map +1 -1
- package/lib/block/isValidIndexedAttestation.js +9 -10
- package/lib/block/isValidIndexedAttestation.js.map +1 -1
- package/lib/block/processAttestationPhase0.d.ts.map +1 -1
- package/lib/block/processAttestationPhase0.js +1 -1
- package/lib/block/processAttestationPhase0.js.map +1 -1
- package/lib/block/processAttestationsAltair.js +1 -1
- package/lib/block/processAttestationsAltair.js.map +1 -1
- package/lib/block/processAttesterSlashing.d.ts +3 -2
- package/lib/block/processAttesterSlashing.d.ts.map +1 -1
- package/lib/block/processAttesterSlashing.js +3 -3
- package/lib/block/processAttesterSlashing.js.map +1 -1
- package/lib/block/processBlsToExecutionChange.d.ts +3 -1
- package/lib/block/processBlsToExecutionChange.d.ts.map +1 -1
- package/lib/block/processBlsToExecutionChange.js +7 -11
- package/lib/block/processBlsToExecutionChange.js.map +1 -1
- package/lib/block/processExecutionPayload.d.ts.map +1 -1
- package/lib/block/processExecutionPayload.js +6 -4
- package/lib/block/processExecutionPayload.js.map +1 -1
- package/lib/block/processProposerSlashing.d.ts +5 -2
- package/lib/block/processProposerSlashing.d.ts.map +1 -1
- package/lib/block/processProposerSlashing.js +7 -5
- package/lib/block/processProposerSlashing.js.map +1 -1
- package/lib/block/processRandao.js +2 -2
- package/lib/block/processRandao.js.map +1 -1
- package/lib/block/processSyncCommittee.d.ts +2 -1
- package/lib/block/processSyncCommittee.d.ts.map +1 -1
- package/lib/block/processSyncCommittee.js +6 -4
- package/lib/block/processSyncCommittee.js.map +1 -1
- package/lib/block/processVoluntaryExit.js +1 -1
- package/lib/block/processVoluntaryExit.js.map +1 -1
- package/lib/block/processWithdrawals.d.ts +3 -3
- package/lib/block/processWithdrawals.d.ts.map +1 -1
- package/lib/block/processWithdrawals.js +152 -105
- package/lib/block/processWithdrawals.js.map +1 -1
- package/lib/cache/epochCache.d.ts +8 -28
- package/lib/cache/epochCache.d.ts.map +1 -1
- package/lib/cache/epochCache.js +40 -180
- package/lib/cache/epochCache.js.map +1 -1
- package/lib/cache/epochTransitionCache.d.ts +5 -12
- package/lib/cache/epochTransitionCache.d.ts.map +1 -1
- package/lib/cache/epochTransitionCache.js +4 -14
- package/lib/cache/epochTransitionCache.js.map +1 -1
- package/lib/cache/stateCache.d.ts.map +1 -1
- package/lib/cache/stateCache.js +1 -2
- package/lib/cache/stateCache.js.map +1 -1
- package/lib/epoch/processProposerLookahead.d.ts.map +1 -1
- package/lib/epoch/processProposerLookahead.js +3 -6
- package/lib/epoch/processProposerLookahead.js.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/rewards/attestationsRewards.d.ts +6 -0
- package/lib/rewards/attestationsRewards.d.ts.map +1 -0
- package/lib/rewards/attestationsRewards.js +113 -0
- package/lib/rewards/attestationsRewards.js.map +1 -0
- package/lib/rewards/blockRewards.d.ts +14 -0
- package/lib/rewards/blockRewards.d.ts.map +1 -0
- package/lib/rewards/blockRewards.js +96 -0
- package/lib/rewards/blockRewards.js.map +1 -0
- package/lib/rewards/index.d.ts +4 -0
- package/lib/rewards/index.d.ts.map +1 -0
- package/lib/rewards/index.js +4 -0
- package/lib/rewards/index.js.map +1 -0
- package/lib/rewards/syncCommitteeRewards.d.ts +6 -0
- package/lib/rewards/syncCommitteeRewards.d.ts.map +1 -0
- package/lib/rewards/syncCommitteeRewards.js +35 -0
- package/lib/rewards/syncCommitteeRewards.js.map +1 -0
- package/lib/signatureSets/attesterSlashings.d.ts +4 -5
- package/lib/signatureSets/attesterSlashings.d.ts.map +1 -1
- package/lib/signatureSets/attesterSlashings.js +10 -7
- package/lib/signatureSets/attesterSlashings.js.map +1 -1
- package/lib/signatureSets/blsToExecutionChange.d.ts +1 -2
- package/lib/signatureSets/blsToExecutionChange.d.ts.map +1 -1
- package/lib/signatureSets/blsToExecutionChange.js +2 -2
- package/lib/signatureSets/blsToExecutionChange.js.map +1 -1
- package/lib/signatureSets/index.d.ts +2 -2
- package/lib/signatureSets/index.d.ts.map +1 -1
- package/lib/signatureSets/index.js +10 -10
- package/lib/signatureSets/index.js.map +1 -1
- package/lib/signatureSets/indexedAttestation.d.ts +5 -6
- package/lib/signatureSets/indexedAttestation.d.ts.map +1 -1
- package/lib/signatureSets/indexedAttestation.js +12 -9
- package/lib/signatureSets/indexedAttestation.js.map +1 -1
- package/lib/signatureSets/proposer.d.ts +5 -6
- package/lib/signatureSets/proposer.d.ts.map +1 -1
- package/lib/signatureSets/proposer.js +12 -10
- package/lib/signatureSets/proposer.js.map +1 -1
- package/lib/signatureSets/proposerSlashings.d.ts +3 -4
- package/lib/signatureSets/proposerSlashings.d.ts.map +1 -1
- package/lib/signatureSets/proposerSlashings.js +7 -4
- package/lib/signatureSets/proposerSlashings.js.map +1 -1
- package/lib/signatureSets/randao.d.ts +2 -3
- package/lib/signatureSets/randao.d.ts.map +1 -1
- package/lib/signatureSets/randao.js +6 -4
- package/lib/signatureSets/randao.js.map +1 -1
- package/lib/signatureSets/voluntaryExits.d.ts +4 -5
- package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
- package/lib/signatureSets/voluntaryExits.js +10 -7
- package/lib/signatureSets/voluntaryExits.js.map +1 -1
- package/lib/stateTransition.d.ts.map +1 -1
- package/lib/stateTransition.js +1 -2
- package/lib/stateTransition.js.map +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/util/epochShuffling.d.ts +1 -34
- package/lib/util/epochShuffling.d.ts.map +1 -1
- package/lib/util/epochShuffling.js +1 -1
- package/lib/util/epochShuffling.js.map +1 -1
- package/lib/util/execution.d.ts +11 -1
- package/lib/util/execution.d.ts.map +1 -1
- package/lib/util/execution.js +26 -1
- package/lib/util/execution.js.map +1 -1
- package/lib/util/index.d.ts +1 -2
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -2
- package/lib/util/index.js.map +1 -1
- package/lib/util/shuffling.d.ts +58 -0
- package/lib/util/shuffling.d.ts.map +1 -0
- package/lib/util/shuffling.js +175 -0
- package/lib/util/shuffling.js.map +1 -0
- package/package.json +14 -11
- package/src/block/index.ts +6 -2
- package/src/block/isValidIndexedAttestation.ts +19 -12
- package/src/block/processAttestationPhase0.ts +2 -1
- package/src/block/processAttestationsAltair.ts +1 -1
- package/src/block/processAttesterSlashing.ts +16 -4
- package/src/block/processBlsToExecutionChange.ts +13 -14
- package/src/block/processExecutionPayload.ts +14 -8
- package/src/block/processProposerSlashing.ts +21 -11
- package/src/block/processRandao.ts +2 -2
- package/src/block/processSyncCommittee.ts +7 -4
- package/src/block/processVoluntaryExit.ts +1 -1
- package/src/block/processWithdrawals.ts +230 -135
- package/src/cache/epochCache.ts +52 -214
- package/src/cache/epochTransitionCache.ts +9 -34
- package/src/cache/stateCache.ts +1 -2
- package/src/epoch/processProposerLookahead.ts +3 -7
- package/src/index.ts +2 -4
- package/src/rewards/attestationsRewards.ts +200 -0
- package/src/rewards/blockRewards.ts +150 -0
- package/src/rewards/index.ts +3 -0
- package/src/rewards/syncCommitteeRewards.ts +56 -0
- package/src/signatureSets/attesterSlashings.ts +10 -9
- package/src/signatureSets/blsToExecutionChange.ts +2 -3
- package/src/signatureSets/index.ts +11 -11
- package/src/signatureSets/indexedAttestation.ts +12 -11
- package/src/signatureSets/proposer.ts +11 -11
- package/src/signatureSets/proposerSlashings.ts +7 -6
- package/src/signatureSets/randao.ts +4 -5
- package/src/signatureSets/voluntaryExits.ts +10 -9
- package/src/stateTransition.ts +1 -4
- package/src/types.ts +1 -0
- package/src/util/epochShuffling.ts +2 -43
- package/src/util/execution.ts +39 -0
- package/src/util/index.ts +1 -2
- package/src/util/shuffling.ts +234 -0
- package/lib/util/calculateCommitteeAssignments.d.ts +0 -12
- package/lib/util/calculateCommitteeAssignments.d.ts.map +0 -1
- package/lib/util/calculateCommitteeAssignments.js +0 -26
- package/lib/util/calculateCommitteeAssignments.js.map +0 -1
- package/lib/util/shufflingDecisionRoot.d.ts +0 -20
- package/lib/util/shufflingDecisionRoot.d.ts.map +0 -1
- package/lib/util/shufflingDecisionRoot.js +0 -76
- package/lib/util/shufflingDecisionRoot.js.map +0 -1
- package/src/util/calculateCommitteeAssignments.ts +0 -43
- package/src/util/shufflingDecisionRoot.ts +0 -81
|
@@ -19,22 +19,22 @@ export * from "./voluntaryExits.js";
|
|
|
19
19
|
* Includes all signatures on the block (except the deposit signatures) for verification.
|
|
20
20
|
* Deposits are not included because they can legally have invalid signatures.
|
|
21
21
|
*/
|
|
22
|
-
export function getBlockSignatureSets(config, index2pubkey,
|
|
22
|
+
export function getBlockSignatureSets(config, index2pubkey, currentSyncCommitteeIndexed, signedBlock, indexedAttestations, opts) {
|
|
23
23
|
// fork based validations
|
|
24
|
-
const fork =
|
|
24
|
+
const fork = config.getForkSeq(signedBlock.message.slot);
|
|
25
25
|
const signatureSets = [
|
|
26
|
-
getRandaoRevealSignatureSet(config, index2pubkey,
|
|
27
|
-
...getProposerSlashingsSignatureSets(config, index2pubkey,
|
|
28
|
-
...getAttesterSlashingsSignatureSets(config, index2pubkey,
|
|
29
|
-
...getAttestationsSignatureSets(config, index2pubkey,
|
|
30
|
-
...getVoluntaryExitsSignatureSets(config, index2pubkey,
|
|
26
|
+
getRandaoRevealSignatureSet(config, index2pubkey, signedBlock.message),
|
|
27
|
+
...getProposerSlashingsSignatureSets(config, index2pubkey, signedBlock),
|
|
28
|
+
...getAttesterSlashingsSignatureSets(config, index2pubkey, signedBlock),
|
|
29
|
+
...getAttestationsSignatureSets(config, index2pubkey, signedBlock, indexedAttestations),
|
|
30
|
+
...getVoluntaryExitsSignatureSets(config, index2pubkey, signedBlock),
|
|
31
31
|
];
|
|
32
32
|
if (!opts?.skipProposerSignature) {
|
|
33
|
-
signatureSets.push(getBlockProposerSignatureSet(config, index2pubkey,
|
|
33
|
+
signatureSets.push(getBlockProposerSignatureSet(config, index2pubkey, signedBlock));
|
|
34
34
|
}
|
|
35
35
|
// Only after altair fork, validate tSyncCommitteeSignature
|
|
36
36
|
if (fork >= ForkSeq.altair) {
|
|
37
|
-
const syncCommitteeSignatureSet = getSyncCommitteeSignatureSet(config, index2pubkey,
|
|
37
|
+
const syncCommitteeSignatureSet = getSyncCommitteeSignatureSet(config, index2pubkey, currentSyncCommitteeIndexed, signedBlock.message);
|
|
38
38
|
// There may be no participants in this syncCommitteeSignature, so it must not be validated
|
|
39
39
|
if (syncCommitteeSignatureSet) {
|
|
40
40
|
signatureSets.push(syncCommitteeSignatureSet);
|
|
@@ -42,7 +42,7 @@ export function getBlockSignatureSets(config, index2pubkey, state, signedBlock,
|
|
|
42
42
|
}
|
|
43
43
|
// only after capella fork
|
|
44
44
|
if (fork >= ForkSeq.capella) {
|
|
45
|
-
const blsToExecutionChangeSignatureSets = getBlsToExecutionChangeSignatureSets(
|
|
45
|
+
const blsToExecutionChangeSignatureSets = getBlsToExecutionChangeSignatureSets(config, signedBlock);
|
|
46
46
|
if (blsToExecutionChangeSignatureSets.length > 0) {
|
|
47
47
|
signatureSets.push(...blsToExecutionChangeSignatureSets);
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signatureSets/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAC,4BAA4B,EAAC,MAAM,kCAAkC,CAAC;AAI9E,OAAO,EAAC,iCAAiC,EAAC,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAC,oCAAoC,EAAC,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAC,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MAAM,EACN,WAAwC,CACzC,CAAC;QACF,IAAI,iCAAiC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjD,aAAa,CAAC,IAAI,CAAC,GAAG,iCAAiC,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BeaconConfig } from "@lodestar/config";
|
|
2
|
-
import { IndexedAttestation, SignedBeaconBlock, phase0 } from "@lodestar/types";
|
|
2
|
+
import { IndexedAttestation, SignedBeaconBlock, Slot, phase0 } from "@lodestar/types";
|
|
3
3
|
import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
|
|
4
|
-
import { CachedBeaconStateAllForks } from "../types.js";
|
|
5
4
|
import { ISignatureSet } from "../util/index.js";
|
|
6
|
-
export declare function getAttestationDataSigningRoot(config: BeaconConfig,
|
|
7
|
-
export declare function getAttestationWithIndicesSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
8
|
-
export declare function getIndexedAttestationSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
9
|
-
export declare function getAttestationsSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
5
|
+
export declare function getAttestationDataSigningRoot(config: BeaconConfig, stateSlot: Slot, data: phase0.AttestationData): Uint8Array;
|
|
6
|
+
export declare function getAttestationWithIndicesSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache, stateSlot: Slot, attestation: Pick<phase0.Attestation, "data" | "signature">, attestingIndices: number[]): ISignatureSet;
|
|
7
|
+
export declare function getIndexedAttestationSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache, stateSlot: Slot, indexedAttestation: IndexedAttestation): ISignatureSet;
|
|
8
|
+
export declare function getAttestationsSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache, signedBlock: SignedBeaconBlock, indexedAttestations: IndexedAttestation[]): ISignatureSet[];
|
|
10
9
|
//# sourceMappingURL=indexedAttestation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexedAttestation.d.ts","sourceRoot":"","sources":["../../src/signatureSets/indexedAttestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"indexedAttestation.d.ts","sourceRoot":"","sources":["../../src/signatureSets/indexedAttestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,kBAAkB,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,aAAa,EAId,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,IAAI,EACf,IAAI,EAAE,MAAM,CAAC,eAAe,GAC3B,UAAU,CAKZ;AAED,wBAAgB,qCAAqC,CACnD,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,IAAI,EACf,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CAAC,EAC3D,gBAAgB,EAAE,MAAM,EAAE,GACzB,aAAa,CAMf;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,IAAI,EACf,kBAAkB,EAAE,kBAAkB,GACrC,aAAa,CAQf;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,WAAW,EAAE,iBAAiB,EAC9B,mBAAmB,EAAE,kBAAkB,EAAE,GACxC,aAAa,EAAE,CAYjB"}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { DOMAIN_BEACON_ATTESTER } from "@lodestar/params";
|
|
2
2
|
import { ssz } from "@lodestar/types";
|
|
3
3
|
import { computeSigningRoot, computeStartSlotAtEpoch, createAggregateSignatureSetFromComponents, } from "../util/index.js";
|
|
4
|
-
export function getAttestationDataSigningRoot(config,
|
|
5
|
-
const
|
|
6
|
-
const domain = config.getDomain(
|
|
4
|
+
export function getAttestationDataSigningRoot(config, stateSlot, data) {
|
|
5
|
+
const messageSlot = computeStartSlotAtEpoch(data.target.epoch);
|
|
6
|
+
const domain = config.getDomain(stateSlot, DOMAIN_BEACON_ATTESTER, messageSlot);
|
|
7
7
|
return computeSigningRoot(ssz.phase0.AttestationData, data, domain);
|
|
8
8
|
}
|
|
9
|
-
export function getAttestationWithIndicesSignatureSet(config, index2pubkey,
|
|
10
|
-
return createAggregateSignatureSetFromComponents(attestingIndices.map((i) => index2pubkey[i]), getAttestationDataSigningRoot(config,
|
|
9
|
+
export function getAttestationWithIndicesSignatureSet(config, index2pubkey, stateSlot, attestation, attestingIndices) {
|
|
10
|
+
return createAggregateSignatureSetFromComponents(attestingIndices.map((i) => index2pubkey[i]), getAttestationDataSigningRoot(config, stateSlot, attestation.data), attestation.signature);
|
|
11
11
|
}
|
|
12
|
-
export function getIndexedAttestationSignatureSet(config, index2pubkey,
|
|
13
|
-
return getAttestationWithIndicesSignatureSet(config, index2pubkey,
|
|
12
|
+
export function getIndexedAttestationSignatureSet(config, index2pubkey, stateSlot, indexedAttestation) {
|
|
13
|
+
return getAttestationWithIndicesSignatureSet(config, index2pubkey, stateSlot, indexedAttestation, indexedAttestation.attestingIndices);
|
|
14
14
|
}
|
|
15
|
-
export function getAttestationsSignatureSets(config, index2pubkey,
|
|
15
|
+
export function getAttestationsSignatureSets(config, index2pubkey, signedBlock, indexedAttestations) {
|
|
16
16
|
if (indexedAttestations.length !== signedBlock.message.body.attestations.length) {
|
|
17
17
|
throw Error(`Indexed attestations length mismatch: got ${indexedAttestations.length}, expected ${signedBlock.message.body.attestations.length}`);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
20
|
+
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
21
|
+
const blockSlot = signedBlock.message.slot;
|
|
22
|
+
return indexedAttestations.map((indexedAttestation) => getIndexedAttestationSignatureSet(config, index2pubkey, blockSlot, indexedAttestation));
|
|
20
23
|
}
|
|
21
24
|
//# sourceMappingURL=indexedAttestation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexedAttestation.js","sourceRoot":"","sources":["../../src/signatureSets/indexedAttestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"indexedAttestation.js","sourceRoot":"","sources":["../../src/signatureSets/indexedAttestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAsD,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAEzF,OAAO,EAEL,kBAAkB,EAClB,uBAAuB,EACvB,yCAAyC,GAC1C,MAAM,kBAAkB,CAAC;AAE1B,MAAM,UAAU,6BAA6B,CAC3C,MAAoB,EACpB,SAAe,EACf,IAA4B;IAE5B,MAAM,WAAW,GAAG,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,sBAAsB,EAAE,WAAW,CAAC,CAAC;IAEhF,OAAO,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACtE,CAAC;AAED,M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types";
|
|
2
|
+
import { SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, phase0 } from "@lodestar/types";
|
|
3
3
|
import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
|
|
4
|
-
import { CachedBeaconStateAllForks } from "../types.js";
|
|
5
4
|
import { ISignatureSet } from "../util/signatureSets.js";
|
|
6
|
-
export declare function verifyProposerSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
7
|
-
export declare function getBlockProposerSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
8
|
-
export declare function getBlockHeaderProposerSignatureSetByParentStateSlot(index2pubkey: Index2PubkeyCache,
|
|
9
|
-
export declare function getBlockHeaderProposerSignatureSetByHeaderSlot(
|
|
5
|
+
export declare function verifyProposerSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache, signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock): boolean;
|
|
6
|
+
export declare function getBlockProposerSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache, signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock): ISignatureSet;
|
|
7
|
+
export declare function getBlockHeaderProposerSignatureSetByParentStateSlot(config: BeaconConfig, index2pubkey: Index2PubkeyCache, parentStateSlot: Slot, signedBlockHeader: phase0.SignedBeaconBlockHeader): ISignatureSet;
|
|
8
|
+
export declare function getBlockHeaderProposerSignatureSetByHeaderSlot(config: BeaconConfig, index2pubkey: Index2PubkeyCache, signedBlockHeader: phase0.SignedBeaconBlockHeader): ISignatureSet;
|
|
10
9
|
//# sourceMappingURL=proposer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposer.d.ts","sourceRoot":"","sources":["../../src/signatureSets/proposer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAE,wBAAwB,
|
|
1
|
+
{"version":3,"file":"proposer.d.ts","sourceRoot":"","sources":["../../src/signatureSets/proposer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAE,wBAAwB,EAAE,IAAI,EAAwB,MAAM,EAAM,MAAM,iBAAiB,CAAC;AACrH,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAC,aAAa,EAAuC,MAAM,0BAA0B,CAAC;AAE7F,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,WAAW,EAAE,iBAAiB,GAAG,wBAAwB,GACxD,OAAO,CAGT;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,WAAW,EAAE,iBAAiB,GAAG,wBAAwB,GACxD,aAAa,CAgBf;AAED,wBAAgB,mDAAmD,CACjE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,eAAe,EAAE,IAAI,EACrB,iBAAiB,EAAE,MAAM,CAAC,uBAAuB,iBAGlD;AAED,wBAAgB,8CAA8C,CAC5D,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,iBAAiB,EAAE,MAAM,CAAC,uBAAuB,iBAGlD"}
|
|
@@ -2,12 +2,15 @@ import { DOMAIN_BEACON_PROPOSER } from "@lodestar/params";
|
|
|
2
2
|
import { isBlindedBeaconBlock, ssz } from "@lodestar/types";
|
|
3
3
|
import { computeSigningRoot } from "../util/index.js";
|
|
4
4
|
import { SignatureSetType, verifySignatureSet } from "../util/signatureSets.js";
|
|
5
|
-
export function verifyProposerSignature(config, index2pubkey,
|
|
6
|
-
const signatureSet = getBlockProposerSignatureSet(config, index2pubkey,
|
|
5
|
+
export function verifyProposerSignature(config, index2pubkey, signedBlock) {
|
|
6
|
+
const signatureSet = getBlockProposerSignatureSet(config, index2pubkey, signedBlock);
|
|
7
7
|
return verifySignatureSet(signatureSet);
|
|
8
8
|
}
|
|
9
|
-
export function getBlockProposerSignatureSet(config, index2pubkey,
|
|
10
|
-
|
|
9
|
+
export function getBlockProposerSignatureSet(config, index2pubkey, signedBlock) {
|
|
10
|
+
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
11
|
+
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
12
|
+
const blockSlot = signedBlock.message.slot;
|
|
13
|
+
const domain = config.getDomain(blockSlot, DOMAIN_BEACON_PROPOSER, blockSlot);
|
|
11
14
|
const blockType = isBlindedBeaconBlock(signedBlock.message)
|
|
12
15
|
? config.getPostBellatrixForkTypes(signedBlock.message.slot).BlindedBeaconBlock
|
|
13
16
|
: config.getForkTypes(signedBlock.message.slot).BeaconBlock;
|
|
@@ -18,14 +21,13 @@ export function getBlockProposerSignatureSet(config, index2pubkey, state, signed
|
|
|
18
21
|
signature: signedBlock.signature,
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
|
-
export function getBlockHeaderProposerSignatureSetByParentStateSlot(index2pubkey,
|
|
22
|
-
return getBlockHeaderProposerSignatureSet(
|
|
24
|
+
export function getBlockHeaderProposerSignatureSetByParentStateSlot(config, index2pubkey, parentStateSlot, signedBlockHeader) {
|
|
25
|
+
return getBlockHeaderProposerSignatureSet(config, index2pubkey, signedBlockHeader, parentStateSlot);
|
|
23
26
|
}
|
|
24
|
-
export function getBlockHeaderProposerSignatureSetByHeaderSlot(
|
|
25
|
-
return getBlockHeaderProposerSignatureSet(
|
|
27
|
+
export function getBlockHeaderProposerSignatureSetByHeaderSlot(config, index2pubkey, signedBlockHeader) {
|
|
28
|
+
return getBlockHeaderProposerSignatureSet(config, index2pubkey, signedBlockHeader, signedBlockHeader.message.slot);
|
|
26
29
|
}
|
|
27
|
-
function getBlockHeaderProposerSignatureSet(
|
|
28
|
-
const { config } = state;
|
|
30
|
+
function getBlockHeaderProposerSignatureSet(config, index2pubkey, signedBlockHeader, domainSlot) {
|
|
29
31
|
const domain = config.getDomain(domainSlot, DOMAIN_BEACON_PROPOSER, signedBlockHeader.message.slot);
|
|
30
32
|
return {
|
|
31
33
|
type: SignatureSetType.single,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposer.js","sourceRoot":"","sources":["../../src/signatureSets/proposer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAoD,oBAAoB,EAAU,GAAG,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"proposer.js","sourceRoot":"","sources":["../../src/signatureSets/proposer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAoD,oBAAoB,EAAU,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAErH,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAgB,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,0BAA0B,CAAC;AAE7F,MAAM,UAAU,uBAAuB,CACrC,MAAoB,EACpB,YAA+B,EAC/B,WAAyD;IAEzD,MAAM,YAAY,GAAG,4BAA4B,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IACrF,OAAO,kBAAkB,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,MAAoB,EACpB,YAA+B,EAC/B,WAAyD;IAEzD,oHAAoH;IACpH,0GAA0G;IAC1G,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,sBAAsB,EAAE,SAAS,CAAC,CAAC;IAE9E,MAAM,SAAS,GAAG,oBAAoB,CAAC,WAAW,CAAC,OAAO,CAAC;QACzD,CAAC,CAAC,MAAM,CAAC,yB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BAAiB,CAAC,SAAS;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BeaconConfig } from "@lodestar/config";
|
|
2
|
-
import { SignedBeaconBlock, phase0 } from "@lodestar/types";
|
|
2
|
+
import { SignedBeaconBlock, Slot, phase0 } from "@lodestar/types";
|
|
3
3
|
import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
|
|
4
|
-
import { CachedBeaconStateAllForks } from "../types.js";
|
|
5
4
|
import { ISignatureSet } from "../util/index.js";
|
|
6
5
|
/**
|
|
7
6
|
* Extract signatures to allow validating all block signatures at once
|
|
8
7
|
*/
|
|
9
|
-
export declare function getProposerSlashingSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
10
|
-
export declare function getProposerSlashingsSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
8
|
+
export declare function getProposerSlashingSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache, stateSlot: Slot, proposerSlashing: phase0.ProposerSlashing): ISignatureSet[];
|
|
9
|
+
export declare function getProposerSlashingsSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache, signedBlock: SignedBeaconBlock): ISignatureSet[];
|
|
11
10
|
//# sourceMappingURL=proposerSlashings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposerSlashings.d.ts","sourceRoot":"","sources":["../../src/signatureSets/proposerSlashings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"proposerSlashings.d.ts","sourceRoot":"","sources":["../../src/signatureSets/proposerSlashings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAuC,MAAM,kBAAkB,CAAC;AAErF;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,IAAI,EACf,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,GACxC,aAAa,EAAE,CAejB;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,WAAW,EAAE,iBAAiB,GAC7B,aAAa,EAAE,CAOjB"}
|
|
@@ -4,12 +4,12 @@ import { SignatureSetType, computeSigningRoot } from "../util/index.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Extract signatures to allow validating all block signatures at once
|
|
6
6
|
*/
|
|
7
|
-
export function getProposerSlashingSignatureSets(config, index2pubkey,
|
|
7
|
+
export function getProposerSlashingSignatureSets(config, index2pubkey, stateSlot, proposerSlashing) {
|
|
8
8
|
const pubkey = index2pubkey[proposerSlashing.signedHeader1.message.proposerIndex];
|
|
9
9
|
// In state transition, ProposerSlashing headers are only partially validated. Their slot could be higher than the
|
|
10
10
|
// clock and the slashing would still be valid. Must use bigint variants to hash correctly to all possible values
|
|
11
11
|
return [proposerSlashing.signedHeader1, proposerSlashing.signedHeader2].map((signedHeader) => {
|
|
12
|
-
const domain = config.getDomain(
|
|
12
|
+
const domain = config.getDomain(stateSlot, DOMAIN_BEACON_PROPOSER, Number(signedHeader.message.slot));
|
|
13
13
|
return {
|
|
14
14
|
type: SignatureSetType.single,
|
|
15
15
|
pubkey,
|
|
@@ -18,7 +18,10 @@ export function getProposerSlashingSignatureSets(config, index2pubkey, state, pr
|
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
export function getProposerSlashingsSignatureSets(config, index2pubkey,
|
|
22
|
-
|
|
21
|
+
export function getProposerSlashingsSignatureSets(config, index2pubkey, signedBlock) {
|
|
22
|
+
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
23
|
+
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
24
|
+
const blockSlot = signedBlock.message.slot;
|
|
25
|
+
return signedBlock.message.body.proposerSlashings.flatMap((proposerSlashing) => getProposerSlashingSignatureSets(config, index2pubkey, blockSlot, proposerSlashing));
|
|
23
26
|
}
|
|
24
27
|
//# sourceMappingURL=proposerSlashings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposerSlashings.js","sourceRoot":"","sources":["../../src/signatureSets/proposerSlashings.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"proposerSlashings.js","sourceRoot":"","sources":["../../src/signatureSets/proposerSlashings.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAkC,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAgB,gBAAgB,EAAE,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAErF;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC9C,MAAoB,EACpB,YAA+B,EAC/B,SAAe,EACf,gBAAyC;IAEzC,MAAM,MAAM,GAAG,YAAY,CAAC,gBAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAElF,kHAAkH;IAClH,iHAAiH;IACjH,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,EAAiB,EAAE;QAC1G,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,sBAAsB,EAAE,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,IAAc,CAAC,CAAC,CAAC;QAEhH,OAAO;YACL,IAAI,EAAE,gBAAgB,CAAC,MAAM;YAC7B,MAAM;YACN,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,uBAAuB,EAAE,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC;YACjG,SAAS,EAAE,YAAY,CAAC,SAAS;SAClC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,MAAoB,EACpB,YAA+B,EAC/B,WAA8B;IAE9B,oHAAoH;IACpH,0GAA0G;IAC1G,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3C,OAAO,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAC7E,gCAAgC,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,gBAAgB,CAAC,CACpF,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BeaconConfig } from "@lodestar/config";
|
|
2
2
|
import { BeaconBlock } from "@lodestar/types";
|
|
3
3
|
import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
|
|
4
|
-
import { CachedBeaconStateAllForks } from "../types.js";
|
|
5
4
|
import { ISignatureSet } from "../util/index.js";
|
|
6
|
-
export declare function verifyRandaoSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
5
|
+
export declare function verifyRandaoSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache, block: BeaconBlock): boolean;
|
|
7
6
|
/**
|
|
8
7
|
* Extract signatures to allow validating all block signatures at once
|
|
9
8
|
*/
|
|
10
|
-
export declare function getRandaoRevealSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
9
|
+
export declare function getRandaoRevealSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache, block: BeaconBlock): ISignatureSet;
|
|
11
10
|
//# sourceMappingURL=randao.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randao.d.ts","sourceRoot":"","sources":["../../src/signatureSets/randao.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAM,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"randao.d.ts","sourceRoot":"","sources":["../../src/signatureSets/randao.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAM,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,WAAW,GACjB,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,KAAK,EAAE,WAAW,GACjB,aAAa,CAaf"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { DOMAIN_RANDAO } from "@lodestar/params";
|
|
2
2
|
import { ssz } from "@lodestar/types";
|
|
3
3
|
import { SignatureSetType, computeEpochAtSlot, computeSigningRoot, verifySignatureSet, } from "../util/index.js";
|
|
4
|
-
export function verifyRandaoSignature(config, index2pubkey,
|
|
5
|
-
return verifySignatureSet(getRandaoRevealSignatureSet(config, index2pubkey,
|
|
4
|
+
export function verifyRandaoSignature(config, index2pubkey, block) {
|
|
5
|
+
return verifySignatureSet(getRandaoRevealSignatureSet(config, index2pubkey, block));
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Extract signatures to allow validating all block signatures at once
|
|
9
9
|
*/
|
|
10
|
-
export function getRandaoRevealSignatureSet(config, index2pubkey,
|
|
10
|
+
export function getRandaoRevealSignatureSet(config, index2pubkey, block) {
|
|
11
11
|
// should not get epoch from epochCtx
|
|
12
12
|
const epoch = computeEpochAtSlot(block.slot);
|
|
13
|
-
|
|
13
|
+
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
14
|
+
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
15
|
+
const domain = config.getDomain(block.slot, DOMAIN_RANDAO, block.slot);
|
|
14
16
|
return {
|
|
15
17
|
type: SignatureSetType.single,
|
|
16
18
|
pubkey: index2pubkey[block.proposerIndex],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"randao.js","sourceRoot":"","sources":["../../src/signatureSets/randao.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAc,GAAG,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"randao.js","sourceRoot":"","sources":["../../src/signatureSets/randao.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAc,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAEL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,UAAU,qBAAqB,CACnC,MAAoB,EACpB,YAA+B,EAC/B,KAAkB;IAElB,OAAO,kBAAkB,CAAC,2BAA2B,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;AACtF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CACzC,MAAoB,EACpB,YAA+B,EAC/B,KAAkB;IAElB,qCAAqC;IACrC,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7C,oHAAoH;IACpH,0GAA0G;IAC1G,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAEvE,OAAO;QACL,IAAI,EAAE,gBAAgB,CAAC,MAAM;QAC7B,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC;QACzC,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC;QACzD,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { BeaconConfig } from "@lodestar/config";
|
|
2
|
-
import { SignedBeaconBlock, phase0 } from "@lodestar/types";
|
|
2
|
+
import { SignedBeaconBlock, Slot, phase0 } from "@lodestar/types";
|
|
3
3
|
import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
|
|
4
|
-
import { CachedBeaconStateAllForks } from "../types.js";
|
|
5
4
|
import { ISignatureSet } from "../util/index.js";
|
|
6
|
-
export declare function verifyVoluntaryExitSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
5
|
+
export declare function verifyVoluntaryExitSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache, stateSlot: Slot, signedVoluntaryExit: phase0.SignedVoluntaryExit): boolean;
|
|
7
6
|
/**
|
|
8
7
|
* Extract signatures to allow validating all block signatures at once
|
|
9
8
|
*/
|
|
10
|
-
export declare function getVoluntaryExitSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
11
|
-
export declare function getVoluntaryExitsSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache,
|
|
9
|
+
export declare function getVoluntaryExitSignatureSet(config: BeaconConfig, index2pubkey: Index2PubkeyCache, stateSlot: Slot, signedVoluntaryExit: phase0.SignedVoluntaryExit): ISignatureSet;
|
|
10
|
+
export declare function getVoluntaryExitsSignatureSets(config: BeaconConfig, index2pubkey: Index2PubkeyCache, signedBlock: SignedBeaconBlock): ISignatureSet[];
|
|
12
11
|
//# sourceMappingURL=voluntaryExits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voluntaryExits.d.ts","sourceRoot":"","sources":["../../src/signatureSets/voluntaryExits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"voluntaryExits.d.ts","sourceRoot":"","sources":["../../src/signatureSets/voluntaryExits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAC,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,aAAa,EAKd,MAAM,kBAAkB,CAAC;AAE1B,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,IAAI,EACf,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,GAC9C,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,IAAI,EACf,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,GAC9C,aAAa,CAUf;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,iBAAiB,EAC/B,WAAW,EAAE,iBAAiB,GAC7B,aAAa,EAAE,CAOjB"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ssz } from "@lodestar/types";
|
|
2
2
|
import { SignatureSetType, computeSigningRoot, computeStartSlotAtEpoch, verifySignatureSet, } from "../util/index.js";
|
|
3
|
-
export function verifyVoluntaryExitSignature(config, index2pubkey,
|
|
4
|
-
return verifySignatureSet(getVoluntaryExitSignatureSet(config, index2pubkey,
|
|
3
|
+
export function verifyVoluntaryExitSignature(config, index2pubkey, stateSlot, signedVoluntaryExit) {
|
|
4
|
+
return verifySignatureSet(getVoluntaryExitSignatureSet(config, index2pubkey, stateSlot, signedVoluntaryExit));
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Extract signatures to allow validating all block signatures at once
|
|
8
8
|
*/
|
|
9
|
-
export function getVoluntaryExitSignatureSet(config, index2pubkey,
|
|
10
|
-
const
|
|
11
|
-
const domain = config.getDomainForVoluntaryExit(
|
|
9
|
+
export function getVoluntaryExitSignatureSet(config, index2pubkey, stateSlot, signedVoluntaryExit) {
|
|
10
|
+
const messageSlot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
|
|
11
|
+
const domain = config.getDomainForVoluntaryExit(stateSlot, messageSlot);
|
|
12
12
|
return {
|
|
13
13
|
type: SignatureSetType.single,
|
|
14
14
|
pubkey: index2pubkey[signedVoluntaryExit.message.validatorIndex],
|
|
@@ -16,7 +16,10 @@ export function getVoluntaryExitSignatureSet(config, index2pubkey, state, signed
|
|
|
16
16
|
signature: signedVoluntaryExit.signature,
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
export function getVoluntaryExitsSignatureSets(config, index2pubkey,
|
|
20
|
-
|
|
19
|
+
export function getVoluntaryExitsSignatureSets(config, index2pubkey, signedBlock) {
|
|
20
|
+
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
21
|
+
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
22
|
+
const blockSlot = signedBlock.message.slot;
|
|
23
|
+
return signedBlock.message.body.voluntaryExits.map((voluntaryExit) => getVoluntaryExitSignatureSet(config, index2pubkey, blockSlot, voluntaryExit));
|
|
21
24
|
}
|
|
22
25
|
//# sourceMappingURL=voluntaryExits.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voluntaryExits.js","sourceRoot":"","sources":["../../src/signatureSets/voluntaryExits.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"voluntaryExits.js","sourceRoot":"","sources":["../../src/signatureSets/voluntaryExits.ts"],"names":[],"mappings":"AACA,OAAO,EAAkC,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAEL,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,UAAU,4BAA4B,CAC1C,MAAoB,EACpB,YAA+B,EAC/B,SAAe,EACf,mBAA+C;IAE/C,OAAO,kBAAkB,CAAC,4BAA4B,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAChH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,MAAoB,EACpB,YAA+B,EAC/B,SAAe,EACf,mBAA+C;IAE/C,MAAM,WAAW,GAAG,uBAAuB,CAAC,mBAAmB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC/E,MAAM,MAAM,GAAG,MAAM,CAAC,yBAAyB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAExE,OAAO;QACL,IAAI,EAAE,gBAAgB,CAAC,MAAM;QAC7B,MAAM,EAAE,YAAY,CAAC,mBAAmB,CAAC,OAAO,CAAC,cAAc,CAAC;QAChE,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,aAAa,EAAE,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC;QAC9F,SAAS,EAAE,mBAAmB,CAAC,SAAS;KACzC,CAAC;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ib/stateTransition.js
CHANGED
|
@@ -52,8 +52,7 @@ export function stateTransition(state, signedBlock, options = {
|
|
|
52
52
|
// Includes state upgrades
|
|
53
53
|
postState = processSlotsWithTransientCache(postState, blockSlot, options, { metrics, validatorMonitor });
|
|
54
54
|
// Verify proposer signature only
|
|
55
|
-
if (verifyProposer &&
|
|
56
|
-
!verifyProposerSignature(postState.config, postState.epochCtx.index2pubkey, postState, signedBlock)) {
|
|
55
|
+
if (verifyProposer && !verifyProposerSignature(postState.config, postState.epochCtx.index2pubkey, signedBlock)) {
|
|
57
56
|
throw new Error("Invalid block signature");
|
|
58
57
|
}
|
|
59
58
|
// Process block
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stateTransition.js","sourceRoot":"","sources":["../src/stateTransition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAA2D,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAoB,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,yBAAyB,CAAC;AAC1G,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAiD,kBAAkB,EAAC,MAAM,iCAAiC,CAAC;AACnH,OAAO,EAAC,mBAAmB,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAA+B,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACnG,OAAO,EAAC,uBAAuB,EAAC,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,kBAAkB,EAAC,MAAM,8BAA8B,CAAC;AAWhE,OAAO,EAAC,kBAAkB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;YACD,IAAI,UAAU,KAAK,MAAM,CAAC,kBAAkB,EAAE,CAAC;gBAC7C,SAAS,GAAG,qBAAqB,CAAC,SAAmC,CAA8B,CAAC;YACtG,CAAC;YACD,IAAI,UAAU,KAAK,MAAM,CAAC,eAAe,EAAE,CAAC;gBAC1C,SAAS,GAAG,kBAAkB,CAAC,SAAqC,CAA8B,CAAC;YACrG,CAAC;YACD,IAAI,UAAU,KAAK,MAAM,CAAC,gBAAgB,EAAE,CAAC;gBAC3C,SAAS,GAAG,mBAAmB,CAAC,SAAkC,CAA8B,CAAC;YACnG,CAAC;YAED,CAAC;gBACC,MAAM,KAAK,GAAG,OAAO,EAAE,uBAAuB,CAAC,UAAU,CAAC,EAAC,IAAI,EAAE,mBAAmB,CAAC,iBAAiB,EAAC,CAAC,CAAC;gBACzG,uHAAuH;gBACvH,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;gBAChD,KAAK,EAAE,EAAE,CAAC;YACZ,CAAC;YAED,+GAA+G;YAC/G,0GAA0G;YAC1G,CAAC;gBACC,MAAM,KAAK,GAAG,OAAO,EAAE,yBAAyB,CAAC,UAAU,EAAE,CAAC;gBAC9D,SAAS,CAAC,MAAM,EAAE,CAAC;gBACnB,KAAK,EAAE,EAAE,CAAC;YACZ,CAAC;YAED,oIAAoI;YACpI,oBAAoB,EAAE,EAAE,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EpochCache } from "./cache/epochCache.js";
|
|
2
2
|
export type { EpochTransitionCache } from "./cache/epochTransitionCache.js";
|
|
3
3
|
export type { CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStateBellatrix, CachedBeaconStateCapella, CachedBeaconStateDeneb, CachedBeaconStateElectra, CachedBeaconStateExecutions, CachedBeaconStateFulu, CachedBeaconStateGloas, CachedBeaconStatePhase0, } from "./cache/stateCache.js";
|
|
4
|
-
export type { BeaconStateAllForks, BeaconStateAltair, BeaconStateBellatrix, BeaconStateCapella, BeaconStateDeneb, BeaconStateElectra, BeaconStateExecutions, BeaconStateFulu, BeaconStateGloas, BeaconStatePhase0, } from "./cache/types.js";
|
|
4
|
+
export type { BeaconStateAllForks, BeaconStateAltair, BeaconStateBellatrix, BeaconStateCapella, BeaconStateDeneb, BeaconStateElectra, BeaconStateExecutions, BeaconStateFulu, BeaconStateGloas, BeaconStatePhase0, ShufflingGetter, } from "./cache/types.js";
|
|
5
5
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
import { BeaconConfig } from "@lodestar/config";
|
|
2
2
|
import { Epoch, RootHex, ValidatorIndex } from "@lodestar/types";
|
|
3
|
-
import { GaugeExtra, Logger, NoLabels } from "@lodestar/utils";
|
|
4
3
|
import { BeaconStateAllForks } from "../types.js";
|
|
5
|
-
export interface ShufflingBuildProps {
|
|
6
|
-
state: BeaconStateAllForks;
|
|
7
|
-
activeIndices: Uint32Array;
|
|
8
|
-
}
|
|
9
|
-
export interface PublicShufflingCacheMetrics {
|
|
10
|
-
shufflingCache: {
|
|
11
|
-
nextShufflingNotOnEpochCache: GaugeExtra<NoLabels>;
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export interface IShufflingCache {
|
|
15
|
-
metrics: PublicShufflingCacheMetrics | null;
|
|
16
|
-
logger: Logger | null;
|
|
17
|
-
/**
|
|
18
|
-
* Gets a cached shuffling via the epoch and decision root. If the state and
|
|
19
|
-
* activeIndices are passed and a shuffling is not available it will be built
|
|
20
|
-
* synchronously. If the state is not passed and the shuffling is not available
|
|
21
|
-
* nothing will be returned.
|
|
22
|
-
*
|
|
23
|
-
* NOTE: If a shuffling is already queued and not calculated it will build and resolve
|
|
24
|
-
* the promise but the already queued build will happen at some later time
|
|
25
|
-
*/
|
|
26
|
-
getSync<T extends ShufflingBuildProps | undefined>(epoch: Epoch, decisionRoot: RootHex, buildProps?: T): T extends ShufflingBuildProps ? EpochShuffling : EpochShuffling | null;
|
|
27
|
-
/**
|
|
28
|
-
* Gets a cached shuffling via the epoch and decision root. Returns a promise
|
|
29
|
-
* for the shuffling if it hs not calculated yet. Returns null if a build has
|
|
30
|
-
* not been queued nor a shuffling was calculated.
|
|
31
|
-
*/
|
|
32
|
-
get(epoch: Epoch, decisionRoot: RootHex): Promise<EpochShuffling | null>;
|
|
33
|
-
/**
|
|
34
|
-
* Queue asynchronous build for an EpochShuffling
|
|
35
|
-
*/
|
|
36
|
-
build(epoch: Epoch, decisionRoot: RootHex, state: BeaconStateAllForks, activeIndices: Uint32Array): void;
|
|
37
|
-
}
|
|
38
4
|
/**
|
|
39
5
|
* Readonly interface for EpochShuffling.
|
|
40
6
|
*/
|
|
@@ -72,6 +38,7 @@ export type EpochShuffling = {
|
|
|
72
38
|
export declare function computeCommitteeCount(activeValidatorCount: number): number;
|
|
73
39
|
export declare function computeEpochShuffling(state: BeaconStateAllForks, activeIndices: Uint32Array, epoch: Epoch): EpochShuffling;
|
|
74
40
|
export declare function computeEpochShufflingAsync(state: BeaconStateAllForks, activeIndices: Uint32Array, epoch: Epoch): Promise<EpochShuffling>;
|
|
41
|
+
export declare function calculateDecisionRoot(state: BeaconStateAllForks, epoch: Epoch): RootHex;
|
|
75
42
|
/**
|
|
76
43
|
* Get the shuffling decision block root for the given epoch of given state
|
|
77
44
|
* - Special case close to genesis block, return the genesis block root
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochShuffling.d.ts","sourceRoot":"","sources":["../../src/util/epochShuffling.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAS9C,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAM,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"epochShuffling.d.ts","sourceRoot":"","sources":["../../src/util/epochShuffling.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,C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|
|
61
61
|
}
|
|
62
|
-
function calculateDecisionRoot(state, epoch) {
|
|
62
|
+
export function calculateDecisionRoot(state, epoch) {
|
|
63
63
|
const pivotSlot = computeStartSlotAtEpoch(epoch - 1) - 1;
|
|
64
64
|
return toRootHex(getBlockRootAtSlot(state, pivotSlot));
|
|
65
65
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epochShuffling.js","sourceRoot":"","sources":["../../src/util/epochShuffling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAEjF,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAiC,GAAG,EAAC,MAAM,iBAAiB,CAAC;AACpE,OAAO,
|
|
1
|
+
{"version":3,"file":"epochShuffling.js","sourceRoot":"","sources":["../../src/util/epochShuffling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAEjF,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAiC,GAAG,EAAC,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,uBAAuB,EAAC,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AA0ClC,MAAM,UAAU,qBAAqB,CAAC,oBAA4B;IAChE,MAAM,iBAAiB,GAAG,MAAM,CAAC,oBA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AAS,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC5C,MAAoB,EACpB,KAA0B,EAC1B,KAAY;IAEZ,OAAO,KAAK,CAAC,IAAI,GAAG,YAAY;QAC9B,CAAC,CAAC,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC;QACrC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC,YAAY,CAAC,uBAAuB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/G,CAAC"}
|
package/lib/util/execution.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { ForkName, ForkPostBellatrix, ForkPreGloas, ForkSeq } from "@lodestar/params";
|
|
2
|
-
import { BeaconBlock, BeaconBlockBody, BlindedBeaconBlockBody, ExecutionPayload, ExecutionPayloadHeader, capella } from "@lodestar/types";
|
|
2
|
+
import { BeaconBlock, BeaconBlockBody, BlindedBeaconBlock, BlindedBeaconBlockBody, ExecutionPayload, ExecutionPayloadHeader, capella } from "@lodestar/types";
|
|
3
3
|
import { BeaconStateAllForks, BeaconStateCapella, BeaconStateExecutions, CachedBeaconStateAllForks, CachedBeaconStateExecutions } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Execution enabled = merge is done.
|
|
6
|
+
* When (A) state has execution data OR (B) block has execution data
|
|
7
|
+
*/
|
|
8
|
+
export declare function isExecutionEnabled(state: BeaconStateExecutions, block: BeaconBlock | BlindedBeaconBlock): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Merge is complete when the state includes execution layer data:
|
|
11
|
+
* state.latestExecutionPayloadHeader NOT EMPTY or state is post-capella
|
|
12
|
+
*/
|
|
13
|
+
export declare function isMergeTransitionComplete(state: BeaconStateExecutions): boolean;
|
|
4
14
|
/** Type guard for bellatrix.BeaconState */
|
|
5
15
|
export declare function isExecutionStateType(state: BeaconStateAllForks): state is BeaconStateExecutions;
|
|
6
16
|
/** Type guard for capella.BeaconState */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/util/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,iBAAiB,EAAE,YAAY,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EAEtB,OAAO,
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../../src/util/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,iBAAiB,EAAE,YAAY,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACpF,OAAO,EACL,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EAEtB,OAAO,EAKR,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,mBAAmB,EAEnB,kBAAkB,EAClB,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC5B,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,WAAW,GAAG,kBAAkB,GAAG,OAAO,CAcjH;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAU/E;AAED,2CAA2C;AAC3C,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,IAAI,qBAAqB,CAE/F;AAED,yCAAyC;AACzC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,IAAI,kBAAkB,CAK1F;AAED,iDAAiD;AACjD,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,yBAAyB,GAAG,KAAK,IAAI,2BAA2B,CAEjH;AAED,wCAA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