Compare commits
4 Commits
v0.1.0-dev
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 26e29924ce | |
Derrick Hammer | 7932fbbf12 | |
Derrick Hammer | c90c3db973 | |
Derrick Hammer | 6f07421fe8 |
|
@ -1,3 +1,10 @@
|
|||
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-07-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* implement isValidLightClientHeader ([6f07421](https://git.lumeweb.com/LumeWeb/libethsync/commit/6f07421fe80f008255cbe472204d8530e2bb3352))
|
||||
|
||||
# [0.1.0-develop.14](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.13...v0.1.0-develop.14) (2023-07-11)
|
||||
|
||||
|
||||
|
|
3
LICENSE
3
LICENSE
|
@ -1,6 +1,7 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
Copyright (c) 2023 Hammer Technologies LLC
|
||||
Copyright (c) 2022 Shresth Agrawal
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@lumeweb/libethclient",
|
||||
"version": "0.1.0-develop.14",
|
||||
"version": "0.1.0-develop.15",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lumeweb/libethclient",
|
||||
"version": "0.1.0-develop.14",
|
||||
"version": "0.1.0-develop.15",
|
||||
"dependencies": {
|
||||
"@chainsafe/as-sha256": "^0.3.1",
|
||||
"@chainsafe/bls": "7.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lumeweb/libethsync",
|
||||
"version": "0.1.0-develop.14",
|
||||
"version": "0.1.0-develop.15",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
32
src/util.ts
32
src/util.ts
|
@ -1,4 +1,9 @@
|
|||
import { createBeaconConfig } from "@lodestar/config";
|
||||
import {
|
||||
createBeaconConfig,
|
||||
BeaconConfig,
|
||||
ChainForkConfig,
|
||||
} from "@lodestar/config";
|
||||
import { allForks } from "@lodestar/types";
|
||||
import { BEACON_SYNC_SUPER_MAJORITY, mainnetConfig } from "./constants.js";
|
||||
import { networksChainConfig } from "@lodestar/config/networks";
|
||||
import { fromHexString } from "@chainsafe/ssz";
|
||||
|
@ -9,7 +14,14 @@ import axiosRetry from "axios-retry";
|
|||
import axios from "axios";
|
||||
import { digest } from "@chainsafe/as-sha256";
|
||||
import { concatBytes } from "@noble/hashes/utils";
|
||||
import { deserializeSyncCommittee } from "@lodestar/light-client/utils";
|
||||
import {
|
||||
deserializeSyncCommittee,
|
||||
isValidMerkleBranch,
|
||||
} from "@lodestar/light-client/utils";
|
||||
import {
|
||||
BLOCK_BODY_EXECUTION_PAYLOAD_DEPTH as EXECUTION_PAYLOAD_DEPTH,
|
||||
BLOCK_BODY_EXECUTION_PAYLOAD_INDEX as EXECUTION_PAYLOAD_INDEX,
|
||||
} from "@lodestar/params";
|
||||
|
||||
export function getDefaultClientConfig() {
|
||||
const chainConfig = createBeaconConfig(
|
||||
|
@ -103,3 +115,19 @@ export async function getConsensusOptimisticUpdate() {
|
|||
|
||||
return update.data;
|
||||
}
|
||||
function isValidLightClientHeader(
|
||||
config: ChainForkConfig,
|
||||
header: allForks.LightClientHeader,
|
||||
): boolean {
|
||||
return isValidMerkleBranch(
|
||||
config
|
||||
.getExecutionForkTypes(header.beacon.slot)
|
||||
.ExecutionPayloadHeader.hashTreeRoot(
|
||||
(header as capella.LightClientHeader).execution,
|
||||
),
|
||||
(header as capella.LightClientHeader).executionBranch,
|
||||
EXECUTION_PAYLOAD_DEPTH,
|
||||
EXECUTION_PAYLOAD_INDEX,
|
||||
header.beacon.bodyRoot,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue