Commit Graph

291 Commits

Author SHA1 Message Date
Alex Sharov
47d22773b9
[wip] dv2: Validate body (#1913)
* validate body

* validate body

* save

* save

* body deliveries messages handling into staged sync

* body deliveries messages handling into staged sync

* body deliveries messages handling into staged sync

* body deliveries messages handling into staged sync

* body deliveries messages handling into staged sync

* penalize right after verifyUncles and stop, don't batch

* penalize right after verifyUncles and stop, don't batch

* penalize right after verifyUncles and stop, don't batch

* penalize right after verifyUncles and stop, don't batch

* penalize right after verifyUncles and stop, don't batch

* penalize right after verifyUncles and stop, don't batch

* penalize right after verifyUncles and stop, don't batch

* penalize right after verifyUncles and stop, don't batch

* penalize right after verifyUncles and stop, don't batch
2021-05-12 14:57:35 +01:00
ledgerwatch
59e5502744
Initial work on RPC streaming (#1880)
* Initial work on RPC streaming

* Create the stream and pass it on

* trace_filter expressed as streamable (not finished)

* Reenable call trace index

* Add new line

* Remove storage mode override

* Tool for overriding storage mode

* Diagnostics

* Make trace_filter more streamy

* Streaming debug_traceTransaction and debug_traceCall

* Fix test

* Log error on stream flush

* Enable streaming for http

* Flush the stream too

* Make trace_filter flush too

* Stop streaming if client is not interested

* Try to quiet annoying test|

* Revert "Try to quiet annoying test|"

This reverts commit 42849257bfa52e90140aa535af34b957cd97a222.

* Debug log for test

* Proceed with handshake regardless of whether peer notification worked

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2021-05-06 18:37:38 +01:00
Alex Sharov
aacc457ea8
rawdb deprecated methods with Database interface (#1854) 2021-05-01 14:42:23 +07:00
Alex Sharov
ac7ece4a4d
Revert txpool grpc (#1794) 2021-04-24 10:48:06 +07:00
ledgerwatch
12cde41772
Aleut support (Eip1559) (#1704)
* Where I am at

* Refactoring of transaction types

* More refactoring

* Use Homested signer in rpc daemon

* Unified signer

* Continue unified signer

* A bit more

* Fixes and down the rabbit hole...

* More tx pool fixes

* More refactoring fixes

* More fixes'

* more fixes

* More fixes

* More compile fixes

* More RLP hand-writing

* Finish RLP encoding/decoding of transactions

* Fixes to header encoding, start on protocol packets

* Transaction decoding

* Use DecodeTransaction function

* Decoding BlockBodyPacket

* Encode and decode for pool txs

* Start fixing tests

* Introduce SigningHash

* Fixes to SignHash

* RLP encoding fixes

* Fixes for encoding/decoding

* More test fixes

* Fix more tests

* More test fixes

* More test fixes

* Fix core tests

* More fixes for signer

* Fix for tx

* Fixes to string encoding/size

* Fix eip2930 test

* Fix rest of ./tests

* More fixes

* Fix compilation

* More test fixes

* More test fixes

* Test fixes

* More fixes

* Reuse EncodingSize in EncodeRLP for accessList

* Rearrange things in dynamic fee tx

* Add MarshalBinary

* More fixes

* Make V,R,S non-pointers

* More NPE fixes

* More fixes

* Receipt fixes

* Fix core/types

* Fix ./eth

* More compile fixes for tests

* More test fixes

* More test fixes

* Try to see lint errors better

* Try to see lint errors better

* Fix lint

* Debugging eip1559 test

* Fix TestEIP1559Transition test

* Fix NewBlockPacket encoding/decoding

* Fix calculation of TxHash

* Fix perf problem with senders

* Update aleut config values

* Try adding static peers

* Add staticpeers to defaul flags

* Change aleut networkID

* Fix test

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2021-04-22 18:11:37 +01:00
Artem Vorotnikov
9a3e47a498
Remove StateCache where unused (#1770) 2021-04-21 16:14:23 +07:00
Alex Sharov
bf1c219531
Move txPool.Get method behind direct-grpc (#1760) 2021-04-20 21:41:46 +07:00
Alex Sharov
bf6f042a5d
Start mining on new tx (#1740) 2021-04-20 09:12:08 +07:00
Evgeny Danilenko
17c07c50a5
Move clique buckets to separate DB (#1703)
* debug

* debug

* it works

* rename clique bucket

* remove genesis special case

* copy snapshot

* remove debug

* migration

* debug

* regenerate snapshots

* simplify

* regeneration

* after merge

* tests

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2021-04-19 22:58:05 +01:00
Alex Sharov
2050127f01
Remove eth64 (#1715) 2021-04-13 21:48:36 +07:00
Alex Sharov
9527671e5e
Remove blockchain object step3 (#1684) 2021-04-07 12:38:43 +07:00
Artem Vorotnikov
dbc0db0856
Nuke old miner and mux (#1666) 2021-04-03 13:09:31 +07:00
Artem Vorotnikov
1bedfc1965
Nuke remnants of non-staged-sync modes (#1664) 2021-04-03 08:48:57 +07:00
Alex Sharov
8ccc6b2664
Mining: remove local pow mining (from ethash), --miner.notify is required now, cycle is non-blocking now (#1617) 2021-03-28 21:40:27 +07:00
Artem Vorotnikov
e67be2b1be
Remove unused code (#1604)
* Remove graphql, legacy options

* Remove CODEOWNERS

* Remove EWASM and custom EVM interpreter
2021-03-26 09:08:01 +07:00
Alex Sharov
aff859edc0
Mining stage (#1554) 2021-03-23 16:00:07 +07:00
ledgerwatch
a6be390fd5
Handshake in tests, correct ENR updates, etc. (#1578)
* Remove Blockchain dependency from forkID, fix ENR update

* Fix handshake_test

* Remove db access from handshake

* Undo

* Use StagedSync in test handlers

* Compile fix

* Debugging

* dependency fixes

* More info

* Print test name

* Increase timeout

* Disable checkpoint test

* Optimise RW message pipe

* Fix test

* Print handshake errors

* See where the pipe is closing

* Remove checkpoints

* Remove printouts

* Revert "Fix test"

This reverts commit d154e07b5f97f0b54485b50d572fb27c6c61af4b.

* Revert "Optimise RW message pipe"

This reverts commit 6936111a7ffdf166a19c6cf6fa9c8de725b449e0.

* Revert "Increase timeout"

This reverts commit 9dc0e234bbb80a1ff5146788a308fb7d76ce69de.

* Revert "See where the pipe is closing"

This reverts commit 3cf22afc43f2b2a254b63b86a0e24b58f84bdc2b.

* Remove printing

* Relax peerEventCh

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2021-03-21 21:23:47 +00:00
Igor Mandrigin
36297dd057 more linter fixes 2021-03-18 11:44:22 +01:00
Alexey Sharp
74dbb6e7ac Fix lints 2021-03-18 06:58:14 +00:00
Igor Mandrigin
e5206bc584 fix some eth handler tests 2021-03-16 15:18:14 +01:00
Alexey Sharp
122791ba75 Fix tg crash again 2021-03-15 18:37:27 +00:00
Alexey Sharp
132da24d0f Fixes 2021-03-15 18:34:22 +00:00
Alexey Sharp
a486baa0a0 Fixes 2021-03-15 09:50:41 +00:00
Alexey Sharp
519b19f8aa Compilation fixes 2021-03-14 08:00:37 +00:00
Martin Holst Swende
5bcef5b9c7 eth/handler, broadcast: optimize tx broadcast mechanism (#22176)
This PR optimizes the broadcast loop. Instead of iterating twice through a given set of transactions to weed out which peers have and which do not have a tx, to send/announce transactions, we do it only once.
2021-03-10 11:09:01 +01:00
Péter Szilágyi
08ad6aaec7 eth: check snap satelliteness, delegate drop to eth (#22235)
* eth: check snap satelliteness, delegate drop to eth

* eth: better handle eth/snap satellite relation, merge reg/unreg paths
# Conflicts:
#	eth/handler.go
#	eth/peer.go
2021-03-09 13:55:09 +01:00
Martin Holst Swende
ff2b58887f eth, p2p: reserve half peer slots for snap peers during snap sync (#22171)
* eth, p2p: reserve half peer slots for snap peers during snap sync

* eth: less logging

* eth: rework the eth/snap peer reservation logic

* eth: rework the eth/snap peer reservation logic (again)
2021-03-09 12:46:30 +01:00
Martin Holst Swende
e6dd171f2f eth/protocols/snap: snap sync testing (#22179)
* eth/protocols/snap: make timeout configurable

* eth/protocols/snap: snap sync testing

* eth/protocols/snap: test to trigger panic

* eth/protocols/snap: fix race condition on timeouts

* eth/protocols/snap: return error on cancelled sync

* squashme: updates + test causing panic + properly serve accounts in order

* eth/protocols/snap: revert failing storage response

* eth/protocols/snap: revert on bad responses (storage, code)

* eth/protocols/snap: fix account handling stall

* eth/protocols/snap: fix remaining revertal-issues

* eth/protocols/snap: timeouthandler for bytecode requests

* eth/protocols/snap: debugging + fix log message

* eth/protocols/snap: fix misspelliings in docs

* eth/protocols/snap: fix race in bytecode handling

* eth/protocols/snap: undo deduplication of storage roots

* synctests: refactor + minify panic testcase

* eth/protocols/snap: minor polishes

* eth: minor polishes to make logs more useful

* eth/protocols/snap: remove excessive logs from the test runs

* eth/protocols/snap: stress tests with concurrency

* eth/protocols/snap: further fixes to test cancel channel handling

* eth/protocols/snap: extend test timeouts on CI

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2021-03-09 12:34:26 +01:00
Marius van der Wijden
993d973de4 eth: improve log message (#22146)
* eth: fixed typos

* eth: fixed log message
2021-03-09 10:32:29 +01:00
Péter Szilágyi
693459073e core, eth: split eth package, implement snap protocol (#21482)
This commit splits the eth package, separating the handling of eth and snap protocols. It also includes the capability to run snap sync (https://github.com/ethereum/devp2p/blob/master/caps/snap.md) , but does not enable it by default.

Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>
# Conflicts:
#	cmd/geth/misccmd.go
#	cmd/utils/flags.go
#	core/blockchain.go
#	core/blockchain_snapshot_test.go
#	core/forkid/forkid.go
#	core/rawdb/accessors_snapshot.go
#	core/rawdb/schema.go
#	core/state/snapshot/generate.go
#	core/state/statedb.go
#	eth/api_test.go
#	eth/backend.go
#	eth/downloader/downloader.go
#	eth/downloader/downloader_test.go
#	eth/downloader/modes.go
#	eth/downloader/queue.go
#	eth/downloader/statesync.go
#	eth/gen_config.go
#	eth/handler.go
#	eth/handler_test.go
#	eth/helper_test.go
#	eth/peer.go
#	eth/protocol.go
#	eth/protocol_test.go
#	eth/sync.go
#	eth/sync_test.go
#	ethstats/ethstats.go
#	les/client.go
#	les/enr_entry.go
#	les/handler_test.go
#	les/peer.go
#	les/server_handler.go
#	tests/block_test_util.go
#	trie/proof.go
#	trie/proof_test.go
#	trie/trie.go
#	turbo/trie/notary.go
#	turbo/trie/sync_bloom.go
2021-03-08 17:07:38 +01:00
ledgerwatch
b743b88218
Revert "Extract validating interface (#1120)" (#1543)
* Revert "Extract validating interface (#1120)"

This reverts commit e4e36c152e.

* Fix go mod tidy

* Fix lint

* Fix lint

* fix lint

* Test fix

* Fix test

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2021-03-05 20:34:23 +00:00
Alex Sharov
8538ec85b3
don't open db in exclusive mode if no migrations (#1524) 2021-03-01 11:02:22 +07:00
Evgeny Danilenko
e4e36c152e
Extract validating interface (#1120)
* interface

* generalize interface

* linters

* fix deadlock

* fix linters

* close goroutine

* fix

* debug

* id+ttl

* refactor downloader tests

* tests

* lru

* handle genesis, extract fake consensuses

* fix fake consensus

* test uncles, verify

* after a new master

* fmt

* fix close

* debug

* debug

* fix chain length

* remove test field

* use single account

* fix data race on closing channel

* remove postponed blocks queue

* miner test

* VerifyHeaderRequests

* fmt

* fmt

* fix data race

* handle validating errors

* simplify matchParents

* remove copy-paste

* move sort to constructor

* clean up

* debug for 10 parents

* debug

* debug

* batch responses

* batch requests

* works for many ancestors

* remove debug

* always Close an engine

* linters

* ancestors deduplication

* fix test

* reduce interface

* api

* clique

* green clique sync

* stable

* perpermance per second

* full sync

* linters

* gitignore

* deps

* fix panic after master merge

* init consensus

* clique tests

* fix tests

* fix tests

* clean up

* reuse snap

* store vefified snapshots

* optimize snapshots

* safe close

* cleanup loop

* after downloader

* downloader and consensus tests

* update tests

* hack.go

* clique flags

* fix cliuqe config

* review

* gitignore

* remove additional bucket

* blk/sec instead of blk/microsecond

* rename

* deps

* optimize

* debug

* test

* tests without extracted validation process

* same base performance as on master

* benchmark

* simplify ethash verification

* ethash

* ethash

* linters

* ethash

* master stats

* cleanup

* gomod

* linters

* tests

* better locks

* Fix

* Remove logging for verifyHeaders

* Verification speed in the logs

* Fix compile error

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2021-02-25 19:40:45 +00:00
Alex Sharov
f1ee8d507e
New Trie db layout - store trie structure info and multiple hashes per record (#1500)
* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* squash

* SE

* SE

* SE

* SE

* SE

* SE

* SE

* SE

* SE

* SE

* SE

* SE

* SE

* SE

* SE
2021-02-21 18:41:59 +00:00
ledgerwatch
820216b77f
Block body download - more recent updates (#1441)
* Combined

* Fix lint

* Fix lint

* Initial bodydownload package

* Updates

* fix lint and process incoming body

* Fix compile errors

* Use deliveries

* Ready for initial testing

* Better handling of missing temp files dir

* Intermediate testing

* First working code

* Fix races, more efficient request scheduling

* Remove excessive logging

* Fix lint

* Interruptibility, fix lint

* Remove more logging

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2021-01-15 10:58:04 +00:00
Alex Sharov
d7d9ce0a8e
fix go vet (#1425) 2020-12-26 10:18:16 +07:00
ledgerwatch
5ea590c18e
State cache switching writes to reads during commit (#1368)
* State cache init

* More code

* Fix lint

* More tests

* More tests

* More tests

* Fix test

* Transformations

* remove writeQueue, before fixing the tests

* Fix tests

* Add more tests, incarnation to the code items

* Fix lint

* Fix lint

* Remove shards prototype, add incarnation to the state reader code

* Clean up and replace cache in call_traces stage

* fix flaky test

* Save changes

* Readers to use addrHash, writes - addresses

* Fix lint

* Fix lint

* More accurate tracking of size

* Optimise for smaller write batches

* Attempt to integrate state cache into Execution stage

* cacheSize to default flags

* Print correct cache sizes and batch sizes

* cacheSize in the integration

* Fix tests

* Fix lint

* Remove print

* Fix exec stage

* Fix test

* Refresh sequence on write

* No double increment

* heap.Remove

* Try to fix alignment

* Refactoring, adding hashItems

* More changes

* Fix compile errors

* Fix lint

* Wrapping cached reader

* Wrap writer into cached writer

* Turn state cache off by default

* Fix plain state writer

* Fix for code/storage mixup

* Fix tests

* Fix clique test

* Better fix for the tests

* Add test and fix some more

* Fix compile error|

* More functions

* Fixes

* Fix for the tests

* sepatate DeletedFlag and AbsentFlag

* Minor fixes

* Test refactoring

* More changes

* Fix some tests

* More test fixes

* More test fixes

* Fix lint

* Move blockchain_test to be able to use stagedsync

* More fixes

* Fixes and cleanup

* Fix tests in turbo/stages

* Fix lint

* Fix lint

* Intemediate

* Fix tests

* Intemediate

* More fixes

* Compilation fixes

* More fixes

* Fix compile errors

* More test fixes

* More fixes

* More test fixes

* Fix compile error

* Fixes

* Fix

* Fix

* More fixes

* Fixes

* More fixes and cleanup

* Further fix

* Check gas used and bloom with header

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2020-12-08 09:44:29 +00:00
ledgerwatch
f20a278b51
Possible fix for tx pool hanging (#1352)
* Possible fix for tx pool hanging

* Fix for mutex

* Fix

* Unlock before waiting for response to top header request

* Add comment
2020-11-16 12:05:53 +00:00
Alex Sharov
76f1b05cb2
Move tmpdir definition to app-start, move migrations folder inside tmpdir (#1282)
* extract tmpdir to app-level-code

* extract tmpdir to app-level-code

* save progresss
2020-10-23 12:18:45 +01:00
ledgerwatch
88acfc55ca
Vary batch size for execution stage (#1274)
* Vary batch size for execution stage

* Fix in logging

* Improve log of timings

* Log improvements

* Log improvements

* Fix tests

* More log improvments, fix tests

* Fix tests

* Better logging for Bodies and Interhash

* Fix tests

* Minor fixes

* Fix test
2020-10-21 18:01:40 +01:00
Evgeny Danilenko
44562fd07a
Jump tables data race (#1245)
* initial

* fix

* fmt

* linters

* linters

* debug

* fix data races

* safe close

* remove jump table clonning

* revert fix
2020-10-20 22:23:56 +01:00
Igor Mandrigin
f3ce1ce423
turbo-api: add a plug-in mechanism for possible Bloom and other filters (#1229)
* Add a convenience method to replace stages

* allow more parameters to the execution function

* add a plug-in point for stuff like bloom filters, etc

* add comments

* fixups
2020-10-12 14:58:45 +01:00
ledgerwatch
d7c570ccbe
Prevent block_fetcher from accessing the database (#1200) 2020-10-07 18:58:09 +01:00
rene
8a12d561f2 cmd/devp2p: add eth protocol test suite (#21598)
This change adds a test framework for the "eth" protocol and some basic
tests. The tests can be run using the './devp2p rlpx eth-test' command.
# Conflicts:
#	core/forkid/forkid.go
#	eth/discovery.go
#	eth/handler.go
#	eth/helper_test.go
#	eth/protocol_test.go
2020-10-06 14:12:09 +02:00
ledgerwatch
ab4c456fec
Headers poc 3 - intermediate changes (#1093)
* Use log instead of Printf

* Better output

* Display NewBlockHeadersMsg

* Print tx hashes

* Separate sentry and downloader

* Fix lint

* Requesting headers

* Fix lint

* Prevent deadlock, fix NPE

* Not quit when did not restore

* Fix types

* Fix types again

* Warn on penalty

* Prints

* Avoid deadlock

* Better request logic

* Print height

* Actually send header requests

* Actually send header request

* Fix compile errors, sending

* Print BlockHeadersMsg

* Fix lint
2020-09-11 07:35:51 +01:00
ledgerwatch
256e4262e1
2nd batch of Headers PoC changes (#1067)
* PoC utility

* Headers cmd

* headers download command

* Fix lint

* Send handshake

* Receive Status message

* Better error messages

* Messages

* Fix

* Fix lint

* Print block number for NewBlockMsg

* Fix lint
2020-09-07 07:03:12 +01:00
Igor Mandrigin
2a6478d799
turbo-api: create a second executable file with a custom stage example (#1055) 2020-09-05 18:07:27 +02:00
Igor Mandrigin
5b92d47e9d
Initialize Staged Sync with stages. (#1033)
* externalize default stages

* initialize with the right stages

* fix some bugs

* fix

* linters
2020-09-02 19:11:41 +01:00
ledgerwatch
c6975414e8
[WIP] Warmup the state bucket for HDD sync (#1032)
* Warmup

* Log the warmup

* Make warmup interruptible

* Make warmup a command line option for HDD

* Activate hdd flag
2020-09-02 12:24:27 +01:00
Igor Mandrigin
7bc892e886
Prefetch block bodies (#1013)
* prefetched blocks 1

* fixups

* fix logs

* fixups

* linters

* remove logs

* fix an NPE in tests

* setup the correct origin

* run blocks on prefetched bodies

* fix log

* smaller cache size
2020-08-30 18:34:40 +01:00