@lodestar/state-transition 1.40.0-dev.1cab20c166 → 1.40.0-dev.2ae7375100
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 +5 -5
- 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/block/processVoluntaryExit.js +1 -1
- package/lib/block/processVoluntaryExit.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 +4 -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 +5 -4
- package/lib/signatureSets/indexedPayloadAttestation.d.ts.map +1 -1
- package/lib/signatureSets/indexedPayloadAttestation.js +3 -3
- 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 +1 -3
- 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 +5 -5
- package/src/block/processProposerSlashing.ts +2 -2
- package/src/block/processSyncCommittee.ts +3 -6
- package/src/block/processVoluntaryExit.ts +1 -1
- package/src/signatureSets/attesterSlashings.ts +3 -7
- package/src/signatureSets/blsToExecutionChange.ts +3 -3
- package/src/signatureSets/executionPayloadBid.ts +14 -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 +9 -7
- 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 -14
- package/src/util/index.ts +1 -0
- package/src/util/signatureSets.ts +84 -8
|
@@ -6,19 +6,19 @@ export function getAttestationDataSigningRoot(config, stateSlot, data) {
|
|
|
6
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,
|
|
10
|
-
return createAggregateSignatureSetFromComponents(attestingIndices
|
|
9
|
+
export function getAttestationWithIndicesSignatureSet(config, stateSlot, attestation, attestingIndices) {
|
|
10
|
+
return createAggregateSignatureSetFromComponents(attestingIndices, getAttestationDataSigningRoot(config, stateSlot, attestation.data), attestation.signature);
|
|
11
11
|
}
|
|
12
|
-
export function getIndexedAttestationSignatureSet(config,
|
|
13
|
-
return getAttestationWithIndicesSignatureSet(config,
|
|
12
|
+
export function getIndexedAttestationSignatureSet(config, stateSlot, indexedAttestation) {
|
|
13
|
+
return getAttestationWithIndicesSignatureSet(config, stateSlot, indexedAttestation, indexedAttestation.attestingIndices);
|
|
14
14
|
}
|
|
15
|
-
export function getAttestationsSignatureSets(config,
|
|
15
|
+
export function getAttestationsSignatureSets(config, 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
20
|
// and the same epoch when we verify blocks in batch in beacon-node. So we can safely use block.slot here.
|
|
21
21
|
const blockSlot = signedBlock.message.slot;
|
|
22
|
-
return indexedAttestations.map((indexedAttestation) => getIndexedAttestationSignatureSet(config,
|
|
22
|
+
return indexedAttestations.map((indexedAttestation) => getIndexedAttestationSignatureSet(config, blockSlot, indexedAttestation));
|
|
23
23
|
}
|
|
24
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,EAAsD,GAAG,EAAC,MAAM,iBAAiB,CAAC;
|
|
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;AACzF,OAAO,E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IAC3C,OAAO,mBAAmB,CAAC,GAAG,CAAC,CAAC,kBAAkB,EAAE,EAAE,CACpD,iCAAiC,CAAC,MAAM,EAAE,SAAS,EAAE,kBAAkB,CAAC,CACzE,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { BeaconConfig } from "@lodestar/config";
|
|
2
|
+
import { Slot, gloas } from "@lodestar/types";
|
|
3
|
+
import { CachedBeaconStateGloas } from "../types.js";
|
|
4
|
+
import { ISignatureSet } from "../util/index.js";
|
|
4
5
|
export declare function getIndexedPayloadAttestationSignatureSet(state: CachedBeaconStateGloas, indexedPayloadAttestation: gloas.IndexedPayloadAttestation): ISignatureSet;
|
|
5
|
-
export declare function getPayloadAttestationDataSigningRoot(
|
|
6
|
+
export declare function getPayloadAttestationDataSigningRoot(config: BeaconConfig, stateSlot: Slot, data: gloas.PayloadAttestationData): Uint8Array;
|
|
6
7
|
//# sourceMappingURL=indexedPayloadAttestation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexedPayloadAttestation.d.ts","sourceRoot":"","sources":["../../src/signatureSets/indexedPayloadAttestation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexedPayloadAttestation.d.ts","sourceRoot":"","sources":["../../src/signatureSets/indexedPayloadAttestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,IAAI,EAAE,KAAK,EAAM,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAC,sBAAsB,EAAC,MAAM,aAAa,CAAC;AACnD,OAAO,EAAC,aAAa,EAAgE,MAAM,kBAAkB,CAAC;AAE9G,wBAAgB,wCAAwC,CACtD,KAAK,EAAE,sBAAsB,EAC7B,yBAAyB,EAAE,KAAK,CAAC,yBAAyB,GACzD,aAAa,CAMf;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,IAAI,EACf,IAAI,EAAE,KAAK,CAAC,sBAAsB,GACjC,UAAU,CAIZ"}
|
|
@@ -2,10 +2,10 @@ import { DOMAIN_PTC_ATTESTER } from "@lodestar/params";
|
|
|
2
2
|
import { ssz } from "@lodestar/types";
|
|
3
3
|
import { computeSigningRoot, createAggregateSignatureSetFromComponents } from "../util/index.js";
|
|
4
4
|
export function getIndexedPayloadAttestationSignatureSet(state, indexedPayloadAttestation) {
|
|
5
|
-
return createAggregateSignatureSetFromComponents(indexedPayloadAttestation.attestingIndices
|
|
5
|
+
return createAggregateSignatureSetFromComponents(indexedPayloadAttestation.attestingIndices, getPayloadAttestationDataSigningRoot(state.config, state.slot, indexedPayloadAttestation.data), indexedPayloadAttestation.signature);
|
|
6
6
|
}
|
|
7
|
-
export function getPayloadAttestationDataSigningRoot(
|
|
8
|
-
const domain =
|
|
7
|
+
export function getPayloadAttestationDataSigningRoot(config, stateSlot, data) {
|
|
8
|
+
const domain = config.getDomain(stateSlot, DOMAIN_PTC_ATTESTER);
|
|
9
9
|
return computeSigningRoot(ssz.gloas.PayloadAttestationData, data, domain);
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=indexedPayloadAttestation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexedPayloadAttestation.js","sourceRoot":"","sources":["../../src/signatureSets/indexedPayloadAttestation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexedPayloadAttestation.js","sourceRoot":"","sources":["../../src/signatureSets/indexedPayloadAttestation.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAc,GAAG,EAAC,MAAM,iBAAiB,CAAC;AAEjD,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,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC,EAC9F,yBAAyB,CAAC,SAAS,CACpC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,oCAAoC,CAClD,MAAoB,EACpB,SAAe,EACf,IAAkC;IAElC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;IAEhE,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,EAAC,MAAM,0BAA0B,CAAC;AAE7F,MAAM,UAAU,uBAAuB,CACrC,MAAoB,EACpB,YAA+B,EAC/B,WAAyD;IAEzD,MAAM,YAAY,GAAG,4BAA4B,CAAC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AE,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,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAkC,GAAG,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"proposerSlashings.js","sourceRoot":"","sources":["../../src/sign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AAC"}
|
|
@@ -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,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,
|
|
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,KAAK,CAAC,EAAE,YAAY,CAAC,CAAC;AACtF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAoB,EAAE,KAAkB;IAClF,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,OAAO;QAC9B,KAAK,EAAE,KAAK,CAAC,aAAa;QAC1B,WAAW,EAAE,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC;QACzD,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY;KACnC,CAAC;AACJ,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, Epoch, ValidatorIndex, gloas } 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(
|
|
26
|
+
export declare function isActiveBuilder(builder: gloas.Builder, finalizedEpoch: Epoch): 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,KAAK,EAAE,cAAc,EAAE,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAC3E,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,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,GAAG,OAAO,CAEtF;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
CHANGED
|
@@ -35,9 +35,7 @@ export function convertValidatorIndexToBuilderIndex(validatorIndex) {
|
|
|
35
35
|
* Check if a builder is active (deposited and not yet withdrawable).
|
|
36
36
|
* Spec: https://github.com/ethereum/consensus-specs/blob/v1.7.0-alpha.1/specs/gloas/beacon-chain.md#isactivebuilder
|
|
37
37
|
*/
|
|
38
|
-
export function isActiveBuilder(
|
|
39
|
-
const builder = state.builders.getReadonly(builderIndex);
|
|
40
|
-
const finalizedEpoch = state.finalizedCheckpoint.epoch;
|
|
38
|
+
export function isActiveBuilder(builder, finalizedEpoch) {
|
|
41
39
|
return builder.depositEpoch < finalizedEpoch && builder.withdrawableEpoch === FAR_FUTURE_EPOCH;
|
|
42
40
|
}
|
|
43
41
|
/**
|
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","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;AAI1B,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAG9C,MAAM,UAAU,6BAA6B,CAAC,qBAAiC;IAC7E,OAAO,qBAAqB,CAAC,CAAC,CAAC,KAAK,yBAAyB,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,KAA6B;IAC5E,MAAM,MAAM,GACV,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,4BAA4B,GAAG,2BAA2B,CAAC,GAAG,eAAe,CAAC;QACzG,mCAAmC,CAAC;IAEtC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,qCAAqC,CAAC,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,cAAsB;IACnD,OAAO,CAAC,cAAc,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;A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AAC,KAA6B,EAAE,IAAqB;IACxF,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,mBAAmB,GAAG,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACxG,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,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.d.ts","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"}
|
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,c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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;;;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