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

Update docs; fix coinbase setup #200

Merged
merged 1 commit into from
May 13, 2024
Merged
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
24 changes: 3 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion geth/chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
)
15 changes: 3 additions & 12 deletions geth/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions newsfragments/200.docs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update documentation for ``DevGethProcess`` transition to using ``geth --dev``.