Commit Graph

13475 Commits

Author SHA1 Message Date
Sina Mahmoodi
7bb1463a63 graphql: fix nonce for pending accounts (#24443) 2022-08-19 07:40:41 +08:00
b1ackd0t
c1dd16f4ce internal/ethapi: fix incorrect type on empty slice (#24372)
* Fixes #24368

Signed-off-by: 0x6f736f646f <blackd0t@protonmail.com>

* Update internal/ethapi/api.go

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-08-19 07:35:43 +08:00
zhiqiangxu
a1db38af74 p2p: reduce the scope of variable dialPubkey (#24385)
dialPubkey isn't used anywhere else after dialDest.Load, so it should be safe to
restrict its scope to the if clause.
2022-08-19 07:33:07 +08:00
Martin Holst Swende
788b77115c core/state: fix read-meters + simplify code (#24304) 2022-08-19 07:31:35 +08:00
Roshan
11d2bae157
bep153: Native Staking on BSC (#1051) 2022-08-18 14:36:45 +08:00
setunapo
ddbe6c4f77 ci: no type-case check for scope. 2022-08-17 19:24:48 +08:00
joeycli
dbb047bccc
Merge pull request #1053 from bnb-chain/fix_opendatabase_fail
state: fix offline tool start failed when start with pruneancient
2022-08-17 14:29:11 +08:00
dylanhuang
05d8399cdf
ci: add commit message lint (#1044) 2022-08-16 19:01:24 +08:00
joeycli
895c077f8a fix bug #1034, offline tool start failed when start with pruneancient 2022-08-16 14:02:45 +08:00
Leon
76e3c9071a [R4R] Pipecommit enable trie prefetcher (#992) 2022-08-01 17:41:50 +08:00
setunapo
77c8372cc4 Trie prefetch on state pretch (#996)
* feature: do trie prefetch on state prefetch

Currently, state prefetch just pre execute the transactions and discard the results.
It is helpful to increase the snapshot cache hit rate.
It would be more helpful, if it can do trie prefetch at the same time, since the it will
preload the trie node and build the trie tree in advance.
This patch is to implement it, by reusing the main trie prefetch and doing finalize after
transaction is executed.

* some code improvements for trie prefetch

** increase pendingSize before dispatch tasks
** use throwaway StateDB for TriePrefetchInAdvance and remove the prefetcherLock
** remove the necessary drain operation in trie prefetch mainloop,
   trie prefetcher won't be used after close.
2022-08-01 17:41:50 +08:00
setunapo
df3e1be9d3 [Feature]: Improve trie prefetch (#952)
* trie prefetcher for From/To address in advance

We found that trie prefetch could be not fast enough, especially trie prefetch of
the outer big state trie tree.
Instead of do trie prefetch until a transaction is finalized, we could do trie prefetch
in advance. Try to prefetch the trie node of the From/To accounts, since their root hash
are most likely to be changed.

* Parallel TriePrefetch for large trie update.

Currently, we create a subfetch for each account address to do trie prefetch. If the address
has very large state change, trie prefetch could be not fast enough, e.g. a contract modified
lots of KV pair or a large number of account's root hash is changed in a block.

With this commit, there will be children subfetcher created to do trie prefetch in parallell if
the parent subfetch's workload exceed the threshold.

* some improvemnts of parallel trie prefetch implementation

1.childrenLock is removed, since it is not necessary
  APIs of triePrefetcher is not thread safe, they should be used sequentially.
  A prefetch will be interrupted by trie() or clos(), so we only need mark it as
  interrupted and check before call scheduleParallel to avoid the concurrent access to paraChildren
2.rename subfetcher.children to subfetcher.paraChildren
3.use subfetcher.pendingSize to replace totalSize & processedIndex
4.randomly select the start child to avoid always feed the first one
5.increase threshold and capacity to avoid create too many child routine

* fix review comments

** nil check refine
** create a separate routine for From/To prefetch, avoid blocking the cirtical path

* remove the interrupt member

* not create a signer for each transaction

* some changes to triePrefetcher

** remove the abortLoop, move the subfetcher abort operation into mainLoop
   since we want to make subfetcher's create & schedule & abort within a loop to
   avoid concurrent access locks.

** no wait subfetcher's term signal in abort()
   it could speed up the close by closing subfetcher concurrently.
   we send stop signnal to all subfetchers in burst and wait their term signal later.

* some coding improve for subfetcher.scheduleParallel

* fix a UT crash of s.prefetcher == nil

* update parallel trie prefetcher configuration

tested with different combination of parallelTriePrefetchThreshold & parallelTriePrefetchCapacity,
found the most efficient configure could be:
  parallelTriePrefetchThreshold = 10
  parallelTriePrefetchCapacity  = 20

* fix review comments: code refine
2022-08-01 17:41:50 +08:00
kyrie-yl
51bfecacb0 broadcast block before commit block and add metrics (#975)
Signed-off-by: cryyl <yl.on.the.way@gmail.com>
2022-08-01 17:41:50 +08:00
dylanhuang
09dfd2ff7e
prepare for release v1.1.12 (#1023) 2022-07-28 17:25:47 +08:00
zjubfd
6c46c59f27
fix: verify node is not treated as verify node (#1024) 2022-07-28 13:58:33 +08:00
dylanhuang
06bc2a0681
fix: remove diffhash patch introduced fro (#1020) 2022-07-27 13:58:49 +08:00
Leon
a2a90d3212
Fix pipecommit about activeState (#1002)
* get copy of prefetcher before use to avoid been modified between access and not-nil condition
2022-07-27 01:24:28 +08:00
Leon
71f0caa6cf
Remove duplicate update/delete on tire (#1001)
* rm duplicate update/delete on tire
* rm useless code
2022-07-27 01:23:19 +08:00
dylanhuang
dd3b3a69b5
fix: memory leak issue with diff protocol (#1019) 2022-07-26 16:33:59 +08:00
zjubfd
cd46de9e0b
log: disable noisy logs since system transaction will cause gas capping (#1015) 2022-07-25 21:13:49 +08:00
zjubfd
0ed265c5e0
fix: fast node can not recover from force kill or panic (#1014) 2022-07-25 21:12:45 +08:00
joeycli
9d59a140d6
[R4R]fix: tools broken because of writting metadata when open a readyonly db (#1013)
* freezer batch compatible offline prunblock command

adjust pruneblock local var

* not write metadata to db when open db with readyonly
2022-07-25 09:56:17 +08:00
joeycli
d93211b310
[R4R]db: freezer batch compatible offline prunblock command (#1005)
[R4R]db: freezer batch compatible offline prunblock command (#1005)
2022-07-22 16:11:34 +08:00
dylanhuang
403b19c629
[R4R] fix: Incorrect merkle root issue when enabling pipecommit with miner (#1011)
[R4R] fix: Incorrect merkle root issue when enabling pipecommit with miner (#1011)
2022-07-22 15:58:06 +08:00
kyrie-yl
015c527b60
[R4R]fix: resolve the concurrent cache read and write issue for fast node (#1009)
* fix cache read and write concurrency issue of empty block

Signed-off-by: cryyl <yl.on.the.way@gmail.com>

* fix: limit the size of chainHeadChanSize

Co-authored-by: zjubfd <296179868@qq.com>
2022-07-22 15:54:06 +08:00
dylanhuang
21c4ecee3e
fix: incorrect behavior of miner (#1007) 2022-07-20 17:33:51 +08:00
Jason Yi
37b7ac7b71
feat: update dockerfile with a few enhancement (#998)
* feat: refactor dockerfile to add entrypoint script
2022-07-20 12:07:00 +08:00
dylanhuang
659f670b9b
ci: add script to docker image (#990) 2022-07-19 15:55:32 +08:00
dylanhuang
fd1d1e356e
fix: nil pointer issue when stopping mining new block (#983) 2022-07-08 13:17:40 +08:00
setunapo
8e74562179
[R4R]: Redesign triePrefetcher to make it thread safe (#972)
* Redesign triePrefetcher to make it thread safe

There are 2 types of triePrefetcher instances:
1.New created triePrefetcher: it is key to do trie prefetch to speed up validation phase.
2.Copied triePrefetcher: it only copy the prefetched trie information, actually it won't do
  prefetch at all, the copied tries are all kept in p.fetches.

Here we try to improve the new created one, to make it concurrent safe, while the copied one's
behavior stay unchanged(its logic is very simple).
As commented in triePrefetcher struct, its APIs are not thread safe. So callers should make sure
the created triePrefetcher should be used within a single routine.
As we are trying to improve triePrefetcher, we would use it concurrently, so it is necessary to
redesign it for concurrent access.

The design is simple:
** start a mainLoop to do all the work, APIs just send channel message.

Others:
** remove the metrics copy, since it is useless for copied triePrefetcher
** for trie(), only get subfetcher through channel to reduce the workload of mainloop

* some code enhancement for triePrefetcher redesign

* some fixup: rename, temporary trie chan for concurrent safe.

* fix review comments

* add some protection in case the trie prefetcher is already stopped

* fix review comments

** make close concurrent safe
** fix potential deadlock

* replace channel by RWMutex for a few triePrefetcher APIs

For APIs like: trie(), copy(), used(), it is simpler and more efficient to
use a RWMutex instead of channel communicaton.
Since the mainLoop would be busy handling trie request, while these trie request
can be processed in parallism.

We would only keep prefetch and close within the mainLoop, since they could update
the fetchers

* add lock for subfecter.used access to make it concurrent safe

* no need to create channel for copied triePrefetcher

* fix trie_prefetcher_test.go

trie prefetcher’s behavior has changed, prefetch() won't create subfetcher immediately.
it is reasonable, but break the UT, to fix the failed UT
2022-07-07 10:00:09 +08:00
zjubfd
552e404e8c
Merge pull request #976 from j75689/fix/difflayer_ut
[R4R] fix asynchronous caching of difflayer causes random errors in tests
2022-07-06 19:16:52 +08:00
j75689
b6c02a492c fix: asynchronous caching of difflayer causes random errors in tests 2022-07-06 15:43:33 +08:00
zjubfd
a02c4fabc8
Merge pull request #816 from bnb-chain/merge_eth
[R4R] merge go-ethereum
2022-07-06 11:06:11 +08:00
j75689
b01b45a33e Merge branch 'develop' into merge_eth 2022-07-05 11:18:13 +08:00
j75689
79bd42836c fix: code compatibility fixes 2022-07-05 11:14:21 +08:00
dean
0483394ef6
[R4R] Separate Processing and State Verification on BSC (#926)
Implement Separate Processing and State Verification on BSC
2022-07-04 09:49:07 +08:00
zjubfd
0f3bfa888e
Merge pull request #959 from KeefeL/keefe/dev
[R4R]update some packages' version
2022-06-30 11:44:09 +08:00
joeycli
d6b9bdbc84
add prune ancient feature (#862)
* add prune ancient feature

* change notes and log for pr suggest

* change StableStateBloc to SafePointBlock and enhanced 'pruneancient' flag hints

* change pruneancient usage

* fix note misspelling

* fix set SafePointBlockNumber by mpt height replace current block number

Co-authored-by: user <joeycli0919@qq.com>
2022-06-29 18:47:25 +08:00
zjubfd
ba120d04ef
Merge pull request #961 from KeefeL/develop
[R4R] sync with master branch
2022-06-29 12:23:47 +08:00
Larry
5b5cc005d9
Merge pull request #950 from setunapo/improve_state_prefetch
Improve state prefetch
2022-06-24 10:53:25 +08:00
Larry
128977c105
Merge pull request #953 from qinglin89/fix-evm
correct logic for eip check of NewEVMInterpreter
2022-06-24 10:48:16 +08:00
Keefe-Liu
c45130e3eb Merge branch 'master' into develop 2022-06-24 01:03:18 +08:00
zjubfd
6ec6edaad8
Merge pull request #958 from KeefeL/keefe/bugfix
[R4R] p2p: define DiscReason as uint8
2022-06-23 10:36:36 +08:00
Keefe-Liu
5ef4a2b329 upgrade gogo/protobuf to version v1.3.2 2022-06-23 03:05:11 +08:00
Keefe-Liu
fcfc57feb3 upgrade docker version to 1.6.1 2022-06-23 03:03:36 +08:00
Felix Lange
4b8c03b129 p2p: define DiscReason as uint8 (#24507)
All other implementations store disconnect reasons as a single byte,
so go-ethereum should do it too.
2022-06-23 02:42:38 +08:00
qinglin89
0137f20a31 refactor: cuncurrency safe for state_prefetcher 2022-06-21 12:36:59 +08:00
qinglin89
ebceb25176 fix:correct logic for eip check of NewEVMInterpreter 2022-06-20 18:47:25 +08:00
setunapo
8c36d29f99 Improve the state prefetch dispatch policy
** 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
2022-06-20 14:59:51 +08:00
setunapo
28f80903dd Improve StatePrefetch, use AsMessageNoNonceCheck to skip nonce check
For state prefetch, no need to check transaction's nonce,
since the transaction's result will be discarded anyway.
2022-06-17 16:05:28 +08:00