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

Feature/bci 2996 local finality violation #13048

Merged
merged 72 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
800e8d8
implement RPCClient changes
dhaidashenko Apr 29, 2024
1bc46f8
simplify interception of RPC's view on chain
dhaidashenko Apr 30, 2024
9d46a41
Remove redundant changes
dhaidashenko Apr 30, 2024
8627c95
remove redundant changes
dhaidashenko Apr 30, 2024
5f306bd
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko Apr 30, 2024
4788f16
do not pick RPC as active if it's lagging on finalized block
dhaidashenko May 6, 2024
cb05bdb
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko May 6, 2024
0a30137
fix race
dhaidashenko May 7, 2024
1431d77
minor refactor
dhaidashenko May 8, 2024
a1b8b6d
Added FinalizedBlockOffset to config
dhaidashenko May 10, 2024
c7a38cd
HeadTracker support of FinalizedBlockOffset
dhaidashenko May 10, 2024
7d21583
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko May 10, 2024
6a2e4be
fix lint issues
dhaidashenko May 10, 2024
a377ccb
switch logpoller to head tracker
dhaidashenko May 10, 2024
d79ef7e
remove redundant changes
dhaidashenko May 10, 2024
27b146a
fix build
dhaidashenko May 10, 2024
ab31c32
Capture latest chain info on RPC level to avoid race on state transit…
dhaidashenko May 13, 2024
bfe7a54
EnforceRepeatableRead config option
dhaidashenko May 13, 2024
71117fe
ensure HeadTracked does not miss block if it's committed between ini…
dhaidashenko May 13, 2024
32511e3
hot fix flakey test
dhaidashenko May 13, 2024
fffaa3b
fix build & changeset
dhaidashenko May 13, 2024
2bdc0f0
remove outdated test
dhaidashenko May 13, 2024
4a00825
fix headtracker tests
dhaidashenko May 13, 2024
3d41882
use polling in head tracker to get latest finalized block
dhaidashenko May 14, 2024
2078ea6
fix relay
dhaidashenko May 14, 2024
e213656
regen mocks
dhaidashenko May 14, 2024
1b80553
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko May 14, 2024
2d0a17d
use proper context in the LogPoller's latestBlocks
dhaidashenko May 14, 2024
0b5d25d
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko May 15, 2024
fad674c
fix flaky test
dhaidashenko May 15, 2024
a1c45b4
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko May 20, 2024
3dd728b
fixes for changes from develop branch
dhaidashenko May 20, 2024
a105c9d
replace panic with FailNow
dhaidashenko May 23, 2024
a0da533
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko May 23, 2024
ee06183
report dead node only if it's dead for long enough
dhaidashenko May 23, 2024
277facf
fix racy test
dhaidashenko May 23, 2024
2bc2903
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko May 30, 2024
0c00407
rollback foundry change caused by merge with develop
dhaidashenko May 30, 2024
dff61c0
use active node as source of HighestChainInfo to reduce number of tra…
dhaidashenko Jun 4, 2024
588944c
optimised loading of latest finalized block
dhaidashenko Jun 4, 2024
7ddd6a5
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko Jun 5, 2024
fca61d5
fix merge conflicts
dhaidashenko Jun 5, 2024
650e7c5
make generate
dhaidashenko Jun 5, 2024
44bd1f5
simplify capturing of app layer observations
dhaidashenko Jun 5, 2024
d76d2f6
ensure logpoller is not affected by FinalityTagBypass
dhaidashenko Jun 5, 2024
3e3fced
fix comment
dhaidashenko Jun 5, 2024
4c4de8b
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko Jun 5, 2024
71b5251
reset keystone to develop
dhaidashenko Jun 5, 2024
3b9dfc3
reset keystone
dhaidashenko Jun 5, 2024
bf9ac9f
reset to develop
dhaidashenko Jun 5, 2024
9a990dd
ungoimport
dhaidashenko Jun 5, 2024
41f1d4b
move newChainIDSubForwarder into the test
dhaidashenko Jun 6, 2024
33a0113
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko Jun 6, 2024
724b472
fix typo
dhaidashenko Jun 7, 2024
003efd0
Merge branch 'feature/BCI-2996-local-finality-violation' of github.co…
dhaidashenko Jun 7, 2024
0108734
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko Jun 10, 2024
399af41
Move deathDeclarationDelay to config
dhaidashenko Jun 10, 2024
073707c
Comments adjustments
dhaidashenko Jun 14, 2024
669b8cd
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko Jun 14, 2024
7abfbfe
fix merge issues
dhaidashenko Jun 14, 2024
b7f02a1
regen mocks
dhaidashenko Jun 14, 2024
93030c1
fix multinode flaky test
dhaidashenko Jun 17, 2024
8214f46
refactor SetTotalDifficultyIfGt to MaxTotalDifficulty
dhaidashenko Jun 20, 2024
e6fbfc0
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko Jun 20, 2024
ab317a2
Use softer language in LatestFinalizedBlock comments
dhaidashenko Jun 21, 2024
df26dff
nits
dhaidashenko Jun 21, 2024
6ecd7d9
Merge branch 'feature/BCI-2996-local-finality-violation' of github.co…
dhaidashenko Jun 21, 2024
289fe91
Ensure HistoryDepth is >= FinalizedBlockOffset
dhaidashenko Jun 26, 2024
7558770
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko Jun 26, 2024
99fd66f
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
dhaidashenko Jun 27, 2024
992aeb4
regen mocks with newer version
dhaidashenko Jun 27, 2024
3e942c0
Merge branch 'develop' into feature/BCI-2996-local-finality-violation
reductionista Jun 27, 2024
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
9 changes: 9 additions & 0 deletions .changeset/dull-ants-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"chainlink": patch
---

Fixed local finality violation caused by an RPC lagging behind on latest finalized block.

Added `EVM.FinalizedBlockOffset` and `EVM.NodePool.EnforceRepeatableRead` config options.
With `EnforceRepeatableRead = true`, RPC is considered healthy only if its most recent finalized block is larger or equal to the highest finalized block observed by the Node minus `FinalizedBlockOffset`.
#bugfix
17 changes: 17 additions & 0 deletions common/client/ctx.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package client

import "context"

type multiNodeContextKey int

const (
contextKeyHeathCheckRequest multiNodeContextKey = iota + 1
)

func CtxAddHealthCheckFlag(ctx context.Context) context.Context {
return context.WithValue(ctx, contextKeyHeathCheckRequest, struct{}{})
}

func CtxIsHeathCheckRequest(ctx context.Context) bool {
return ctx.Value(contextKeyHeathCheckRequest) != nil
}
16 changes: 16 additions & 0 deletions common/client/ctx_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package client

import (
"testing"

"github.com/stretchr/testify/assert"

"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
)

func TestContext(t *testing.T) {
ctx := tests.Context(t)
assert.False(t, CtxIsHeathCheckRequest(ctx), "expected false for test context")
ctx = CtxAddHealthCheckFlag(ctx)
assert.True(t, CtxIsHeathCheckRequest(ctx), "expected context to contain the healthcheck flag")
}
51 changes: 38 additions & 13 deletions common/client/mock_node_client_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 30 additions & 18 deletions common/client/mock_node_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions common/client/mock_pool_chain_info_provider_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 38 additions & 13 deletions common/client/mock_rpc_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions common/client/mocks/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package mocks
import "time"

type ChainConfig struct {
IsFinalityTagEnabled bool
FinalityDepthVal uint32
NoNewHeadsThresholdVal time.Duration
IsFinalityTagEnabled bool
FinalityDepthVal uint32
NoNewHeadsThresholdVal time.Duration
FinalizedBlockOffsetVal uint32
}

func (t ChainConfig) NodeNoNewHeadsThreshold() time.Duration {
Expand All @@ -19,3 +20,7 @@ func (t ChainConfig) FinalityDepth() uint32 {
func (t ChainConfig) FinalityTagEnabled() bool {
return t.IsFinalityTagEnabled
}

func (t ChainConfig) FinalizedBlockOffset() uint32 {
return t.FinalizedBlockOffsetVal
}
Loading
Loading