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

Add execution circuit breaker #3669

Merged
merged 4 commits into from
Jan 26, 2024
Merged

Add execution circuit breaker #3669

merged 4 commits into from
Jan 26, 2024

Conversation

zbuc
Copy link
Contributor

@zbuc zbuc commented Jan 25, 2024

This adds a circuit break mechanism to the DEX that bounds the maximum number of path searches and position executions for any given batch swap during a block, to prevent potentially unbounded looping.

Closes #3303

@zbuc zbuc force-pushed the 3374_exec_circuit_breaker branch from d949472 to 2ac6b0c Compare January 25, 2024 21:50
@erwanor
Copy link
Member

erwanor commented Jan 25, 2024

Will do a review on the concrete implementation, but first high-level comment: this approach is clean and I think that it follows what @hdevalence outlined on discord: a top level counter that increments function calls to path_search and fill_route.

I think my preference would be for more intrusive metering, where we reach deep into fill_route_inner and track each position we fill against. The reason for this is that a bug in the constraint resolution logic, or in the Frontier::load code, will cause a chain hang (similar to Testnet 53's) and infinite execution that the current approach would miss. With that said, I will review the approach that we have decided on here.

use penumbra_proto::{core::component::dex::v1alpha1 as pb, DomainType, TypeUrl};

#[derive(Debug, Clone, Default)]
pub struct AssetTallies {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't used AFAICT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is preliminary for the value circuit breaker

Copy link
Member

@erwanor erwanor left a comment

Choose a reason for hiding this comment

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

Resolved some comments

@zbuc zbuc merged commit e7b81ab into main Jan 26, 2024
6 of 7 checks passed
@zbuc zbuc deleted the 3374_exec_circuit_breaker branch January 26, 2024 21:10
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.

dex: implement an execution circuit-breaker
2 participants