@lodestar/state-transition 1.40.0-dev.c7b6a784da → 1.40.0-dev.cfd894719f
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/isValidIndexedPayloadAttestation.d.ts.map +1 -1
- package/lib/block/isValidIndexedPayloadAttestation.js +1 -1
- package/lib/block/isValidIndexedPayloadAttestation.js.map +1 -1
- package/lib/block/processAttestationsAltair.d.ts.map +1 -1
- package/lib/block/processAttestationsAltair.js +2 -2
- package/lib/block/processAttestationsAltair.js.map +1 -1
- package/lib/block/processExecutionPayloadBid.d.ts.map +1 -1
- package/lib/block/processExecutionPayloadBid.js +4 -4
- package/lib/block/processExecutionPayloadBid.js.map +1 -1
- package/lib/block/processProposerSlashing.js +2 -2
- package/lib/block/processProposerSlashing.js.map +1 -1
- package/lib/block/processSyncCommittee.d.ts +1 -2
- package/lib/block/processSyncCommittee.d.ts.map +1 -1
- package/lib/block/processSyncCommittee.js +5 -5
- package/lib/block/processSyncCommittee.js.map +1 -1
- package/lib/signatureSets/attesterSlashings.d.ts +3 -4
- package/lib/signatureSets/attesterSlashings.d.ts.map +1 -1
- package/lib/signatureSets/attesterSlashings.js +6 -6
- package/lib/signatureSets/attesterSlashings.js.map +1 -1
- package/lib/signatureSets/blsToExecutionChange.d.ts +3 -3
- package/lib/signatureSets/blsToExecutionChange.d.ts.map +1 -1
- package/lib/signatureSets/blsToExecutionChange.js.map +1 -1
- package/lib/signatureSets/executionPayloadBid.d.ts +5 -0
- package/lib/signatureSets/executionPayloadBid.d.ts.map +1 -0
- package/lib/signatureSets/executionPayloadBid.js +8 -0
- package/lib/signatureSets/executionPayloadBid.js.map +1 -0
- package/lib/signatureSets/executionPayloadEnvelope.d.ts +4 -0
- package/lib/signatureSets/executionPayloadEnvelope.d.ts.map +1 -0
- package/lib/signatureSets/executionPayloadEnvelope.js +8 -0
- package/lib/signatureSets/executionPayloadEnvelope.js.map +1 -0
- package/lib/signatureSets/index.d.ts +3 -2
- package/lib/signatureSets/index.d.ts.map +1 -1
- package/lib/signatureSets/index.js +10 -8
- package/lib/signatureSets/index.js.map +1 -1
- package/lib/signatureSets/indexedAttestation.d.ts +3 -4
- package/lib/signatureSets/indexedAttestation.d.ts.map +1 -1
- package/lib/signatureSets/indexedAttestation.js +6 -6
- package/lib/signatureSets/indexedAttestation.js.map +1 -1
- package/lib/signatureSets/indexedPayloadAttestation.d.ts +2 -2
- package/lib/signatureSets/indexedPayloadAttestation.js +1 -1
- package/lib/signatureSets/indexedPayloadAttestation.js.map +1 -1
- package/lib/signatureSets/proposer.d.ts +3 -3
- package/lib/signatureSets/proposer.d.ts.map +1 -1
- package/lib/signatureSets/proposer.js +12 -12
- package/lib/signatureSets/proposer.js.map +1 -1
- package/lib/signatureSets/proposerSlashings.d.ts +2 -3
- package/lib/signatureSets/proposerSlashings.d.ts.map +1 -1
- package/lib/signatureSets/proposerSlashings.js +6 -6
- package/lib/signatureSets/proposerSlashings.js.map +1 -1
- package/lib/signatureSets/randao.d.ts +1 -1
- package/lib/signatureSets/randao.d.ts.map +1 -1
- package/lib/signatureSets/randao.js +4 -4
- package/lib/signatureSets/randao.js.map +1 -1
- package/lib/signatureSets/voluntaryExits.d.ts +2 -2
- package/lib/signatureSets/voluntaryExits.d.ts.map +1 -1
- package/lib/signatureSets/voluntaryExits.js +6 -6
- package/lib/signatureSets/voluntaryExits.js.map +1 -1
- package/lib/util/gloas.d.ts +10 -9
- package/lib/util/gloas.d.ts.map +1 -1
- package/lib/util/gloas.js.map +1 -1
- package/lib/util/index.d.ts +1 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +1 -0
- package/lib/util/index.js.map +1 -1
- package/lib/util/signatureSets.d.ts +38 -5
- package/lib/util/signatureSets.d.ts.map +1 -1
- package/lib/util/signatureSets.js +48 -6
- package/lib/util/signatureSets.js.map +1 -1
- package/package.json +7 -7
- package/src/block/isValidIndexedAttestation.ts +3 -2
- package/src/block/isValidIndexedPayloadAttestation.ts +4 -1
- package/src/block/processAttestationsAltair.ts +2 -8
- package/src/block/processExecutionPayloadBid.ts +4 -4
- package/src/block/processProposerSlashing.ts +2 -2
- package/src/block/processSyncCommittee.ts +3 -6
- package/src/signatureSets/attesterSlashings.ts +3 -7
- package/src/signatureSets/blsToExecutionChange.ts +3 -3
- package/src/signatureSets/executionPayloadBid.ts +15 -0
- package/src/signatureSets/executionPayloadEnvelope.ts +13 -0
- package/src/signatureSets/index.ts +8 -9
- package/src/signatureSets/indexedAttestation.ts +2 -7
- package/src/signatureSets/indexedPayloadAttestation.ts +3 -3
- package/src/signatureSets/proposer.ts +8 -12
- package/src/signatureSets/proposerSlashings.ts +4 -7
- package/src/signatureSets/randao.ts +4 -8
- package/src/signatureSets/voluntaryExits.ts +5 -10
- package/src/util/gloas.ts +19 -11
- package/src/util/index.ts +1 -0
- package/src/util/signatureSets.ts +84 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexedPayloadAttestation.js","sourceRoot":"","sources":["../../src/signatureSets/indexedPayloadAttestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAQ,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAgB,kBAAkB,EAAE,yCAAyC,EAAC,MAAM,kBAAkB,CAAC;AAE9G,MAAM,UAAU,wCAAwC,CACtD,KAA6B,EAC7B,yBAA0D;IAE1D,OAAO,yCAAyC,CAC9C,yBAAyB,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"indexedPayloadAttestation.js","sourceRoot":"","sources":["../../src/signatureSets/indexedPayloadAttestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAQ,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EAAgB,kBAAkB,EAAE,yCAAyC,EAAC,MAAM,kBAAkB,CAAC;AAE9G,MAAM,UAAU,wCAAwC,CACtD,KAA6B,EAC7B,yBAA0D;IAE1D,OAAO,yCAAyC,CAC9C,yBAAyB,CAAC,gBAAgB,EAC1C,oCAAoC,CAAC,KAAK,EAAE,yBAAyB,CAAC,IAAI,CAAC,EAC3E,yBAAyB,CAAC,SAAS,CACpC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,KAA6B,EAC7B,IAAkC;IAElC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAEvE,OAAO,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,sBAAsB,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, phase0 } from "@lode
|
|
|
3
3
|
import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
|
|
4
4
|
import { ISignatureSet } from "../util/signatureSets.js";
|
|
5
5
|
export declare function verifyProposerSignature(config: BeaconConfig, index2pubkey: Index2PubkeyCache, signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock): boolean;
|
|
6
|
-
export declare function getBlockProposerSignatureSet(config: BeaconConfig,
|
|
7
|
-
export declare function getBlockHeaderProposerSignatureSetByParentStateSlot(config: BeaconConfig,
|
|
8
|
-
export declare function getBlockHeaderProposerSignatureSetByHeaderSlot(config: BeaconConfig,
|
|
6
|
+
export declare function getBlockProposerSignatureSet(config: BeaconConfig, signedBlock: SignedBeaconBlock | SignedBlindedBeaconBlock): ISignatureSet;
|
|
7
|
+
export declare function getBlockHeaderProposerSignatureSetByParentStateSlot(config: BeaconConfig, parentStateSlot: Slot, signedBlockHeader: phase0.SignedBeaconBlockHeader): ISignatureSet;
|
|
8
|
+
export declare function getBlockHeaderProposerSignatureSetByHeaderSlot(config: BeaconConfig, signedBlockHeader: phase0.SignedBeaconBlockHeader): ISignatureSet;
|
|
9
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,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,
|
|
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,WAAW,EAAE,iBAAiB,GAAG,wBAAwB,GACxD,aAAa,CAgBf;AAED,wBAAgB,mDAAmD,CACjE,MAAM,EAAE,YAAY,EACpB,eAAe,EAAE,IAAI,EACrB,iBAAiB,EAAE,MAAM,CAAC,uBAAuB,iBAGlD;AAED,wBAAgB,8CAA8C,CAC5D,MAAM,EAAE,YAAY,EACpB,iBAAiB,EAAE,MAAM,CAAC,uBAAuB,iBAGlD"}
|
|
@@ -3,10 +3,10 @@ import { isBlindedBeaconBlock, ssz } from "@lodestar/types";
|
|
|
3
3
|
import { computeSigningRoot } from "../util/index.js";
|
|
4
4
|
import { SignatureSetType, verifySignatureSet } from "../util/signatureSets.js";
|
|
5
5
|
export function verifyProposerSignature(config, index2pubkey, signedBlock) {
|
|
6
|
-
const signatureSet = getBlockProposerSignatureSet(config,
|
|
7
|
-
return verifySignatureSet(signatureSet);
|
|
6
|
+
const signatureSet = getBlockProposerSignatureSet(config, signedBlock);
|
|
7
|
+
return verifySignatureSet(signatureSet, index2pubkey);
|
|
8
8
|
}
|
|
9
|
-
export function getBlockProposerSignatureSet(config,
|
|
9
|
+
export function getBlockProposerSignatureSet(config, signedBlock) {
|
|
10
10
|
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
11
11
|
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
12
12
|
const blockSlot = signedBlock.message.slot;
|
|
@@ -15,23 +15,23 @@ export function getBlockProposerSignatureSet(config, index2pubkey, signedBlock)
|
|
|
15
15
|
? config.getPostBellatrixForkTypes(signedBlock.message.slot).BlindedBeaconBlock
|
|
16
16
|
: config.getForkTypes(signedBlock.message.slot).BeaconBlock;
|
|
17
17
|
return {
|
|
18
|
-
type: SignatureSetType.
|
|
19
|
-
|
|
18
|
+
type: SignatureSetType.indexed,
|
|
19
|
+
index: signedBlock.message.proposerIndex,
|
|
20
20
|
signingRoot: computeSigningRoot(blockType, signedBlock.message, domain),
|
|
21
21
|
signature: signedBlock.signature,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
export function getBlockHeaderProposerSignatureSetByParentStateSlot(config,
|
|
25
|
-
return getBlockHeaderProposerSignatureSet(config,
|
|
24
|
+
export function getBlockHeaderProposerSignatureSetByParentStateSlot(config, parentStateSlot, signedBlockHeader) {
|
|
25
|
+
return getBlockHeaderProposerSignatureSet(config, signedBlockHeader, parentStateSlot);
|
|
26
26
|
}
|
|
27
|
-
export function getBlockHeaderProposerSignatureSetByHeaderSlot(config,
|
|
28
|
-
return getBlockHeaderProposerSignatureSet(config,
|
|
27
|
+
export function getBlockHeaderProposerSignatureSetByHeaderSlot(config, signedBlockHeader) {
|
|
28
|
+
return getBlockHeaderProposerSignatureSet(config, signedBlockHeader, signedBlockHeader.message.slot);
|
|
29
29
|
}
|
|
30
|
-
function getBlockHeaderProposerSignatureSet(config,
|
|
30
|
+
function getBlockHeaderProposerSignatureSet(config, signedBlockHeader, domainSlot) {
|
|
31
31
|
const domain = config.getDomain(domainSlot, DOMAIN_BEACON_PROPOSER, signedBlockHeader.message.slot);
|
|
32
32
|
return {
|
|
33
|
-
type: SignatureSetType.
|
|
34
|
-
|
|
33
|
+
type: SignatureSetType.indexed,
|
|
34
|
+
index: signedBlockHeader.message.proposerIndex,
|
|
35
35
|
signingRoot: computeSigningRoot(ssz.phase0.BeaconBlockHeader, signedBlockHeader.message, domain),
|
|
36
36
|
signature: signedBlockHeader.signature,
|
|
37
37
|
};
|
|
@@ -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;AAErH,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAgB,gBAAgB,EAAE,kBAAkB,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K,EAAE,WAAW,CAAC,OAAO,CAAC,aAAa;QACxC,WAAW,EAAE,kBAAkB,CAAC,SAAS,EAAE,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;QACvE,SAAS,EAAE,WAAW,CAAC,SAAS;KACjC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mDAAmD,CACjE,MAAoB,EACpB,eAAqB,EACrB,iBAAiD;IAEjD,OAAO,kCAAkC,CAAC,MAAM,EAAE,iBAAiB,EAAE,eAAe,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,8CAA8C,CAC5D,MAAoB,EACpB,iBAAiD;IAEjD,OAAO,kCAAkC,CAAC,MAAM,EAAE,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACvG,CAAC;AAED,SAAS,kCAAkC,CACzC,MAAoB,EACpB,iBAAiD,EACjD,UAAgB;IAEhB,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,sBAAsB,EAAE,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpG,OAAO;QACL,IAAI,EAAE,gBAAgB,CAAC,OAAO;QAC9B,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,aAAa;QAC9C,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,EAAE,MAAM,CAAC;QAChG,SAAS,EAAE,iBAAiB,CAAC,SAAS;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BeaconConfig } from "@lodestar/config";
|
|
2
2
|
import { SignedBeaconBlock, Slot, phase0 } from "@lodestar/types";
|
|
3
|
-
import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
|
|
4
3
|
import { ISignatureSet } from "../util/index.js";
|
|
5
4
|
/**
|
|
6
5
|
* Extract signatures to allow validating all block signatures at once
|
|
7
6
|
*/
|
|
8
|
-
export declare function getProposerSlashingSignatureSets(config: BeaconConfig,
|
|
9
|
-
export declare function getProposerSlashingsSignatureSets(config: BeaconConfig,
|
|
7
|
+
export declare function getProposerSlashingSignatureSets(config: BeaconConfig, stateSlot: Slot, proposerSlashing: phase0.ProposerSlashing): ISignatureSet[];
|
|
8
|
+
export declare function getProposerSlashingsSignatureSets(config: BeaconConfig, signedBlock: SignedBeaconBlock): ISignatureSet[];
|
|
10
9
|
//# 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,IAAI,EAAE,MAAM,EAAM,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAC,
|
|
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,aAAa,EAAuC,MAAM,kBAAkB,CAAC;AAErF;;GAEG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,IAAI,EACf,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,GACxC,aAAa,EAAE,CAejB;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,YAAY,EACpB,WAAW,EAAE,iBAAiB,GAC7B,aAAa,EAAE,CAOjB"}
|
|
@@ -4,24 +4,24 @@ 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,
|
|
8
|
-
const
|
|
7
|
+
export function getProposerSlashingSignatureSets(config, stateSlot, proposerSlashing) {
|
|
8
|
+
const proposerIndex = 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
12
|
const domain = config.getDomain(stateSlot, DOMAIN_BEACON_PROPOSER, Number(signedHeader.message.slot));
|
|
13
13
|
return {
|
|
14
|
-
type: SignatureSetType.
|
|
15
|
-
|
|
14
|
+
type: SignatureSetType.indexed,
|
|
15
|
+
index: proposerIndex,
|
|
16
16
|
signingRoot: computeSigningRoot(ssz.phase0.BeaconBlockHeaderBigint, signedHeader.message, domain),
|
|
17
17
|
signature: signedHeader.signature,
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
export function getProposerSlashingsSignatureSets(config,
|
|
21
|
+
export function getProposerSlashingsSignatureSets(config, signedBlock) {
|
|
22
22
|
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
23
23
|
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
24
24
|
const blockSlot = signedBlock.message.slot;
|
|
25
|
-
return signedBlock.message.body.proposerSlashings.flatMap((proposerSlashing) => getProposerSlashingSignatureSets(config,
|
|
25
|
+
return signedBlock.message.body.proposerSlashings.flatMap((proposerSlashing) => getProposerSlashingSignatureSets(config, blockSlot, proposerSlashing));
|
|
26
26
|
}
|
|
27
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,EAA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,iBAAiB,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAC7E,gCAAgC,CAAC,MAAM,EAAE,SAAS,EAAE,gBAAgB,CAAC,CACtE,CAAC;AACJ,CAAC"}
|
|
@@ -6,5 +6,5 @@ export declare function verifyRandaoSignature(config: BeaconConfig, index2pubkey
|
|
|
6
6
|
/**
|
|
7
7
|
* Extract signatures to allow validating all block signatures at once
|
|
8
8
|
*/
|
|
9
|
-
export declare function getRandaoRevealSignatureSet(config: BeaconConfig,
|
|
9
|
+
export declare function getRandaoRevealSignatureSet(config: BeaconConfig, block: BeaconBlock): ISignatureSet;
|
|
10
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,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,
|
|
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,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,GAAG,aAAa,CAanG"}
|
|
@@ -2,20 +2,20 @@ 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
4
|
export function verifyRandaoSignature(config, index2pubkey, block) {
|
|
5
|
-
return verifySignatureSet(getRandaoRevealSignatureSet(config,
|
|
5
|
+
return verifySignatureSet(getRandaoRevealSignatureSet(config, block), index2pubkey);
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Extract signatures to allow validating all block signatures at once
|
|
9
9
|
*/
|
|
10
|
-
export function getRandaoRevealSignatureSet(config,
|
|
10
|
+
export function getRandaoRevealSignatureSet(config, 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
14
|
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
15
15
|
const domain = config.getDomain(block.slot, DOMAIN_RANDAO, block.slot);
|
|
16
16
|
return {
|
|
17
|
-
type: SignatureSetType.
|
|
18
|
-
|
|
17
|
+
type: SignatureSetType.indexed,
|
|
18
|
+
index: block.proposerIndex,
|
|
19
19
|
signingRoot: computeSigningRoot(ssz.Epoch, epoch, domain),
|
|
20
20
|
signature: block.body.randaoReveal,
|
|
21
21
|
};
|
|
@@ -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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J,CAAC"}
|
|
@@ -6,6 +6,6 @@ export declare function verifyVoluntaryExitSignature(config: BeaconConfig, index
|
|
|
6
6
|
/**
|
|
7
7
|
* Extract signatures to allow validating all block signatures at once
|
|
8
8
|
*/
|
|
9
|
-
export declare function getVoluntaryExitSignatureSet(config: BeaconConfig,
|
|
10
|
-
export declare function getVoluntaryExitsSignatureSets(config: BeaconConfig,
|
|
9
|
+
export declare function getVoluntaryExitSignatureSet(config: BeaconConfig, stateSlot: Slot, signedVoluntaryExit: phase0.SignedVoluntaryExit): ISignatureSet;
|
|
10
|
+
export declare function getVoluntaryExitsSignatureSets(config: BeaconConfig, 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,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,
|
|
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,SAAS,EAAE,IAAI,EACf,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,GAC9C,aAAa,CAUf;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,GAAG,aAAa,EAAE,CAOpH"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { ssz } from "@lodestar/types";
|
|
2
2
|
import { SignatureSetType, computeSigningRoot, computeStartSlotAtEpoch, verifySignatureSet, } from "../util/index.js";
|
|
3
3
|
export function verifyVoluntaryExitSignature(config, index2pubkey, stateSlot, signedVoluntaryExit) {
|
|
4
|
-
return verifySignatureSet(getVoluntaryExitSignatureSet(config,
|
|
4
|
+
return verifySignatureSet(getVoluntaryExitSignatureSet(config, stateSlot, signedVoluntaryExit), index2pubkey);
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Extract signatures to allow validating all block signatures at once
|
|
8
8
|
*/
|
|
9
|
-
export function getVoluntaryExitSignatureSet(config,
|
|
9
|
+
export function getVoluntaryExitSignatureSet(config, stateSlot, signedVoluntaryExit) {
|
|
10
10
|
const messageSlot = computeStartSlotAtEpoch(signedVoluntaryExit.message.epoch);
|
|
11
11
|
const domain = config.getDomainForVoluntaryExit(stateSlot, messageSlot);
|
|
12
12
|
return {
|
|
13
|
-
type: SignatureSetType.
|
|
14
|
-
|
|
13
|
+
type: SignatureSetType.indexed,
|
|
14
|
+
index: signedVoluntaryExit.message.validatorIndex,
|
|
15
15
|
signingRoot: computeSigningRoot(ssz.phase0.VoluntaryExit, signedVoluntaryExit.message, domain),
|
|
16
16
|
signature: signedVoluntaryExit.signature,
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
export function getVoluntaryExitsSignatureSets(config,
|
|
19
|
+
export function getVoluntaryExitsSignatureSets(config, signedBlock) {
|
|
20
20
|
// the getDomain() api requires the state slot as 1st param, however it's the same to block.slot in state-transition
|
|
21
21
|
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
22
22
|
const blockSlot = signedBlock.message.slot;
|
|
23
|
-
return signedBlock.message.body.voluntaryExits.map((voluntaryExit) => getVoluntaryExitSignatureSet(config,
|
|
23
|
+
return signedBlock.message.body.voluntaryExits.map((voluntaryExit) => getVoluntaryExitSignatureSet(config, blockSlot, voluntaryExit));
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=voluntaryExits.js.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,SAAS,EAAE,mBAAmB,CAAC,EAAE,YAAY,CAAC,CAAC;AAChH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,4BAA4B,CAC1C,MAAoB,EACpB,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,OAAO;QAC9B,KAAK,EAAE,mBAAmB,CAAC,OAAO,CAAC,cAAc;QACjD,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,CAAC,MAAoB,EAAE,WAA8B;IACjG,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,SAAS,EAAE,aAAa,CAAC,CAC/D,CAAC;AACJ,CAAC"}
|
package/lib/util/gloas.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { BuilderIndex, ValidatorIndex } from "@lodestar/types";
|
|
1
2
|
import { AttestationData } from "@lodestar/types/phase0";
|
|
2
|
-
import { CachedBeaconStateGloas } from "../types.
|
|
3
|
-
import { RootCache } from "./rootCache.
|
|
3
|
+
import { CachedBeaconStateGloas } from "../types.js";
|
|
4
|
+
import { RootCache } from "./rootCache.js";
|
|
4
5
|
export declare function isBuilderWithdrawalCredential(withdrawalCredentials: Uint8Array): boolean;
|
|
5
6
|
export declare function getBuilderPaymentQuorumThreshold(state: CachedBeaconStateGloas): number;
|
|
6
7
|
/**
|
|
@@ -12,39 +13,39 @@ export declare function isBuilderIndex(validatorIndex: number): boolean;
|
|
|
12
13
|
* Convert a builder index to a flagged validator index for use in Withdrawal containers.
|
|
13
14
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/beacon-chain.md#new-convert_builder_index_to_validator_index
|
|
14
15
|
*/
|
|
15
|
-
export declare function convertBuilderIndexToValidatorIndex(builderIndex:
|
|
16
|
+
export declare function convertBuilderIndexToValidatorIndex(builderIndex: BuilderIndex): ValidatorIndex;
|
|
16
17
|
/**
|
|
17
18
|
* Convert a flagged validator index back to a builder index.
|
|
18
19
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/beacon-chain.md#new-convert_validator_index_to_builder_index
|
|
19
20
|
*/
|
|
20
|
-
export declare function convertValidatorIndexToBuilderIndex(validatorIndex:
|
|
21
|
+
export declare function convertValidatorIndexToBuilderIndex(validatorIndex: ValidatorIndex): BuilderIndex;
|
|
21
22
|
/**
|
|
22
23
|
* Check if a builder is active (deposited and not yet withdrawable).
|
|
23
24
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/beacon-chain.md#isactivebuilder
|
|
24
25
|
*/
|
|
25
|
-
export declare function isActiveBuilder(state: CachedBeaconStateGloas, builderIndex:
|
|
26
|
+
export declare function isActiveBuilder(state: CachedBeaconStateGloas, builderIndex: BuilderIndex): boolean;
|
|
26
27
|
/**
|
|
27
28
|
* Get the total pending balance to withdraw for a builder (from withdrawals + payments).
|
|
28
29
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/beacon-chain.md#new-get_pending_balance_to_withdraw_for_builder
|
|
29
30
|
*/
|
|
30
|
-
export declare function getPendingBalanceToWithdrawForBuilder(state: CachedBeaconStateGloas, builderIndex:
|
|
31
|
+
export declare function getPendingBalanceToWithdrawForBuilder(state: CachedBeaconStateGloas, builderIndex: BuilderIndex): number;
|
|
31
32
|
/**
|
|
32
33
|
* Check if a builder has sufficient balance to cover a bid amount.
|
|
33
34
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/beacon-chain.md#new-can_builder_cover_bid
|
|
34
35
|
*/
|
|
35
|
-
export declare function canBuilderCoverBid(state: CachedBeaconStateGloas, builderIndex:
|
|
36
|
+
export declare function canBuilderCoverBid(state: CachedBeaconStateGloas, builderIndex: BuilderIndex, bidAmount: number): boolean;
|
|
36
37
|
/**
|
|
37
38
|
* Initiate a builder exit by setting their withdrawable epoch.
|
|
38
39
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/beacon-chain.md#new-initiate_builder_exit
|
|
39
40
|
*/
|
|
40
|
-
export declare function initiateBuilderExit(state: CachedBeaconStateGloas, builderIndex:
|
|
41
|
+
export declare function initiateBuilderExit(state: CachedBeaconStateGloas, builderIndex: BuilderIndex): void;
|
|
41
42
|
/**
|
|
42
43
|
* Find the index of a builder by their public key.
|
|
43
44
|
* Returns null if not found.
|
|
44
45
|
*
|
|
45
46
|
* May consider builder pubkey cache if performance becomes an issue.
|
|
46
47
|
*/
|
|
47
|
-
export declare function findBuilderIndexByPubkey(state: CachedBeaconStateGloas, pubkey: Uint8Array):
|
|
48
|
+
export declare function findBuilderIndexByPubkey(state: CachedBeaconStateGloas, pubkey: Uint8Array): BuilderIndex | null;
|
|
48
49
|
export declare function isAttestationSameSlot(state: CachedBeaconStateGloas, data: AttestationData): boolean;
|
|
49
50
|
export declare function isAttestationSameSlotRootCache(rootCache: RootCache, data: AttestationData): boolean;
|
|
50
51
|
export declare function isParentBlockFull(state: CachedBeaconStateGloas): boolean;
|
package/lib/util/gloas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gloas.d.ts","sourceRoot":"","sources":["../../src/util/gloas.ts"],"names":[],"mappings":"AAWA,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,wBAAgB,6BAA6B,CAAC,qBAAqB,EAAE,UAAU,GAAG,OAAO,CAExF;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAMtF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"gloas.d.ts","sourceRoot":"","sources":["../../src/util/gloas.ts"],"names":[],"mappings":"AAWA,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AAGnD,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,wBAAgB,6BAA6B,CAAC,qBAAqB,EAAE,UAAU,GAAG,OAAO,CAExF;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,sBAAsB,GAAG,MAAM,CAMtF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,YAAY,EAAE,YAAY,GAAG,cAAc,CAE9F;AAED;;;GAGG;AACH,wBAAgB,mCAAmC,CAAC,cAAc,EAAE,cAAc,GAAG,YAAY,CAEhG;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAKlG;AAED;;;GAGG;AACH,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,sBAAsB,EAC7B,YAAY,EAAE,YAAY,GACzB,MAAM,CAoBR;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,sBAAsB,EAC7B,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAUT;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,sBAAsB,EAAE,YAAY,EAAE,YAAY,GAAG,IAAI,CAWnG;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,sBAAsB,EAAE,MAAM,EAAE,UAAU,GAAG,YAAY,GAAG,IAAI,CAO/G;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAOnG;AAED,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,GAAG,OAAO,CAOnG;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAExE"}
|
package/lib/util/gloas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gloas.js","sourceRoot":"","sources":["../../src/util/gloas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,qCAAqC,EACrC,mCAAmC,EACnC,yBAAyB,EACzB,2BAA2B,EAC3B,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"gloas.js","sourceRo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,MAAM,kBAAkB,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IAE5G,OAAO,mBAAmB,IAAI,kBAAkB,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,SAAoB,EAAE,IAAqB;IACxF,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,mBAAmB,GAAG,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3G,MAAM,kBAAkB,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IAE/G,OAAO,mBAAmB,IAAI,kBAAkB,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,OAAO,eAAe,CAAC,KAAK,CAAC,yBAAyB,CAAC,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;AAC3F,CAAC"}
|
package/lib/util/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from "./epochShuffling.js";
|
|
|
15
15
|
export * from "./execution.js";
|
|
16
16
|
export * from "./finality.js";
|
|
17
17
|
export * from "./genesis.js";
|
|
18
|
+
export * from "./gloas.js";
|
|
18
19
|
export * from "./interop.js";
|
|
19
20
|
export * from "./loadState/index.js";
|
|
20
21
|
export * from "./rootCache.js";
|
package/lib/util/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB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;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
|
package/lib/util/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export * from "./epochShuffling.js";
|
|
|
15
15
|
export * from "./execution.js";
|
|
16
16
|
export * from "./finality.js";
|
|
17
17
|
export * from "./genesis.js";
|
|
18
|
+
export * from "./gloas.js";
|
|
18
19
|
export * from "./interop.js";
|
|
19
20
|
export * from "./loadState/index.js";
|
|
20
21
|
export * from "./rootCache.js";
|
package/lib/util/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,23 +1,56 @@
|
|
|
1
1
|
import { PublicKey } from "@chainsafe/blst";
|
|
2
2
|
import { Root } from "@lodestar/types";
|
|
3
|
+
import { Index2PubkeyCache } from "../cache/pubkeyCache.js";
|
|
3
4
|
export declare enum SignatureSetType {
|
|
4
5
|
single = "single",
|
|
5
|
-
aggregate = "aggregate"
|
|
6
|
+
aggregate = "aggregate",
|
|
7
|
+
/**
|
|
8
|
+
* Single signature with validator index instead of pubkey.
|
|
9
|
+
* Pubkey lookup is deferred to verification time.
|
|
10
|
+
*/
|
|
11
|
+
indexed = "indexed"
|
|
6
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Single signature with pubkey directly.
|
|
15
|
+
* Used when pubkey comes from the message itself (e.g. BLS to execution change).
|
|
16
|
+
*/
|
|
7
17
|
export type SingleSignatureSet = {
|
|
8
18
|
type: SignatureSetType.single;
|
|
9
19
|
pubkey: PublicKey;
|
|
10
20
|
signingRoot: Root;
|
|
11
21
|
signature: Uint8Array;
|
|
12
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Single signature with validator index.
|
|
25
|
+
* Pubkey is looked up at verification time.
|
|
26
|
+
*/
|
|
27
|
+
export type IndexedSignatureSet = {
|
|
28
|
+
type: SignatureSetType.indexed;
|
|
29
|
+
index: number;
|
|
30
|
+
signingRoot: Root;
|
|
31
|
+
signature: Uint8Array;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Aggregate signature with validator indices.
|
|
35
|
+
* Pubkeys are looked up and aggregated at verification time.
|
|
36
|
+
*/
|
|
13
37
|
export type AggregatedSignatureSet = {
|
|
14
38
|
type: SignatureSetType.aggregate;
|
|
15
|
-
|
|
39
|
+
indices: number[];
|
|
16
40
|
signingRoot: Root;
|
|
17
41
|
signature: Uint8Array;
|
|
18
42
|
};
|
|
19
|
-
export type ISignatureSet = SingleSignatureSet | AggregatedSignatureSet;
|
|
20
|
-
|
|
43
|
+
export type ISignatureSet = SingleSignatureSet | IndexedSignatureSet | AggregatedSignatureSet;
|
|
44
|
+
/**
|
|
45
|
+
* Get the pubkey for a signature set, performing aggregation if necessary.
|
|
46
|
+
* Requires index2pubkey cache for indexed and aggregate sets.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getSignatureSetPubkey(signatureSet: ISignatureSet, index2pubkey: Index2PubkeyCache): PublicKey;
|
|
49
|
+
export declare function verifySignatureSet(signatureSet: SingleSignatureSet, index2pubkey?: Index2PubkeyCache): boolean;
|
|
50
|
+
export declare function verifySignatureSet(signatureSet: IndexedSignatureSet, index2pubkey: Index2PubkeyCache): boolean;
|
|
51
|
+
export declare function verifySignatureSet(signatureSet: AggregatedSignatureSet, index2pubkey: Index2PubkeyCache): boolean;
|
|
52
|
+
export declare function verifySignatureSet(signatureSet: ISignatureSet, index2pubkey: Index2PubkeyCache): boolean;
|
|
21
53
|
export declare function createSingleSignatureSetFromComponents(pubkey: PublicKey, signingRoot: Root, signature: Uint8Array): SingleSignatureSet;
|
|
22
|
-
export declare function
|
|
54
|
+
export declare function createIndexedSignatureSetFromComponents(index: number, signingRoot: Root, signature: Uint8Array): IndexedSignatureSet;
|
|
55
|
+
export declare function createAggregateSignatureSetFromComponents(indices: number[], signingRoot: Root, signature: Uint8Array): AggregatedSignatureSet;
|
|
23
56
|
//# sourceMappingURL=signatureSets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signatureSets.d.ts","sourceRoot":"","sources":["../../src/util/signatureSets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"signatureSets.d.ts","sourceRoot":"","sources":["../../src/util/signatureSets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAA8D,MAAM,iBAAiB,CAAC;AACvG,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAE1D,oBAAY,gBAAgB;IAC1B,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB;;;OAGG;IACH,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,gBAAgB,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,SAAS,CAAC;IAClB,WAAW,EAAE,IAAI,CAAC;IAClB,SAAS,EAAE,UAAU,CAAC;CACvB,CAAC;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AE,EACjB,WAAW,EAAE,IAAI,EACjB,SAAS,EAAE,UAAU,GACpB,sBAAsB,CAOxB"}
|
|
@@ -1,17 +1,51 @@
|
|
|
1
|
-
import { Signature, fastAggregateVerify, verify } from "@chainsafe/blst";
|
|
1
|
+
import { Signature, aggregatePublicKeys, fastAggregateVerify, verify } from "@chainsafe/blst";
|
|
2
2
|
export var SignatureSetType;
|
|
3
3
|
(function (SignatureSetType) {
|
|
4
4
|
SignatureSetType["single"] = "single";
|
|
5
5
|
SignatureSetType["aggregate"] = "aggregate";
|
|
6
|
+
/**
|
|
7
|
+
* Single signature with validator index instead of pubkey.
|
|
8
|
+
* Pubkey lookup is deferred to verification time.
|
|
9
|
+
*/
|
|
10
|
+
SignatureSetType["indexed"] = "indexed";
|
|
6
11
|
})(SignatureSetType || (SignatureSetType = {}));
|
|
7
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Get the pubkey for a signature set, performing aggregation if necessary.
|
|
14
|
+
* Requires index2pubkey cache for indexed and aggregate sets.
|
|
15
|
+
*/
|
|
16
|
+
export function getSignatureSetPubkey(signatureSet, index2pubkey) {
|
|
17
|
+
switch (signatureSet.type) {
|
|
18
|
+
case SignatureSetType.single:
|
|
19
|
+
return signatureSet.pubkey;
|
|
20
|
+
case SignatureSetType.indexed:
|
|
21
|
+
return index2pubkey[signatureSet.index];
|
|
22
|
+
case SignatureSetType.aggregate: {
|
|
23
|
+
const pubkeys = signatureSet.indices.map((i) => index2pubkey[i]);
|
|
24
|
+
return aggregatePublicKeys(pubkeys);
|
|
25
|
+
}
|
|
26
|
+
default:
|
|
27
|
+
throw Error("Unknown signature set type");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function verifySignatureSet(signatureSet, index2pubkey) {
|
|
8
31
|
// All signatures are not trusted and must be group checked (p2.subgroup_check)
|
|
9
32
|
const signature = Signature.fromBytes(signatureSet.signature, true);
|
|
10
33
|
switch (signatureSet.type) {
|
|
11
34
|
case SignatureSetType.single:
|
|
12
35
|
return verify(signatureSet.signingRoot, signatureSet.pubkey, signature);
|
|
13
|
-
case SignatureSetType.
|
|
14
|
-
|
|
36
|
+
case SignatureSetType.indexed: {
|
|
37
|
+
if (!index2pubkey) {
|
|
38
|
+
throw Error("index2pubkey required for indexed signature set");
|
|
39
|
+
}
|
|
40
|
+
return verify(signatureSet.signingRoot, index2pubkey[signatureSet.index], signature);
|
|
41
|
+
}
|
|
42
|
+
case SignatureSetType.aggregate: {
|
|
43
|
+
if (!index2pubkey) {
|
|
44
|
+
throw Error("index2pubkey required for aggregate signature set");
|
|
45
|
+
}
|
|
46
|
+
const pubkeys = signatureSet.indices.map((i) => index2pubkey[i]);
|
|
47
|
+
return fastAggregateVerify(signatureSet.signingRoot, pubkeys, signature);
|
|
48
|
+
}
|
|
15
49
|
default:
|
|
16
50
|
throw Error("Unknown signature set type");
|
|
17
51
|
}
|
|
@@ -24,10 +58,18 @@ export function createSingleSignatureSetFromComponents(pubkey, signingRoot, sign
|
|
|
24
58
|
signature,
|
|
25
59
|
};
|
|
26
60
|
}
|
|
27
|
-
export function
|
|
61
|
+
export function createIndexedSignatureSetFromComponents(index, signingRoot, signature) {
|
|
62
|
+
return {
|
|
63
|
+
type: SignatureSetType.indexed,
|
|
64
|
+
index,
|
|
65
|
+
signingRoot,
|
|
66
|
+
signature,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export function createAggregateSignatureSetFromComponents(indices, signingRoot, signature) {
|
|
28
70
|
return {
|
|
29
71
|
type: SignatureSetType.aggregate,
|
|
30
|
-
|
|
72
|
+
indices,
|
|
31
73
|
signingRoot,
|
|
32
74
|
signature,
|
|
33
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signatureSets.js","sourceRoot":"","sources":["../../src/util/signatureSets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":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ED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"bugs": {
|
|
12
12
|
"url": "https://github.com/ChainSafe/lodestar/issues"
|
|
13
13
|
},
|
|
14
|
-
"version": "1.40.0-dev.
|
|
14
|
+
"version": "1.40.0-dev.cfd894719f",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
@@ -62,14 +62,14 @@
|
|
|
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.40.0-dev.
|
|
66
|
-
"@lodestar/params": "^1.40.0-dev.
|
|
67
|
-
"@lodestar/types": "^1.40.0-dev.
|
|
68
|
-
"@lodestar/utils": "^1.40.0-dev.
|
|
65
|
+
"@lodestar/config": "^1.40.0-dev.cfd894719f",
|
|
66
|
+
"@lodestar/params": "^1.40.0-dev.cfd894719f",
|
|
67
|
+
"@lodestar/types": "^1.40.0-dev.cfd894719f",
|
|
68
|
+
"@lodestar/utils": "^1.40.0-dev.cfd894719f",
|
|
69
69
|
"bigint-buffer": "^1.1.5"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@lodestar/api": "^1.40.0-dev.
|
|
72
|
+
"@lodestar/api": "^1.40.0-dev.cfd894719f"
|
|
73
73
|
},
|
|
74
74
|
"keywords": [
|
|
75
75
|
"ethereum",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"beacon",
|
|
78
78
|
"blockchain"
|
|
79
79
|
],
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "990d8c40a36a3e5dcfcaf4134a80594573ddaad0"
|
|
81
81
|
}
|
|
@@ -21,7 +21,7 @@ export function isValidIndexedAttestation(
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (verifySignature) {
|
|
24
|
-
return verifySignatureSet(getIndexedAttestationSignatureSet(config,
|
|
24
|
+
return verifySignatureSet(getIndexedAttestationSignatureSet(config, stateSlot, indexedAttestation), index2pubkey);
|
|
25
25
|
}
|
|
26
26
|
return true;
|
|
27
27
|
}
|
|
@@ -40,7 +40,8 @@ export function isValidIndexedAttestationBigint(
|
|
|
40
40
|
|
|
41
41
|
if (verifySignature) {
|
|
42
42
|
return verifySignatureSet(
|
|
43
|
-
getIndexedAttestationBigintSignatureSet(config,
|
|
43
|
+
getIndexedAttestationBigintSignatureSet(config, stateSlot, indexedAttestation),
|
|
44
|
+
index2pubkey
|
|
44
45
|
);
|
|
45
46
|
}
|
|
46
47
|
return true;
|