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

feat: add a --dev option #3866

Merged
merged 8 commits into from
Jul 25, 2023
Merged

Conversation

pistomat
Copy link
Contributor

Implements features described in #3699, adds the following cli arguments:

Dev testnet:
      --dev
          Start the node in dev mode
          
          This mode uses a local proof-of-authority consensus engine with either fixed block times
          or automatically mined blocks.
          Disables network discovery and enables local http server.
          Prefunds 20 accounts derived by mnemonic "test test test test test test test test test test
          test junk" with 10 000 ETH each.

      --dev.block_max_transactions <BLOCK_MAX_TRANSACTIONS>
          How many block_max_transactions to mine per block

      --dev.block_time <BLOCK_TIME>
          Interval between blocks

This configuration enables developers to experiment with Reth's source code or develop new applications without having to sync to a pre-existing public network.

@onbjerg onbjerg added C-enhancement New feature or request M-changelog This change should be included in the changelog A-cli Related to the reth CLI labels Jul 24, 2023
@onbjerg onbjerg self-assigned this Jul 24, 2023
@onbjerg
Copy link
Member

onbjerg commented Jul 24, 2023

Will take a look, currently having some issues with CI, so it will take a minute. Sorry for the delayed review

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supportive, smol nit re docs.

otherwise this looks pretty good

bin/reth/src/args/network_args.rs Show resolved Hide resolved
bin/reth/src/args/dev_args.rs Outdated Show resolved Hide resolved
Comment on lines 118 to 119
block_max_transactions: Option<usize>,
block_time: Option<Duration>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be mutually exclusive, but I can see how this would be more convenient coming from CLI

so at the very least, this needs to be included in the docs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was not sure how to handle this. Throw if both are Some? Merge them to one enum parameter including both variants?

Copy link
Member

@onbjerg onbjerg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also lgtm w mattse's review - please open up an issue about including this in the book (new flags, we should also document what accounts are funded)

@codecov
Copy link

codecov bot commented Jul 25, 2023

Codecov Report

Merging #3866 (570e273) into main (39cd0e0) will increase coverage by 0.29%.
The diff coverage is 85.12%.

Impacted file tree graph

Files Changed Coverage Δ
bin/reth/src/args/network_args.rs 15.27% <ø> (ø)
bin/reth/src/args/rpc_server_args.rs 51.26% <ø> (ø)
crates/consensus/auto-seal/src/lib.rs 0.00% <0.00%> (ø)
crates/primitives/src/constants.rs 100.00% <ø> (ø)
crates/primitives/src/lib.rs 100.00% <ø> (ø)
bin/reth/src/args/utils.rs 74.64% <50.00%> (-0.72%) ⬇️
bin/reth/src/node/mod.rs 11.99% <57.14%> (+1.92%) ⬆️
bin/reth/src/args/dev_args.rs 93.18% <93.18%> (ø)
crates/primitives/src/chain/mod.rs 95.23% <100.00%> (+0.06%) ⬆️
crates/primitives/src/chain/spec.rs 97.70% <100.00%> (+0.08%) ⬆️

... and 43 files with indirect coverage changes

Flag Coverage Δ
integration-tests 15.51% <0.00%> (-0.05%) ⬇️
unit-tests 64.44% <85.12%> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
reth binary 27.24% <78.37%> (+0.76%) ⬆️
blockchain tree 83.01% <ø> (-0.02%) ⬇️
pipeline 89.66% <ø> (+0.06%) ⬆️
storage (db) 74.19% <ø> (-0.07%) ⬇️
trie 94.70% <ø> (+0.05%) ⬆️
txpool 46.00% <ø> (-0.58%) ⬇️
networking 77.66% <ø> (-0.05%) ⬇️
rpc 58.25% <ø> (+0.74%) ⬆️
consensus 64.46% <0.00%> (-0.83%) ⬇️
revm 33.68% <ø> (ø)
payload builder 6.61% <ø> (ø)
primitives 88.06% <100.00%> (-0.02%) ⬇️

@@ -115,13 +115,13 @@ where
pool: Pool,
to_engine: UnboundedSender<BeaconEngineMessage>,
canon_state_notification: CanonStateNotificationSender,
mode: MiningMode,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the best solution imo, even if it makes calling it slightly more verbose

@mattsse mattsse added this pull request to the merge queue Jul 25, 2023
Merged via the queue into paradigmxyz:main with commit 1b31a55 Jul 25, 2023
23 checks passed
merklefruit pushed a commit to anton-rs/op-reth that referenced this pull request Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Related to the reth CLI C-enhancement New feature or request M-changelog This change should be included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants