fix: Revert "fix: create fixSerializedUint8Array helper method to deal with weird quirk of ssz serialize"
This reverts commit d8430b4a11
.
This commit is contained in:
parent
20b6d56c23
commit
6ef18dbc05
13
src/store.ts
13
src/store.ts
|
@ -5,7 +5,6 @@ import { concatBytes } from "@noble/hashes/utils";
|
||||||
import { LightClientUpdate } from "#types.js";
|
import { LightClientUpdate } from "#types.js";
|
||||||
import * as capella from "@lodestar/types/capella";
|
import * as capella from "@lodestar/types/capella";
|
||||||
import NodeCache from "node-cache";
|
import NodeCache from "node-cache";
|
||||||
import { fixSerializedUint8Array } from "#util.js";
|
|
||||||
|
|
||||||
export interface StoreItem {
|
export interface StoreItem {
|
||||||
update: Uint8Array;
|
update: Uint8Array;
|
||||||
|
@ -23,14 +22,10 @@ export default class Store implements IStore {
|
||||||
addUpdate(period: number, update: LightClientUpdate) {
|
addUpdate(period: number, update: LightClientUpdate) {
|
||||||
try {
|
try {
|
||||||
this.store.set(period, {
|
this.store.set(period, {
|
||||||
update: fixSerializedUint8Array(
|
update: capella.ssz.LightClientUpdate.serialize(update),
|
||||||
capella.ssz.LightClientUpdate.serialize(update),
|
nextCommittee: CommitteeSSZ.serialize(update.nextSyncCommittee.pubkeys),
|
||||||
),
|
nextCommitteeHash: digest(
|
||||||
nextCommittee: fixSerializedUint8Array(
|
concatBytes(...update.nextSyncCommittee.pubkeys),
|
||||||
CommitteeSSZ.serialize(update.nextSyncCommittee.pubkeys),
|
|
||||||
),
|
|
||||||
nextCommitteeHash: fixSerializedUint8Array(
|
|
||||||
digest(concatBytes(...update.nextSyncCommittee.pubkeys)),
|
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -131,6 +131,3 @@ function isValidLightClientHeader(
|
||||||
header.beacon.bodyRoot,
|
header.beacon.bodyRoot,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export function fixSerializedUint8Array(arr: Uint8Array) {
|
|
||||||
return new Uint8Array(Object.values(arr));
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue