* experiment of not using retain list
* better handle sub-tx
* save progress
* don't touch collector
* don't run collector on sub-tx because of `mdb_cursor_put: MDB_TXN_FULL: Transaction has too many dirty pages - transaction too big`
* clear
* clear
* share config object
* create default config and logger
* move db connection to common func
* move server start to cli package
* clear
* clear
* rename cli to rpc
* use unified SetupLogger func
* make all root flag persistent
* use common flags in different packages
* use common flags in different packages
* move TraceTx method to eth package
* use native slice flags
* create package "turbo"
* disable geth api
* disable geth api
* move more data types to turbo/adapter package
* add support for customApiList
* run more
* run more
* run more
* dog-food
* move DoCall
* move DoCall
* fix tests
* fix test
* add logging to loader
* use pure tx in etl loading, logs in mutation commit
* clean
* bletter logging and more cleanup
* bletter logging and more cleanup
* increase batch size to 500M
* better batch commit logging
* async fsync
* sync fsync
* sync fsync
* unify logging
* fix corner-case when etl can use empty bucket name
* fix tests
* better logging
* better logging
* rebase master
* remove lmdb.NoMetaSync flag for now
* consistent walk and multi-walk
* clean
* sub tx
* add consistent multi-put
* implement dupsort support in one new cursor method
* clear
This PR significantly changes the APIs for instantiating Ethereum nodes in
a Go program. The new APIs are not backwards-compatible, but we feel that
this is made up for by the much simpler way of registering services on
node.Node. You can find more information and rationale in the design
document: https://gist.github.com/renaynay/5bec2de19fde66f4d04c535fd24f0775.
There is also a new feature in Node's Go API: it is now possible to
register arbitrary handlers on the user-facing HTTP server. In geth, this
facility is used to enable GraphQL.
There is a single minor change relevant for geth users in this PR: The
GraphQL API is no longer available separately from the JSON-RPC HTTP
server. If you want GraphQL, you need to enable it using the
./geth --http --graphql flag combination.
The --graphql.port and --graphql.addr flags are no longer available.
# Conflicts:
# cmd/faucet/faucet.go
# cmd/geth/chaincmd.go
# cmd/geth/config.go
# cmd/geth/consolecmd.go
# cmd/geth/main.go
# cmd/utils/flags.go
# cmd/wnode/main.go
# core/rawdb/freezer.go
# eth/api_backend.go
# eth/backend.go
# ethclient/ethclient_test.go
# ethstats/ethstats.go
# graphql/service.go
# internal/ethapi/backend.go
# les/api_backend.go
# les/api_test.go
# les/checkpointoracle/oracle.go
# les/client.go
# les/commons.go
# les/server.go
# miner/stresstest/stress_clique.go
# miner/stresstest/stress_ethash.go
# mobile/geth.go
# node/api.go
# node/node.go
# node/node_example_test.go
# node/node_test.go
# node/rpcstack.go
# node/rpcstack_test.go
# node/service.go
# node/service_test.go
# node/utils_test.go
# p2p/simulations/examples/ping-pong.go
# p2p/testing/peerpool.go
# p2p/testing/protocolsession.go
# p2p/testing/protocoltester.go
# whisper/mailserver/server_test.go
# whisper/whisperv6/api_test.go
# whisper/whisperv6/filter_test.go
# whisper/whisperv6/whisper.go
# whisper/whisperv6/whisper_test.go
* init
notes
removed some mentions of eth62, bumped protocol err too old to >=63
* remove sanity checks and bump supported protocol version up to 63
* remove 62 tests, still need to add 65
* remove 65 tests
# Conflicts:
# eth/downloader/downloader_test.go
# eth/downloader/peer.go
* eth/downloader: refactor downloader + queue
downloader, fetcher: throttle-metrics, fetcher filter improvements, standalone resultcache
downloader: more accurate deliverytime calculation, less mem overhead in state requests
downloader/queue: increase underlying buffer of results, new throttle mechanism
eth/downloader: updates to tests
eth/downloader: fix up some review concerns
eth/downloader/queue: minor fixes
eth/downloader: minor fixes after review call
eth/downloader: testcases for queue.go
eth/downloader: minor change, don't set progress unless progress...
eth/downloader: fix flaw which prevented useless peers from being dropped
eth/downloader: try to fix tests
eth/downloader: verify non-deliveries against advertised remote head
eth/downloader: fix flaw with checking closed-status causing hang
eth/downloader: hashing avoidance
eth/downloader: review concerns + simplify resultcache and queue
eth/downloader: add back some locks, address review concerns
downloader/queue: fix remaining lock flaw
* eth/downloader: nitpick fixes
* eth/downloader: remove the *2*3/4 throttling threshold dance
* eth/downloader: print correct throttle threshold in stats
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
# Conflicts:
# eth/downloader/downloader.go
# eth/downloader/downloader_test.go
# eth/downloader/queue.go
# eth/downloader/statesync.go
# eth/fetcher/block_fetcher.go
This fixes two issues with state sync restarts:
When sync restarts with a new root, some peers can have in-flight requests.
Since all peers with active requests were marked idle when exiting sync,
the new sync would schedule more requests for those peers. When the
response for the earlier request arrived, the new sync would reject it and
mark the peer idle again, rendering the peer useless until it disconnected.
The other issue was that peers would not be marked idle when they had
delivered a response, but the response hadn't been processed before
restarting the state sync. This also made the peer useless because it
would be permanently marked busy.
Co-authored-by: Felix Lange <fjl@twurst.com>
# Conflicts:
# eth/downloader/downloader.go
# eth/downloader/statesync.go
This PR reduces the bandwidth used by the light client to compute the
recommended gas price. The current mechanism for suggesting the price is:
- retrieve recent 20 blocks
- get the lowest gas price of these blocks
- sort the price array and return the middle(60%) one
This works for full nodes, which have all blocks available locally.
However, this is very expensive for the light client because the light
client needs to retrieve block bodies from the network.
The PR changes the default options for light client. With the new config,
the light client only retrieves the two latest blocks, but in order to
collect more sample transactions, the 3 lowest prices are collected from
each block.
This PR also changes the behavior for empty blocks. If the block is empty,
the lastest price is reused for sampling.
# Conflicts:
# eth/gasprice/gasprice.go
* eth/downloaded: fixed datarace between synchronize and Progress
There was a race condition between `downloader.synchronize()` and `Progress` `syncWithPeer` `fetchHeight` `findAncestors` and `processHeaders`
This PR changes the behavior of the downloader a bit.
Previously the functions `Progress` `syncWithPeer` `fetchHeight` `findAncestors` and `processHeaders` read the syncMode anew within their loops. Now they read the syncMode at the start of their function and don't change it during their runtime.
* eth/downloaded: comment
* eth/downloader: added comment
# Conflicts:
# eth/downloader/downloader.go
* core, crypto: various allocation savings regarding tx handling
* core: reduce allocs for gas price comparison
This change reduces the allocations needed for comparing different transactions to each other.
A call to `tx.GasPrice()` copies the gas price as it has to be safe against modifications and
also needs to be threadsafe. For comparing and ordering different transactions we don't need
these guarantees
* core: added tx.GasPriceIntCmp for comparison without allocation
adds a method to remove unneeded allocation in comparison to tx.gasPrice
* core/types: pool legacykeccak256 objects in rlpHash
rlpHash is by far the most used function in core that allocates a legacyKeccak256 object on each call.
Since it is so widely used it makes sense to add pooling here so we relieve the GC.
On my machine these changes result in > 100 MILLION less allocations and > 30 GB less allocated memory.
* reverted some changes
* reverted some changes
* trie: use crypto.KeccakState instead of replicating code
Co-authored-by: Martin Holst Swende <martin@swende.se>
# Conflicts:
# core/tx_list.go
# core/tx_pool.go
# core/types/block.go
# core/types/transaction.go
# trie/committer.go
# trie/hasher.go
* eth/downloader tests: fix spurious failing test due to race between receipts/headers
* miner tests: fix travis failure on arm64
* eth/downloader: tests - store td in ancients too
# Conflicts:
# eth/downloader/downloader_test.go
# miner/worker_test.go
* Fix tx propagation and announcement tests
* Fix checkpoint challenge test
* Save current state of code
* Fix compile errors
* Fixes
* Fix formatting
* Printouts
* Printouts
* Printouts
* Too much printing, not close db when stopping
* Better handing of interruptions
* No need to reset after incremental interruption
* Fix stages
* Fixes
* Giving up
* Fix formatting
* Cleanup
* save state
* cleanup
* add walkasof test for storage with chunks
* fix lint
* fix lint
* remove useless comments
* fix dump test
* move accountRange test to plain state
* get last block fixes
* make plain state + staged sync the default
* remove sync mode flag completely
* one thing
* fix the console
* simplify code
* fix and skip tests
* fixup for console tests
* cmd/tester to initiate reorg
* Second commit
* Turn on profile
* More
* Unwind function
* More fixes
* Before fixing tests
* Fix compile error
* Fix lint
* Fix formatting
* Fix lint
* Fix nil in tests
* Fix lint
* Decouple txpool from rawdb
* Fix some tx tests
* One more test
* Fix the rest of tests in tx_pool_test.go
* Fix formatting
* limit incremental step size of stages 5 and 6
* remove limit, make incremental
* remove_load_start_key_from_etl
* switch to "struct of arrays" from "array of structs"
* switch to "struct of arrays" from "array of structs"
Co-authored-by: Alexey Akhunov <akhounov@gmail.com>
* close goruotines
* fix using defer
* close pm managers a bit later
* fmt
* finalizer for in-mem db
* after cr
* revert finalizer
Co-authored-by: alex.sharov <AskAlexSharov@gmail.com>
* store stageData correctly
* integration: use State of sync, use stage data, don't skip persistent steps even if they complete before interruption
* reset_state: clear unwind stages info
* stage4: stop where previous stage stopped, print to logs digits which represent what exactly is in DB, rename variable 'nextBlockNumber' to 'stateProgress'
* rebase to master
* simplify chainconfig
* try increase sleep time on ci
* try increase sleep time on ci
* try increase sleep time on ci
* try increase sleep time on ci
* cmp to reference db if --reference_chaindata provided
* graceful shutdown
* add ./cmd/integration to makefile
* add interruption support for different stages
* don't compare errors directly
* save state
* walkAsOf by cs test passed
* cs search for plain state
* save state
* fix accounts tests
* refactor walkAsOf account tests
* fix storage test
* refactor walkAsOf storage tests
* fix lint
* fix test
* save state
* save state
* add test with fixed bits
* fmt
* add stages check
* fix lint
* fix lint
* remove obsoleted methods
```
go run ./cmd/integration reset --chaindata=...
go run ./cmd/integration state_stages -h
go run ./cmd/integration state_stages --chaindata=... --verbosity=3 --block=2_000_000 --unwind=10 --unwind_every=1_000
```
Also, it inherits flags from geth:
```
--pprof.cpuprofile=./cpu.out // to file
--pprof --pprof.port=6060 // launch pprof server
--metrics // sends to prometheus
```
* fix case: if header stage is ehead of body stage
* fix case: if header stage is ehead of body stage
* fix case: if header stage is ehead of body stage
* allow stage3 to sync to given block
* allow stage3 to sync to given block
* TestWatchNoDir not to be parallel
* Print ks and inc
* Print addrHash
* Change the buffer
* Print loading
* Skip
* More logging
* Error out earlier
* Handle empty codes
* Handle empty codes
* Remove logging
* Compare states
* Not do stage5
* compareBucket
* Preimage
* Clearer errors
* No need to clean up contract code
* Restore stage6
* Printing
* Skip the skipping
* Print all
* Change buffer type
* Add limit to stage5
* Always fail
* Remove exessive logging
* Restore buffer type
* Revert
* Print when exception
* Reenable skipping
* Skip storage items for deleted contracts
* not shortcut
* Remove removeAccount
* Re-enable state hashing
* Default to plain state
* Disable hashing state
* Reenable reset5
* Print unfurl list
* Enable removingAccount
* No printing
* Reenable stage5 commit
* Swap order of stages
* Prevent backwards promotion, reset tx lookup
* reset finish
* Introduce storage item replacement
* See if unwind works
* Restore removingAccount
* Don't do removeAccount for unwinding
* Possible fix
* Proper(er) fix
* Don't exclude unwinding
* Remove unwinding flag
* Fix formatting
* Fix lint
* Not to ignore blocks if they cause reorg
* Fix test, separate stages again
* Fix TestUnwind
* Fix stage
* Swap unwinding
* Revert to unwinding flag
* Print unfurl list
* Print
* Print inside receive
* Print after
* No printing
* Cleanup
* Not use blockCache when doing GetBlock
* Handle bucket error
* Replace with 0
* SetMaxDBs
* Set MaxDb before opening'
* Merge stage5 and stage6
* Fix lint
* Make downloader tests not parallel
* avoid 0 length key/values and seek arguments
* less abstractions in .get method, and copy memory from C space without unsafe conversion into go memory
* fix test
This PR makes use of go 1.13 error handling, wrapping errors and using
errors.Is to check a wrapped root-cause. It also removes the travis
builders for go 1.11 and go 1.12.
# Conflicts:
# eth/downloader/downloader.go
# eth/downloader/downloader_test.go
This adds a new API method on core.BlockChain to allow interrupting
running data inserts, and calls the method before shutting down the
downloader.
The BlockChain interrupt checks are now done through a method instead
of inlining the atomic load everywhere. There is no loss of efficiency from
this and it makes the interrupt protocol a lot clearer because the check is
defined next to the method that sets the flag.
# Conflicts:
# core/blockchain.go
# light/lightchain.go
This PR reimplements the light client server pool. It is also a first step
to move certain logic into a new lespay package. This package will contain
the implementation of the lespay token sale functions, the token buying and
selling logic and other components related to peer selection/prioritization
and service quality evaluation. Over the long term this package will be
reusable for incentivizing future protocols.
Since the LES peer logic is now based on enode.Iterator, it can now use
DNS-based fallback discovery to find servers.
This document describes the function of the new components:
https://gist.github.com/zsfelfoldi/3c7ace895234b7b345ab4f71dab102d4
# Conflicts:
# cmd/utils/flags.go
# core/forkid/forkid.go
# les/client.go
# les/client_handler.go
# les/commons.go
# les/distributor.go
# les/enr_entry.go
# les/fetcher.go
# les/lespay/client/valuetracker.go
# les/metrics.go
# les/peer.go
# les/protocol.go
# les/retrieve.go
# les/server.go
# les/serverpool.go
# les/test_helper.go
# les/utils/expiredvalue.go
# les/utils/weighted_select.go
# les/utils/weighted_select_test.go
# params/bootnodes.go
* Fix body fetch
* Reduce spurious reorgs
* Exit the sync cycle after unwinds
* Fix out of range
* No stalling check for staged sync
* Disable failing tests
* Remove duplicate log message
* Fix UnwindTest and add assertions
* Fix formatting
* Cleanup
* Fix off by one error with bodies
* Remove rollback
* Profile all stages
* Try to recover senders with 8 goroutines
* fix CPU profiling for stage_bodies
* fix out-of-index
* Try full DAG for verfication of header seals
* Try to unroll fnvHash for performance
* SSE2 assembly for fnvHash16
* fnvHash16AVX2
* Revert changes to state.go
* check we're on 64-bit in useAVX2
* Shave a move off fnvHash16AVX2
* asmdecl doesn't know about VMOVD
* disable linter in the right place
* save state
* txlookup full results
* save state
* save state
* remove experiments
* some fix&lint
* add end key to txLookup and index generation
* change log message
* change log
* fix lint
* lint
* fix test
* Euphemerally -> Ephemerally
* Move StorageMode to ethdb and pass it to PrepareStagedSync
* linter
* Remove StorageModeThinHistory and move SetStorageModeIfNotExist into storage_mode.go
* Optionally write receipts in the execute stage
* memory profiler
* linter
* proper linter fix
* linter
* typo
* Merge stateDb with changeDb so that all-or-nothing is commited in stage_execute
use `s.UpdateWithStageData(db, <block number>, <key>)` to store the key
use `s.StageData` with `etl.NextKey` to restart ETL from where it was interrupted.
* Start from 9m7
* Regenerate IH + receipts
* Only stats for iH bucket
* Persist receipts
* Go all in
* Start from block 10m
* Convert DbState to use plain state
* Fix findHistory
* Hard-code export
* More fixes
* Fix test
* Fix formatting
* Introduce PlainDbState
* Actually return PlainDbState
* Fix formatting
* Fix name style lint
* Fix linters
* Fix history_test
* Fix blockchain_test
* Fix compile error
* Bucket stats from all buckets
* Query progress
* Run stage4 offline
* More thorough resetState
* Correct BlockNumber
* Fix formatting
* State loop
* do every 200k blocks
* Shift to 6.6m
* Close dbs in tests
* Stage2 with option of no reset
* every 100k blocks
* Reset state before stage5
* Introduce another stage
* Check compile errors
* Fix linter
* Fix linter
* Disable unreliable test
* Fix test
* Remove unreachable code
* uint256 in rlp
* uint256 rather than big.Int in Transation
* linters
* more linters
* still linters
* Reduce garbage in writeUint256
* Experiment with GC in writeByteArray
* db based version of PrefixByCumulativeWitnessSize
* db based version of PrefixByCumulativeWitnessSize
* retain all in Trie by default
* fix WitnessLen logic in calcTrie roots
* Rename IntermediateTrieWitnessLenBucket to IntermediateWitnessLenBucket
* handle corner cases in WL
* Use correct incarnation for IH bucket
* use name WitnessSize
* save progress towards db-only witness estimation
* results from trie and from db are still different
* less recursion
* correct incarnation in CumulativeSearch
* reuse results from previous Tick, separate concepts of parent and startKey
* experiment: if not including trie structure to WitnessSize will reduce cumulative error
* tool to generate all IH and tool to calculate assessment of cumulative error
* tool to generate all IH
* Calculate totalWitnessSize based on DB data - then schedule will not overrun state during MGR cycle
* better stats
* Calculate totalWitnessSize based on DB data - then schedule will not overrun state during MGR cycle
* Calculate totalWitnessSize based on DB data - then schedule will not overrun state during MGR cycle
* calculate ticks size distribution
* estimate cumulative error
* fix linter
* resetIH from scratch if needed
* cleanup
* fix test
* fix test
* Not hash, keep the files
* Calculate savings
* Fix
* Fix
* Fix
* Fix
* RestAPI to support local boltdb
* Not error on read-only db
* Changes so far
* Continue
* More
* Roll back a bit
* Restore newline
* something compiles
* Fix restapi
* Fix block number
* Fix reads
* Use plain writer
* Maps for storage reads and writes
* Clean up coersions
* Fix accounts/abi/bind
* Fix tests
* More fixes
* more fixes
* More fixes
* Fixes
* Fixed core/state
* Fixed eth tests
* Move code, fix linter
* Fix test
* Fix linter
* Fix linter
* Fix linter, badger_db to support AbstractKV
* Increase IdealBatchSize for badger
* Fix linter
* Fix linter
* Move promotion before the shortcut
* Correct the logs
* Trying without the encoder
* Revert "Trying without the encoder"
This reverts commit 24c526bc2791fb6806b1c0d4f52a43b87c3959b9.
* Commit to db, not to the mutation
* Fix log more
* No need to log every deleted file
* Produce less garbage in GetState
* Still playing with mem allocation in GetCommittedState
* Pass key by pointer in GetState as well
* linter
* Avoid a memory allocation in opSload
* Use uint256.Int rather than common.Hash for storage values to reduce memory allocation in opSload & opSstore
* linter
* linters
* small clean up
* "Unwind" for the execution phase when plain state is selected
* test stub (fails)
* tests (one with incarnations fails)
* test fixups
* fix tests: cleanup contract code bucket
* Produce less garbage in GetState
* Still playing with mem allocation in GetCommittedState
* Pass key by pointer in GetState as well
* linter
* Avoid a memory allocation in opSload
* Rewrite
* Fix linter, make counter
* Skip hash stage
* Fix linter
* Add common
* Fix wrong bucket
* Use temp files to generate index
* Fix hack, defer
* Add logging when creating files
* Properly pass datadir
* Bigger buffers, less logging
* Log current key, enforce batching
* Limit to 4m, print more
* Use ReadFull
* Optimised version of storage generation
* Don't print entire key
* Commit at the end
* Fix linter
* Remove a bit of copy-paste
* More copy-paste reduction
* Fixes
* Fix key length
* Not delete files too early
* Fix linter
* Fix logging
* Fix starting block
* Skip test
* Remove limit on the stage 4
* Fix test while disabling the hash check
* Fix tests
* Fix unreachable
* save state
* add current index feature
* fix test
* remove logs
* Only execute 1000 blocks
* Reset history index
* Correct action
* Increase batch size
* Increase chunk size, print memory stats
* Fix linter
* Remove unused from
* Split into 2 staged
* Use storage history gen
* remove log
* Not to run tx_cacher in staged mode
* Not to recover during stage 2
* Not to recover during stage 2
* Remove counter
Co-authored-by: b00ris <b00ris@mail.ru>
* eth: don't reassign more cache than is being made available
* eth: don't inadvertently enable snapshot in a case where --snapshot wasn't given
# Conflicts:
# eth/backend.go
* all: seperate consensus error and evm internal error
There are actually two types of error will be returned when
a tranaction/message call is executed: (a) consensus error
(b) evm internal error. The former should be converted to
a consensus issue, e.g. The sender doesn't enough asset to
purchase the gas it specifies. The latter is allowed since
evm itself is a blackbox and internal error is allowed to happen.
This PR emphasizes the difference by introducing a executionResult
structure. The evm error is embedded inside. So if any error
returned, it indicates consensus issue happens.
And also this PR improve the `EstimateGas` API to return the concrete
revert reason if the transaction always fails
* all: polish
* accounts/abi/bind/backends: add tests
* accounts/abi/bind/backends, internal: cleanup error message
* all: address comments
* core: fix lint
* accounts, core, eth, internal: address comments
* accounts, internal: resolve revert reason if possible
* accounts, internal: address comments
# Conflicts:
# accounts/abi/abi.go
# accounts/abi/bind/backends/simulated.go
# cmd/geth/retesteth.go
# core/state/snapshot/difflayer_test.go
# core/state/snapshot/disklayer_test.go
# core/state/snapshot/iterator_test.go
# core/state_processor.go
# core/state_transition.go
# core/vm/evm.go
# core/vm/instructions.go
# core/vm/jump_table.go
# eth/api_tracer.go
# internal/ethapi/api.go
# les/odr_test.go
# light/odr_test.go
# tests/state_test_util.go
* core/vm: improve jumpdest lookup
* Use uint256 in EVM implementation (kudos to Pawel Bylica)
* Safety precaution in opMulmod
Co-authored-by: Martin Holst Swende <martin@swende.se>
* introduce PlainStateReader with fallbacks
* no 10.000 changes in tests
* even less iterations
* remove even more iterations
* add `go run ./cmd/geth --syncmode staged --plainstate` flag
* fix serialization calls
* make a more sensible file default
doesn’t affect anything, because this flag is always overriden when parsing CLI. but still.
* introduce fork
* Fix unwind test
* Unwind now really works in the test
* Fix linter
* Fix linter
* Fix linter
* Not to handle block and block hash announced in staged sync