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

Exec: commit root caching #518

Merged
merged 9 commits into from
Jan 31, 2025
Merged

Exec: commit root caching #518

merged 9 commits into from
Jan 31, 2025

Conversation

winder
Copy link
Contributor

@winder winder commented Jan 29, 2025

Add a CommitsRootCache which allows the execute plugin to remember what has already been executed. This enables it to skip RPC calls associated with known-executed commit roots.

In addition, a snooze button was added which allows us to snooze commit roots associated with cursed chains.

@winder winder mentioned this pull request Jan 29, 2025
@winder winder marked this pull request as ready for review January 29, 2025 20:21
@winder winder requested a review from a team as a code owner January 29, 2025 20:21
mateusz-sekara
mateusz-sekara previously approved these changes Jan 30, 2025
// Filter out reports that cannot be executed (snoozed).
// TODO: filter func instead of 'canExecute'?
var filtered []exectypes.CommitData
for _, commitReport := range reports {
Copy link
Contributor

Choose a reason for hiding this comment

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

The original commit_roots.go also has a nice trick with a sliding window. Therefore we were limiting a number of database logs fetched from the db to memory by narrowing the lookup window based on the latest finalized and executed Commit Report. Not sure if applicable here, but I wanted to raise that as a follow-up perf improvement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thats another great optimization that I've been thinking about. We can take it a step further by adding a "Pending" cache, that way stuck transactions wouldn't prevent us from narrowing the lookup window.

commitRootsCache cache.CommitsRootsCache

// TODO: remove this, it can be transient. Also its logger is never initialized.
observationOptimizer optimizers.ObservationOptimizer
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we remove it as a part of this PR? If not, could please create a ticket? I think we easily forget about these TODOs in the code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated PR to address this TODO.

// TODO: filter func instead of 'canExecute'?
var filtered []exectypes.CommitData
for _, commitReport := range reports {
if !canExecute(commitReport.SourceChain, commitReport.MerkleRoot) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth logging as debug these skipped reports

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, added a log.

0xnogo
0xnogo previously approved these changes Jan 30, 2025
Copy link

Metric will/snooze-2 main
Coverage 75.6% 75.5%

@winder winder merged commit f7b9617 into main Jan 31, 2025
17 checks passed
@winder winder deleted the will/snooze-2 branch January 31, 2025 17:38
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.

3 participants