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

No new finalized Heads Implementation #13907

Merged
merged 12 commits into from
Jul 30, 2024

Conversation

dhaidashenko
Copy link
Collaborator

@dhaidashenko dhaidashenko commented Jul 19, 2024

  • Added new health check that ensures RPC provides new finalized heads at least every NoNewFinalizedHeadsThreshold
  • Ensure that out-of-sync loop transitions to alive only when RPC satisfies all restrictions. (Previously it was sufficient for RPC to satisfies constraint that caused transition to out-of-sync)

Explanation of methodology to define NoNewFinalizedHeadsThreshold is available here
Default values were only set for chains that have FinalityTagEnabled = true for CCIP and NoNewHeadsThreshold > 0.

@dhaidashenko dhaidashenko marked this pull request as ready for review July 21, 2024 15:11
@dhaidashenko dhaidashenko requested review from a team as code owners July 21, 2024 15:11
DylanTinianov
DylanTinianov previously approved these changes Jul 24, 2024
Copy link
Contributor

@DylanTinianov DylanTinianov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit on sync issue naming, but looks good.

Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>
Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>
Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>
…hub.com:smartcontractkit/chainlink into feature/BCI-3731-no-new-finalized-block-develop
amit-momin
amit-momin previously approved these changes Jul 24, 2024
Copy link
Contributor

@amit-momin amit-momin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

common/client/models.go Outdated Show resolved Hide resolved
Comment on lines +289 to +291
//n.stateMu.Lock()
//n.healthCheckSubs = append(n.healthCheckSubs, sub)
//n.stateMu.Unlock()
Copy link
Collaborator

@dimriou dimriou Jul 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these placeholders?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, after merging the BCI-2875 result.sub = sub will be replaced with

n.stateMu.Lock()
n.healthCheckSubs = append(n.healthCheckSubs, sub)
n.stateMu.Unlock()

if !n.onNewHead(lggr, &localHighestChainInfo, head) {
continue
}

Copy link
Collaborator

@dimriou dimriou Jul 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can you add a one-line comment here to quickly explain how we use bitwise operators? i.e. "We clear NoNewHead sync issue, after receiving a new head and check for out of sync." or something along these lines. It took me some time to figure out what is going on, without context.

Comment on lines 80 to 90
type syncIssue int

const (
// syncIssueNotInSyncWithPool - RPC is lagging behind the highest block observed within the pool of RPCs
syncIssueNotInSyncWithPool syncIssue = 1 << iota
// syncIssueNoNewHead - RPC failed to produce a new head for too long
syncIssueNoNewHead
// syncIssueNoNewFinalizedHead - RPC failed to produce a new finalized head for too long
syncIssueNoNewFinalizedHead
syncIssueLen
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does changing syncIssue to syncStatus and adding synced state as 0 work, or does it mess up the enumeration incrementation? I noticed in outOfSyncLoop we use a 0 value instead of an enum value because of this.

…hub.com:smartcontractkit/chainlink into feature/BCI-3731-no-new-finalized-block-develop
@dimriou dimriou added this pull request to the merge queue Jul 30, 2024
Merged via the queue into develop with commit 1eaf5e0 Jul 30, 2024
115 checks passed
@dimriou dimriou deleted the feature/BCI-3731-no-new-finalized-block-develop branch July 30, 2024 10:51
Tofel pushed a commit that referenced this pull request Jul 31, 2024
* No new finalized Heads Implementation

* fixed tests

* update defaults for NoNewFinalizedHeadsThreshold

* Update common/client/node_lifecycle.go

Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>

* Update common/client/node_lifecycle_test.go

Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>

* Update common/client/node_lifecycle_test.go

Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>

* rename HeadIsNotIncreasing to NoNewHead

* move and add docs for syncIssue consts

* rename syncIssue to syncStatus

---------

Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>
friedemannf added a commit to smartcontractkit/ccip that referenced this pull request Aug 20, 2024
asoliman92 pushed a commit that referenced this pull request Aug 28, 2024
* No new finalized Heads Implementation

* fixed tests

* update defaults for NoNewFinalizedHeadsThreshold

* Update common/client/node_lifecycle.go

Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>

* Update common/client/node_lifecycle_test.go

Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>

* Update common/client/node_lifecycle_test.go

Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>

* rename HeadIsNotIncreasing to NoNewHead

* move and add docs for syncIssue consts

* rename syncIssue to syncStatus

---------

Co-authored-by: amit-momin <108959691+amit-momin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants