Compare commits

..

5 Commits

Author SHA1 Message Date
semantic-release-bot f76fc9b9e8 chore(release): 0.1.0-develop.36 [skip ci]
# [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](b87017eb67))
* Revert "fix: create fixSerializedUint8Array helper method to deal with weird quirk of ssz serialize" ([6ef18db](6ef18dbc05))
* temporarily disable block hash check as it is bugged ([91144cb](91144cb5a2))
* use byteArrayEquals ([157811b](157811b234))
2023-07-13 16:27:45 +00:00
Derrick Hammer 91144cb5a2
fix: temporarily disable block hash check as it is bugged 2023-07-13 12:26:41 -04:00
Derrick Hammer 157811b234
fix: use byteArrayEquals 2023-07-13 12:25:21 -04:00
Derrick Hammer b87017eb67
fix: need to use concat not push 2023-07-13 12:23:33 -04:00
Derrick Hammer 6ef18dbc05
fix: Revert "fix: create fixSerializedUint8Array helper method to deal with weird quirk of ssz serialize"
This reverts commit d8430b4a11.
2023-07-13 10:40:25 -04:00
6 changed files with 25 additions and 20 deletions

View File

@ -1,3 +1,13 @@
# [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)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libethclient",
"version": "0.1.0-develop.35",
"version": "0.1.0-develop.36",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libethclient",
"version": "0.1.0-develop.35",
"version": "0.1.0-develop.36",
"dependencies": {
"@chainsafe/as-sha256": "^0.3.1",
"@chainsafe/bls": "7.1.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libethsync",
"version": "0.1.0-develop.35",
"version": "0.1.0-develop.36",
"type": "module",
"repository": {
"type": "git",

View File

@ -45,7 +45,7 @@ import {
RPCTx,
} from "./types.js";
import { keccak256 } from "ethereum-cryptography/keccak";
import { fromHexString } from "@chainsafe/ssz";
import { byteArrayEquals, 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.push([curr, arr[idx + 1]]) : acc,
idx % 2 === 0 ? acc.concat([[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,7 +640,10 @@ export default class VerifyingProvider implements IClientVerifyingProvider {
private verifyCodeHash(code: Bytes, codeHash: Bytes32): boolean {
return (
(code === "0x" && codeHash === "0x" + KECCAK256_NULL_S) ||
keccak256(fromHexString(codeHash)) === fromHexString(codeHash)
byteArrayEquals(
keccak256(fromHexString(codeHash)),
fromHexString(codeHash),
)
);
}

View File

@ -5,7 +5,6 @@ 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;
@ -23,14 +22,10 @@ export default class Store implements IStore {
addUpdate(period: number, update: LightClientUpdate) {
try {
this.store.set(period, {
update: fixSerializedUint8Array(
capella.ssz.LightClientUpdate.serialize(update),
),
nextCommittee: fixSerializedUint8Array(
CommitteeSSZ.serialize(update.nextSyncCommittee.pubkeys),
),
nextCommitteeHash: fixSerializedUint8Array(
digest(concatBytes(...update.nextSyncCommittee.pubkeys)),
update: capella.ssz.LightClientUpdate.serialize(update),
nextCommittee: CommitteeSSZ.serialize(update.nextSyncCommittee.pubkeys),
nextCommitteeHash: digest(
concatBytes(...update.nextSyncCommittee.pubkeys),
),
});
} catch (e) {

View File

@ -131,6 +131,3 @@ function isValidLightClientHeader(
header.beacon.bodyRoot,
);
}
export function fixSerializedUint8Array(arr: Uint8Array) {
return new Uint8Array(Object.values(arr));
}