Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare for release v1.1.13 #1056

Merged
merged 40 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
51bfeca
broadcast block before commit block and add metrics (#975)
kyrie-yl Jul 14, 2022
df3e1be
[Feature]: Improve trie prefetch (#952)
setunapo Jul 15, 2022
77c8372
Trie prefetch on state pretch (#996)
setunapo Jul 26, 2022
76e3c90
[R4R] Pipecommit enable trie prefetcher (#992)
qinglin89 Jul 29, 2022
895c077
fix bug #1034, offline tool start failed when start with pruneancient
joeylichang Aug 16, 2022
05d8399
ci: add commit message lint (#1044)
j75689 Aug 16, 2022
dbb047b
Merge pull request #1053 from bnb-chain/fix_opendatabase_fail
joeylichang Aug 17, 2022
ddbe6c4
ci: no type-case check for scope.
setunapo Aug 17, 2022
11d2bae
bep153: Native Staking on BSC (#1051)
pythonberg1997 Aug 18, 2022
e64fde1
ci: allow merge pull request
setunapo Aug 18, 2022
788b771
core/state: fix read-meters + simplify code (#24304)
holiman Feb 14, 2022
a1db38a
p2p: reduce the scope of variable dialPubkey (#24385)
zhiqiangxu Feb 14, 2022
c1dd16f
internal/ethapi: fix incorrect type on empty slice (#24372)
rodneyosodo Feb 15, 2022
7bb1463
graphql: fix nonce for pending accounts (#24443)
s1na Feb 22, 2022
62d66e4
appveyor.yml: fetch sub-modules recursively (#24451)
gurukamath Mar 1, 2022
e5f4fde
les/vflux/client: fix goroutine leak in testIter (#24449)
zsfelfoldi Mar 1, 2022
02b31ab
test: fix TestOfflineBlockPrune (#1062)
j75689 Aug 22, 2022
c3e3b11
consensus: fix the GasLimitBoundDivisor (#1060)
j75689 Aug 22, 2022
2e22fe3
ci: fix the pattern of commit lint (#1063)
j75689 Aug 22, 2022
413a42d
core/rawdb: add HasCode, HashTrieNode and use them where possible (#2…
ceyonur Mar 8, 2022
9843a36
mobile: remove deprecated Stop function (#24369)
Zachinquarantine Mar 8, 2022
0e65495
eth/protocols/snap: avoid estimating infinite percentage
holiman Mar 10, 2022
799f041
rpc: fix defer in test (#24490)
s7v7nislands Mar 11, 2022
d130c0e
trie: fix two issues in trie iterator (#24539)
rjl493456442 Mar 15, 2022
f8e2104
build: fix linter install on windows (#24523)
ligi Mar 15, 2022
3572eb7
eth/tracers: use hex encoding for debug_traceBlock argument (#24517)
guifel Mar 15, 2022
c1d9690
les, tests: fix vflux fuzzer by removing unnecessary panic (#24537)
rjl493456442 Mar 16, 2022
9c72720
eth/downloader: ignore zero size header batch for importing (#24569)
rjl493456442 Mar 22, 2022
94885ae
core/vm: fix sstore gas comment type (#24583)
lispc Mar 29, 2022
f2b1f3f
Merge pull request #1061 from qinglin89/dev-merge
unclezoro Aug 23, 2022
1d6c01a
rlp/rlpgen: RLP encoder code generator (#24251)
fjl Feb 16, 2022
25337f5
core/types: faster RLP encoding of Header, StateAcccount, Re... (#24420)
fjl Feb 18, 2022
da57d11
rlp trie: faster trie node encoding (#24126)
qianbin Mar 9, 2022
24da9ec
fix: gomod add packages
qinglin89 Aug 26, 2022
f457598
txpool: reheap the priced list if london fork not enabled (#1070)
j75689 Aug 31, 2022
b485651
fix: fix potential goroutine leak (#1067)
bittrainee Aug 31, 2022
64549a7
statedb: get rid of activestate, stopPrefetcher manually (#1006)
qinglin89 Aug 31, 2022
755df16
Merge pull request #1068 from qinglin89/dev-rlp
unclezoro Aug 31, 2022
fd6fa7c
fix: update cross chain logic of native stake (#1066)
pythonberg1997 Aug 31, 2022
aa835e0
upgrade: update version and CHANGELOG.md (#1073)
pythonberg1997 Aug 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const validateTypeNums = (parsedCommit) => {
const mergePrefix = "Merge pull request"
if (parsedCommit.raw.startsWith(mergePrefix)) {
console.log('this is a merge commit:' + parsedCommit.raw)
return [true,'']
}

if (!parsedCommit.type) {
return [false, 'invalid commit message, should be like "name: descriptions.", yours: "' + parsedCommit.raw + '"']
}

const types = parsedCommit.type.split(' ')
for (var i=0;i<types.length;i++){
if ((types[i].toLowerCase() == "wip") || (types[i].toLowerCase() == "r4r")) {
return [false, 'R4R or WIP is not acceptable, no matter upper case or lower case']
}
}
return [true,'']
}


module.exports = {
parserPreset: {
parserOpts: {
headerPattern: /^(.*):.*/,
}
},
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-function-rules'],
rules: {
'subject-empty':[2, 'always'],
'scope-empty':[2, 'always'],
'type-enum': [2, 'never'],
'type-case': [0, 'always'],
'function-rules/type-case': [2, 'always', validateTypeNums],
'header-max-length': [
2,
'always',
72,
],
},
helpUrl:
'https://github.com/bnb-chain/bsc/tree/develop/docs/lint/commit.md',
}
45 changes: 45 additions & 0 deletions .github/workflows/commit-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint Commit Messages

on:
push:
branches:
- master
- develop

pull_request:
branches:
- master
- develop

jobs:
commitlint:
strategy:
matrix:
node-version: [14.x]
os: [ubuntu-18.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v3
with:
path: |
~/.npm
**/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Deps
run: |
npm install -g commitlint-plugin-function-rules @commitlint/cli
npm install --save-dev commitlint-plugin-function-rules @commitlint/cli
- uses: wagoid/commitlint-github-action@v5
id: commitlint
env:
NODE_PATH: ${{ github.workspace }}/node_modules
with:
configFile: /github/workspace/.github/commitlint.config.js
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## v1.1.13

FEATURE
* [\#1051](https://github.com/bnb-chain/bsc/pull/1051) Implement BEP153: Native Staking
* [\#1066](https://github.com/bnb-chain/bsc/pull/1066) Upgrade cross chain logic of native staking

IMPROVEMENT
* [\#952](https://github.com/bnb-chain/bsc/pull/952) Improve trie prefetch
* [\#975](https://github.com/bnb-chain/bsc/pull/975) broadcast block before commit block and add metrics
* [\#992](https://github.com/bnb-chain/bsc/pull/992) Pipecommit enable trie prefetcher
* [\#996](https://github.com/bnb-chain/bsc/pull/996) Trie prefetch on state pretch

BUGFIX
* [\#1053](https://github.com/bnb-chain/bsc/pull/1053) state: fix offline tool start failed when start with pruneancient
* [\#1060](https://github.com/bnb-chain/bsc/pull/1060) consensus: fix the GasLimitBoundDivisor
* [\#1061](https://github.com/bnb-chain/bsc/pull/1061) fix: upstream patches from go-ethereum
* [\#1067](https://github.com/bnb-chain/bsc/pull/1067) fix:fix potential goroutine leak
* [\#1068](https://github.com/bnb-chain/bsc/pull/1068) core trie rlp: patches from go-ethereum
* [\#1070](https://github.com/bnb-chain/bsc/pull/1070) txpool: reheap the priced list if london fork not enabled

## v1.1.12

FEATURE
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ environment:
GETH_MINGW: 'C:\msys64\mingw32'

install:
- git submodule update --init --depth 1
- git submodule update --init --depth 1 --recursive
- go version

for:
Expand Down
13 changes: 9 additions & 4 deletions build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func doTest(cmdline []string) {
packages := []string{"./accounts/...", "./common/...", "./consensus/...", "./console/...", "./core/...",
"./crypto/...", "./eth/...", "./ethclient/...", "./ethdb/...", "./event/...", "./graphql/...", "./les/...",
"./light/...", "./log/...", "./metrics/...", "./miner/...", "./mobile/...", "./node/...",
"./p2p/...", "./params/...", "./rlp/...", "./rpc/...", "./tests/...", "./trie/..."}
"./p2p/...", "./params/...", "./rlp/...", "./rpc/...", "./tests/...", "./trie/...", "./cmd/geth/..."}
if len(flag.CommandLine.Args()) > 0 {
packages = flag.CommandLine.Args()
}
Expand Down Expand Up @@ -342,12 +342,17 @@ func downloadLinter(cachedir string) string {

csdb := build.MustLoadChecksums("build/checksums.txt")
arch := runtime.GOARCH
if arch == "arm" {
ext := ".tar.gz"

if runtime.GOOS == "windows" {
ext = ".zip"
}
if arch == "arm" {
arch += "v" + os.Getenv("GOARM")
}
base := fmt.Sprintf("golangci-lint-%s-%s-%s", version, runtime.GOOS, arch)
url := fmt.Sprintf("https://github.com/golangci/golangci-lint/releases/download/v%s/%s.tar.gz", version, base)
archivePath := filepath.Join(cachedir, base+".tar.gz")
url := fmt.Sprintf("https://github.com/golangci/golangci-lint/releases/download/v%s/%s%s", version, base, ext)
archivePath := filepath.Join(cachedir, base+ext)
if err := csdb.DownloadFile(url, archivePath); err != nil {
log.Fatal(err)
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/geth/pruneblock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ var (
blockPruneBackUpBlockNumber = 128
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
address = crypto.PubkeyToAddress(key.PublicKey)
balance = big.NewInt(10000000)
gspec = &core.Genesis{Config: params.TestChainConfig, Alloc: core.GenesisAlloc{address: {Balance: balance}}}
balance = big.NewInt(100000000000000000)
gspec = &core.Genesis{Config: params.TestChainConfig, Alloc: core.GenesisAlloc{address: {Balance: balance}}, BaseFee: big.NewInt(params.InitialBaseFee)}
signer = types.LatestSigner(gspec.Config)
config = &core.CacheConfig{
TrieCleanLimit: 256,
Expand Down Expand Up @@ -93,7 +93,7 @@ func testOfflineBlockPruneWithAmountReserved(t *testing.T, amountReserved uint64
t.Fatalf("Failed to back up block: %v", err)
}

dbBack, err := rawdb.NewLevelDBDatabaseWithFreezer(chaindbPath, 0, 0, newAncientPath, "", false, true, false, false)
dbBack, err := rawdb.NewLevelDBDatabaseWithFreezer(chaindbPath, 0, 0, newAncientPath, "", false, true, false, false, true)
if err != nil {
t.Fatalf("failed to create database with ancient backend")
}
Expand Down Expand Up @@ -139,7 +139,7 @@ func testOfflineBlockPruneWithAmountReserved(t *testing.T, amountReserved uint64

func BlockchainCreator(t *testing.T, chaindbPath, AncientPath string, blockRemain uint64) (ethdb.Database, []*types.Block, []*types.Block, []types.Receipts, []*big.Int, uint64, *core.BlockChain) {
//create a database with ancient freezer
db, err := rawdb.NewLevelDBDatabaseWithFreezer(chaindbPath, 0, 0, AncientPath, "", false, false, false, false)
db, err := rawdb.NewLevelDBDatabaseWithFreezer(chaindbPath, 0, 0, AncientPath, "", false, false, false, false, true)
if err != nil {
t.Fatalf("failed to create database with ancient backend")
}
Expand All @@ -154,7 +154,7 @@ func BlockchainCreator(t *testing.T, chaindbPath, AncientPath string, blockRemai
// Make chain starting from genesis
blocks, _ := core.GenerateChain(gspec.Config, genesis, ethash.NewFaker(), db, 500, func(i int, block *core.BlockGen) {
block.SetCoinbase(common.Address{0: byte(canonicalSeed), 19: byte(i)})
tx, err := types.SignTx(types.NewTransaction(block.TxNonce(address), common.Address{0x00}, big.NewInt(1000), params.TxGas, nil, nil), signer, key)
tx, err := types.SignTx(types.NewTransaction(block.TxNonce(address), common.Address{0x00}, big.NewInt(1000), params.TxGas, big.NewInt(params.InitialBaseFee), nil), signer, key)
if err != nil {
panic(err)
}
Expand Down
13 changes: 5 additions & 8 deletions cmd/geth/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,7 @@ func traverseState(ctx *cli.Context) error {
}
}
if !bytes.Equal(acc.CodeHash, emptyCode) {
code := rawdb.ReadCode(chaindb, common.BytesToHash(acc.CodeHash))
if len(code) == 0 {
if !rawdb.HasCode(chaindb, common.BytesToHash(acc.CodeHash)) {
log.Error("Code is missing", "hash", common.BytesToHash(acc.CodeHash))
return errors.New("missing code")
}
Expand Down Expand Up @@ -673,11 +672,10 @@ func traverseRawState(ctx *cli.Context) error {
nodes += 1
node := accIter.Hash()

// Check the present for non-empty hash node(embedded node doesn't
// have their own hash).
if node != (common.Hash{}) {
// Check the present for non-empty hash node(embedded node doesn't
// have their own hash).
blob := rawdb.ReadTrieNode(chaindb, node)
if len(blob) == 0 {
if !rawdb.HasTrieNode(chaindb, node) {
log.Error("Missing trie node(account)", "hash", node)
return errors.New("missing account")
}
Expand Down Expand Up @@ -721,8 +719,7 @@ func traverseRawState(ctx *cli.Context) error {
}
}
if !bytes.Equal(acc.CodeHash, emptyCode) {
code := rawdb.ReadCode(chaindb, common.BytesToHash(acc.CodeHash))
if len(code) == 0 {
if !rawdb.HasCode(chaindb, common.BytesToHash(acc.CodeHash)) {
log.Error("Code is missing", "account", common.BytesToHash(accIter.LeafKey()))
return errors.New("missing code")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node, readonly, disableFree
chainDb, err = stack.OpenDatabase(name, cache, handles, "", readonly)
} else {
name := "chaindata"
chainDb, err = stack.OpenDatabaseWithFreezer(name, cache, handles, ctx.GlobalString(AncientFlag.Name), "", readonly, disableFreeze, false, false)
chainDb, err = stack.OpenDatabaseWithFreezer(name, cache, handles, ctx.GlobalString(AncientFlag.Name), "", readonly, disableFreeze, false, false, true)
}
if err != nil {
Fatalf("Could not open database: %v", err)
Expand Down
92 changes: 46 additions & 46 deletions consensus/misc/eip1559_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,53 +58,53 @@ func config() *params.ChainConfig {

// TestBlockGasLimits tests the gasLimit checks for blocks both across
// the EIP-1559 boundary and post-1559 blocks
func TestBlockGasLimits(t *testing.T) {
initial := new(big.Int).SetUint64(params.InitialBaseFee)
// func TestBlockGasLimits(t *testing.T) {
// initial := new(big.Int).SetUint64(params.InitialBaseFee)

for i, tc := range []struct {
pGasLimit uint64
pNum int64
gasLimit uint64
ok bool
}{
// Transitions from non-london to london
{10000000, 4, 20000000, true}, // No change
{10000000, 4, 20019530, true}, // Upper limit
{10000000, 4, 20019531, false}, // Upper +1
{10000000, 4, 19980470, true}, // Lower limit
{10000000, 4, 19980469, false}, // Lower limit -1
// London to London
{20000000, 5, 20000000, true},
{20000000, 5, 20019530, true}, // Upper limit
{20000000, 5, 20019531, false}, // Upper limit +1
{20000000, 5, 19980470, true}, // Lower limit
{20000000, 5, 19980469, false}, // Lower limit -1
{40000000, 5, 40039061, true}, // Upper limit
{40000000, 5, 40039062, false}, // Upper limit +1
{40000000, 5, 39960939, true}, // lower limit
{40000000, 5, 39960938, false}, // Lower limit -1
} {
parent := &types.Header{
GasUsed: tc.pGasLimit / 2,
GasLimit: tc.pGasLimit,
BaseFee: initial,
Number: big.NewInt(tc.pNum),
}
header := &types.Header{
GasUsed: tc.gasLimit / 2,
GasLimit: tc.gasLimit,
BaseFee: initial,
Number: big.NewInt(tc.pNum + 1),
}
err := VerifyEip1559Header(config(), parent, header)
if tc.ok && err != nil {
t.Errorf("test %d: Expected valid header: %s", i, err)
}
if !tc.ok && err == nil {
t.Errorf("test %d: Expected invalid header", i)
}
}
}
// for i, tc := range []struct {
// pGasLimit uint64
// pNum int64
// gasLimit uint64
// ok bool
// }{
// // Transitions from non-london to london
// {10000000, 4, 20000000, true}, // No change
// {10000000, 4, 20019530, true}, // Upper limit
// {10000000, 4, 20019531, false}, // Upper +1
// {10000000, 4, 19980470, true}, // Lower limit
// {10000000, 4, 19980469, false}, // Lower limit -1
// // London to London
// {20000000, 5, 20000000, true},
// {20000000, 5, 20019530, true}, // Upper limit
// {20000000, 5, 20019531, false}, // Upper limit +1
// {20000000, 5, 19980470, true}, // Lower limit
// {20000000, 5, 19980469, false}, // Lower limit -1
// {40000000, 5, 40039061, true}, // Upper limit
// {40000000, 5, 40039062, false}, // Upper limit +1
// {40000000, 5, 39960939, true}, // lower limit
// {40000000, 5, 39960938, false}, // Lower limit -1
// } {
// parent := &types.Header{
// GasUsed: tc.pGasLimit / 2,
// GasLimit: tc.pGasLimit,
// BaseFee: initial,
// Number: big.NewInt(tc.pNum),
// }
// header := &types.Header{
// GasUsed: tc.gasLimit / 2,
// GasLimit: tc.gasLimit,
// BaseFee: initial,
// Number: big.NewInt(tc.pNum + 1),
// }
// err := VerifyEip1559Header(config(), parent, header)
// if tc.ok && err != nil {
// t.Errorf("test %d: Expected valid header: %s", i, err)
// }
// if !tc.ok && err == nil {
// t.Errorf("test %d: Expected invalid header", i)
// }
// }
// }

// TestCalcBaseFee assumes all blocks are 1559-blocks
func TestCalcBaseFee(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ func (p *Parlia) verifyCascadingFields(chain consensus.ChainHeaderReader, header
if diff < 0 {
diff *= -1
}
limit := parent.GasLimit / params.ParliaGasLimitBoundDivisor
limit := parent.GasLimit / params.GasLimitBoundDivisor

if uint64(diff) >= limit || header.GasLimit < params.MinGasLimit {
return fmt.Errorf("invalid gas limit: have %d, want %d += %d", header.GasLimit, parent.GasLimit, limit)
Expand Down
4 changes: 2 additions & 2 deletions core/block_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ func TestCalcGasLimit(t *testing.T) {
max uint64
min uint64
}{
{20000000, 20019530, 19980470},
{40000000, 40039061, 39960939},
{20000000, 20078124, 19921876},
{40000000, 40156249, 39843751},
} {
// Increase
if have, want := CalcGasLimit(tc.pGasLimit, 2*tc.pGasLimit), tc.max; have != want {
Expand Down
Loading