Compare commits
3 Commits
v0.1.0-dev
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 9bf3aaf07b | |
Derrick Hammer | 746e76ecfc | |
Derrick Hammer | ccaca65a90 |
|
@ -1,3 +1,10 @@
|
|||
# [0.1.0-develop.52](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.51...v0.1.0-develop.52) (2023-09-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add syncFromCheckpoint method ([ccaca65](https://git.lumeweb.com/LumeWeb/libethsync/commit/ccaca65a900ec75adc1605e5b22caab4182587dd))
|
||||
|
||||
# [0.1.0-develop.51](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.50...v0.1.0-develop.51) (2023-09-16)
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "@lumeweb/libethsync",
|
||||
"version": "0.1.0-develop.51",
|
||||
"version": "0.1.0-develop.52",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@lumeweb/libethsync",
|
||||
"version": "0.1.0-develop.51",
|
||||
"version": "0.1.0-develop.52",
|
||||
"dependencies": {
|
||||
"@chainsafe/as-sha256": "^0.3.1",
|
||||
"@chainsafe/bls": "7.1.1",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lumeweb/libethsync",
|
||||
"version": "0.1.0-develop.51",
|
||||
"version": "0.1.0-develop.52",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -56,7 +56,7 @@ export default abstract class BaseClient extends EventEmitter {
|
|||
return this._latestOptimisticUpdate as Uint8Array;
|
||||
}
|
||||
|
||||
private _latestPeriod: number = -1;
|
||||
protected _latestPeriod: number = -1;
|
||||
|
||||
get latestPeriod(): number {
|
||||
return this._latestPeriod;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import BaseClient, { BaseClientOptions } from "#baseClient.js";
|
||||
import { IProver, IVerifyingProviderConstructor } from "#interfaces.js";
|
||||
import { IClientVerifyingProvider } from "#client/verifyingProvider.js";
|
||||
import { LightClientUpdate } from "#types.js";
|
||||
import { computeSyncPeriodAtSlot } from "@lodestar/light-client/utils/index.js";
|
||||
|
||||
interface Config extends BaseClientOptions {
|
||||
prover: IProver;
|
||||
|
@ -19,7 +21,10 @@ export default class Client extends BaseClient {
|
|||
|
||||
async sync(): Promise<void> {
|
||||
await super.sync();
|
||||
await this.boot();
|
||||
}
|
||||
|
||||
private async boot() {
|
||||
if (!this.provider) {
|
||||
const { blockHash, blockNumber } = await this.getNextValidExecutionInfo();
|
||||
const factory = this.options.provider;
|
||||
|
@ -40,6 +45,16 @@ export default class Client extends BaseClient {
|
|||
}
|
||||
}
|
||||
|
||||
public async syncFromCheckpoint(checkpoint: LightClientUpdate) {
|
||||
this._latestPeriod = computeSyncPeriodAtSlot(
|
||||
checkpoint.attestedHeader.beacon.slot,
|
||||
);
|
||||
this.latestCommittee = checkpoint.nextSyncCommittee.pubkeys;
|
||||
this.booted = true;
|
||||
|
||||
await super.sync();
|
||||
}
|
||||
|
||||
public async rpcCall(method: string, params: any) {
|
||||
return this.provider?.rpcMethod(method, params);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue