Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update persistent-merkle-tree 0.6.1 #5969

Merged
merged 6 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"check-readme": "typescript-docs-verifier"
},
"dependencies": {
"@chainsafe/persistent-merkle-tree": "^0.5.0",
"@chainsafe/persistent-merkle-tree": "^0.6.1",
"@chainsafe/ssz": "^0.13.0",
"@lodestar/config": "^1.11.1",
"@lodestar/params": "^1.11.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"@chainsafe/discv5": "^5.1.0",
"@chainsafe/libp2p-gossipsub": "^10.1.0",
"@chainsafe/libp2p-noise": "^13.0.0",
"@chainsafe/persistent-merkle-tree": "^0.5.0",
"@chainsafe/persistent-merkle-tree": "^0.6.1",
"@chainsafe/prometheus-gc-stats": "^1.0.0",
"@chainsafe/ssz": "^0.13.0",
"@chainsafe/threads": "^1.11.1",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@chainsafe/discv5": "^5.1.0",
"@chainsafe/ssz": "^0.13.0",
"@chainsafe/threads": "^1.11.1",
"@chainsafe/persistent-merkle-tree": "^0.6.1",
"@libp2p/crypto": "^2.0.2",
"@libp2p/peer-id": "^3.0.1",
"@libp2p/peer-id-factory": "^3.0.2",
Expand Down
15 changes: 11 additions & 4 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/usr/bin/env node

// MUST import first to apply preset from args
import "./applyPreset.js";
import {YargsError} from "./util/index.js";
import {getLodestarCli, yarg} from "./cli.js";
// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/as-sha256.js";
// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies
import {setHasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index.js";
wemeetagain marked this conversation as resolved.
Show resolved Hide resolved
import "source-map-support/register.js";

// without setting this first, persistent-merkle-tree will use noble instead
setHasher(hasher);

// MUST import second to apply preset from args
await import("./applyPreset.js");
const {YargsError} = await import("./util/index.js");
const {getLodestarCli, yarg} = await import("./cli.js");
const lodestar = getLodestarCli();

void lodestar
Expand Down
2 changes: 1 addition & 1 deletion packages/light-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
"dependencies": {
"@chainsafe/bls": "7.1.1",
"@chainsafe/persistent-merkle-tree": "^0.5.0",
"@chainsafe/persistent-merkle-tree": "^0.6.1",
"@chainsafe/ssz": "^0.13.0",
"@lodestar/api": "^1.11.1",
"@lodestar/config": "^1.11.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/light-client/src/utils/verifyMerkleBranch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {byteArrayEquals} from "@chainsafe/ssz";
import {hash} from "@chainsafe/persistent-merkle-tree";
import {hasher} from "@chainsafe/persistent-merkle-tree";

export const SYNC_COMMITTEES_DEPTH = 4;
export const SYNC_COMMITTEES_INDEX = 11;
Expand All @@ -20,9 +20,9 @@ export function isValidMerkleBranch(
let value = leaf;
for (let i = 0; i < depth; i++) {
if (Math.floor(index / 2 ** i) % 2) {
value = hash(proof[i], value);
value = hasher.digest64(proof[i], value);
} else {
value = hash(value, proof[i]);
value = hasher.digest64(value, proof[i]);
}
}
return byteArrayEquals(value, root);
Expand Down
14 changes: 10 additions & 4 deletions packages/prover/src/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#!/usr/bin/env node

// MUST import first to apply preset from args
import "./applyPreset.js";
import {YargsError} from "../utils/errors.js";
import {getLodestarProverCli, yarg} from "./cli.js";
// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies
import {hasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/as-sha256.js";
// eslint-disable-next-line no-restricted-imports, import/no-extraneous-dependencies
import {setHasher} from "@chainsafe/persistent-merkle-tree/lib/hasher/index.js";
import "source-map-support/register.js";

// without setting this first, persistent-merkle-tree will use noble instead
setHasher(hasher);
// MUST import second to apply preset from args
await import("./applyPreset.js");
const {getLodestarProverCli, yarg} = await import("./cli.js");
const {YargsError} = await import("../utils/errors.js");
const prover = getLodestarProverCli();

void prover
Expand Down
2 changes: 1 addition & 1 deletion packages/state-transition/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"dependencies": {
"@chainsafe/as-sha256": "^0.3.1",
"@chainsafe/bls": "7.1.1",
"@chainsafe/persistent-merkle-tree": "^0.5.0",
"@chainsafe/persistent-merkle-tree": "^0.6.1",
"@chainsafe/persistent-ts": "^0.19.1",
"@chainsafe/ssz": "^0.13.0",
"@lodestar/config": "^1.11.1",
Expand Down
7 changes: 0 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -611,13 +611,6 @@
dependencies:
"@chainsafe/is-ip" "^2.0.1"

"@chainsafe/persistent-merkle-tree@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.5.0.tgz#2b4a62c9489a5739dedd197250d8d2f5427e9f63"
integrity sha512-l0V1b5clxA3iwQLXP40zYjyZYospQLZXzBVIhhr9kDg/1qHZfzzHw0jj4VPBijfYCArZDlPkRi1wZaV2POKeuw==
dependencies:
"@chainsafe/as-sha256" "^0.3.1"

"@chainsafe/persistent-merkle-tree@^0.6.1":
version "0.6.1"
resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.6.1.tgz#37bde25cf6cbe1660ad84311aa73157dc86ec7f2"
Expand Down
Loading