-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Reth node bindings (#1092)
* generalize geth into node * add basic reth setup * basic spawning and capturing of ports works, shutdown does not * add auth_port, p2p_port * clean up * fix geth tests * simplify abstraction * clean up * add explicit `dev` mode command, reth remains open * --chain takes path or string, not id * add support for UDP endpoint extraction from keys * clean up, add dev flag * tag as dev * add option to set block time * add block time * disable peer persistence if discovery is disabled * update binaries * add reth install in github workflow * fix build * fix doctest * windows geth build is zipped * fix name * fix path to reth binary * tar is flat * fix url * fix output path * reth is already extracted to the root * reth renders via stdout * disable dev by default, enabling it with .dev() * make sure to exit when running into fatal error * add tests to cover the feature set * try debugging windows * run binary install in parallel * disable discovery on blocktime dev * attempt to fix on windows by not using tempdir * re-enable tempdir, attempt to get full error log on windows * ignore tests on windows, CI of Windows is not compatible: [crates\node-bindings\src\nodes\reth.rs:369:13] &line = "2024-09-04T12:39:10.637528Z INFO reth::cli: Opening database path=\"C:\\\\Users\\\\RUNNER~1\\\\AppData\\\\Local\\\\Temp\\\\.tmp4XoSee\\\\db\"\n" [crates\node-bindings\src\nodes\reth.rs:369:13] &line = "2024-09-04T12:39:10.731699Z ERROR reth::cli: shutting down due to error\n" Error: failed to open the database: environment or database is not compatible with the requested operation or flags (-30784) Location: /project/crates/storage/db/src/mdbx.rs:28:8 * only install on linux * temporarily re-enable windows to test error catching * revert
- Loading branch information
1 parent
0cb54b5
commit 002aed5
Showing
8 changed files
with
862 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
//! Node-related types and constants. | ||
use std::time::Duration; | ||
use thiserror::Error; | ||
|
||
/// How long we will wait for the node to indicate that it is ready. | ||
pub const NODE_STARTUP_TIMEOUT: Duration = Duration::from_secs(10); | ||
|
||
/// Timeout for waiting for the node to add a peer. | ||
pub const NODE_DIAL_LOOP_TIMEOUT: Duration = Duration::from_secs(20); | ||
|
||
/// Errors that can occur when working with a node instance. | ||
#[derive(Debug)] | ||
pub enum NodeInstanceError { | ||
/// Timed out waiting for a message from node's stderr. | ||
Timeout(String), | ||
|
||
/// A line could not be read from the node's stderr. | ||
ReadLineError(std::io::Error), | ||
|
||
/// The child node process's stderr was not captured. | ||
NoStderr, | ||
|
||
/// The child node process's stdout was not captured. | ||
NoStdout, | ||
} | ||
|
||
/// Errors that can occur when working with the node. | ||
#[derive(Debug, Error)] | ||
pub enum NodeError { | ||
/// The chain id was not set. | ||
#[error("the chain ID was not set")] | ||
ChainIdNotSet, | ||
/// Could not create the data directory. | ||
#[error("could not create directory: {0}")] | ||
CreateDirError(std::io::Error), | ||
/// No stderr was captured from the child process. | ||
#[error("no stderr was captured from the process")] | ||
NoStderr, | ||
/// No stdout was captured from the child process. | ||
#[error("no stdout was captured from the process")] | ||
NoStdout, | ||
/// Timed out waiting for the node to start. | ||
#[error("timed out waiting for node to spawn; is the node binary installed?")] | ||
Timeout, | ||
/// Encountered a fatal error. | ||
#[error("fatal error: {0}")] | ||
Fatal(String), | ||
/// A line could not be read from the node stderr. | ||
#[error("could not read line from node stderr: {0}")] | ||
ReadLineError(std::io::Error), | ||
/// Genesis error | ||
#[error("genesis error occurred: {0}")] | ||
GenesisError(String), | ||
/// Node init error | ||
#[error("node init error occurred")] | ||
InitError, | ||
/// Spawn node error | ||
#[error("could not spawn node: {0}")] | ||
SpawnError(std::io::Error), | ||
/// Wait error | ||
#[error("could not wait for node to exit: {0}")] | ||
WaitError(std::io::Error), | ||
|
||
/// Clique private key error | ||
#[error("clique address error: {0}")] | ||
CliqueAddressError(String), | ||
} |
File renamed without changes.
Oops, something went wrong.