Skip to content

Commit 16f5a59

Browse files
committed
refactor: rename HeightChecker to HeightProvider for clarity in execution layer
1 parent 1d9a4d7 commit 16f5a59

5 files changed

Lines changed: 9 additions & 11 deletions

File tree

block/internal/executing/executor.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -588,12 +588,10 @@ func (e *Executor) applyBlock(ctx context.Context, header types.Header, data *ty
588588
// This is called during initialization to handle crash recovery scenarios where ev-node
589589
// is ahead of the execution layer.
590590
func (e *Executor) syncExecutionLayer(ctx context.Context, state types.State) error {
591-
// Check if the executor supports height checking
592-
execHeightChecker, ok := e.exec.(interface {
593-
GetLatestHeight(ctx context.Context) (uint64, error)
594-
})
591+
// Check if the executor implements HeightProvider
592+
execHeightProvider, ok := e.exec.(coreexecutor.HeightProvider)
595593
if !ok {
596-
e.logger.Debug().Msg("executor does not support height checking, skipping sync")
594+
e.logger.Debug().Msg("executor does not implement HeightProvider, skipping sync")
597595
return nil
598596
}
599597

@@ -605,7 +603,7 @@ func (e *Executor) syncExecutionLayer(ctx context.Context, state types.State) er
605603
return nil
606604
}
607605

608-
execHeight, err := execHeightChecker.GetLatestHeight(ctx)
606+
execHeight, err := execHeightProvider.GetLatestHeight(ctx)
609607
if err != nil {
610608
return fmt.Errorf("failed to get execution layer height: %w", err)
611609
}

block/internal/executing/sync_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
"github.com/evstack/ev-node/types"
1515
)
1616

17-
// MockHeightAwareExecutor is a mock that implements both Executor and HeightChecker
17+
// MockHeightAwareExecutor is a mock that implements both Executor and HeightProvider
1818
type MockHeightAwareExecutor struct {
1919
mock.Mock
2020
}

core/execution/execution.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ type Executor interface {
8686
SetFinal(ctx context.Context, blockHeight uint64) error
8787
}
8888

89-
// HeightChecker is an optional interface that execution clients can implement
89+
// HeightProvider is an optional interface that execution clients can implement
9090
// to support height synchronization checks between ev-node and the execution layer.
91-
type HeightChecker interface {
91+
type HeightProvider interface {
9292
// GetLatestHeight returns the current block height of the execution layer.
9393
// This is useful for detecting desynchronization between ev-node and the execution layer
9494
// after crashes or restarts.

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,5 @@ require (
161161
gopkg.in/yaml.v3 v3.0.1 // indirect
162162
lukechampine.com/blake3 v1.4.1 // indirect
163163
)
164+
165+
replace github.com/evstack/ev-node/core => ./core

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
6262
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
6363
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
6464
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
65-
github.com/evstack/ev-node/core v1.0.0-beta.3 h1:01K2Ygm3puX4m2OBxvg/HDxu+he54jeNv+KDmpgujFc=
66-
github.com/evstack/ev-node/core v1.0.0-beta.3/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY=
6765
github.com/filecoin-project/go-clock v0.1.0 h1:SFbYIM75M8NnFm1yMHhN9Ahy3W5bEZV9gd6MPfXbKVU=
6866
github.com/filecoin-project/go-clock v0.1.0/go.mod h1:4uB/O4PvOjlx1VCMdZ9MyDZXRm//gkj1ELEbxfI1AZs=
6967
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=

0 commit comments

Comments
 (0)