-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
HeadTracker finalization support #12082
HeadTracker finalization support #12082
Conversation
# Conflicts: # common/client/mock_rpc_test.go
I see that you haven't updated any README files. Would it make sense to do so? |
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
core/chains/evm/headtracker/heads.go
Outdated
} | ||
|
||
// copy slice as we are going to modify it | ||
newHeads := make([]*evmtypes.Head, len(h.heads)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we copy this to h.heads ? It seems like we do all the work but we don't actually update the original structure.
…smartcontractkit/chainlink into feature/BCI-2649-latest-finalized-block
core/chains/evm/client/client.go
Outdated
@@ -366,3 +367,7 @@ func (client *client) SuggestGasTipCap(ctx context.Context) (tipCap *big.Int, er | |||
func (client *client) IsL2() bool { | |||
return client.pool.ChainType().IsL2() | |||
} | |||
|
|||
func (client *client) LatestFinalizedBlock(_ context.Context) (*evmtypes.Head, error) { | |||
panic("not implemented. client was deprecated. New methods are added only to satisfy type constraints while we are migrating to new alternatives") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the entire app should crash if someone uses this method by mistake. It's better if we return nil & an error message so any user can handle this gracefully.
This is a public PR so I don't see why this shouldn't be mentioned 😅 . Can you dm me the example? |
Co-authored-by: Dimitris Grigoriou <[email protected]>
# Conflicts: # core/chains/evm/client/simulated_backend_client.go
Quality Gate passedIssues Measures |
* Add LatestFinalizedBlock to HeadTracker * Added LatestFinalizedHead to Head * remove unused func * fix flakey nil pointer * improve logs & address lint issue * nitpicks * fixed copy on heads on MarkFinalized * error instead of panic * return error instead of panic * nitpicks * Finalized block based history depth * simplify trimming * nit fixes * fix build issues caused by merge * regen * FIx rpc client mock generation * nit fixes * nit fixes * update comments * ensure that we trim redundant blocks both in slice and in chain in Heads handle corner case for multiple uncle blocks at the end of the slice * nit fix * Update common/headtracker/head_tracker.go Co-authored-by: Dimitris Grigoriou <[email protected]> * HeadTracker backfill test with 0 finality depth * docs * Update docs/CHANGELOG.md Co-authored-by: Dimitris Grigoriou <[email protected]> * ensure latest finalized block is valid on startup * changeset * switch from warn to debug level when we failed to makr block as finalized --------- Co-authored-by: Dimitris Grigoriou <[email protected]>
* Add LatestFinalizedBlock to HeadTracker * Added LatestFinalizedHead to Head * remove unused func * fix flakey nil pointer * improve logs & address lint issue * nitpicks * fixed copy on heads on MarkFinalized * error instead of panic * return error instead of panic * nitpicks * Finalized block based history depth * simplify trimming * nit fixes * fix build issues caused by merge * regen * FIx rpc client mock generation * nit fixes * nit fixes * update comments * ensure that we trim redundant blocks both in slice and in chain in Heads handle corner case for multiple uncle blocks at the end of the slice * nit fix * Update common/headtracker/head_tracker.go Co-authored-by: Dimitris Grigoriou <[email protected]> * HeadTracker backfill test with 0 finality depth * docs * Update docs/CHANGELOG.md Co-authored-by: Dimitris Grigoriou <[email protected]> * ensure latest finalized block is valid on startup * changeset * switch from warn to debug level when we failed to makr block as finalized --------- Co-authored-by: Dimitris Grigoriou <[email protected]>
historyDepth
blocks in the cache. Such logic could have lead to redundant RPC calls on a chain with finalityTags ifhistoryDepth
was smaller than the actualfinalityDepth.
To address this issue, we only trim blocks that are older thanlatestFinalized - historyDepth