Skip to content

Commit 91e0d26

Browse files
authored
Merge pull request bnb-chain#3356 from bnb-chain/develop
Draft release v1.6.1-beta
2 parents fca6a6b + b448f7f commit 91e0d26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2059
-935
lines changed

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
# Changelog
2+
## v1.6.1
3+
v1.6.1-alpha is a preview release, which fixes several issues of the v1.6.0-alpha, it is more reliable than v1.6.0-alpha, so mark it as beta stage.
4+
5+
### FEATURE
6+
NA
7+
8+
### BUGFIX
9+
[\#3336](https://github.com/bnb-chain/bsc/pull/3336) miner: avoid to commit a bid twice
10+
[\#3347](https://github.com/bnb-chain/bsc/pull/3347) fix: discovery AyncFilter deadlock on shutdown
11+
[\#3340](https://github.com/bnb-chain/bsc/pull/3340) core: rework fast node
12+
13+
### IMPROVEMENT
14+
[\#3337](https://github.com/bnb-chain/bsc/pull/3337) eth/pebble: use NoSync as write mode
15+
[\#3332](https://github.com/bnb-chain/bsc/pull/3332) FilterMap: update bsc checkpoint file
16+
[\#3324](https://github.com/bnb-chain/bsc/pull/3324) eth/downloader: remove InsertHeaderChain to improve sync speed
17+
[\#3319](https://github.com/bnb-chain/bsc/pull/3319) core/rawdb: remove func AncientOffSet and ItemAmountInAncient
18+
[\#3346](https://github.com/bnb-chain/bsc/pull/3346) cmd/geth: remove subcmd hbss2pbss and insecure-prune-all
19+
[\#3354](https://github.com/bnb-chain/bsc/pull/3354) freezer: add debug log for out of bounds access
20+
221
## v1.6.0
322
v1.6.0-alpha is a preview release for upstream code sync, it catches up with [go-ethereum release [v1.16.1]](https://github.com/ethereum/go-ethereum/releases/tag/v1.16.1) and also inlcude several bug fix.
423

accounts/abi/bind/v2/dep_tree_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ func TestContractLinking(t *testing.T) {
329329
map[rune]struct{}{},
330330
},
331331
// two contracts ('a' and 'f') share some dependencies. contract 'a' is marked as an override. expect that any of
332-
// its depdencies that aren't shared with 'f' are not deployed.
332+
// its dependencies that aren't shared with 'f' are not deployed.
333333
linkTestCaseInput{map[rune][]rune{
334334
'a': {'b', 'c', 'd', 'e'},
335335
'f': {'g', 'c', 'd', 'h'}},

accounts/abi/bind/v2/internal/contracts/db/contract.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ contract DB {
2525
if (v == 0) {
2626
return _keys.length;
2727
}
28-
// Check if a key is being overriden
28+
// Check if a key is being overridden
2929
if (_store[k] == 0) {
3030
_keys.push(k);
3131
_stats.inserts++;

cmd/devp2p/internal/ethtest/suite.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ to check if the node disconnects after receiving multiple invalid requests.`)
174174
},
175175
}
176176

177-
// Send request 10 times. Some clients are lient on the first few invalids.
177+
// Send request 10 times. Some clients are client on the first few invalids.
178178
for i := 0; i < 10; i++ {
179179
badReq.RequestId = uint64(i)
180180
if err := conn.Write(ethProto, eth.GetBlockHeadersMsg, badReq); err != nil {
@@ -541,7 +541,7 @@ func (s *Suite) TestBlockRangeUpdateInvalid(t *utesting.T) {
541541

542542
func (s *Suite) TestBlockRangeUpdateFuture(t *utesting.T) {
543543
t.Log(`This test sends a BlockRangeUpdate that is beyond the chain head.
544-
The node should accept the update and should not disonnect.`)
544+
The node should accept the update and should not disconnect.`)
545545
conn, err := s.dialAndPeer(nil)
546546
if err != nil {
547547
t.Fatal(err)
@@ -577,7 +577,7 @@ The node should accept the update and should not disonnect.`)
577577

578578
func (s *Suite) TestBlockRangeUpdateHistoryExp(t *utesting.T) {
579579
t.Log(`This test sends a BlockRangeUpdate announcing incomplete (expired) history.
580-
The node should accept the update and should not disonnect.`)
580+
The node should accept the update and should not disconnect.`)
581581
conn, err := s.dialAndPeer(nil)
582582
if err != nil {
583583
t.Fatal(err)

cmd/geth/dbcmd.go

Lines changed: 6 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,21 @@ Remove blockchain and state databases`,
7878
dbCompactCmd,
7979
dbGetCmd,
8080
dbDeleteCmd,
81-
dbDeleteTrieStateCmd,
82-
dbInspectTrieCmd,
8381
dbPutCmd,
8482
dbGetSlotsCmd,
8583
dbDumpFreezerIndex,
8684
dbImportCmd,
8785
dbExportCmd,
8886
dbMetadataCmd,
89-
ancientInspectCmd,
90-
// no legacy stored receipts for bsc
91-
// dbMigrateFreezerCmd,
9287
dbCheckStateContentCmd,
93-
dbHbss2PbssCmd,
88+
dbInspectHistoryCmd,
89+
90+
// only defined in bsc
91+
dbInspectTrieCmd,
9492
dbTrieGetCmd,
9593
dbTrieDeleteCmd,
96-
dbInspectHistoryCmd,
94+
dbDeleteTrieStateCmd,
95+
ancientInspectCmd,
9796
},
9897
}
9998
dbInspectCmd = &cli.Command{
@@ -125,19 +124,6 @@ Remove blockchain and state databases`,
125124
For each trie node encountered, it checks that the key corresponds to the keccak256(value). If this is not true, this indicates
126125
a data corruption.`,
127126
}
128-
dbHbss2PbssCmd = &cli.Command{
129-
Action: hbss2pbss,
130-
Name: "hbss-to-pbss",
131-
ArgsUsage: "<jobnum (optional)>",
132-
Flags: []cli.Flag{
133-
utils.DataDirFlag,
134-
utils.SyncModeFlag,
135-
utils.ForceFlag,
136-
utils.AncientFlag,
137-
},
138-
Usage: "Convert Hash-Base to Path-Base trie node.",
139-
Description: `This command iterates the entire trie node database and convert the hash-base node to path-base node.`,
140-
}
141127
dbTrieGetCmd = &cli.Command{
142128
Action: dbTrieGet,
143129
Name: "trie-get",
@@ -1201,112 +1187,6 @@ func showMetaData(ctx *cli.Context) error {
12011187
return nil
12021188
}
12031189

1204-
func hbss2pbss(ctx *cli.Context) error {
1205-
if ctx.NArg() > 1 {
1206-
return fmt.Errorf("required arguments: %v", ctx.Command.ArgsUsage)
1207-
}
1208-
1209-
var jobnum uint64
1210-
var err error
1211-
if ctx.NArg() == 1 {
1212-
jobnum, err = strconv.ParseUint(ctx.Args().Get(0), 10, 64)
1213-
if err != nil {
1214-
return fmt.Errorf("failed to Parse jobnum, Args[1]: %v, err: %v", ctx.Args().Get(1), err)
1215-
}
1216-
} else {
1217-
// by default
1218-
jobnum = 1000
1219-
}
1220-
1221-
force := ctx.Bool(utils.ForceFlag.Name)
1222-
1223-
stack, _ := makeConfigNode(ctx)
1224-
defer stack.Close()
1225-
1226-
db := utils.MakeChainDatabase(ctx, stack, false)
1227-
db.SyncAncient()
1228-
defer db.Close()
1229-
1230-
// convert hbss trie node to pbss trie node
1231-
var lastStateID uint64
1232-
lastStateID = rawdb.ReadPersistentStateID(db.GetStateStore())
1233-
if lastStateID == 0 || force {
1234-
config := triedb.HashDefaults
1235-
triedb := triedb.NewDatabase(db, config)
1236-
triedb.Cap(0)
1237-
log.Info("hbss2pbss triedb", "scheme", triedb.Scheme())
1238-
defer triedb.Close()
1239-
1240-
headerHash := rawdb.ReadHeadHeaderHash(db)
1241-
blockNumber := rawdb.ReadHeaderNumber(db, headerHash)
1242-
if blockNumber == nil {
1243-
log.Error("read header number failed.")
1244-
return fmt.Errorf("read header number failed")
1245-
}
1246-
1247-
log.Info("hbss2pbss converting", "HeaderHash: ", headerHash.String(), ", blockNumber: ", *blockNumber)
1248-
1249-
var headerBlockHash common.Hash
1250-
var trieRootHash common.Hash
1251-
1252-
if *blockNumber != math.MaxUint64 {
1253-
headerBlockHash = rawdb.ReadCanonicalHash(db, *blockNumber)
1254-
if headerBlockHash == (common.Hash{}) {
1255-
return errors.New("ReadHeadBlockHash empty hash")
1256-
}
1257-
blockHeader := rawdb.ReadHeader(db, headerBlockHash, *blockNumber)
1258-
trieRootHash = blockHeader.Root
1259-
fmt.Println("Canonical Hash: ", headerBlockHash.String(), ", TrieRootHash: ", trieRootHash.String())
1260-
}
1261-
if (trieRootHash == common.Hash{}) {
1262-
log.Error("Empty root hash")
1263-
return errors.New("Empty root hash.")
1264-
}
1265-
1266-
id := trie.StateTrieID(trieRootHash)
1267-
theTrie, err := trie.New(id, triedb)
1268-
if err != nil {
1269-
log.Error("fail to new trie tree", "err", err, "rootHash", err, trieRootHash.String())
1270-
return err
1271-
}
1272-
1273-
h2p, err := trie.NewHbss2Pbss(theTrie, triedb, trieRootHash, *blockNumber, jobnum)
1274-
if err != nil {
1275-
log.Error("fail to new hash2pbss", "err", err, "rootHash", err, trieRootHash.String())
1276-
return err
1277-
}
1278-
h2p.Run()
1279-
} else {
1280-
log.Info("Convert hbss to pbss success. Nothing to do.")
1281-
}
1282-
1283-
lastStateID = rawdb.ReadPersistentStateID(db.GetStateStore())
1284-
1285-
if lastStateID == 0 {
1286-
log.Error("Convert hbss to pbss trie node error. The last state id is still 0")
1287-
}
1288-
1289-
var ancient string
1290-
if db.HasSeparateStateStore() {
1291-
dirName := filepath.Join(stack.ResolvePath("chaindata"), "state")
1292-
ancient = filepath.Join(dirName, "ancient")
1293-
} else {
1294-
ancient = stack.ResolveAncient("chaindata", ctx.String(utils.AncientFlag.Name))
1295-
}
1296-
err = rawdb.ResetStateFreezerTableOffset(ancient, lastStateID)
1297-
if err != nil {
1298-
log.Error("Reset state freezer table offset failed", "error", err)
1299-
return err
1300-
}
1301-
// prune hbss trie node
1302-
err = rawdb.PruneHashTrieNodeInDataBase(db.GetStateStore())
1303-
if err != nil {
1304-
log.Error("Prune Hash trie node in database failed", "error", err)
1305-
return err
1306-
}
1307-
return nil
1308-
}
1309-
13101190
func inspectAccount(db *triedb.Database, start uint64, end uint64, address common.Address, raw bool) error {
13111191
stats, err := db.AccountHistory(address, start, end)
13121192
if err != nil {

cmd/geth/snapshot.go

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,13 @@ import (
2727

2828
"github.com/ethereum/go-ethereum/cmd/utils"
2929
"github.com/ethereum/go-ethereum/common"
30-
"github.com/ethereum/go-ethereum/core"
3130
"github.com/ethereum/go-ethereum/core/rawdb"
3231
"github.com/ethereum/go-ethereum/core/state"
3332
"github.com/ethereum/go-ethereum/core/state/pruner"
3433
"github.com/ethereum/go-ethereum/core/state/snapshot"
3534
"github.com/ethereum/go-ethereum/core/types"
3635
"github.com/ethereum/go-ethereum/crypto"
37-
"github.com/ethereum/go-ethereum/eth/ethconfig"
3836
"github.com/ethereum/go-ethereum/log"
39-
"github.com/ethereum/go-ethereum/metrics"
4037
"github.com/ethereum/go-ethereum/rlp"
4138
"github.com/ethereum/go-ethereum/trie"
4239
"github.com/urfave/cli/v2"
@@ -80,29 +77,6 @@ geth snapshot verify-state <state-root>
8077
will traverse the whole accounts and storages set based on the specified
8178
snapshot and recalculate the root hash of state for verification.
8279
In other words, this command does the snapshot to trie conversion.
83-
`,
84-
},
85-
{
86-
Name: "insecure-prune-all",
87-
Usage: "Prune all trie state data except genesis block, it will break storage for fullnode, only suitable for fast node " +
88-
"who do not need trie storage at all",
89-
ArgsUsage: "<genesisPath>",
90-
Action: pruneAllState,
91-
Category: "MISCELLANEOUS COMMANDS",
92-
Flags: []cli.Flag{
93-
utils.DataDirFlag,
94-
utils.AncientFlag,
95-
},
96-
Description: `
97-
will prune all historical trie state data except genesis block.
98-
All trie nodes will be deleted from the database.
99-
100-
It expects the genesis file as argument.
101-
102-
WARNING: It's necessary to delete the trie clean cache after the pruning.
103-
If you specify another directory for the trie clean cache via "--cache.trie.journal"
104-
during the use of Geth, please also specify it here for correct deletion. Otherwise
105-
the trie clean cache with default directory will be deleted.
10680
`,
10781
},
10882
{
@@ -235,49 +209,6 @@ func pruneState(ctx *cli.Context) error {
235209
return nil
236210
}
237211

238-
func pruneAllState(ctx *cli.Context) error {
239-
stack, _ := makeConfigNode(ctx)
240-
defer stack.Close()
241-
242-
genesisPath := ctx.Args().First()
243-
if len(genesisPath) == 0 {
244-
utils.Fatalf("Must supply path to genesis JSON file")
245-
}
246-
file, err := os.Open(genesisPath)
247-
if err != nil {
248-
utils.Fatalf("Failed to read genesis file: %v", err)
249-
}
250-
defer file.Close()
251-
252-
g := new(core.Genesis)
253-
if err := json.NewDecoder(file).Decode(g); err != nil {
254-
cfg := gethConfig{
255-
Eth: ethconfig.Defaults,
256-
Node: defaultNodeConfig(),
257-
Metrics: metrics.DefaultConfig,
258-
}
259-
260-
// Load config file.
261-
if err := loadConfig(genesisPath, &cfg); err != nil {
262-
utils.Fatalf("%v", err)
263-
}
264-
g = cfg.Eth.Genesis
265-
}
266-
267-
chaindb := utils.MakeChainDatabase(ctx, stack, false)
268-
defer chaindb.Close()
269-
pruner, err := pruner.NewAllPruner(chaindb)
270-
if err != nil {
271-
log.Error("Failed to open snapshot tree", "err", err)
272-
return err
273-
}
274-
if err = pruner.PruneAll(g); err != nil {
275-
log.Error("Failed to prune state", "err", err)
276-
return err
277-
}
278-
return nil
279-
}
280-
281212
func verifyState(ctx *cli.Context) error {
282213
stack, _ := makeConfigNode(ctx)
283214
defer stack.Close()

cmd/jsutils/getchainstatus.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ const validatorMap = new Map([
172172
['0x18c44f4FBEde9826C7f257d500A65a3D5A8edebc', [ 'Nozti' , '0x95E105468b3a9E158df258ee385CA873cB566bF2', '0xa76a951b947eda0b4585730049bf08338c0e679071127f0f2f7e7dce542a655d69b24e7af4586ed20efc2764044c0b3c']],
173173
['0xEdB69D7AE8fE7c21a33e0491e76db241C8e09a5F', ['BlkRazor' , '0x5eBAf404d466a1cc2d02684B6A3bB1D43dCB7586', '0xb23e281776590409333b1b36019390f7fadce505f55bfb98969cd3df6660bfe873b73e73d28aeef04bac40e3f4520df1']],
174174
['0xd6Ab358AD430F65EB4Aa5a1598FF2c34489dcfdE', [ 'Saturn' , '0x54A9c15A143dBFf49539dfF4e095ec8D09464A4A', '0x835a7608cb0888fa649aa4120e81b1ab8c54c894e01b3b1d8c458563bec901ba6bb0c5f356dca5b962392872480f3b4c']],
175+
['0xCc767841fbB5b79B91EdF7a19EC5bd2F3D334fD8', [ 'Kraken' , '0x4279baBE4293c0826810b6C59e40F9DA9e5fd45b', '0xaa7a4c76d38b9fe7f872bbc53ac172faa56c7db2ad4b4aea3af41de2c2df7738e82827f501f206ea82ad050b4ffead8a']],
175176
// Testnet: Chapel
176177
['0x08265dA01E1A65d62b903c7B34c08cB389bF3D99', [ 'Ararat' , '0x341e228f22D4ec16297DD05A9d6347C74c125F66', '0x96f763f030b1adcfb369c5a5df4a18e1529baffe7feaec66db3dbd1bc06810f7f6f88b7be6645418a7e2a2a3f40514c2']],
177178
['0x7f5f2cF1aec83bF0c74DF566a41aa7ed65EA84Ea', [ 'Kita' , '0x2716756EAF7F1B4f4DbB282A80efdbf96e90A644', '0x99e3849ef31887c0f880a0feb92f356f58fbd023a82f5311fc87a5883a662e9ebbbefc90bf13aa533c2438a4113804bf']],
@@ -207,6 +208,7 @@ const validatorMap = new Map([
207208
['0x6a5470a3B7959ab064d6815e349eD4aE2dE5210d', ['Skynet10k' , '0xDD1fD7C74BaCCA08e1b88a24199F19aB1b1b9cE4', '0x81f13afdbd6976d9784a05619405df430314e2707050b32f29ae683b9ef89d285d1a227df3e31ac147016c4c7533be70']],
208209
['0xce6cCa0DE7b3EB3fd0CcE4bc38cceF473166e4f4', ['Infinity' , '0xc8A6Bfe0834FB99340a0Df253d79B7CaE25053b8', '0xa40f553889e9de6b4fe8005a06d7335fa061ae51ef5ba2b0c4ea477fcaa8f6de1650e318cf59824462b1831a725488da']],
209210
['0xa7deE0bCAEb78849Ec4aD4e2f48688D2e9f2315B', ['KrakV' , '0x6563AA29C30d9f80968c2fb7DFFed092a03FBdeD', '0x848ffc9a3fac00d9fbaebcb63f2b7c0a4747d9ffecd4b484073ad03d91584cb51af29870c1c8421b757f4f6fae813288']],
211+
['0x32415e630B9B3489639dEE7de21274Ab64016226', ['Kraken' , '0x70Cd30d9216AF7A5654D245e9F5c649b811aB2eB', '0xa80ebd07bd9d717bd538413e8830f673e63dfad496c901de324be5d16b0496aee39352ecfb84fa58d8d8a67746f8ae6c']],
210212
]);
211213

212214
const builderMap = new Map([

cmd/utils/flags.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ var (
369369
}
370370
JournalFileFlag = &cli.BoolFlag{
371371
Name: "journalfile",
372-
Usage: "Enable using journal file to store the TrieJournal instead of KVDB in pbss (default = false)",
373-
Value: false,
372+
Usage: "Enable using journal file to store the TrieJournal instead of KVDB in pbss (default = true)",
373+
Value: true,
374374
Category: flags.StateCategory,
375375
}
376376
StateHistoryFlag = &cli.Uint64Flag{
@@ -2078,9 +2078,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
20782078
if ctx.IsSet(PathDBSyncFlag.Name) {
20792079
cfg.PathSyncFlush = true
20802080
}
2081-
if ctx.IsSet(JournalFileFlag.Name) {
2082-
cfg.JournalFileEnabled = true
2083-
}
2081+
2082+
cfg.JournalFileEnabled = ctx.Bool(JournalFileFlag.Name)
20842083

20852084
if ctx.String(GCModeFlag.Name) == "archive" {
20862085
if cfg.TransactionHistory != 0 {

consensus/parlia/parlia.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2361,7 +2361,7 @@ func (p *Parlia) detectNewVersionWithFork(chain consensus.ChainHeaderReader, hea
23612361
forkHashHex := hex.EncodeToString(nextForkHash[:])
23622362
if !snap.isMajorityFork(forkHashHex) {
23632363
logFn := log.Debug
2364-
if state.NoTrie() {
2364+
if state.NoTries() {
23652365
logFn = log.Warn
23662366
}
23672367
logFn("possible fork detected: client is not in majority", "nextForkHash", forkHashHex)

0 commit comments

Comments
 (0)