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 dynamic timeout on rpc call #35

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 24 additions & 19 deletions docs/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ Usage: eleel [OPTIONS] --ee-jwt-secret <PATH> --controller-jwt-secret <PATH> --c
Options:
--listen-address <IP>
Listening address for the HTTP server

[default: 127.0.0.1]

--listen-port <PORT>
Listening port for the HTTP server

[default: 8552]

--ee-url <URL>
Primary execution engine to be shared by connected consensus nodes

[default: http://localhost:8551]

--ee-jwt-secret <PATH>
Expand All @@ -27,42 +27,42 @@ Options:

--client-jwt-secrets <PATH>
Path to TOML file of JWT secrets for the non-controlling consensus clients.

See docs for TOML file format.

--new-payload-cache-size <N>
Number of recent newPayload messages to cache in memory

[default: 64]

--fcu-cache-size <N>
Number of recent forkchoiceUpdated messages to cache in memory

[default: 64]

--payload-builder-cache-size <N>
Number of payload attributes and past payloads to cache in memory

[default: 8]

--payload-builder-extra-data <STRING>
Extra data to include in produced blocks

[default: Eleel]

--justified-block-cache-size <N>
Number of justified block hashes to cache in memory

[default: 4]

--finalized-block-cache-size <N>
Number of finalized block hashes to cache in memory

[default: 4]

--fcu-matching <NAME>
Choose the type of matching to use before returning a VALID fcU message to a client

[default: loose]

Possible values:
Expand All @@ -72,35 +72,40 @@ Options:

--network <NAME>
Network that the consensus and execution nodes are operating on

[default: mainnet]

--new-payload-wait-millis <MILLIS>
Maximum time that a consensus node should wait for a newPayload response from the cache.

We expect that the controlling consensus node and primary execution node will take some time to process requests, and that requests from consensus nodes could arrive while this processing is on-going. Using a timeout of 0 will often result in a SYNCING response, which will put the consensus node into optimistic sync. Using a longer timeout will allow the definitive (VALID) response from the execution engine to be returned, more closely matching the behaviour of a full execution engine.

[default: 2000]

--new-payload-wait-cutoff <NUM_BLOCKS>
Maximum age of a payload that will trigger a wait on `newPayload`

Payloads older than this age receive an instant SYNCING response. See docs for `--new-payload-wait-millis` for the purpose of this wait.

[default: 64]

--fcu-wait-millis <MILLIS>
Maximum time that a consensus node should wait for a forkchoiceUpdated response from the cache.

See the docs for `--new-payload-wait-millis` for the purpose of this timeout.

[default: 1000]

--body-limit-mb <MEGABYTES>
Maximum size of JSON-RPC message to accept from any connected consensus node

[default: 128]

--ee-timeout-millis <MILLIS>
Maximum timeout that need to wait for a response from the execution

[default: 15000]

-h, --help
Print help (see a summary with '-h')
```
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ pub struct Config {
/// Maximum size of JSON-RPC message to accept from any connected consensus node.
#[arg(long, value_name = "MEGABYTES", default_value = "128")]
pub body_limit_mb: usize,
/// Maximum timeout that need to wait for a response from the execution
#[arg(long, value_name = "MILLIS", default_value = "15000")]
pub ee_timeout_millis: u64,
}

#[derive(Deserialize, Serialize)]
Expand Down
7 changes: 2 additions & 5 deletions src/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ impl<E: EthSpec> Multiplexer<E> {
pub async fn handle_chain_id(&self, request: Request) -> Result<Response, ErrorResponse> {
let (id, _) = request.parse_as::<Vec<()>>()?;

// TODO: dynamic timeout
let timeout = Duration::from_secs(1);
let timeout = Duration::from_millis(self.config.ee_timeout_millis);
let chain_id = self
.engine
.api
Expand Down Expand Up @@ -47,9 +46,7 @@ impl<E: EthSpec> Multiplexer<E> {

pub async fn proxy_directly(&self, request: Request) -> Result<Response, ErrorResponse> {
let id = request.id;

// TODO: adjust timeout
tesol2y090 marked this conversation as resolved.
Show resolved Hide resolved
let timeout = Duration::from_secs(12);
let timeout = Duration::from_millis(self.config.ee_timeout_millis);

let result: JsonValue = self
.engine
Expand Down
Loading