Commit Graph

64 Commits

Author SHA1 Message Date
593a94e426 feat: add drop subcommand for db command (#801) 2023-01-10 22:55:05 +01:00
3bd1458df6 Rename cursor functions (#787) 2023-01-10 20:08:30 +01:00
515590faa8 refactor: move cli utils to new reth-cli-utils crate (#790)
* Move bin/src/util to reth-cli-utils

* Add reth-cli-utils to workspace members

* Fix imports in bin/src

* Create reth-cli-utils crate

* Add utils import
2023-01-10 01:13:41 +01:00
40f30ec951 refactor: clean up SocketAddr value parser (#777)
- Rename the function
- Add more docs explaining the supported formats
- Remove support for empty string (just use an `Option`),
  and remove support for `:` (should be considered a typo)
- Reduce allocations of strings
2023-01-09 17:31:53 +01:00
2b5ee2b18d chore(primitives): use reth::Bytes and implements arbitrary (#776)
* clippy

* add arbitrary to reth Bytes

* clean

* add missing dependency
2023-01-09 12:09:18 +01:00
d296946bf1 add unknown fork spec (#774) 2023-01-09 09:07:47 +01:00
31cb66902e fix: Fix typos (#773) 2023-01-09 01:43:51 +01:00
ca3372909a feat(cli): add more convenient SocketAddr argument parsing (#757) 2023-01-07 02:28:07 +02:00
fe5e3bd0c8 feat(node): allow config'ing trusted nodes from cli (#728) 2023-01-05 11:54:25 +02:00
e069248e78 feat: Stage Tool Execution Stage (#723)
* feat(stage-tool): exec stage

* fix(stage-tool): commit for the full range

* feat: skip unwinding
2023-01-04 23:40:24 +02:00
759ba39311 feat: Stage tool (#716)
* feat: `reth stage` command

* refactor(bin): move init utils to separate file

* feat(bin): scaffold stage command for one stage

* fix: correctly set from/to for stage range

* fix(stage-tool): add unwind before execute to re-exec

otherwise we're double executing stuff

* fix(stage-tool): use max commit threshold avail

* chore: rm unused vars

* fix(genesis-init): take a write tx only if needed

this avoids blocking by accident if we took a write tx expecting
that init_genesis would immediately return the hash

* feat(stage-tool): add bodies stage

Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
2023-01-04 21:53:27 +02:00
973ea48e03 feat(cli): p2p header & body download (#698)
* p2p cli scaffolding

* refactor to fetch client

* body & header download

* p2p trusted opts

* add retries

* notify on retry

* clippy

* display err
2023-01-04 21:33:08 +02:00
ec88f1deef feat(sync): standardize stage control flow checks (#681)
* feat(sync): standardize stage control flow checks

* fix input parameter for test_eth_chain

* clean up & put behind macro

* Update crates/stages/src/stage.rs

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* address comments

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>
2023-01-04 11:03:36 -08:00
8c413ad0a9 trace(download): failed requests (#715) 2023-01-04 19:55:59 +01:00
c60495df7e feat(sync): update sync state within pipeline (#697)
* feat(sync): update sync state within pipeline

* address pr comments

* fix comment
2023-01-04 11:25:40 +02:00
6407b5087e chore: use B160, B256 and U256 coming from revm and ruint (#676)
* use B256, B160 and U256 from revm

* fix U256 from_str

* use U256::ZERO

* use temporary commit for revm and interpreter

* more U256::ZERO

* more changes for revm/ruint types

* clippy

* change revm and revm-interpreter repo

* remove H160 wrap

* minor cleanup

* remove unused

* fix MIN_PROTOCOL_BASE_FEE
2023-01-04 11:11:48 +02:00
93b6ce597a test(chain): add shanghai forkspecs (#700) 2023-01-03 17:33:55 +01:00
13441ff299 style: rm redundant Pipeline::new (#682) 2023-01-02 14:58:31 +01:00
cb6ddfcc43 feat(sync): total difficulty stage (#665)
* feat(sync): total difficulty stage

* linter

* rm commented log

* patch current td in headers tests
2023-01-01 19:03:25 +02:00
efac887e30 chore: add serde feature to network crate (#653)
* Add serde feature and support for PeersConfig

* Add Duration fields and Weights

* Add serde for ConnectionInfo field
2023-01-01 18:27:55 +02:00
20847845e2 feat: raise fd limit of the binary (#668)
* raise fd limit of the binary

* Remove tracing and return error

* Ignore errors
2023-01-01 12:49:00 +01:00
f5ae970e63 feat(cli): add --disable-discovery (#597)
* redo add disable_discovery cli flag

* incorporate option into discovery test

* smol touch up

* rustmft

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
2022-12-30 10:56:59 +01:00
b5d8b6d4dd feat(node): print peer ID and addr on startup (#655)
* feat(node): print peer ID and addr on startup

* fix(node): print full PeerId on startup
2022-12-29 22:31:39 +01:00
76e76bb651 feat: add trusted nodes configuration (#569)
* Add preferred nodes to config

* Add preferred nodes on boot

* Add flag in config for trusted only mode

* Add preferred nodes configuration to config

* Fix comment

* Add preferred nodes to config file

* Rename preferred_nodes to trusted_nodes

* Change preferred to trusted

I renamed preferred_nodes to trusted_nodes in various places.
Seems I missed quite a bit of them.

* Pull trusted_only from config

* Rename DiscoveryConfig to PeersConfig

* Fix last commit

Now actually renamed DiscoveryConfig

* Rename trusted_only to connect_trusted_nodes_only

* Add helper function

* Use HashSet for boot_nodes and trusted_nodes

* Change trusted nodes functions in ConfigBuilder

* Move trusted peers from discv4 to network config

* Add trusted nodes to peers on Manager creation

* Use NodeRecord in trusted_nodes config

* Fix comment

* Move trusted_nodes config to PeersConfig

* Add trusted nodes directly to peers

* Move network_config to Config impl

* Move start_network to NetworkConfig impl
2022-12-28 21:48:11 +01:00
d4d8a8c882 Moves code walkthrough book chapters to docs (#629)
* replaced template blocks with code blocks in stages chapter

* replaced template blocks with code blocks in network chapter

* moved book sections to docs

* fix indentation in recover_signer codeblock

* remove unnecessary TODO comment in network.md
2022-12-28 10:24:39 +01:00
a51fa4fd63 docs(book): start book chapter for network crate (#445)
* WIP FOR DRAFT PR

* WIP draft, walking through usage in pipeline

* diving deeper into instantiation of NetworkHandle & FetchClient

* WIP network management task & eth requests task done (ish)

* address pr comments: networkmanager as standalone task, networkconfig as main entrypoint for setup

* complete draft of the  crate docs

* restructured, starts w/ expl of

* added more snippets/anchors

* using ignore flag on code blocks, brief explanation of  struct

* typos addressed
2022-12-27 14:53:15 -08:00
663efa8d2a feat(metrics): Metrics derive macro (#592)
* feat(metrics): `Metrics` derive macro

* rename metrics to metrics-derive

* use fully qualified fmt path

* metric vec with capacity

* favor metrics over simple scope attr, simplify code

* pull metric description from doc comment

* rm debug log

* add more docs and sample usage

* link to metrics macros

* add tests for metrics derive macro

* clippy

* simplify path comparison

* cleanup

* remove unused dep

* rename stage metrics
2022-12-26 14:27:24 -08:00
d2b4081849 feat: Enable ExecutionStage (#622) 2022-12-27 00:09:04 +02:00
bfe2fd6221 ci: add eth chain test. Set prevrandao after merge (#621)
* Small changes

* feat: Add eth chain test to ci. Set prevrandao after merge

* Update .github/workflows/ci.yml

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>

* move env

Co-authored-by: Bjerg <onbjerg@users.noreply.github.com>
2022-12-26 22:55:46 +01:00
ba585cf7d9 fix: do not lowercase table arg in db list (#606) 2022-12-25 22:52:39 +02:00
19a618e3a4 fix(db): Dont compress DupSort SubKey (#594)
* bug(db): Dont compress DupSort SubKey

* unwrap or default config, Added notes

* fmt empty lines
2022-12-25 01:13:03 +01:00
284391c181 test(execution): chain test state check, execution bug fixes/upgrades (#472)
* temp: header stage backoff stand-in

* feat(execution): Check chain post state, fix StateProviderLatest and evm return

* Disable receipt merkle tree check

* update and merge

* Fix storage double values in dup table

* fmt

* Update bin/reth/src/test_eth_chain/runner.rs

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* Enable receipt root check after byzantium

* Receipt inner rlp without header for proof root

* some cleanup nits

* nit

Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-12-23 18:42:19 +01:00
562e895f21 ci: unused dependencies sanity check (#590)
* ci: add unused deps sanity check

* ci: fix unused deps issue template title

* ci: rename udeps job

* chore: formatting

* chore: make `cargo-udeps` ignore `aquamarine`

* deps: resolve unused deps

* ci: check every feature and target in udeps job
2022-12-23 13:19:50 +01:00
b12939db47 feat: add stagedsync headers metrics (#498)
* add dockerfile for reth

* Add docker compose for prometheus

* Add some metrics

* Add p2p connection errors metric

* Add dependency caching for dockerfile

This reduces image build times by ~50% after the first one.

Uses cargo-chef inside the image.
More info in: https://morioh.com/p/987a2bda4526

* Add --metrics flag to docker-compose config file

* add Cargo.lock

* Move docker-compose.yml to docker directory

* Apply formatting

* Remove docker folder

* Remove .dockerignore file

* Add 'reth' prefix to metric names

* Add headers errors and request time metrics

* Modularize metrics exporter functionality and describe metrics

* Format files

* Add metrics documentation in metrics.md

* Fix metrics doc title

* Commit changes after rebase

* Solve conflict

* Modularize metrics describers

* Add stages_metrics_describer

* Rearrange header error metrics

* Add update_headers_metrics function

* Add one-line docs to describers

* Remove commented line

* Refactor metrics describer

* Update metrics doc

* Fix import

* Add header metrics struct

* add new metrics format in the headers execute method

* Add default implementation for HeaderMetrics

* Fix typo

* Fix another typo

* Fix more typos

* Move new HeaderMetrics meathod to default

* Solve conflicts

* Fix test

Co-authored-by: Tomás <tomas.gruner@lambdaclass.com>
2022-12-22 15:45:57 +01:00
0b1b5368e6 chore: Rename BlockLocked to SealedBlock (#573)
* chore: Rename BlockLocked to SealedBlock

* chore: fmt

Co-authored-by: Genysys <112424909+samtvlabs@users.noreply.github.com>
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-12-22 14:45:36 +02:00
6f6c4f61e0 refactor: rename EthConsensus (#572)
Closes #566
2022-12-22 12:05:49 +01:00
276be27310 chore(sync): rename senders stage (#554) 2022-12-21 05:34:18 -08:00
2dc5b80ef0 feat: verbose flag (#541) 2022-12-20 18:41:04 +01:00
82cd84eca7 test: fix emits_bodies_in_order test (#534)
* feat(test-utils): make body tx count configurable

* test: fix `emits_bodies_in_order` test
2022-12-20 01:29:04 +01:00
f65562e2e4 refactor(sync): remove require_tip (#528)
`require_tip` could only be determined by the headers stage,
and it signalled that we have all of the headers to sync all
the way to the chain tip. Some stages may wait to execute
until the tip is reached, e.g. the stage that checks the
stage root, but there are a few problems:

- On initial sync, `reached_tip` would be `true`, but by
  the time we reach the hashing stage, this would actually
  no longer be the case: the other stages have spent
  enough time for us to be "out of sync". This means
  that the optimization here is lost, and the additional
  logic is added for nothing.
- When we are not doing our initial sync, `reached_tip` would
  always be `true` for each subsequent block we sync.
  The same logic applies as above, i.e. the extra logic
  is there for nothing.

In other words, `reached_tip` would *always* be `true` once
we leave the header stage, making the extra logic entirely
redundant.
2022-12-19 22:04:42 +01:00
13bb41517d feat: config (#496)
* feat: default reth dirs

* docs: clarify txpool config docs

* feat: `serde` feature for `reth-consensus`

* feat: add missing hardforks

* feat: full chain specification

* feat: `DbPath` type

* feat: custom chain specs

* feat: `--debug.tip` option

* feat: basic stage config

* fix: resize db geometry

* refactor: don't commit in headers stage

* chore: remove headers dl timeout

* feat: loading of config

* refactor(config): `stage` -> `stages`
2022-12-19 21:27:26 +01:00
75fb90be9a refactor: move metrics endpoint to node cmd (#505)
* refactor: move metrics endpoint to node cmd

* feat: value names

* refactor: simplify db path parsing
2022-12-18 13:57:37 +02:00
4da574df84 feat: add prometheus support (#474) 2022-12-16 20:21:26 +01:00
3989d5d3e0 feat: add more tables to db list (#491)
* feat: add more tables to db list

* feat: table macro for db command

* feat: lowercase table arg in db cmd

* chore: fix some rustdocs
2022-12-16 18:00:15 +01:00
daaf039fbf feat(sync): state transition indexes (#449)
* introduce state transitions and revert/modify block bodies table

* init refactor

* revamp transaction iteration based on bodies and add state transition mappings

* change expected return on empty db execution

* interim commit

* fix body downloader & stage

* refactor(bodies/dl): make fetch bodies fn more clear

* chore: disable unused vars/fns temporarily until exec is back

* chore: fmt

* test: fix tests

* use transitions in execution stage

* clarify empty unwind test

* remove last_tx_index fn

* rename fn and var names

* fix full block response comment

* rename fetcher`s get_block_body to get_block_bodies

* Update crates/stages/src/db.rs

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* fmt

* fix index overlap check error

* uncomment eth chain command

* fix doc comment

* typos

* cleanup

* any_last_tx_index -> last_tx_index

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
Co-authored-by: Oliver Nordbjerg <hi@notbjerg.me>
2022-12-16 08:37:49 -08:00
ca204a346d chore: use later block (#480)
The block we chose for testing sync previously did not include
any transactions.
2022-12-16 11:18:27 +02:00
9cd5824f35 chore: rename StageDB to Transaction (#470)
* chore: rename StageDB to Transaction

* chore: cargo fmt

* chore: add note about potentially removing this in the future
2022-12-15 18:14:14 +02:00
c10bdb5830 feat: add flag for displaying log target (#469) 2022-12-15 18:08:29 +02:00
f509213cb4 refactor: clean up reth node (#450)
* feat: parse genesis block from a json spec

* refactor: clean up `init_genesis`
2022-12-15 17:09:31 +02:00
9208f2fd9b test(execution): execution test runner (#426)
* wip run chain test

* dump pre test state

* bug: fix casting to revm spec

* wip move execution to std thread

* wip scoped thread execution

* fmt clippy

* Update crates/stages/src/stages/execution.rs

* Update bin/reth/Cargo.toml

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* Update bin/reth/src/test_eth_chain/models.rs

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>

* Correct models for chain tests

Co-authored-by: rakita <dragan0rakita@gmail.com>
Co-authored-by: rakita <rakita@users.noreply.github.com>
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-12-15 13:39:55 +01:00