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

feat: Add ratelimiting to OpWitness API #12998

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

stevencartavia
Copy link
Contributor

should close #12871

Copy link
Collaborator

Choose a reason for hiding this comment

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

these are unrelated, please undo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just the pending_block.rs or also block.rs and transactions.rs?

let builder = OpPayloadBuilder::new(evm_config);
let inner = OpDebugWitnessApiInner { provider, builder };
let inner = OpDebugWitnessApiInner { provider, builder, task_spawner };
Copy link
Collaborator

Choose a reason for hiding this comment

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

good start, we also want to add a new tokio Semaphor for ratelimiting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what would be the number of permits?

and I'm not sure if this is the correct place and way to use it :(

impl<Provider, EvmConfig> OpDebugWitnessApi<Provider, EvmConfig> {
    /// Creates a new instance of the `OpDebugWitnessApi`.
    pub fn new(
        provider: Provider,
        evm_config: EvmConfig,
        task_spawner: Box<dyn TaskSpawner>,
    ) -> Self {
        let builder = OpPayloadBuilder::new(evm_config);
        let semaphore = Arc::new(Semaphore::new(3));
        let inner = OpDebugWitnessApiInner { provider, builder, task_spawner, semaphore };
        Self { inner: Arc::new(inner) }
    }
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

3 seems fine

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.

Add ratelimiting to OpWitness API
2 participants