@lodestar/state-transition 1.39.0-dev.b37f2bd1bd → 1.39.0-dev.b6bba4cb8c
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 +3 -2
- package/lib/block/isValidIndexedAttestation.d.ts.map +1 -1
- package/lib/block/isValidIndexedAttestation.js +4 -4
- 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.d.ts.map +1 -1
- package/lib/block/processAttestationsAltair.js +1 -1
- package/lib/block/processAttestationsAltair.js.map +1 -1
- package/lib/block/processAttesterSlashing.js +1 -1
- package/lib/block/processAttesterSlashing.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.map +1 -1
- package/lib/block/processProposerSlashing.js +1 -1
- 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 +3 -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.d.ts.map +1 -1
- package/lib/block/processVoluntaryExit.js +2 -1
- package/lib/block/processVoluntaryExit.js.map +1 -1
- package/lib/cache/epochCache.d.ts +0 -3
- package/lib/cache/epochCache.d.ts.map +1 -1
- package/lib/cache/epochCache.js +0 -3
- package/lib/cache/epochCache.js.map +1 -1
- package/lib/cache/stateCache.d.ts +1 -0
- package/lib/cache/stateCache.d.ts.map +1 -1
- package/lib/cache/stateCache.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/signatureSets/attesterSlashings.d.ts +5 -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/index.d.ts +3 -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 +6 -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 +3 -2
- package/lib/signatureSets/proposer.d.ts.map +1 -1
- package/lib/signatureSets/proposer.js +7 -5
- package/lib/signatureSets/proposer.js.map +1 -1
- package/lib/signatureSets/proposerSlashings.d.ts +4 -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 +3 -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 +5 -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.js +1 -1
- package/lib/stateTransition.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/package.json +6 -6
- package/src/block/index.ts +6 -2
- package/src/block/isValidIndexedAttestation.ts +7 -2
- package/src/block/processAttestationPhase0.ts +1 -0
- package/src/block/processAttestationsAltair.ts +7 -1
- package/src/block/processAttesterSlashing.ts +1 -1
- package/src/block/processExecutionPayload.ts +14 -8
- package/src/block/processProposerSlashing.ts +6 -1
- package/src/block/processRandao.ts +2 -2
- package/src/block/processSyncCommittee.ts +15 -4
- package/src/block/processVoluntaryExit.ts +4 -1
- package/src/cache/epochCache.ts +0 -3
- package/src/cache/stateCache.ts +1 -0
- package/src/index.ts +1 -2
- package/src/signatureSets/attesterSlashings.ts +14 -9
- package/src/signatureSets/index.ts +14 -11
- package/src/signatureSets/indexedAttestation.ts +18 -11
- package/src/signatureSets/proposer.ts +8 -5
- package/src/signatureSets/proposerSlashings.ts +10 -10
- package/src/signatureSets/randao.ts +7 -5
- package/src/signatureSets/voluntaryExits.ts +14 -9
- package/src/stateTransition.ts +1 -1
- package/src/util/execution.ts +39 -0
|
@@ -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(
|
|
5
|
-
return verifySignatureSet(getRandaoRevealSignatureSet(
|
|
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(
|
|
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":"
|
|
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,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BeaconConfig } from "@lodestar/config";
|
|
2
|
+
import { SignedBeaconBlock, Slot, phase0 } from "@lodestar/types";
|
|
2
3
|
import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
|
|
3
|
-
import { CachedBeaconStateAllForks } from "../types.js";
|
|
4
4
|
import { ISignatureSet } from "../util/index.js";
|
|
5
|
-
export declare function verifyVoluntaryExitSignature(index2pubkey: Index2PubkeyCache,
|
|
5
|
+
export declare function verifyVoluntaryExitSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache, stateSlot: Slot, signedVoluntaryExit: phase0.SignedVoluntaryExit): boolean;
|
|
6
6
|
/**
|
|
7
7
|
* Extract signatures to allow validating all block signatures at once
|
|
8
8
|
*/
|
|
9
|
-
export declare function getVoluntaryExitSignatureSet(index2pubkey: Index2PubkeyCache,
|
|
10
|
-
export declare function getVoluntaryExitsSignatureSets(
|
|
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[];
|
|
11
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,
|
|
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(index2pubkey,
|
|
4
|
-
return verifySignatureSet(getVoluntaryExitSignatureSet(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(index2pubkey,
|
|
10
|
-
const
|
|
11
|
-
const domain =
|
|
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(index2pubkey, state, signedVoluntar
|
|
|
16
16
|
signature: signedVoluntaryExit.signature,
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
export function getVoluntaryExitsSignatureSets(
|
|
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":"
|
|
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;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,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,cAAc,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,EAAE,CACnE,4BAA4B,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,CAAC,CAC7E,CAAC;AACJ,CAAC"}
|
package/lib/stateTransition.js
CHANGED
|
@@ -52,7 +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 && !verifyProposerSignature(postState.epochCtx.index2pubkey,
|
|
55
|
+
if (verifyProposer && !verifyProposerSignature(postState.config, postState.epochCtx.index2pubkey, signedBlock)) {
|
|
56
56
|
throw new Error("Invalid block signature");
|
|
57
57
|
}
|
|
58
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,EAAC,MAAM,iBAAiB,CAAC;AA8BnD;;GAEG;AACH,MAAM,CAAN,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IAC1B,uDAAmC,CAAA;IACnC,iDAA6B,CAAA;AAC/B,CAAC,EAHW,gBAAgB,KAAhB,gBAAgB,QAG3B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,uBAOX;AAPD,WAAY,uBAAuB;IACjC,+DAAoC,CAAA;IACpC,+DAAoC,CAAA;IACpC,gE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8B,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/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,wCAAwC;AACxC,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,eAAe,GACzB,SAAS,IAAI,eAAe,CAAC,iBAAiB,GAAG,YAAY,CAAC,CAEhE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB,GAAG,sBAAsB,CAErG;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,eAAe,GAAG,sBAAsB,GAC7C,gBAAgB,GAAG,sBAAsB,CAU3C;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,gBAAgB,GAAG,sBAAsB,GACjD,OAAO,IAAI,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAK1F;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,CAAC,6BAA6B,GAC7C,OAAO,IAAI,OAAO,CAAC,sBAAsB,CAE3C;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,GAAG,sBAAsB,CAuChH"}
|
package/lib/util/execution.js
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { ForkSeq } from "@lodestar/params";
|
|
2
|
-
import { isBlindedBeaconBlockBody, ssz, } from "@lodestar/types";
|
|
2
|
+
import { isBlindedBeaconBlockBody, isExecutionPayload, ssz, } from "@lodestar/types";
|
|
3
|
+
/**
|
|
4
|
+
* Execution enabled = merge is done.
|
|
5
|
+
* When (A) state has execution data OR (B) block has execution data
|
|
6
|
+
*/
|
|
7
|
+
export function isExecutionEnabled(state, block) {
|
|
8
|
+
if (isMergeTransitionComplete(state)) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
// Throws if not post-bellatrix block. A fork-guard before isExecutionEnabled() prevents this from happening
|
|
12
|
+
const payload = getFullOrBlindedPayload(block);
|
|
13
|
+
return isExecutionPayload(payload)
|
|
14
|
+
? !ssz.bellatrix.ExecutionPayload.equals(payload, ssz.bellatrix.ExecutionPayload.defaultValue())
|
|
15
|
+
: !ssz.bellatrix.ExecutionPayloadHeader.equals(state.latestExecutionPayloadHeader, ssz.bellatrix.ExecutionPayloadHeader.defaultValue());
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Merge is complete when the state includes execution layer data:
|
|
19
|
+
* state.latestExecutionPayloadHeader NOT EMPTY or state is post-capella
|
|
20
|
+
*/
|
|
21
|
+
export function isMergeTransitionComplete(state) {
|
|
22
|
+
if (isCapellaStateType(state)) {
|
|
23
|
+
// All networks have completed the merge transition before capella
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
return !ssz.bellatrix.ExecutionPayloadHeader.equals(state.latestExecutionPayloadHeader, ssz.bellatrix.ExecutionPayloadHeader.defaultValue());
|
|
27
|
+
}
|
|
3
28
|
/** Type guard for bellatrix.BeaconState */
|
|
4
29
|
export function isExecutionStateType(state) {
|
|
5
30
|
return state.latestExecutionPayloadHeader !== undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/util/execution.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACpF,OAAO,
|
|
1
|
+
{"version":3,"file":"execution.js","sourceRoot":"","sources":["../../src/util/execution.ts"],"names":[],"mappings":"A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QAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,gBAAgB;KACjB,CAAC;IAEF,IAAI,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,sBAAyD,CAAC,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAC9G,OAAoC,CAAC,WAAW,CAClD,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAC1B,+GAA+G;QAC9G,sBAAuD,CAAC,WAAW,GAClE,OACD,CAAC,WAAW,CAAC;QACb,sBAAuD,CAAC,aAAa,GACpE,OACD,CAAC,aAAa,CAAC;IAClB,CAAC;IAED,uBAAuB;IAEvB,OAAO,sBAAsB,CAAC;AAChC,CAAC"}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.39.0-dev.
|
|
14
|
+
"version": "1.39.0-dev.b6bba4cb8c",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"@chainsafe/pubkey-index-map": "^3.0.0",
|
|
63
63
|
"@chainsafe/ssz": "^1.2.2",
|
|
64
64
|
"@chainsafe/swap-or-not-shuffle": "^1.2.1",
|
|
65
|
-
"@lodestar/config": "1.39.0-dev.
|
|
66
|
-
"@lodestar/params": "1.39.0-dev.
|
|
67
|
-
"@lodestar/types": "1.39.0-dev.
|
|
68
|
-
"@lodestar/utils": "1.39.0-dev.
|
|
65
|
+
"@lodestar/config": "1.39.0-dev.b6bba4cb8c",
|
|
66
|
+
"@lodestar/params": "1.39.0-dev.b6bba4cb8c",
|
|
67
|
+
"@lodestar/types": "1.39.0-dev.b6bba4cb8c",
|
|
68
|
+
"@lodestar/utils": "1.39.0-dev.b6bba4cb8c",
|
|
69
69
|
"bigint-buffer": "^1.1.5"
|
|
70
70
|
},
|
|
71
71
|
"keywords": [
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"beacon",
|
|
75
75
|
"blockchain"
|
|
76
76
|
],
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "0218a7a470c8b2afbf0f1fd407863bc1be198b59"
|
|
78
78
|
}
|
package/src/block/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
CachedBeaconStateCapella,
|
|
8
8
|
CachedBeaconStateGloas,
|
|
9
9
|
} from "../types.js";
|
|
10
|
-
import {getFullOrBlindedPayload} from "../util/execution.js";
|
|
10
|
+
import {getFullOrBlindedPayload, isExecutionEnabled} from "../util/execution.js";
|
|
11
11
|
import {BlockExternalData, DataAvailabilityStatus} from "./externalData.js";
|
|
12
12
|
import {processBlobKzgCommitments} from "./processBlobKzgCommitments.js";
|
|
13
13
|
import {processBlockHeader} from "./processBlockHeader.js";
|
|
@@ -67,7 +67,11 @@ export function processBlock(
|
|
|
67
67
|
// The call to the process_execution_payload must happen before the call to the process_randao as the former depends
|
|
68
68
|
// on the randao_mix computed with the reveal of the previous block.
|
|
69
69
|
// TODO GLOAS: We call processExecutionPayload somewhere else post-gloas
|
|
70
|
-
if (
|
|
70
|
+
if (
|
|
71
|
+
fork < ForkSeq.gloas &&
|
|
72
|
+
fork >= ForkSeq.bellatrix &&
|
|
73
|
+
isExecutionEnabled(state as CachedBeaconStateBellatrix, block)
|
|
74
|
+
) {
|
|
71
75
|
processExecutionPayload(fork, state as CachedBeaconStateBellatrix, block.body, externalData);
|
|
72
76
|
}
|
|
73
77
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {BeaconConfig} from "@lodestar/config";
|
|
1
2
|
import {ForkSeq, MAX_COMMITTEES_PER_SLOT, MAX_VALIDATORS_PER_COMMITTEE} from "@lodestar/params";
|
|
2
3
|
import {IndexedAttestation, IndexedAttestationBigint} from "@lodestar/types";
|
|
3
4
|
import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
|
|
@@ -9,6 +10,7 @@ import {verifySignatureSet} from "../util/index.js";
|
|
|
9
10
|
* Check if `indexedAttestation` has sorted and unique indices and a valid aggregate signature.
|
|
10
11
|
*/
|
|
11
12
|
export function isValidIndexedAttestation(
|
|
13
|
+
config: BeaconConfig,
|
|
12
14
|
index2pubkey: Index2PubkeyCache,
|
|
13
15
|
state: CachedBeaconStateAllForks,
|
|
14
16
|
indexedAttestation: IndexedAttestation,
|
|
@@ -19,12 +21,13 @@ export function isValidIndexedAttestation(
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
if (verifySignature) {
|
|
22
|
-
return verifySignatureSet(getIndexedAttestationSignatureSet(index2pubkey, state, indexedAttestation));
|
|
24
|
+
return verifySignatureSet(getIndexedAttestationSignatureSet(config, index2pubkey, state.slot, indexedAttestation));
|
|
23
25
|
}
|
|
24
26
|
return true;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export function isValidIndexedAttestationBigint(
|
|
30
|
+
config: BeaconConfig,
|
|
28
31
|
index2pubkey: Index2PubkeyCache,
|
|
29
32
|
state: CachedBeaconStateAllForks,
|
|
30
33
|
indexedAttestation: IndexedAttestationBigint,
|
|
@@ -35,7 +38,9 @@ export function isValidIndexedAttestationBigint(
|
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
if (verifySignature) {
|
|
38
|
-
return verifySignatureSet(
|
|
41
|
+
return verifySignatureSet(
|
|
42
|
+
getIndexedAttestationBigintSignatureSet(config, index2pubkey, state.slot, indexedAttestation)
|
|
43
|
+
);
|
|
39
44
|
}
|
|
40
45
|
return true;
|
|
41
46
|
}
|
|
@@ -64,7 +64,13 @@ export function processAttestationsAltair(
|
|
|
64
64
|
// TODO: Why should we verify an indexed attestation that we just created? If it's just for the signature
|
|
65
65
|
// we can verify only that and nothing else.
|
|
66
66
|
if (verifySignature) {
|
|
67
|
-
const sigSet = getAttestationWithIndicesSignatureSet(
|
|
67
|
+
const sigSet = getAttestationWithIndicesSignatureSet(
|
|
68
|
+
state.config,
|
|
69
|
+
epochCtx.index2pubkey,
|
|
70
|
+
state.slot,
|
|
71
|
+
attestation,
|
|
72
|
+
attestingIndices
|
|
73
|
+
);
|
|
68
74
|
if (!verifySignatureSet(sigSet)) {
|
|
69
75
|
throw new Error("Attestation signature is not valid");
|
|
70
76
|
}
|
|
@@ -55,7 +55,7 @@ export function assertValidAttesterSlashing(
|
|
|
55
55
|
// be higher than the clock and the slashing would still be valid. Same applies to attestation data index, which
|
|
56
56
|
// can be any arbitrary value. Must use bigint variants to hash correctly to all possible values
|
|
57
57
|
for (const [i, attestation] of [attestation1, attestation2].entries()) {
|
|
58
|
-
if (!isValidIndexedAttestationBigint(index2pubkey, state, attestation, verifySignatures)) {
|
|
58
|
+
if (!isValidIndexedAttestationBigint(state.config, index2pubkey, state, attestation, verifySignatures)) {
|
|
59
59
|
throw new Error(`AttesterSlashing attestation${i} is invalid`);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -3,7 +3,11 @@ import {ForkName, ForkSeq, isForkPostDeneb} from "@lodestar/params";
|
|
|
3
3
|
import {BeaconBlockBody, BlindedBeaconBlockBody, deneb, isExecutionPayload} from "@lodestar/types";
|
|
4
4
|
import {toHex, toRootHex} from "@lodestar/utils";
|
|
5
5
|
import {CachedBeaconStateBellatrix, CachedBeaconStateCapella} from "../types.js";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
executionPayloadToPayloadHeader,
|
|
8
|
+
getFullOrBlindedPayloadFromBody,
|
|
9
|
+
isMergeTransitionComplete,
|
|
10
|
+
} from "../util/execution.js";
|
|
7
11
|
import {computeEpochAtSlot, computeTimeAtSlot, getRandaoMix} from "../util/index.js";
|
|
8
12
|
import {BlockExternalData, ExecutionPayloadStatus} from "./externalData.js";
|
|
9
13
|
|
|
@@ -17,13 +21,15 @@ export function processExecutionPayload(
|
|
|
17
21
|
const forkName = ForkName[ForkSeq[fork] as ForkName];
|
|
18
22
|
// Verify consistency of the parent hash, block number, base fee per gas and gas limit
|
|
19
23
|
// with respect to the previous execution payload header
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if (isMergeTransitionComplete(state)) {
|
|
25
|
+
const {latestExecutionPayloadHeader} = state;
|
|
26
|
+
if (!byteArrayEquals(payload.parentHash, latestExecutionPayloadHeader.blockHash)) {
|
|
27
|
+
throw Error(
|
|
28
|
+
`Invalid execution payload parentHash ${toRootHex(payload.parentHash)} latest blockHash ${toRootHex(
|
|
29
|
+
latestExecutionPayloadHeader.blockHash
|
|
30
|
+
)}`
|
|
31
|
+
);
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
// Verify random
|
|
@@ -77,7 +77,12 @@ export function assertValidProposerSlashing(
|
|
|
77
77
|
|
|
78
78
|
// verify signatures
|
|
79
79
|
if (verifySignatures) {
|
|
80
|
-
const signatureSets = getProposerSlashingSignatureSets(
|
|
80
|
+
const signatureSets = getProposerSlashingSignatureSets(
|
|
81
|
+
state.config,
|
|
82
|
+
state.epochCtx.index2pubkey,
|
|
83
|
+
state.slot,
|
|
84
|
+
proposerSlashing
|
|
85
|
+
);
|
|
81
86
|
for (let i = 0; i < signatureSets.length; i++) {
|
|
82
87
|
if (!verifySignatureSet(signatureSets[i])) {
|
|
83
88
|
throw new Error(`ProposerSlashing header${i + 1} signature invalid`);
|
|
@@ -12,12 +12,12 @@ import {getRandaoMix} from "../util/index.js";
|
|
|
12
12
|
* PERF: Fixed work independent of block contents.
|
|
13
13
|
*/
|
|
14
14
|
export function processRandao(state: CachedBeaconStateAllForks, block: BeaconBlock, verifySignature = true): void {
|
|
15
|
-
const {epochCtx} = state;
|
|
15
|
+
const {epochCtx, config} = state;
|
|
16
16
|
const epoch = epochCtx.epoch;
|
|
17
17
|
const randaoReveal = block.body.randaoReveal;
|
|
18
18
|
|
|
19
19
|
// verify RANDAO reveal
|
|
20
|
-
if (verifySignature && !verifyRandaoSignature(epochCtx.index2pubkey,
|
|
20
|
+
if (verifySignature && !verifyRandaoSignature(config, epochCtx.index2pubkey, block)) {
|
|
21
21
|
throw new Error("RANDAO reveal is an invalid signature");
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {byteArrayEquals} from "@chainsafe/ssz";
|
|
2
|
+
import {BeaconConfig} from "@lodestar/config";
|
|
2
3
|
import {DOMAIN_SYNC_COMMITTEE, SYNC_COMMITTEE_SIZE} from "@lodestar/params";
|
|
3
4
|
import {altair, ssz} from "@lodestar/types";
|
|
4
5
|
import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
|
|
6
|
+
import {SyncCommitteeCache} from "../cache/syncCommitteeCache.js";
|
|
5
7
|
import {G2_POINT_AT_INFINITY} from "../constants/index.js";
|
|
6
8
|
import {CachedBeaconStateAllForks} from "../types.js";
|
|
7
9
|
import {
|
|
@@ -24,7 +26,13 @@ export function processSyncAggregate(
|
|
|
24
26
|
if (verifySignatures) {
|
|
25
27
|
// This is to conform to the spec - we want the signature to be verified
|
|
26
28
|
const participantIndices = block.body.syncAggregate.syncCommitteeBits.intersectValues(committeeIndices);
|
|
27
|
-
const signatureSet = getSyncCommitteeSignatureSet(
|
|
29
|
+
const signatureSet = getSyncCommitteeSignatureSet(
|
|
30
|
+
state.config,
|
|
31
|
+
state.epochCtx.index2pubkey,
|
|
32
|
+
state.epochCtx.currentSyncCommitteeIndexed,
|
|
33
|
+
block,
|
|
34
|
+
participantIndices
|
|
35
|
+
);
|
|
28
36
|
// When there's no participation we consider the signature valid and just ignore i
|
|
29
37
|
if (signatureSet !== null && !verifySignatureSet(signatureSet)) {
|
|
30
38
|
throw Error("Sync committee signature invalid");
|
|
@@ -64,8 +72,9 @@ export function processSyncAggregate(
|
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
export function getSyncCommitteeSignatureSet(
|
|
75
|
+
config: BeaconConfig,
|
|
67
76
|
index2pubkey: Index2PubkeyCache,
|
|
68
|
-
|
|
77
|
+
currentSyncCommitteeIndexed: SyncCommitteeCache,
|
|
69
78
|
block: altair.BeaconBlock,
|
|
70
79
|
/** Optional parameter to prevent computing it twice */
|
|
71
80
|
participantIndices?: number[]
|
|
@@ -93,7 +102,7 @@ export function getSyncCommitteeSignatureSet(
|
|
|
93
102
|
const rootSigned = block.parentRoot;
|
|
94
103
|
|
|
95
104
|
if (!participantIndices) {
|
|
96
|
-
const committeeIndices =
|
|
105
|
+
const committeeIndices = currentSyncCommitteeIndexed.validatorIndices;
|
|
97
106
|
participantIndices = syncAggregate.syncCommitteeBits.intersectValues(committeeIndices);
|
|
98
107
|
}
|
|
99
108
|
|
|
@@ -107,7 +116,9 @@ export function getSyncCommitteeSignatureSet(
|
|
|
107
116
|
throw Error("Empty sync committee signature is not infinity");
|
|
108
117
|
}
|
|
109
118
|
|
|
110
|
-
|
|
119
|
+
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
120
|
+
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
121
|
+
const domain = config.getDomain(block.slot, DOMAIN_SYNC_COMMITTEE, previousSlot);
|
|
111
122
|
|
|
112
123
|
return {
|
|
113
124
|
type: SignatureSetType.aggregate,
|
|
@@ -74,7 +74,10 @@ export function getVoluntaryExitValidity(
|
|
|
74
74
|
return VoluntaryExitValidity.pendingWithdrawals;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
if (
|
|
77
|
+
if (
|
|
78
|
+
verifySignature &&
|
|
79
|
+
!verifyVoluntaryExitSignature(state.config, epochCtx.index2pubkey, state.slot, signedVoluntaryExit)
|
|
80
|
+
) {
|
|
78
81
|
return VoluntaryExitValidity.invalidSignature;
|
|
79
82
|
}
|
|
80
83
|
|
package/src/cache/epochCache.ts
CHANGED
|
@@ -108,9 +108,6 @@ export class EpochCache {
|
|
|
108
108
|
/**
|
|
109
109
|
* Unique globally shared pubkey registry. There should only exist one for the entire application.
|
|
110
110
|
*
|
|
111
|
-
* TODO: this is a hack, we need a safety mechanism in case a bad eth1 majority vote is in,
|
|
112
|
-
* or handle non finalized data differently, or use an immutable.js structure for cheap copies
|
|
113
|
-
*
|
|
114
111
|
* $VALIDATOR_COUNT x 192 char String -> Number Map
|
|
115
112
|
*/
|
|
116
113
|
pubkey2index: PubkeyIndexMap;
|
package/src/cache/stateCache.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from "./types.js";
|
|
18
18
|
|
|
19
19
|
export type BeaconStateCache = {
|
|
20
|
+
/** @deprecated should not access config outside of state-transition package */
|
|
20
21
|
config: BeaconConfig;
|
|
21
22
|
epochCtx: EpochCache;
|
|
22
23
|
/** Count of clones created from this BeaconStateCache instance. readonly to prevent accidental usage downstream */
|
package/src/index.ts
CHANGED
|
@@ -27,8 +27,7 @@ export {
|
|
|
27
27
|
createEmptyEpochCacheImmutableData,
|
|
28
28
|
} from "./cache/epochCache.js";
|
|
29
29
|
export {type EpochTransitionCache, beforeProcessEpoch} from "./cache/epochTransitionCache.js";
|
|
30
|
-
|
|
31
|
-
export {type Index2PubkeyCache} from "./cache/pubkeyCache.js";
|
|
30
|
+
export {type Index2PubkeyCache, syncPubkeys} from "./cache/pubkeyCache.js";
|
|
32
31
|
// Main state caches
|
|
33
32
|
export {
|
|
34
33
|
type BeaconStateCache,
|
|
@@ -1,38 +1,43 @@
|
|
|
1
|
+
import {BeaconConfig} from "@lodestar/config";
|
|
1
2
|
import {DOMAIN_BEACON_ATTESTER} from "@lodestar/params";
|
|
2
|
-
import {AttesterSlashing, IndexedAttestationBigint, SignedBeaconBlock, ssz} from "@lodestar/types";
|
|
3
|
+
import {AttesterSlashing, IndexedAttestationBigint, SignedBeaconBlock, Slot, ssz} from "@lodestar/types";
|
|
3
4
|
import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
|
|
4
|
-
import {CachedBeaconStateAllForks} from "../types.js";
|
|
5
5
|
import {ISignatureSet, SignatureSetType, computeSigningRoot, computeStartSlotAtEpoch} from "../util/index.js";
|
|
6
6
|
|
|
7
7
|
/** Get signature sets from all AttesterSlashing objects in a block */
|
|
8
8
|
export function getAttesterSlashingsSignatureSets(
|
|
9
|
+
config: BeaconConfig,
|
|
9
10
|
index2pubkey: Index2PubkeyCache,
|
|
10
|
-
state: CachedBeaconStateAllForks,
|
|
11
11
|
signedBlock: SignedBeaconBlock
|
|
12
12
|
): ISignatureSet[] {
|
|
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 blockSlot = signedBlock.message.slot;
|
|
13
16
|
return signedBlock.message.body.attesterSlashings.flatMap((attesterSlashing) =>
|
|
14
|
-
getAttesterSlashingSignatureSets(index2pubkey,
|
|
17
|
+
getAttesterSlashingSignatureSets(config, index2pubkey, blockSlot, attesterSlashing)
|
|
15
18
|
);
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
/** Get signature sets from a single AttesterSlashing object */
|
|
19
22
|
export function getAttesterSlashingSignatureSets(
|
|
23
|
+
config: BeaconConfig,
|
|
20
24
|
index2pubkey: Index2PubkeyCache,
|
|
21
|
-
|
|
25
|
+
stateSlot: Slot,
|
|
22
26
|
attesterSlashing: AttesterSlashing
|
|
23
27
|
): ISignatureSet[] {
|
|
24
28
|
return [attesterSlashing.attestation1, attesterSlashing.attestation2].map((attestation) =>
|
|
25
|
-
getIndexedAttestationBigintSignatureSet(index2pubkey,
|
|
29
|
+
getIndexedAttestationBigintSignatureSet(config, index2pubkey, stateSlot, attestation)
|
|
26
30
|
);
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
export function getIndexedAttestationBigintSignatureSet(
|
|
34
|
+
config: BeaconConfig,
|
|
30
35
|
index2pubkey: Index2PubkeyCache,
|
|
31
|
-
|
|
36
|
+
stateSlot: Slot,
|
|
32
37
|
indexedAttestation: IndexedAttestationBigint
|
|
33
38
|
): ISignatureSet {
|
|
34
|
-
const
|
|
35
|
-
const domain =
|
|
39
|
+
const messageSlot = computeStartSlotAtEpoch(Number(indexedAttestation.data.target.epoch as bigint));
|
|
40
|
+
const domain = config.getDomain(stateSlot, DOMAIN_BEACON_ATTESTER, messageSlot);
|
|
36
41
|
|
|
37
42
|
return {
|
|
38
43
|
type: SignatureSetType.aggregate,
|