** replace atomic read by channel close to interrupt state prefetch
** try to do state prefetch when the prefetch thread is idle, no need to divide into 3 sub-arrays
it will make the prefetchers workload balance
* feat: add BEP-127 and BEP-131 hardfork bytecode to upgrade
* feat: force check that Euler height cannot be a multiple of 200, fix getCurrentValidators, raise SystemTxsGas after Euler fork
Co-authored-by: goth <goth>
* fix logic issue: handlers.removePeer() is called twice.
There is a logic issue which cause "Ethereum peer removal failed, err=peer not registered" occur quite often.
handler.runEthPeer set up a defer removePeer(). This is always called after a peer is disconnected.
However removePeer is also called by mulitple functions like downloader/fetcher. After those kind of functions removePeer(), peer handler executes defer removePeer(). This makes removePeer() happened twice, and this is the reason we often see "Ethereum peer removal failed, err=peer not registered".
To solve this, removePeer only needs to hard Disconnect peer from networking layer. Then defer unregisterPeer() will do the cleanup task after then.
* fix: modify test function for close testing.
reference from go-thereum.
Co-authored-by: zjubfd <296179868@qq.com>
* pipeline state verification
* update codes and add logs for debug
* refactor
* update and add logs
* refactor
* refactor
* remove unneeded logs
* fix a blocking issue
* fix sync issue when force kill
* remove logs
* refactor based on comments
* refactor based on comments
* refactor based on comments
* refactor based on comments
* refactor based on comments
* fix a deadlock issue
* fix merkle root mismatch issue during sync
* refactor based on review comments
* remove unnecessary code
* remove unnecessary code
* refactor based on review comments
* change based on comments
* refactor
* uew dummyRoot to replace emptyRoot
* add nil check
* add comments
* remove unneeded codes
* format comments
Co-authored-by: forcodedancing <liguo.fudan@gmail.com>
* add sharedStorage for prefetching to L1
* remote originStorage in stateObjects
* fix core
* fix bug of sync map
* remove read lock when get & set keys
* statedb copy use CopyWithSharedStorage
* reduce lock access
* fix comment
* avoid sharedPool effects on other modules
* remove tryPreload
* fix comment
* fix var name
* fix lint
* fix L1 miss data && data condition
* fix comment
* offline block prune
* update
* update
* update and add unit test
* addressed comments from walt
* Addressed comments from walt and Igor
* ensure MPT and snapshot matched
* add one more parameter to indicate blockprune
* update the logic of creating freezerDb
* update flag command description
* expose the function for db inspect the offset/startBlockNumber
* add flags to inspect prune info
* rename flag of reserved-recent-blocks to block-amount-reserved
* addressed comments from walt
* handle the case of command interruption
* refined goimports
* addressed comments from walt
* change the logic as restarting prune after interruption
* addressed comments
* reclaimed freezer logic
* introduce flag to enable/disable check between MPT and snapshot
* update the logic of frozen field in freezerDB
* update the code in all places related to freezer change
* addressed comments from dylan
* update the logic for backup block difficulty
* addressed comments from dylan