From 93d28e6c5ca90bb42d0a6a368b4ddf0655058c38 Mon Sep 17 00:00:00 2001 From: Oleg Kovalov Date: Mon, 14 Oct 2024 13:08:40 +0200 Subject: [PATCH] remove old comment --- header.go | 3 ++- p2p/server_test.go | 2 +- sync/sync_head.go | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/header.go b/header.go index 010ab2ca..75cfa4d0 100644 --- a/header.go +++ b/header.go @@ -12,7 +12,8 @@ type Header[H any] interface { // New creates new instance of a header. // It exists to overcome limitation of Go's type system. // See: - // https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#pointer-method-example + // + //https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md#pointer-method-example New() H // IsZero reports whether Header is a zero value of it's concrete type. IsZero() bool diff --git a/p2p/server_test.go b/p2p/server_test.go index 1e896b2e..77496d92 100644 --- a/p2p/server_test.go +++ b/p2p/server_test.go @@ -176,7 +176,7 @@ func (timeoutStore[H]) Append(ctx context.Context, _ ...H) error { return ctx.Err() } -func (timeoutStore[H]) GetRange(ctx context.Context, _ uint64, _ uint64) ([]H, error) { +func (timeoutStore[H]) GetRange(ctx context.Context, _, _ uint64) ([]H, error) { <-ctx.Done() return nil, ctx.Err() } diff --git a/sync/sync_head.go b/sync/sync_head.go index f808f6c6..552d5b62 100644 --- a/sync/sync_head.go +++ b/sync/sync_head.go @@ -196,16 +196,16 @@ func (s *Syncer[H]) verify(ctx context.Context, newHead H) (bool, error) { return false, err } -/* -Subjective head is 500, network head is 1000. -Header at height 1000 does not have sufficient validator set overlap, -so the client downloads height 750 (which does have enough sufficient overlap), -verifies it against 500 and advances the subjective head to 750. - -Client tries to apply height 1000 against 750 and if there is sufficient overlap, -it applies 1000 as the subjective head. -If not, it downloads the halfway point and retries the process. -*/ +// verifySkipping will try to find such headers in range (subjHead, networkHeader) +// that can be verified by subjHead, literally: +// +// header.Verify(subjHead, candidate) +// +// and also such headers can verify `networkHeader`, literally +// +// header.Verify(candidate, networkHeader) +// +// When such candidates cannot be found [NewValidatorSetCantBeTrustedError] will be returned. func (s *Syncer[H]) verifySkipping(ctx context.Context, subjHead, networkHeader H) error { subjHeight := subjHead.Height()