From 2d59164c291335ccc654b649ca963cbc97a9dd29 Mon Sep 17 00:00:00 2001 From: fselmo Date: Mon, 13 May 2024 13:29:50 -0600 Subject: [PATCH] Update docs; fix coinbase setup --- README.md | 24 +++--------------------- geth/chain.py | 6 +++++- geth/process.py | 15 +++------------ newsfragments/200.docs.rst | 1 + 4 files changed, 12 insertions(+), 34 deletions(-) create mode 100644 newsfragments/200.docs.rst diff --git a/README.md b/README.md index c701ffd3..c7350f16 100644 --- a/README.md +++ b/README.md @@ -142,37 +142,19 @@ home directory. The `v1.14.3` binary would be located at ## About `DevGethProcess` -The `DevGethProcess` is designed to facilitate testing. In that regard, it is -preconfigured as follows. +The `DevGethProcess` will run geth in `--dev` mode and is designed to facilitate testing. +In that regard, it is preconfigured as follows. -- A single account is created and allocated 1 billion ether. +- A single account is created, allocated 1 billion ether, and assigned as the coinbase. - All APIs are enabled on both `rpc` and `ipc` interfaces. -- Account 0 is unlocked - Networking is configured to not look for or connect to any peers. - The `networkid` of `1234` is used. - Verbosity is set to `5` (DEBUG) -- Mining is enabled with a single thread. - The RPC interface *tries* to bind to 8545 but will find an open port if this port is not available. - The DevP2P interface *tries* to bind to 30303 but will find an open port if this port is not available. -## Gotchas - -If you are running with `mining` enabled, which is default for `DevGethProcess`, -then you will likely need to generate the `DAG` manually. If you do not, then -it will auto-generate the first time you run the process and this takes a -while. - -To generate it manually: - -```sh -$ geth makedag 0 ~/.ethash -``` - -This is especially important in CI environments like Travis-CI where your -process will likely timeout during generation. - ## Development Clone the repository: diff --git a/geth/chain.py b/geth/chain.py index a7f6f7a7..2f0d600a 100644 --- a/geth/chain.py +++ b/geth/chain.py @@ -170,4 +170,8 @@ def initialize_chain(genesis_data, data_dir): stdoutdata, stderrdata = init_proc.communicate() init_proc.wait() if init_proc.returncode: - raise ValueError(f"Error initializing genesis.json: {stdoutdata + stderrdata}") + raise ValueError( + "Error initializing genesis.json: \n" + f" stdout={stdoutdata}\n" + f" stderr={stderrdata}" + ) diff --git a/geth/process.py b/geth/process.py index ed108b4b..2563bb81 100644 --- a/geth/process.py +++ b/geth/process.py @@ -300,19 +300,10 @@ def __init__(self, chain_name, base_dir=None, overrides=None, genesis_data=None) ) if needs_init: genesis_data["coinbase"] = coinbase - genesis_data.setdefault( - "alloc", - dict( - [ - ( - coinbase, - { - "balance": "1000000000000000000000000000000" # 1 billion ether # noqa: E501 - }, - ), - ] - ), + genesis_data.setdefault("alloc", {}).setdefault( + coinbase, {"balance": "1000000000000000000000000000000"} ) + modify_genesis_based_on_geth_version(genesis_data) initialize_chain(genesis_data, self.data_dir) diff --git a/newsfragments/200.docs.rst b/newsfragments/200.docs.rst new file mode 100644 index 00000000..b88612b3 --- /dev/null +++ b/newsfragments/200.docs.rst @@ -0,0 +1 @@ +Update documentation for ``DevGethProcess`` transition to using ``geth --dev``.