Compare commits
3 Commits
v0.1.0-dev
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 5f5c665aed | |
Derrick Hammer | cbc652ccb1 | |
Derrick Hammer | d8430b4a11 |
|
@ -1,3 +1,10 @@
|
||||||
|
# [0.1.0-develop.34](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.33...v0.1.0-develop.34) (2023-07-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* create fixSerializedUint8Array helper method to deal with weird quirk of ssz serialize ([d8430b4](https://git.lumeweb.com/LumeWeb/libethsync/commit/d8430b4a11f99f38f33cf14abfc9ed841e5226e1))
|
||||||
|
|
||||||
# [0.1.0-develop.33](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.32...v0.1.0-develop.33) (2023-07-13)
|
# [0.1.0-develop.33](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.32...v0.1.0-develop.33) (2023-07-13)
|
||||||
|
|
||||||
# [0.1.0-develop.32](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.31...v0.1.0-develop.32) (2023-07-13)
|
# [0.1.0-develop.32](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.31...v0.1.0-develop.32) (2023-07-13)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libethclient",
|
"name": "@lumeweb/libethclient",
|
||||||
"version": "0.1.0-develop.33",
|
"version": "0.1.0-develop.34",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/libethclient",
|
"name": "@lumeweb/libethclient",
|
||||||
"version": "0.1.0-develop.33",
|
"version": "0.1.0-develop.34",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chainsafe/as-sha256": "^0.3.1",
|
"@chainsafe/as-sha256": "^0.3.1",
|
||||||
"@chainsafe/bls": "7.1.1",
|
"@chainsafe/bls": "7.1.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libethsync",
|
"name": "@lumeweb/libethsync",
|
||||||
"version": "0.1.0-develop.33",
|
"version": "0.1.0-develop.34",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
13
src/store.ts
13
src/store.ts
|
@ -5,6 +5,7 @@ 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;
|
||||||
|
@ -22,10 +23,14 @@ 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: capella.ssz.LightClientUpdate.serialize(update),
|
update: fixSerializedUint8Array(
|
||||||
nextCommittee: CommitteeSSZ.serialize(update.nextSyncCommittee.pubkeys),
|
capella.ssz.LightClientUpdate.serialize(update),
|
||||||
nextCommitteeHash: digest(
|
),
|
||||||
concatBytes(...update.nextSyncCommittee.pubkeys),
|
nextCommittee: fixSerializedUint8Array(
|
||||||
|
CommitteeSSZ.serialize(update.nextSyncCommittee.pubkeys),
|
||||||
|
),
|
||||||
|
nextCommitteeHash: fixSerializedUint8Array(
|
||||||
|
digest(concatBytes(...update.nextSyncCommittee.pubkeys)),
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -131,3 +131,6 @@ function isValidLightClientHeader(
|
||||||
header.beacon.bodyRoot,
|
header.beacon.bodyRoot,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
export function fixSerializedUint8Array(arr: Uint8Array) {
|
||||||
|
return new Uint8Array(Object.values(arr));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue