Closed mattsse closed 2 days ago
with ethProof the EthApi now has an expensive endpoint that should be ratelimited.
the tracing endpoints, like debug already have a shared BlockingTaskGuard:
BlockingTaskGuard
https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/rpc/rpc/src/debug.rs#L1024-L1030
However, these are aimed at the CPU, while eth_proof focuses more on the memory. we can solve this with an additional guard in ethAPI itself. we want to explicitly restrict eth_getproof without interfering too much with the regular tracing calls.
This needs 1) a new setting proof_permits: usize in the new function: https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/rpc/rpc/src/eth/core.rs#L40-L47 2) add a guard instance: https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/rpc/rpc/src/eth/core.rs#L156-L156 3) expose acquire functions in https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/rpc/rpc-eth-api/src/helpers/blocking_task.rs#L10-L10 similar to https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/tasks/src/pool.rs#L31-L39
proof_permits: usize
No response
Hi, I would like to work on this if possible
assigned
Describe the feature
with ethProof the EthApi now has an expensive endpoint that should be ratelimited.
the tracing endpoints, like debug already have a shared
BlockingTaskGuard
:https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/rpc/rpc/src/debug.rs#L1024-L1030
However, these are aimed at the CPU, while eth_proof focuses more on the memory. we can solve this with an additional guard in ethAPI itself. we want to explicitly restrict eth_getproof without interfering too much with the regular tracing calls.
TODO
This needs 1) a new setting
proof_permits: usize
in the new function: https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/rpc/rpc/src/eth/core.rs#L40-L47 2) add a guard instance: https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/rpc/rpc/src/eth/core.rs#L156-L156 3) expose acquire functions in https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/rpc/rpc-eth-api/src/helpers/blocking_task.rs#L10-L10 similar to https://github.com/paradigmxyz/reth/blob/edbbc9636eca770102f6ff33779130deb7b38360/crates/tasks/src/pool.rs#L31-L39Additional context
No response