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

release: draft release v1.3.5 #2006

Merged
merged 35 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
72ffb0c
doc: add instructions for starting fullnode with pbss (#1977)
joeylichang Nov 10, 2023
3fc9f75
consensus/parlia: hardfork block can be epoch block (#1964)
buddh0 Nov 14, 2023
4be9481
internal/ethapi: fix null effectiveGasPrice in GetTransactionReceipt …
buddh0 Nov 14, 2023
8b94dd6
fix(cmd): check pruneancient when creating db (#1986)
weiihann Nov 14, 2023
497fdf8
fix: upgrade pebble and improve config (#1979)
flywukong Nov 20, 2023
0224d48
core: enable Shanghai EIPs (#1970)
buddh0 Nov 20, 2023
cd0356b
core/systemcontracts: include BEP-319 on kepler hardfork
buddh0 Nov 7, 2023
c92b6ce
cmd/utils: exit process if txlookuplimit flag is set (#2000)
weiihann Nov 25, 2023
7894423
consensus/parlia: increase size of snapshot cache in parlia (#2007)
buddh0 Nov 28, 2023
1edb34f
consensus/parlia: recover faster when snapshot of parlia is gone in d…
buddh0 Nov 28, 2023
8e19728
fix: remove sharedPool
brilliant-lx Nov 29, 2023
3ce568f
fix(cmd): check pruneancient when creating db (#1986)
weiihann Nov 14, 2023
cf80501
cmd/utils: exit process if txlookuplimit flag is set (#2000)
weiihann Nov 25, 2023
c409eb6
release: draft v1.3.3
brilliant-lx Nov 30, 2023
20dcaab
Merge branch 'develop' into develop_lock_v1.3.3
brilliant-lx Nov 30, 2023
70ccc3d
Merge pull request #2019 from bnb-chain/develop_lock_v1.3.3
brilliant-lx Nov 30, 2023
f7e9adc
fix: remove sharedPool
brilliant-lx Nov 29, 2023
b494339
fix(cmd): check pruneancient when creating db (#1986)
weiihann Nov 14, 2023
a3507cc
cmd/utils: exit process if txlookuplimit flag is set (#2000)
weiihann Nov 25, 2023
a840915
release: draft v1.3.3
brilliant-lx Nov 30, 2023
8b00720
fix: remove pipecommit in miner
brilliant-lx Dec 1, 2023
7615631
fork: add hardfork Hertzfix
brilliant-lx Dec 4, 2023
a2f9ac0
release: prepare v1.3.4
brilliant-lx Dec 4, 2023
afc3b42
fix: disable flag --pipecommit
brilliant-lx Dec 4, 2023
885de2c
fix: failed ut
brilliant-lx Dec 4, 2023
5b78f57
Merge branch 'develop' into develop_lock_v1.3.4_merge
zzzckck Dec 5, 2023
7e6b43a
Merge pull request #2033 from bnb-chain/develop_lock_v1.3.4_merge
zzzckck Dec 5, 2023
5db73c9
cmd/geth: standardize the action of importing bls account (#2020)
buddh0 Dec 5, 2023
195ae35
release: prepare for release v1.3.5
brilliant-lx Nov 27, 2023
aa15df2
config: setup Kepler/Shanghai hardfork date
brilliant-lx Dec 5, 2023
a30beeb
core/txpool/legacypool: respect nolocals-setting (#2037)
buddh0 Dec 6, 2023
6c788d7
tests/truffle: adapt changes in bsc-genesis-contracts
buddh0 Dec 6, 2023
fa5d0cf
core/systemcontracts: update CommitUrl for keplerUpgrade
buddh0 Dec 6, 2023
e3ef62f
rpc,eth: output more info about failed txs(#2041)
buddh0 Dec 7, 2023
a140a5a
cmd/jsutils: add 2 tools get validator version and block txs number (…
zlacfzy Dec 8, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__"
ANDROID_HOME: "" # Skip android test
run: |
git submodule update --init --depth 1 --recursive
go mod download
make test

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/**/*tx_database*
*/**/*dapps*
build/_vendor/pkg
/tests/truffle/storage

#*
.#*
Expand Down
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
# Changelog
## v1.3.5
FEATURE
* [\#1970](https://github.com/bnb-chain/bsc/pull/1970) core: enable Shanghai EIPs
* [\#1973](https://github.com/bnb-chain/bsc/pull/1973) core/systemcontracts: include BEP-319 on kepler hardfork

BUGFIX
* [\#1964](https://github.com/bnb-chain/bsc/pull/1964) consensus/parlia: hardfork block can be epoch block
* [\#1979](https://github.com/bnb-chain/bsc/pull/1979) fix: upgrade pebble and improve config
* [\#1980](https://github.com/bnb-chain/bsc/pull/1980) internal/ethapi: fix null effectiveGasPrice in GetTransactionReceipt

IMPROVEMENT
* [\#1977](https://github.com/bnb-chain/bsc/pull/1977) doc: add instructions for starting fullnode with pbss

## v1.3.4
BUGFIX
* fix: remove pipecommit in miner
* add a hard fork: Hertzfix

## v1.3.3
BUGFIX
* [\#1986](https://github.com/bnb-chain/bsc/pull/1986) fix(cmd): check pruneancient when creating db

IMPROVEMENT
* [\#2000](https://github.com/bnb-chain/bsc/pull/2000) cmd/utils: exit process if txlookuplimit flag is set

## v1.3.2
BUGFIX
* fix: remove sharedPool

IMPROVEMENT
* [\#2007](https://github.com/bnb-chain/bsc/pull/2007) consensus/parlia: increase size of snapshot cache in parlia
* [\#2008](https://github.com/bnb-chain/bsc/pull/2008) consensus/parlia: recover faster when snapshot of parlia is gone in disk

## v1.3.1
FEATURE
* [\#1881](https://github.com/bnb-chain/bsc/pull/1881) feat: active pbss
Expand Down
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,25 @@ unzip testnet.zip
Download latest chaindata snapshot from [here](https://github.com/bnb-chain/bsc-snapshots). Follow the guide to structure your files.

Note: if you can not download the chaindata snapshot and want to sync from genesis, you have to generate the genesis block first, you have already get the genesis.json in Step 2.
So just run: `geth --datadir <datadir> init ./genesis.json`
So just run:
``` shell
## It will init genesis with Hash-Base Storage Scheme by default.
geth --datadir <datadir> init ./genesis.json

## It will init genesis with Path-Base Storage Scheme.
geth --datadir <datadir> --state.scheme path init ./genesis.json
```
#### 4. Start a full node
```shell
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0

## It is recommand to run fullnode with `--tries-verify-mode none` if you want high performance and care little about state consistency
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0 --tries-verify-mode none
## It will run with Hash-Base Storage Scheme by default
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0 --tries-verify-mode none

## It runs fullnode with Path-Base Storage Scheme.
## It will enable inline state prune, keeping the latest 90000 blocks' history state by default.
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --history.transactions 0 --tries-verify-mode none --state.scheme path
```

#### 5. Monitor node status
Expand Down
148 changes: 67 additions & 81 deletions cmd/geth/blsaccountcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (

"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/internal/flags"
"github.com/ethereum/go-ethereum/signer/core"
)

Expand All @@ -35,19 +36,16 @@ const (
)

var (
au = aurora.NewAurora(true)
privateKeyFlag = &cli.StringFlag{
Name: "private-key",
Usage: "Hex string for the BLS12-381 private key you wish encrypt into a keystore file",
Value: "",
}
au = aurora.NewAurora(true)
showPrivateKeyFlag = &cli.BoolFlag{
Name: "show-private-key",
Usage: "Show the BLS12-381 private key you will encrypt into a keystore file",
Name: "show-private-key",
Usage: "Show the BLS12-381 private key you will encrypt into a keystore file",
Category: flags.AccountCategory,
}
BLSAccountPasswordFileFlag = &cli.StringFlag{
Name: "blsaccountpassword",
Usage: "File path for the BLS account password, which contains the password to encrypt private key into keystore file for managing votes in fast_finality feature",
importedAccountPasswordFileFlag = &cli.StringFlag{
Name: "importedaccountpassword",
Usage: "Password file path for the imported BLS account , which contains the password to get the private key by decrypting the keystore file",
Category: flags.AccountCategory,
}
)

Expand Down Expand Up @@ -130,10 +128,8 @@ Make sure you backup your BLS keys regularly.`,
Category: "BLS ACCOUNT COMMANDS",
Flags: []cli.Flag{
utils.DataDirFlag,
privateKeyFlag,
showPrivateKeyFlag,
utils.BLSPasswordFileFlag,
BLSAccountPasswordFileFlag,
},
Description: `
geth bls account new
Expand All @@ -149,17 +145,17 @@ You must remember this password to unlock your account in the future.`,
Name: "import",
Usage: "Import a BLS account",
Action: blsAccountImport,
ArgsUsage: "<keystore file>",
ArgsUsage: "<keyFile>",
Category: "BLS ACCOUNT COMMANDS",
Flags: []cli.Flag{
utils.DataDirFlag,
utils.BLSPasswordFileFlag,
BLSAccountPasswordFileFlag,
importedAccountPasswordFileFlag,
},
Description: `
geth bls account import <keyFile>

Import a encrypted BLS account from keystore file <keyFile> into the BLS wallet.
Import a encrypted BLS account or a BLS12-381 private key from file <keyFile> into the BLS wallet.

If the BLS wallet not created yet, it will try to create BLS wallet first.`,
},
Expand Down Expand Up @@ -219,7 +215,10 @@ func blsWalletCreate(ctx *cli.Context) error {
utils.Fatalf("BLS wallet already exists in <DATADIR>/bls/wallet.")
}

password := utils.GetPassPhraseWithList("Your new BLS wallet will be locked with a password. Please give a password. Do not forget this password.", true, 0, GetBLSPassword(ctx))
password := utils.GetPassPhraseWithList("Your new BLS wallet will be locked with a password. Please give a password. Do not forget this password.", true, 0, utils.MakePasswordListFromPath(ctx.String(utils.BLSPasswordFileFlag.Name)))
if err := core.ValidatePasswordFormat(password); err != nil {
utils.Fatalf("Password invalid: %v.", err)
}

opts := []accounts.Option{}
opts = append(opts, accounts.WithWalletDir(dir))
Expand Down Expand Up @@ -249,7 +248,10 @@ func openOrCreateBLSWallet(ctx *cli.Context, cfg *gethConfig) (*wallet.Wallet, e
}
if !dirExists {
fmt.Println("BLS wallet not exists, creating BLS wallet...")
password := utils.GetPassPhraseWithList("Your new BLS wallet will be locked with a password. Please give a password. Do not forget this password.", true, 0, GetBLSPassword(ctx))
password := utils.GetPassPhraseWithList("Your new BLS wallet will be locked with a password. Please give a password. Do not forget this password.", true, 0, utils.MakePasswordListFromPath(ctx.String(utils.BLSPasswordFileFlag.Name)))
if err := core.ValidatePasswordFormat(password); err != nil {
utils.Fatalf("Password invalid: %v.", err)
}

opts := []accounts.Option{}
opts = append(opts, accounts.WithWalletDir(walletDir))
Expand All @@ -269,7 +271,7 @@ func openOrCreateBLSWallet(ctx *cli.Context, cfg *gethConfig) (*wallet.Wallet, e
return w, nil
}

walletPassword := utils.GetPassPhraseWithList("Enter the password for your BLS wallet.", false, 0, GetBLSPassword(ctx))
walletPassword := utils.GetPassPhraseWithList("Enter the password for your BLS wallet.", false, 0, utils.MakePasswordListFromPath(ctx.String(utils.BLSPasswordFileFlag.Name)))
w, err = wallet.OpenWallet(context.Background(), &wallet.Config{
WalletDir: walletDir,
WalletPassword: walletPassword,
Expand Down Expand Up @@ -309,27 +311,11 @@ func blsAccountCreate(ctx *cli.Context) error {
if err := os.MkdirAll(keystoreDir, 0755); err != nil {
utils.Fatalf("Could not access keystore dir: %v.", err)
}
accountPassword := utils.GetPassPhraseWithList("Your new BLS account will be encrypted with a password. Please give a password. Do not forget this password.", true, 0, GetBLSAccountPassword(ctx))
if err := core.ValidatePasswordFormat(accountPassword); err != nil {
utils.Fatalf("Password invalid: %v.", err)
}
accountPassword := w.Password()

encryptor := keystorev4.New()
secretKey, err := bls.RandKey()
privateKeyString := ctx.String(privateKeyFlag.Name)
if privateKeyString != "" {
if len(privateKeyString) > 2 && strings.Contains(privateKeyString, "0x") {
privateKeyString = privateKeyString[2:] // Strip the 0x prefix, if any.
}
bytesValue, err := hex.DecodeString(privateKeyString)
if err != nil {
utils.Fatalf("could not decode as hex string: %s", privateKeyString)
}
secretKey, err = bls.SecretKeyFromBytes(bytesValue)
if err != nil {
utils.Fatalf("not a valid BLS12-381 private key")
}
} else if err != nil {
if err != nil {
utils.Fatalf("Could not generate BLS secret key: %v.", err)
}

Expand Down Expand Up @@ -383,22 +369,6 @@ func blsAccountCreate(ctx *cli.Context) error {

// blsAccountImport imports a BLS account into the BLS wallet.
func blsAccountImport(ctx *cli.Context) error {
keyfile := ctx.Args().First()
if len(keyfile) == 0 {
utils.Fatalf("The keystore file must be given as argument.")
}
keyJSON, err := os.ReadFile(keyfile)
if err != nil {
utils.Fatalf("Could not read keystore file: %v", err)
}
keystore := &keymanager.Keystore{}
if err := json.Unmarshal(keyJSON, keystore); err != nil {
utils.Fatalf("Could not decode keystore file: %v.", err)
}
if keystore.Pubkey == "" {
utils.Fatalf(" Missing public key, wrong keystore file.")
}

cfg := gethConfig{Node: defaultNodeConfig()}
// Load config file.
if file := ctx.String(configFileFlag.Name); file != "" {
Expand All @@ -421,13 +391,53 @@ func blsAccountImport(ctx *cli.Context) error {
utils.Fatalf("The BLS keymanager cannot import keystores")
}

password := utils.GetPassPhraseWithList("Enter the password for your imported account.", false, 0, GetBLSAccountPassword(ctx))
keyfile := ctx.Args().First()
if len(keyfile) == 0 {
utils.Fatalf("The keystore file must be given as argument.")
}
keyInfo, err := os.ReadFile(keyfile)
if err != nil {
utils.Fatalf("Could not read keystore file: %v", err)
}
keystore := &keymanager.Keystore{}
var importedAccountPassword string
if err := json.Unmarshal(keyInfo, keystore); err != nil {
secretKey, err := bls.SecretKeyFromBytes(common.FromHex(strings.TrimRight(string(keyInfo), "\r\n")))
if err != nil {
utils.Fatalf("keyFile is neither a keystore file or include a valid BLS12-381 private key: %v.", err)
}
pubKeyBytes := secretKey.PublicKey().Marshal()
encryptor := keystorev4.New()
importedAccountPassword = w.Password()
cryptoFields, err := encryptor.Encrypt(secretKey.Marshal(), importedAccountPassword)
if err != nil {
utils.Fatalf("Could not encrypt secret key: %v.", err)
}
id, err := uuid.NewRandom()
if err != nil {
utils.Fatalf("Could not generate uuid: %v.", err)
}
keystore = &keymanager.Keystore{
Crypto: cryptoFields,
ID: id.String(),
Pubkey: fmt.Sprintf("%x", pubKeyBytes),
Version: encryptor.Version(),
Name: encryptor.Name(),
}
}
if keystore.Pubkey == "" {
utils.Fatalf(" Missing public key, wrong keystore file.")
}

if importedAccountPassword == "" {
importedAccountPassword = utils.GetPassPhraseWithList("Enter the password for your imported account.", false, 0, utils.MakePasswordListFromPath(ctx.String(importedAccountPasswordFileFlag.Name)))
}

fmt.Println("Importing BLS account, this may take a while...")
statuses, err := accounts.ImportAccounts(context.Background(), &accounts.ImportAccountsConfig{
Importer: k,
Keystores: []*keymanager.Keystore{keystore},
AccountPassword: password,
AccountPassword: importedAccountPassword,
})
if err != nil {
utils.Fatalf("Import BLS account failed: %v.", err)
Expand Down Expand Up @@ -458,7 +468,7 @@ func blsAccountList(ctx *cli.Context) error {
utils.Fatalf("BLS wallet not exists.")
}

walletPassword := utils.GetPassPhraseWithList("Enter the password for your BLS wallet.", false, 0, GetBLSPassword(ctx))
walletPassword := utils.GetPassPhraseWithList("Enter the password for your BLS wallet.", false, 0, utils.MakePasswordListFromPath(ctx.String(utils.BLSPasswordFileFlag.Name)))
w, err := wallet.OpenWallet(context.Background(), &wallet.Config{
WalletDir: walletDir,
WalletPassword: walletPassword,
Expand Down Expand Up @@ -537,7 +547,7 @@ func blsAccountDelete(ctx *cli.Context) error {
utils.Fatalf("BLS wallet not exists.")
}

walletPassword := utils.GetPassPhraseWithList("Enter the password for your BLS wallet.", false, 0, GetBLSPassword(ctx))
walletPassword := utils.GetPassPhraseWithList("Enter the password for your BLS wallet.", false, 0, utils.MakePasswordListFromPath(ctx.String(utils.BLSPasswordFileFlag.Name)))
w, err := wallet.OpenWallet(context.Background(), &wallet.Config{
WalletDir: walletDir,
WalletPassword: walletPassword,
Expand Down Expand Up @@ -598,27 +608,3 @@ func blsAccountDelete(ctx *cli.Context) error {

return nil
}

func GetBLSPassword(ctx *cli.Context) []string {
path := ctx.String(utils.BLSPasswordFileFlag.Name)
if path == "" {
return nil
}
text, err := os.ReadFile(path)
if err != nil {
utils.Fatalf("Failed to read wallet password file: %v", err)
}
return []string{string(text)}
}

func GetBLSAccountPassword(ctx *cli.Context) []string {
path := ctx.String(BLSAccountPasswordFileFlag.Name)
if path == "" {
return nil
}
text, err := os.ReadFile(path)
if err != nil {
utils.Fatalf("Failed to read account password file: %v", err)
}
return []string{string(text)}
}
33 changes: 33 additions & 0 deletions cmd/geth/testdata/bls-account-usage-demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

echo "0. prepare---------------------------------------------------------------------------------"
echo 123abc7890 > bls-password.txt
echo 123abc7891 > bls-password1.txt
basedir=$(cd `dirname $0`; pwd)
workspace=${basedir}/../../../

echo "1. create a bls account--------------------------------------------------------------------"
${workspace}/build/bin/geth bls account new --blspassword ./bls-password.txt --datadir ./bls
${workspace}/build/bin/geth bls account list --blspassword ./bls-password.txt --datadir ./bls

echo "2. import a bls account by passing file including a private key-----------------------------"
secretKey=`${workspace}/build/bin/geth bls account new --show-private-key --blspassword ./bls-password1.txt --datadir ./bls1 | grep private | awk '{print $NF}'`
echo ${secretKey} > ./bls1/secretKey
${workspace}/build/bin/geth bls account import --blspassword ./bls-password.txt --datadir ./bls ./bls1/secretKey
${workspace}/build/bin/geth bls account list --blspassword ./bls-password.txt --datadir ./bls

echo "3. delete the imported account above--------------------------------------------------------"
publicKey=`${workspace}/build/bin/geth bls account list --blspassword ./bls-password.txt --datadir ./bls |grep public | tail -1 | awk '{print $NF}'`
${workspace}/build/bin/geth bls account delete --blspassword ./bls-password.txt --datadir ./bls ${publicKey}
${workspace}/build/bin/geth bls account list --blspassword ./bls-password.txt --datadir ./bls

echo "4. import a bls account by passing a keystore file------------------------------------------"
keystoreFile=`ls bls1/bls/keystore`
${workspace}/build/bin/geth bls account import --importedaccountpassword ./bls-password1.txt --blspassword ./bls-password.txt --datadir ./bls ./bls1/bls/keystore/${keystoreFile}
${workspace}/build/bin/geth bls account list --blspassword ./bls-password.txt --datadir ./bls

echo "5. clearup----------------------------------------------------------------------------------"
rm -rf bls
rm -rf bls1
rm -rf bls-password.txt
rm -rf bls-password1.txt
Loading