Commit Graph

13833 Commits

Author SHA1 Message Date
dylanhuang
bf68be2bd9
dep: bump the version of several important library (#1274)
* dep: upgrade secp256k1 to use btcec/v2 v2.3.2 and update insecurity pkg

* build ci: upgrade go to 1.19 and golangci-lint to 1.50.1

* docs: fix format that does not follow the goimports

* dep: redirect github.com/bnb-chain/tendermint to v0.31.13

* ci: disable GOPROXY
2023-02-02 19:36:37 +08:00
j75689
176ab95ee5 ci: disable CGO_ENABLED when building binary 2023-02-02 14:10:02 +08:00
Ng Wei Han
0f744c7f73
docs: minor fix on geth links (#1287) 2023-02-01 11:34:16 +08:00
zjubfd
d22153b9da
docs: minor fix about the readme (#1267) 2023-01-06 10:51:57 +08:00
zjubfd
b34453e3eb
docs: update the readme (#1266) 2023-01-05 18:41:46 +08:00
j75689
8362242de6 build: fix windows compilation failure 2022-12-22 20:09:47 +08:00
j75689
b37d44b289 ci: update unmaintained tools to use maintained tools 2022-12-22 20:09:47 +08:00
joeycli
30369897f2 fix comments: prune ancient compatibility, add prune ancient comments 2022-12-22 20:07:55 +08:00
WayToFuture
154f339ce3
comments: add comments to clarify flags and byte codes (#1245) 2022-12-22 12:39:36 +08:00
Seungbae Yu
e9a04cca30 core: preallocate batch size in bloomIndexer (#25289)
This change reduces allocations when committing bloombits indexes
by creating the database batch with a larger initial size.
2022-12-16 17:30:34 +08:00
rjl493456442
da977e9cdc core, ethdb, tests, trie: implement NewBatchWithSize API for batcher (#24392)
This PR adds an addtional API called `NewBatchWithSize` for db
batcher. It turns out that leveldb batch memory allocation is
super inefficient. The main reason is the allocation step of
leveldb Batch is too small when the batch size is large. It can
take a few second to build a leveldb batch with 100MB size.

Luckily, leveldb also offers another API called MakeBatch which can
pre-allocate the memory area. So if the approximate size of batch is
known in advance, this API can be used in this case.

It's needed in new state scheme PR which needs to commit a batch of
trie nodes in a single batch. Implement the feature in a seperate PR.
2022-12-16 17:30:34 +08:00
dylanhuang
cc17abfa17
metrics: add miner info into metrics server (#1212)
* metrics: add unlock address to metrics when miner module is enabled

* metrics: add miner config into metrics server

* metrics: add device-info into metrics server

* metrics: fix the format of device info

* metrics: remove device-info
2022-12-16 07:59:16 +08:00
kyrie-yl
c5b7d747f7
eth, trie: sync with upstream v1.10.26 to solve snap sync issues (#1226)
* eth: fix a rare datarace on CHT challenge reply / shutdown

* trie: check childrens' existence concurrently for snap heal

* eth/protocols/snap: fix problems due to idle-but-busy peers

* eth/filters: change filter block to be by-ref (#26054)

This PR changes the block field in the filter to be a pointer, to disambiguate between empty hash and no hash

* rpc: handle wrong HTTP batch response length (#26064)

* eth/protocols/snap: throttle trie heal requests when peers DoS us (#25666)

* eth/protocols/snap: throttle trie heal requests when peers DoS us

* eth/protocols/snap: lower heal throttle log to debug

Co-authored-by: Martin Holst Swende <martin@swende.se>

* eth/protocols/snap: fix comment

Co-authored-by: Martin Holst Swende <martin@swende.se>

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Jordan Krage <jmank88@gmail.com>
2022-12-13 17:16:14 +08:00
Eric
b4773e8b50
doc: update README (#1234) 2022-12-08 14:20:39 +08:00
setunapo
8894b65590
doc: update readme (#1233) 2022-12-07 14:59:37 +08:00
zjubfd
cb9e50bdf6
Merge pull request #1223 from bnb-chain/develop
hotfix: fix the incorrect format of prometheus label
v1.1.18_hf
2022-12-01 17:12:31 +08:00
zjubfd
cd0d177f57
Merge pull request #1222 from j75689/fix/build-info
metrics: fix the label format of prometheus server
2022-12-01 17:07:09 +08:00
j75689
ecc12f6493 metrics: fix the label format of prometheus server 2022-12-01 16:54:10 +08:00
nathanhopp
b6b274eba2
metrics fix: edit mutate key to replace - with _ (#1217) 2022-12-01 10:13:50 +08:00
zjubfd
03ff2992ab
Merge pull request #1211 from bnb-chain/develop
release: draft release v1.1.18
v1.1.18
2022-11-29 15:46:26 +08:00
zjubfd
d3873f4ccf
Merge pull request #1210 from guagualvcha/p_1.1.18
release: prepare for v1.1.18 release.
2022-11-29 15:07:01 +08:00
zjubfd
02f7ad74c6 release: prepare for release v1.1.18 2022-11-29 13:39:08 +08:00
dylanhuang
ef16f9efdb
Merge pull request #1209 from j75689/metrics/build-info
metrics: add build info into metrics server
2022-11-29 10:32:21 +08:00
j75689
fe5682c4e0 ci: fix build cmd of arm binary 2022-11-28 22:42:30 +08:00
j75689
d1c9262b12 ci: add git info to cross-compile 2022-11-28 22:42:30 +08:00
j75689
9023e42d0a metrics: add build info into metrics server 2022-11-28 22:42:30 +08:00
j75689
d77ebb8511 metrics: add label type in metrics package 2022-11-28 22:42:30 +08:00
setunapo
807d52e557 worker: some Subscribe NewTxsEvent changes of miner worker
1.remove the unnecessary NewTxsEvent subscriber, which was used for PoW resubmit check.
2.unsubscribe ASAP before another fillTransactions, to avoid block others.
2022-11-28 13:21:14 +08:00
setunapo
58644491ad worker: reused triePrefetch when multi-fillTransactions to mine a block.
avoid too much trie prefetch routines when several fillTransactions are called.
2022-11-28 13:21:14 +08:00
Larry
d87d697d92
worker: add double sign check for safety. (#1201)
* worker: add double sign check for safety.

And for corner cases, such as reorg after reorg...
use slice to record all broadcast blocks's parents to avoid overwritten.
2022-11-24 15:22:37 +08:00
Roshan
90a414ab7c
Merge pull request #1195 from Pythonberg1997/cross_stake
update Gibbs fork height and system contract code
2022-11-22 16:29:03 +08:00
Roshan
db4cb1df26 upgrade: update Gibbs fork height and system contract code 2022-11-21 19:42:35 +08:00
setunapo
aa986b6d4e worker: return for resubmit signal.
it is not necssary to add more transaction when resubmit is fired.
the resubmit logic was for PoW and can be removed later.
2022-11-21 17:28:23 +08:00
setunapo
21b985c14b worker: always drop on new block imported.
When new block is imported, there is no need to commit the current
work, even the new imported block is offturn and itself is inturn.

That is because when offturn block is received, the inturn block is
already later to broadcast block, deliver the later block will cause
many reorg, which is not reasonable.

And also make sure all useless work can be discarded, to avoid goroutine leak.
2022-11-21 17:28:23 +08:00
setunapo
c33f696811 worker: do not fillTransactions immediately on new transaction.
It may not efficient if schedule fillTransactions when new transactions arrive.
It could make the CPU keep running.
To make is more efficient:
  1.schedule fillTransactions when a certain amount of transaction are arrived.
  2.or there is not much time left.
2022-11-21 17:28:23 +08:00
setunapo
de5dd95ada worker: enhancement of the current block generation logic.
Currently, validator only try once to get transactions from TxPool to produce the block.
However, new transactions could arrive while the validator is committing transaction.
Validator should be allowed to add these new arrived transactions as long as
Header.Timestamp is not reached

This commit will:
** commitTransactions return with error code
** drop current mining block on new block imported
** try fillTransactions several times for the best
   not use append mode to follow the GasPrice rule.
** check if there is enough time for another fillTransactions.
2022-11-21 17:28:23 +08:00
zjubfd
276b69ee8b
Merge pull request #1192 from kyrie-yl/upstream_v1.10.22
all: sync with upstream v1.10.22
2022-11-20 15:20:09 +08:00
Henry
fb2e68b79a common/compiler: json unmarshalling error checks (#25449)
complier/solidity:add json.Unmarshal err check
2022-11-18 11:32:36 +08:00
ycyraum
48b6db9f63 core/genesis: remove calaverasAllocData (#25516)
core/genesis: calaverasAllocData no longer used
2022-11-18 11:16:03 +08:00
rjl493456442
466e9a2a3d trie: improve node rlp decoding performance (#25357)
This avoids copying the input []byte while decoding trie nodes. In most
cases, particularly when the input slice is provided by the underlying
database, this optimization is safe to use.

For cases where the origin of the input slice is unclear, the copying version
is retained. The new code performs better even when the input must be
copied, because it is now only copied once in decodeNode.
2022-11-18 11:16:03 +08:00
Justin Traglia
b8c2d2e8f8 eth, les: unlock downloader peerSet if there's an error (#25546)
Unlock peerSet if there's an error in the downloader
2022-11-18 11:16:03 +08:00
Leon
dbc70ee1e2
core/forkid: refactor nextForkHash (#1177) 2022-11-17 12:12:12 +08:00
setunapo
139eb3f467 worker: fix a bug of the delay timer.
`fillTransactions` will call `commitTransactions` twice, if the delay
timer is expired during the first call, it will make the delay timer
never be triggered in the second commitTransactions call.
Pseudo code:
    x := time.NewTimer(time.Second)
    <-x.C
    fmt.Println("read delay 1")
    <-x.C
    fmt.Println("read delay 2")  // will never hit
2022-11-17 11:42:03 +08:00
setunapo
0789afe6e7 worker: remove pre-seal empty block
pre-seal empty block is for PoW to deliver an empty block ASAP to
gain the block mine reward.

It is useless for PoS consensus and it does not work for BSC either.

Delete the code to make worker simpler.
2022-11-16 17:57:44 +08:00
setunapo
086a99b407 worker: no need to add more transaction if not mining
It could be a very old PoW logic, which try to add more transaction
into the pending block when mining is stopped.
Mining can be stopped when:
  1.download started.
  2.manually stopped by RPC.
It is unnecessary to add more transaction into the pending block if a validator is stopped.
And updateSnapshot() is not needed as well, it is to get the pending mining snapshot.
2022-11-16 10:47:58 +08:00
setunapo
fe1c8622f6 parlia: Delay() with DelayLeftOver
Right now, DelayLeftOver is used to reserve time for block finalize, not block
broadcast. And the code does not work as expected.

The general block generation could be described as:
|- fillTransactions -|- finalize a block -|- wait until the period(3s) reached -|- broadcast -|
2022-11-16 10:47:58 +08:00
setunapo
d1ed977d89 worker: change interrupt type from *int to chan
channel operation is preferred than atomic value check in golang.
And it will help for the further refactor on worker.
2022-11-15 13:26:11 +08:00
setunapo
b4dcff5772 worker: remove the code of resubmit interval adjust
resubmit intervalAdjust is for PoW only, to remove it to make worker simpler.

With PoW, there will be a periodic timer to check if it is the time to stop
packing transaction and start calculating the desired hash value, since other miner
could succeed in hash compute if it spends too much time packing transactions.
It will commit the current fruit to calculate root at a reasonable time.
And it will schedule a new work to get a big block if new transaction was received.

When there are too many transactions in the TxPool, the interval of the resubmit timer would be
increased and vice versa.

But it is not needed with PoS related consensus, since the block interval is determined in PoS,
and there is already a timer to stop too long packing.
2022-11-15 13:26:11 +08:00
Guillaume Ballet
bf1dbd9233 accounts/abi: substitude arg%d to the range keyword (#25307)
* accounts/abi: substitude arg%d to the range keyword

* support more keywords

* review feedback
2022-11-15 11:54:31 +08:00
Brion
d07a706aff rpc: add graceful shutdown timeout for HTTP server (#25258)
This change ensures the HTTP server will always terminate within
at most 5s, even when all connections are busy and do not become
idle.

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-11-15 11:54:31 +08:00