Commit Graph

2487 Commits

Author SHA1 Message Date
buddho
0224d48df4
core: enable Shanghai EIPs (#1970) 2023-11-20 19:19:26 +08:00
buddho
4be9481558
internal/ethapi: fix null effectiveGasPrice in GetTransactionReceipt (#1980) 2023-11-14 16:40:25 +08:00
joey
53559fc4d7
eth, trie/triedb/pathdb: pbss patches (#1955)
* fix: use the top root hash for rewinding under path schema

* feat: add async flush nodebuffer in path schema

* chore: add prun-block param suffix check

* fix: code review comments
2023-11-06 14:11:17 +08:00
lx
56424d390f
trie: keep trie prefetch during validation phase (#1954) 2023-10-31 11:32:31 +08:00
GalaIO
0d9151eb8f
txpool: fix a potential crash issue in shutdown; (#1951) 2023-10-30 15:56:37 +08:00
lx
3bf998f55c
code: remove accountTrieCache and storageTrieCache (#1949)
accountTrieCache and storageTrieCache were introduced in this PR:
https://github.com/bnb-chain/bsc/pull/257, which is to improve performance.
Actually the performance gain is quite limited, as there is already dirty
and clean cache for trie node.
And after big merge, these 2 cache can not be used when PBSS is enabled.
So remove these code to simplify the logic.
2023-10-30 10:29:54 +08:00
lx
fd6e7bb3b2
performance: commitTire concurrently (#1948) 2023-10-27 08:55:51 +08:00
lx
01d75a9d21
dependency: go version to 1.20 and some dependencies in go.mod (#1939)
* go.mod: upgrade prysm and the indrect dependency
prysm from v4.0.2 to v4.0.8, and run go mod tidy

* ci: upgrade go version from 1.19 to 1.20
* go-version: upgrade from v1.19 to v1.20
there is some dependency on go v1.20, such as go-libp2p v0.27.8
and also run go mod tidy

* dependency: upgrade docker version for security
it is not a big issue, since docker is only used for test purpose.

* rand: update the usage of math/rand after golang v1.20

2 APIs of math/rand module were deprecated since golang v1.20.
that is: rand.Seed() and rand.Read(), refer: ettps://pkg.go.dev/math/rand

"rand.Seed(seed int64)" has been replaced by: "r := rand.New(rand.NewSource(seed int64))",
need to initialize it with an instance before use

"rand.Read()" has been replaced by "crypto/rand.Read()"

* readme: need golang v1.20+ to build bsc
2023-10-24 21:51:30 +08:00
Nathan
a6cfcfe2b3
consensus/parlia: fix nextForkHash in Extra filed of block header (#1923) 2023-10-17 19:09:11 +08:00
joeycli
9f5842e0ec fix: recover TestStateChanges 2023-10-16 15:27:17 +08:00
rjl493456442
5a3109b1bf trie: remove internal nodes between shortNode and child in path mode (#28163)
* trie: remove internal nodes between shortNode and child in path mode

* trie: address comments

* core/rawdb, trie: address comments

* core/rawdb: delete unused func

* trie: change comments

* trie: add missing tests

* trie: fix lint
2023-10-16 15:27:17 +08:00
joeycli
c3199ab5fc fix: ut error 2023-10-16 15:27:17 +08:00
Delweng
9baffb33b6 core/rawdb: no need to run truncateFile for readonly mode (#28145)
Avoid truncating files, if ancients are opened in readonly mode. With this change, we return error instead of trying (and failing)  to repair
2023-10-16 15:27:17 +08:00
Darioush Jalali
d3a6f9a19e core/state: check err for iter.Error in fastDeleteStorage (#28122)
core/state: check err for iter.Error
2023-10-16 15:27:17 +08:00
rjl493456442
713d8d66a9 core/state: implement fast storage deletion (#27955)
This changes implements faster post-selfdestruct iteration of storage slots for deletion, by using snapshot-storage+stacktrie to recover the trienodes to be deleted. This mechanism is only implemented for path-based schema.

For hash-based schema, the entire post-selfdestruct storage iteration is skipped, with this change, since hash-based does not actually perform deletion anyway.

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-10-16 15:27:17 +08:00
Marius van der Wijden
959b7332bf core/rawdb: allocate database keys with explicit size to avoid slice growth (#27772) 2023-10-16 15:27:17 +08:00
lx
181218128b
Merge branch 'develop' into master 2023-10-12 22:17:11 +08:00
Nathan
b86459a722
core/txpool: ignore nil sub when subpool have been shut down (#1915)
Co-authored-by: buddh0 <galaxystroller@gmail.com>
2023-10-12 10:20:48 +08:00
Nathan
73cfed0ea1
core/vm: clean up evm clearly when get it from pool (#1914) 2023-10-11 16:20:47 +08:00
Nathan
35d85e250b
core: write head block hash when shutdown (#1912) 2023-10-11 16:17:17 +08:00
lx
43e2c779b4
Revert "fix: skip a patch that could fork the chain (#1902)" (#1913)
This reverts commit 0d4721319988e36baf67d95f209c7abaa95d2d65.
2023-10-11 14:37:34 +08:00
Nathan
17ffdf1a9d
core/state: skip deleting storages for EmptyTrie (#1911) 2023-10-10 18:15:24 +08:00
Nathan
f8439514e3
core/state: skip handleDestruction in hash based mode (#1908) 2023-10-08 18:55:30 +08:00
lx
0d47213199
fix: skip a patch that could fork the chain (#1902) 2023-10-07 16:02:33 +08:00
Fynn
4259f4c1f8 fix: state history hasn't write 2023-10-07 14:42:25 +08:00
lx
4b45c5993c
fix: skip HasState check for fast node (#1901) 2023-09-28 10:07:21 +08:00
tokikuch
35b21cac14
core/bloombits: fix deadlock when matcher session hits an error (#1895)
When MatcherSession encounters an error, it attempts to close the session.
Closing waits for all goroutines to finish, including the 'distributor'.
However, the distributor will not exit until all requests have returned.

This patch fixes the issue by delivering the (empty) result to the distributor
before calling Close().
2023-09-27 15:00:27 +08:00
Nathan
f8bc2b76ac
core/state: ensure triedb Commit after Update (#1900) 2023-09-27 11:07:45 +08:00
Fynn
b8bad314ed cmd/geth: add hash2path & trie get tools 2023-09-26 20:45:05 +08:00
joeycli
528d97b541 feat: active pbss on bsc
fix: lint error

fix: ut error

fix: code review comments
2023-09-26 16:14:32 +08:00
rjl493456442
720ff1fe57 all: activate pbss as experimental feature from eth (#26274)
* all: activate pbss

* core/rawdb: fix compilation error

* cma, core, eth, les, trie: address comments

* cmd, core, eth, trie: polish code

* core, cmd, eth: address comments

* cmd, core, eth, les, light, tests: address comment

* cmd/utils: shorten log message

* trie/triedb/pathdb: limit node buffer size to 1gb

* cmd/utils: fix opening non-existing db

* cmd/utils: rename flag name

* cmd, core: group chain history flags and fix tests

* core, eth, trie: fix memory leak in snapshot generation

* cmd, eth, internal: deprecate flags

* all: enable state tests for pathdb, fixes

* cmd, core: polish code

* trie/triedb/pathdb: limit the node buffer size to 256mb

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2023-09-26 16:14:32 +08:00
GalaIO
d179056512 logs: add some logs to trace block miner, justified reorg; (#1894) 2023-09-26 14:21:22 +08:00
GalaIO
2f7d305013
logs: add some logs to trace block miner, justified reorg; (#1894) 2023-09-25 20:11:52 +08:00
Nathan
52e2cb86a5
parlia: reject header with non-nil WithdrawalsHash(#1884)
* parlia: reject header with `WithdrawalsHash` before shanghai fork

* log: output chainconfig when start up

* eth: fix TestOptionMaxPeersPerIP failure of goroutine order
2023-09-21 12:02:59 +08:00
Nathan
41f0667ce1
Revert "core/rawdb: open meta file in read only mode (#26009)" (#1879)
This reverts commit b9ba6f6e4d86d0ee86c63e8f4552e233fe0450aa.
2023-09-20 07:05:18 +08:00
NathanBSC
1bc27f6d98 core/state: handle account destruction after updating account state 2023-09-19 10:58:35 +08:00
NathanBSC
0f622f3829
lint: fix all golang lint after big merge (#1861) 2023-09-08 16:36:16 +08:00
NathanBSC
6632d3bf99 Merge branch 'develop' into merge_develop_to_big_merge_v1.10.16_v1.12.2 2023-09-08 11:14:09 +08:00
NathanBSC
6af6162297
vote: check consensus key match vote key before voting (#1858) 2023-09-08 10:20:07 +08:00
NathanBSC
b5e862b9a8 Merge branch 'develop' into merge_develop_to_big_merge_v1.10.16_v1.12.2 2023-09-07 17:50:15 +08:00
Eric
a0cb4d0377
eth/tracers: trace system tx should add intrinsicGas (#1855) 2023-09-07 16:46:54 +08:00
NathanBSC
202ab70922
Big merge v1.10.16 v1.12.2 fix ci (#1850)
* fix: crash of highestVerifiedHeader

* fix: panic of blobpool

* fix: genesis set up

* 1. modify NewDatabaseWithNodeDB to upstream
2. fix race use of hasher in statedb
3. fix use wrong value when updateTrie

* fix dir legacypool

* fix dir blobpool

* fix dir vote

* remove diffsync related code

* fix core/state/snapshot

* disable pipeCommit for now

* fix applyTransaction for bloom setting

* CI: fast finality in gasprice test

* CI: diffFetcher was removed

* CI: downloader, remove beaconsync test

* CI: no beaconsync in downloader, remove a failed case

TestCheckpointChallenge was removed in:
https://github.com/ethereum/go-ethereum/pull/27147
since after merge, it is useless for ethereum, but might be useful for BSC.
disable the case right now, as it is not a big issue.

* CI: bsc protocol decHandlers

* CI: receipt Bloom process

* 1. skip CheckConfigForkOrder for non-parlia engine
2. all test cases in core work well now
	cd core && go test ./... -v

* fix test cases in trie dir

* CI: no beaconsync in downloader, remove a failed case(redo)

* fix dir miner

* fix dir cmd/geth

* CI: filter test, BaseFee & Finality

* fix dir graphql

* remove diffStore

* fix ethclient

* fix TestRPCGetTransactionReceipt

* fix dir internal

* ut add dir ethstats and signer

* disable pipeCommit thoroughly; fix concurrent map iteration and map write in statedb

* CI: fix snap sync

it could be changed by mistake

* fix tests/Run to generate snapshot

* prepare for merge

* remove useless

* use common hasher in getDeletedStateObject, no race here

* an critical comment for state.Prepare

* do not copy nil accessList

* add omitempty tag for unused new fields of core.Genesis

* remove totalFees

* calculate fees before FinalizeAndAssemble

* revert interface Finalize of consensus

* do not double gas limit upon london block

* use Leveldb as default

* Revert "remove diffStore"

This reverts commit df343b137412b0beb25298a6ba9c3c19e47f20b1.

* Revert "remove diffsync related code"

This reverts commit 8d84b81feae5d794cb5d7fcfdb7f5f7da751941b.

* compile pass after revert

* remove diffsync

* fix dir eth/protocols/trust

* fix TestFastNode

* decHandlers for trust protocol

* keep persist diff in test
2023-09-07 16:39:29 +08:00
NathanBSC
2290201ff1 Merge branch 'develop' into big_merge_v1.10.16_v1.12.2 2023-08-23 19:37:39 +08:00
NathanBSC
872d22ed2d upstream: Merge tag 'v1.12.2' into develop 2023-08-23 17:46:08 +08:00
lx
e2bf0f3fbd
fix: lagging nodes failed to sync (#1829)
FastFinality puts more infor into the header.extra field to keep vote information.
For mainnet, on epoch height, it could be 1526 bytes, which was 517 bytes before.
So the hardcoded 700 bytes for header could be no longer enough, increase it by
2 times would be enough.

this bug could cause P2P sync failure for nodes that are lagging behind, since they
would request access of ancient db, and GetBlockHeaders could be failed.
2023-08-21 10:31:18 +08:00
Péter Szilágyi
811a674059 all: update golang/x/ext and fix slice sorting fallout (#27909)
The Go authors updated golang/x/ext to change the function signature of the slices sort method. 
It's an entire shitshow now because x/ext is not tagged, so everyone's codebase just 
picked a new version that some other dep depends on, causing our code to fail building.

This PR updates the dep on our code too and does all the refactorings to follow upstream...
2023-08-12 00:19:12 +02:00
imulmat4
55863ce0d8 core/txpool/blobpool: fix metrics name for prometheus export (#27901) 2023-08-12 00:18:16 +02:00
Guillaume Ballet
67979022aa
core/state: move UpdateContractCode before the trie hash is computed (#27853)
Context: The UpdateContractCode method was introduced for the state storage commitment
schemes that include the whole code for their commitment computation. It must therefore be called
before the root hash is computed at the end of IntermediateRoot.

This should have no impact on the MPT since, in this context, the method is a no-op.
2023-08-09 18:02:45 +02:00
Martin Holst Swende
e13fa32cea
core/vm: update 4844 - point evaluation precompile address (#27874) 2023-08-08 15:54:19 +03:00
Felix Lange
bb148dd342
core/types: support yParity field in JSON transactions (#27744)
This adds support for the "yParity" field in transaction objects returned by RPC
APIs. We somehow forgot to add this field even though it has been in the spec for
a long time.
2023-08-05 00:54:55 +02:00