@lodestar/state-transition 1.39.0-dev.b255111a20 → 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/isValidIndexedAttestation.d.ts.map +1 -1
- package/lib/block/isValidIndexedAttestation.js +2 -2
- package/lib/block/isValidIndexedAttestation.js.map +1 -1
- package/lib/block/processAttestationsAltair.js +1 -1
- package/lib/block/processAttestationsAltair.js.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 +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/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/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 +2 -2
- package/lib/signatureSets/proposer.d.ts.map +1 -1
- package/lib/signatureSets/proposer.js +7 -4
- 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/package.json +6 -6
- package/src/block/isValidIndexedAttestation.ts +4 -2
- package/src/block/processAttestationsAltair.ts +1 -1
- package/src/block/processProposerSlashing.ts +1 -1
- package/src/block/processRandao.ts +2 -2
- package/src/block/processSyncCommittee.ts +7 -4
- package/src/block/processVoluntaryExit.ts +1 -1
- package/src/signatureSets/attesterSlashings.ts +10 -9
- package/src/signatureSets/index.ts +11 -11
- package/src/signatureSets/indexedAttestation.ts +12 -11
- package/src/signatureSets/proposer.ts +5 -4
- 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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {BeaconConfig} from "@lodestar/config";
|
|
2
|
-
import {SignedBeaconBlock, phase0, ssz} from "@lodestar/types";
|
|
2
|
+
import {SignedBeaconBlock, Slot, phase0, ssz} from "@lodestar/types";
|
|
3
3
|
import {Index2PubkeyCache} from "../cache/pubkeyCache.js";
|
|
4
|
-
import {CachedBeaconStateAllForks} from "../types.js";
|
|
5
4
|
import {
|
|
6
5
|
ISignatureSet,
|
|
7
6
|
SignatureSetType,
|
|
@@ -13,10 +12,10 @@ import {
|
|
|
13
12
|
export function verifyVoluntaryExitSignature(
|
|
14
13
|
config: BeaconConfig,
|
|
15
14
|
index2pubkey: Index2PubkeyCache,
|
|
16
|
-
|
|
15
|
+
stateSlot: Slot,
|
|
17
16
|
signedVoluntaryExit: phase0.SignedVoluntaryExit
|
|
18
17
|
): boolean {
|
|
19
|
-
return verifySignatureSet(getVoluntaryExitSignatureSet(config, index2pubkey,
|
|
18
|
+
return verifySignatureSet(getVoluntaryExitSignatureSet(config, index2pubkey, stateSlot, signedVoluntaryExit));
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
/**
|
|
@@ -25,11 +24,11 @@ export function verifyVoluntaryExitSignature(
|
|
|
25
24
|
export function getVoluntaryExitSignatureSet(
|
|
26
25
|
config: BeaconConfig,
|
|
27
26
|
index2pubkey: Index2PubkeyCache,
|
|
28
|
-
|
|
27
|
+
stateSlot: Slot,
|
|
29
28
|
signedVoluntaryExit: phase0.SignedVoluntaryExit
|
|
30
29
|
): ISignatureSet {
|
|
31
|
-
const
|
|
32
|
-
const domain = config.getDomainForVoluntaryExit(
|
|
30
|
+
const messageSlot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
|
|
31
|
+
const domain = config.getDomainForVoluntaryExit(stateSlot, messageSlot);
|
|
33
32
|
|
|
34
33
|
return {
|
|
35
34
|
type: SignatureSetType.single,
|
|
@@ -42,10 +41,12 @@ export function getVoluntaryExitSignatureSet(
|
|
|
42
41
|
export function getVoluntaryExitsSignatureSets(
|
|
43
42
|
config: BeaconConfig,
|
|
44
43
|
index2pubkey: Index2PubkeyCache,
|
|
45
|
-
state: CachedBeaconStateAllForks,
|
|
46
44
|
signedBlock: SignedBeaconBlock
|
|
47
45
|
): ISignatureSet[] {
|
|
46
|
+
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
47
|
+
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
48
|
+
const blockSlot = signedBlock.message.slot;
|
|
48
49
|
return signedBlock.message.body.voluntaryExits.map((voluntaryExit) =>
|
|
49
|
-
getVoluntaryExitSignatureSet(config, index2pubkey,
|
|
50
|
+
getVoluntaryExitSignatureSet(config, index2pubkey, blockSlot, voluntaryExit)
|
|
50
51
|
);
|
|
51
52
|
}
|
package/src/stateTransition.ts
CHANGED
|
@@ -111,10 +111,7 @@ export function stateTransition(
|
|
|
111
111
|
postState = processSlotsWithTransientCache(postState, blockSlot, options, {metrics, validatorMonitor});
|
|
112
112
|
|
|
113
113
|
// Verify proposer signature only
|
|
114
|
-
if (
|
|
115
|
-
verifyProposer &&
|
|
116
|
-
!verifyProposerSignature(postState.config, postState.epochCtx.index2pubkey, postState, signedBlock)
|
|
117
|
-
) {
|
|
114
|
+
if (verifyProposer && !verifyProposerSignature(postState.config, postState.epochCtx.index2pubkey, signedBlock)) {
|
|
118
115
|
throw new Error("Invalid block signature");
|
|
119
116
|
}
|
|
120
117
|
|