@lodestar/native 1.52.0-dev.a9e15e2b94 → 1.52.0-dev.c8fc3bc8e4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodestar/native",
3
- "version": "1.52.0-dev.a9e15e2b94",
3
+ "version": "1.52.0-dev.c8fc3bc8e4",
4
4
  "description": "Native consensus modules for Lodestar",
5
5
  "files": [
6
6
  "src/"
@@ -23,6 +23,10 @@
23
23
  "types": "./src/pubkeys.d.ts",
24
24
  "import": "./src/pubkeys.js"
25
25
  },
26
+ "./committee-pubkeys": {
27
+ "types": "./src/committee-pubkeys.d.ts",
28
+ "import": "./src/committee-pubkeys.js"
29
+ },
26
30
  "./state-transition": {
27
31
  "types": "./src/state-transition.d.ts",
28
32
  "import": "./src/state-transition.js"
@@ -95,13 +99,13 @@
95
99
  "publishConfig": {
96
100
  "access": "public"
97
101
  },
98
- "gitHead": "db81dc9e67864e07eccc80bdd196493cf170c3e8",
102
+ "gitHead": "dbed613e6d411dc58ecac023a3779274b1cd08e8",
99
103
  "optionalDependencies": {
100
- "@lodestar/native-aarch64-apple-darwin": "1.52.0-dev.a9e15e2b94",
101
- "@lodestar/native-aarch64-unknown-linux-gnu": "1.52.0-dev.a9e15e2b94",
102
- "@lodestar/native-aarch64-unknown-linux-musl": "1.52.0-dev.a9e15e2b94",
103
- "@lodestar/native-x86_64-apple-darwin": "1.52.0-dev.a9e15e2b94",
104
- "@lodestar/native-x86_64-unknown-linux-gnu": "1.52.0-dev.a9e15e2b94",
105
- "@lodestar/native-x86_64-unknown-linux-musl": "1.52.0-dev.a9e15e2b94"
104
+ "@lodestar/native-aarch64-apple-darwin": "1.52.0-dev.c8fc3bc8e4",
105
+ "@lodestar/native-aarch64-unknown-linux-gnu": "1.52.0-dev.c8fc3bc8e4",
106
+ "@lodestar/native-aarch64-unknown-linux-musl": "1.52.0-dev.c8fc3bc8e4",
107
+ "@lodestar/native-x86_64-apple-darwin": "1.52.0-dev.c8fc3bc8e4",
108
+ "@lodestar/native-x86_64-unknown-linux-gnu": "1.52.0-dev.c8fc3bc8e4",
109
+ "@lodestar/native-x86_64-unknown-linux-musl": "1.52.0-dev.c8fc3bc8e4"
106
110
  }
107
111
  }
@@ -2,6 +2,7 @@ export declare const BLS_VERIFIER_SET_TYPE: {
2
2
  readonly indexed: 0;
3
3
  readonly aggregate: 1;
4
4
  readonly single: 2;
5
+ readonly committee: 3;
5
6
  };
6
7
 
7
8
  export declare const BLS_VERIFIER_MAX_BATCH_SIZE: 256;
@@ -30,7 +31,25 @@ export type SingleSignatureSet = {
30
31
  signature: Uint8Array;
31
32
  };
32
33
 
33
- export type BlsSignatureSet = IndexedSignatureSet | AggregateSignatureSet | SingleSignatureSet;
34
+ /**
35
+ * An attestation over whole committees of one slot, verified with the committee pubkeys from
36
+ * `computeCommitteePubkeys()`. Its aggregation bits are concatenated in `committeeIndices` order. `indices` lists the
37
+ * participants and is aggregated instead when the entry is not cached. Only the participant count is checked, so
38
+ * callers must derive `indices` and the aggregation bits from the same attestation.
39
+ */
40
+ export type CommitteeSignatureSet = {
41
+ type: typeof BLS_VERIFIER_SET_TYPE.committee;
42
+ indices: Uint32Array;
43
+ committeePubkeysId: number;
44
+ slot: number;
45
+ committeeIndices: Uint32Array;
46
+ aggregationBits: Uint8Array;
47
+ bitLen: number;
48
+ message: Uint8Array;
49
+ signature: Uint8Array;
50
+ };
51
+
52
+ export type BlsSignatureSet = IndexedSignatureSet | AggregateSignatureSet | SingleSignatureSet | CommitteeSignatureSet;
34
53
 
35
54
  export type SameMessageSignatureSet = {
36
55
  index: number;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Aggregate pubkeys of the beacon committees of an epoch shuffling, held in native memory. Signature sets reference an
3
+ * entry by id, so BLS worker threads can use it too.
4
+ */
5
+
6
+ /** Entries the cache holds at most, counting computations in flight. */
7
+ export declare const COMMITTEE_PUBKEYS_MAX_ENTRIES: number;
8
+
9
+ /**
10
+ * Aggregate the pubkeys of every committee of a shuffling on a libuv worker thread and resolve to the entry id.
11
+ * `shuffling` is the shuffled active validator indices, and it is copied before this returns. Throws when
12
+ * `COMMITTEE_PUBKEYS_MAX_ENTRIES` entries are cached or being computed.
13
+ */
14
+ export declare function computeCommitteePubkeys(
15
+ shuffling: Uint32Array,
16
+ slotsPerEpoch: number,
17
+ committeesPerSlot: number
18
+ ): Promise<number>;
19
+
20
+ /**
21
+ * Free an entry. Returns false if `id` is unknown. A signature set that still references it falls back to its
22
+ * participant indices.
23
+ */
24
+ export declare function releaseCommitteePubkeys(id: number): boolean;
25
+
26
+ /** Number of cached entries. */
27
+ export declare function committeePubkeysCount(): number;
@@ -0,0 +1,9 @@
1
+ import bindings from "./bindings.js";
2
+
3
+ const native = bindings.committeePubkeys;
4
+
5
+ export const COMMITTEE_PUBKEYS_MAX_ENTRIES = native.MAX_ENTRIES;
6
+
7
+ export const computeCommitteePubkeys = native.compute;
8
+ export const releaseCommitteePubkeys = native.release;
9
+ export const committeePubkeysCount = native.size;
package/src/index.d.ts CHANGED
@@ -322,6 +322,7 @@ export declare class BeaconStateView {
322
322
  builderPendingWithdrawals: BuilderPendingWithdrawal[];
323
323
  getBuilder(index: number): Builder;
324
324
  canBuilderCoverBid(builderIndex: number, bidAmount: number): boolean;
325
+ getBuilderBidLimit(builderIndex: number): number;
325
326
  getEpochPTCs(epoch: number): Uint32Array[];
326
327
  getPayloadTimelinessCommittee(slot: number): Uint32Array;
327
328
  getInclusionListCommittee(slot: number): Uint32Array;
package/src/pubkeys.d.ts CHANGED
@@ -48,7 +48,10 @@ export interface PubkeyCache {
48
48
  * recorded in the file is discarded above this limit.
49
49
  */
50
50
  load(filepath: string, maxCapacity: number): void;
51
- /** Testing-only reset from the control environment while no workers are using the cache. */
51
+ /**
52
+ * Testing-only reset from the control environment while no workers are using the cache.
53
+ * Also drops the committee pubkeys aggregated from the cleared keys.
54
+ */
52
55
  reset(): void;
53
56
  /** Save from the control environment. */
54
57
  save(filepath: string): void;