Compare commits
No commits in common. "v0.1.0-develop.36" and "v0.1.0-develop.35" have entirely different histories.
v0.1.0-dev
...
v0.1.0-dev
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -1,13 +1,3 @@
|
|||
# [0.1.0-develop.36](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.35...v0.1.0-develop.36) (2023-07-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* need to use concat not push ([b87017e](https://git.lumeweb.com/LumeWeb/libethsync/commit/b87017eb678282bf47758ca834e2acbc1cf6e516))
|
||||
* Revert "fix: create fixSerializedUint8Array helper method to deal with weird quirk of ssz serialize" ([6ef18db](https://git.lumeweb.com/LumeWeb/libethsync/commit/6ef18dbc05b5b5801a6b05cea5056d631e8a094d))
|
||||
* temporarily disable block hash check as it is bugged ([91144cb](https://git.lumeweb.com/LumeWeb/libethsync/commit/91144cb5a2b5d05fd301b11501861aadd10a69b5))
|
||||
* use byteArrayEquals ([157811b](https://git.lumeweb.com/LumeWeb/libethsync/commit/157811b2348fa94d5d6b076219f34b3b340a50ac))
|
||||
|
||||
# [0.1.0-develop.35](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.34...v0.1.0-develop.35) (2023-07-13)
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@lumeweb/libethclient",
|
||||
"version": "0.1.0-develop.36",
|
||||
"version": "0.1.0-develop.35",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lumeweb/libethclient",
|
||||
"version": "0.1.0-develop.36",
|
||||
"version": "0.1.0-develop.35",
|
||||
"dependencies": {
|
||||
"@chainsafe/as-sha256": "^0.3.1",
|
||||
"@chainsafe/bls": "7.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lumeweb/libethsync",
|
||||
"version": "0.1.0-develop.36",
|
||||
"version": "0.1.0-develop.35",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -45,7 +45,7 @@ import {
|
|||
RPCTx,
|
||||
} from "./types.js";
|
||||
import { keccak256 } from "ethereum-cryptography/keccak";
|
||||
import { byteArrayEquals, fromHexString } from "@chainsafe/ssz";
|
||||
import { fromHexString } from "@chainsafe/ssz";
|
||||
import { RPC } from "#client/rpc.js";
|
||||
|
||||
export interface IClientVerifyingProvider extends IVerifyingProvider {
|
||||
|
@ -464,7 +464,7 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
|
|||
.map((r: any) => r.result)
|
||||
.reduce(
|
||||
(acc, curr, idx, arr) =>
|
||||
idx % 2 === 0 ? acc.concat([[curr, arr[idx + 1]]]) : acc,
|
||||
idx % 2 === 0 ? acc.push([curr, arr[idx + 1]]) : acc,
|
||||
[],
|
||||
) as [AccountResponse, CodeResponse][];
|
||||
|
||||
|
@ -579,9 +579,9 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
|
|||
const header = BlockHeader.fromHeaderData(headerData);
|
||||
|
||||
if (!header.hash().equals(toBuffer(blockHash))) {
|
||||
/* throw new Error(
|
||||
throw new Error(
|
||||
`blockhash doesn't match the blockInfo provided by the RPC`,
|
||||
);*/
|
||||
);
|
||||
}
|
||||
this.blockHeaders[blockHash] = header;
|
||||
}
|
||||
|
@ -640,10 +640,7 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
|
|||
private verifyCodeHash(code: Bytes, codeHash: Bytes32): boolean {
|
||||
return (
|
||||
(code === "0x" && codeHash === "0x" + KECCAK256_NULL_S) ||
|
||||
byteArrayEquals(
|
||||
keccak256(fromHexString(codeHash)),
|
||||
fromHexString(codeHash),
|
||||
)
|
||||
keccak256(fromHexString(codeHash)) === fromHexString(codeHash)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
13
src/store.ts
13
src/store.ts
|
@ -5,6 +5,7 @@ import { concatBytes } from "@noble/hashes/utils";
|
|||
import { LightClientUpdate } from "#types.js";
|
||||
import * as capella from "@lodestar/types/capella";
|
||||
import NodeCache from "node-cache";
|
||||
import { fixSerializedUint8Array } from "#util.js";
|
||||
|
||||
export interface StoreItem {
|
||||
update: Uint8Array;
|
||||
|
@ -22,10 +23,14 @@ export default class Store implements IStore {
|
|||
addUpdate(period: number, update: LightClientUpdate) {
|
||||
try {
|
||||
this.store.set(period, {
|
||||
update: capella.ssz.LightClientUpdate.serialize(update),
|
||||
nextCommittee: CommitteeSSZ.serialize(update.nextSyncCommittee.pubkeys),
|
||||
nextCommitteeHash: digest(
|
||||
concatBytes(...update.nextSyncCommittee.pubkeys),
|
||||
update: fixSerializedUint8Array(
|
||||
capella.ssz.LightClientUpdate.serialize(update),
|
||||
),
|
||||
nextCommittee: fixSerializedUint8Array(
|
||||
CommitteeSSZ.serialize(update.nextSyncCommittee.pubkeys),
|
||||
),
|
||||
nextCommitteeHash: fixSerializedUint8Array(
|
||||
digest(concatBytes(...update.nextSyncCommittee.pubkeys)),
|
||||
),
|
||||
});
|
||||
} catch (e) {
|
||||
|
|
|
@ -131,3 +131,6 @@ function isValidLightClientHeader(
|
|||
header.beacon.bodyRoot,
|
||||
);
|
||||
}
|
||||
export function fixSerializedUint8Array(arr: Uint8Array) {
|
||||
return new Uint8Array(Object.values(arr));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue