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.2.6 (abandoned) #1696

Merged
merged 39 commits into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1b8ec07
fix: log info when failed to verifyVoteAttestation
NathanBSC May 11, 2023
060aba5
readme: update full sync from genesis
brilliant-lx May 18, 2023
bac626c
upgrade: avoid to modify RialtoGenesisHash when testing in rialtoNet …
NathanBSC May 19, 2023
08eab8b
feature: Enable Berlin EIPs (#1608)
sunny2022da May 19, 2023
1759c69
fix: getBlockByNumber support 'safe','finalized' when interact by ipc…
NathanBSC May 22, 2023
bd8795d
upgrade: block height of Luban on mainnet (#1636)
brilliant-lx May 22, 2023
7b7d8c1
release: prepare for release v1.2.4 (#1637)
brilliant-lx May 22, 2023
8d763bc
fix: support getFilterChanges after NewFinalizedHeaderFilter (#1641)
NathanBSC May 23, 2023
11d16df
readme: update the disk requirement to 2.5TB (#1642)
brilliant-lx May 23, 2023
eaea77a
P2P: try to limit the connection number per IP address (#1623)
brilliant-lx May 25, 2023
1036dc7
core: port several London EIPs on BSC(#1422)
Mister-EA May 25, 2023
3d8753c
fix: remove naturally finality
NathanBSC May 25, 2023
86446ed
feat: add a tool for submitting evidence of malicious voting (#1660)
NathanBSC May 31, 2023
b8dbf59
fix: ungraceful shutdown caused by malicious Vote Monitor (#1663)
NathanBSC May 31, 2023
e802c73
consensus, core/rawdb, miner: downgrade logs (#1662)
weiihann May 31, 2023
f316b1d
params: introduce ParliaTestChainConfig
Jun 7, 2023
4afd224
core: add eip3529 tests for parlia config
Jun 7, 2023
a97f713
parlia_tests: update comment
Jun 7, 2023
d6feb72
goleveldb: downgrade the version for performance (#1675)
brilliant-lx Jun 8, 2023
cf9efe5
fix: voting can only be enabled when mining (#1671)
NathanBSC Jun 8, 2023
78ad049
fix: check integer overflow when decode crosschain payload (#1679)
yutianwu Jun 8, 2023
ff32314
fix: not double GasLimit of block upon London upgrade (#1681)
NathanBSC Jun 8, 2023
b1fbb29
eip3529tests: refactor tests
Jun 9, 2023
38002f8
fix: set the signer of parlia to the most permissive one (#1682)
NathanBSC Jun 12, 2023
4a467ec
Merge pull request #1686 from bnb-chain/refactor-eip3529-tests
Mister-EA Jun 12, 2023
15c30b7
Merge pull request #1676 from bnb-chain/eip3529-tests-parlia
Mister-EA Jun 12, 2023
3dca640
config: use default fork config if not specified in config.toml (#1654)
brilliant-lx Jun 13, 2023
4560dc2
readme: add minimal compiler version
MatusKysel Jun 13, 2023
2cd0387
test: Add EIP-2718 unit test for parlia ChainConfig
sunny2022da Jun 13, 2023
23ba7b0
Merge pull request #1695 from sunny2022da/2718-test-dev
Mister-EA Jun 14, 2023
e31270a
Merge pull request #1694 from bnb-chain/improve-readme
MatusKysel Jun 14, 2023
7339721
core: use reflection to set default block values
Jun 15, 2023
486e019
core/statedb: always clear out access list when setting a new one (#1…
NathanBSC Jun 15, 2023
cd44fc4
Merge pull request #1704 from bnb-chain/default-config-reflection
Mister-EA Jun 15, 2023
1ace44b
release: prepare for release v1.2.5
brilliant-lx Jun 8, 2023
019aedc
upgrade: block height of Hertz(London&Berlin) on testnet
brilliant-lx Jun 15, 2023
55bb108
release: prepare for release v1.2.6
brilliant-lx Jun 14, 2023
9841ba5
Merge branch 'master' into develop
brilliant-lx Jun 15, 2023
acd2f5f
p2p: fix length calculation for headPeers method (#1708)
j75689 Jun 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
# Changelog
## v1.2.6
FEATURE
* [\#1697](https://github.com/bnb-chain/bsc/pull/1697) upgrade: block height of Hertz(London&Berlin) on testnet
* [\#1686](https://github.com/bnb-chain/bsc/pull/1686) eip3529tests: refactor tests
* [\#1676](https://github.com/bnb-chain/bsc/pull/1676) EIP-3529 (BEP-212) Unit tests for Parlia Config
* [\#1660](https://github.com/bnb-chain/bsc/pull/1660) feat: add a tool for submitting evidence of maliciousvoting
* [\#1623](https://github.com/bnb-chain/bsc/pull/1623) P2P: try to limit the connection number per IP address
* [\#1608](https://github.com/bnb-chain/bsc/pull/1608) feature: Enable Berlin EIPs
* [\#1597](https://github.com/bnb-chain/bsc/pull/1597) feature: add malicious vote monitor
* [\#1422](https://github.com/bnb-chain/bsc/pull/1422) core: port several London EIPs on BSC

IMPROVEMENT
* [\#1662](https://github.com/bnb-chain/bsc/pull/1662) consensus, core/rawdb, miner: downgrade logs
* [\#1654](https://github.com/bnb-chain/bsc/pull/1654) config: use default fork config if not specified in config.toml
* [\#1642](https://github.com/bnb-chain/bsc/pull/1642) readme: update the disk requirement to 2.5TB
* [\#1621](https://github.com/bnb-chain/bsc/pull/1621) upgrade: avoid to modify RialtoGenesisHash when testing in rialtoNet

BUGFIX
* [\#1682](https://github.com/bnb-chain/bsc/pull/1682) fix: set the signer of parlia to the most permissive one
* [\#1681](https://github.com/bnb-chain/bsc/pull/1681) fix: not double GasLimit of block upon London upgrade
* [\#1679](https://github.com/bnb-chain/bsc/pull/1679) fix: check integer overflow when decode crosschain payload
* [\#1671](https://github.com/bnb-chain/bsc/pull/1671) fix: voting can only be enabled when mining
* [\#1663](https://github.com/bnb-chain/bsc/pull/1663) fix: ungraceful shutdown caused by malicious Vote Monitor
* [\#1651](https://github.com/bnb-chain/bsc/pull/1651) fix: remove naturally finality
* [\#1641](https://github.com/bnb-chain/bsc/pull/1641) fix: support getFilterChanges after NewFinalizedHeaderFilter

## v1.2.5
BUGFIX
* [\#1675](https://github.com/bnb-chain/bsc/pull/1675) goleveldb: downgrade the version for performance
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Many of the below are the same as or similar to go-ethereum.

For prerequisites and detailed build instructions please read the [Installation Instructions](https://geth.ethereum.org/docs/getting-started/installing-geth).

Building `geth` requires both a Go (version 1.19 or later) and a C compiler. You can install
Building `geth` requires both a Go (version 1.19 or later) and a C compiler (GCC 5 or higher). You can install
them using your favourite package manager. Once the dependencies are installed, run

```shell
Expand Down Expand Up @@ -110,7 +110,7 @@ on how you can run your own `geth` instance.

The hardware must meet certain requirements to run a full node on mainnet:
- VPS running recent versions of Mac OS X, Linux, or Windows.
- IMPORTANT 2 TB of free disk space, solid-state drive(SSD), gp3, 8k IOPS, 250 MB/S throughput, read latency <1ms. (if node is started with snap sync, it will need NVMe SSD)
- IMPORTANT 2.5 TB(May 2023) of free disk space, solid-state drive(SSD), gp3, 8k IOPS, 250 MB/S throughput, read latency <1ms. (if node is started with snap sync, it will need NVMe SSD)
- 16 cores of CPU and 64 GB of memory (RAM)
- Suggest m5zn.3xlarge instance type on AWS, c2-standard-16 on Google cloud.
- A broadband Internet connection with upload/download speeds of 5 MB/S
Expand All @@ -131,19 +131,26 @@ chmod -v u+x geth

# MacOS
wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep geth_mac |cut -d\" -f4)
mv geth_mac geth
mv geth_macos geth
chmod -v u+x geth
```

#### 2. Download the config files
```shell
//== mainnet
wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep mainnet |cut -d\" -f4)
unzip mainnet.zip

//== testnet
wget $(curl -s https://api.github.com/repos/bnb-chain/bsc/releases/latest |grep browser_ |grep testnet |cut -d\" -f4)
unzip testnet.zip
```

#### 3. Download snapshot
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`
#### 4. Start a full node
```shell
./geth --config ./config.toml --datadir ./node --cache 8000 --rpc.allow-unprotected-txs --txlookuplimit 0
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ var (
utils.PruneAncientDataFlag,
utils.ListenPortFlag,
utils.MaxPeersFlag,
utils.MaxPeersPerIPFlag,
utils.MaxPendingPeersFlag,
utils.MiningEnabledFlag,
utils.MinerThreadsFlag,
Expand Down
1 change: 1 addition & 0 deletions cmd/geth/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.DNSDiscoveryFlag,
utils.ListenPortFlag,
utils.MaxPeersFlag,
utils.MaxPeersPerIPFlag,
utils.MaxPendingPeersFlag,
utils.NATFlag,
utils.NoDiscoverFlag,
Expand Down
21 changes: 21 additions & 0 deletions cmd/maliciousvote-submit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## maliciousvote-submit
A tool for submitting the evidence of malicious voting

### Options
```
GLOBAL OPTIONS:
--sender value raw private key in hex format without 0x prefix; check permission on your own
--node value rpc endpoint, http,https,ws,wss,ipc are supported
--chainId value chainId, can get by eth_chainId (default: 0)
--evidence value params for submitFinalityViolationEvidence in json format; string
--help, -h show help
--version, -v print the version
```
### Evidence
can be extracted from logs generated by MaliciousVoteMonitor

### Example
```
./build/bin/maliciousvote-submit --chainId 714 --sender 59ba8068eb256d520179e903f43dacf6d8d57d72bd306e1bd603fdb812345678 --node ws://localhost:8545 --evidence "{\"VoteA\":{\"SrcNum\":6948,\"SrcHash\":\"dc58ff5dca8deefb7b03904ef2837e5f8b0e84ec147f021d4ff08343635540d3\",\"TarNum\":6949,\"TarHash\":\"24726f05534dc55c36ecc364951025abada0defa6d1b53bcb6b637f583b59996\",\"Sig\":\"9379a0626f962b828ed21fb34a6b6de034a23651c2e0c12b907293cf8f21d4fdd559e6f9c7f450a4243d33ad7aa5783d0e51e70979631d82819c254dfb130dfe924f057f7e2b4e64195fc7562f1cb0c45486c9cc3e6cc5679b4c0b5744bf33b5\"},\"VoteB\":{\"SrcNum\":6947,\"SrcHash\":\"24726f05534dc55c36ecc364951025abada0defa6d1b53bcb6b637f583b59996\",\"TarNum\":6950,\"TarHash\":\"6257f70ea6439b84d910595064a6e44e55ba0f2abc0c887346c420a60a5ef119\",\"Sig\":\"af9b500877d64277e80eea7c42b8d6ae5744d715625344ef6ddc66fa4e1dcb3e94568c79e018239641b724bacaa93046052d13f87b655d58b7afecf4e31036d5eca911e8c7436deea68c1e64ef7ed527ed25416039e4e7352f9b089cfb86481f\"},\"VoteAddr\":\"98b94137e4e2d4e628dcbc4a05d554f44950a7498040d3276d49c265708229127cd20e48c773cdc7a898b3bb572a17bf\"}"
```

72 changes: 72 additions & 0 deletions cmd/maliciousvote-submit/json_encoding_helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package main

import (
"encoding/json"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
)

func (s SlashIndicatorVoteData) ToWrapper() *types.SlashIndicatorVoteDataWrapper {
wrapper := &types.SlashIndicatorVoteDataWrapper{
SrcNum: s.SrcNum,
TarNum: s.TarNum,
}

if len(s.Sig) != types.BLSSignatureLength {
log.Crit("wrong length of sig", "wanted", types.BLSSignatureLength, "get", len(s.Sig))
}
wrapper.SrcHash = common.Bytes2Hex(s.SrcHash[:])
wrapper.TarHash = common.Bytes2Hex(s.TarHash[:])
wrapper.Sig = common.Bytes2Hex(s.Sig)
return wrapper
}

func (s *SlashIndicatorVoteData) FromWrapper(wrapper *types.SlashIndicatorVoteDataWrapper) {
if len(wrapper.SrcHash) != common.HashLength*2 {
log.Crit("wrong length of SrcHash", "wanted", common.HashLength*2, "get", len(wrapper.SrcHash))
}
if len(wrapper.TarHash) != common.HashLength*2 {
log.Crit("wrong length of TarHash", "wanted", common.HashLength*2, "get", len(wrapper.TarHash))
}
if len(wrapper.Sig) != types.BLSSignatureLength*2 {
log.Crit("wrong length of Sig", "wanted", types.BLSSignatureLength*2, "get", len(wrapper.Sig))
}

s.SrcNum = wrapper.SrcNum
s.TarNum = wrapper.TarNum
copy(s.SrcHash[:], common.Hex2Bytes(wrapper.SrcHash))
copy(s.TarHash[:], common.Hex2Bytes(wrapper.TarHash))
s.Sig = common.Hex2Bytes(wrapper.Sig)
}

func (s SlashIndicatorFinalityEvidence) MarshalJSON() ([]byte, error) {
wrapper := &types.SlashIndicatorFinalityEvidenceWrapper{
VoteA: *s.VoteA.ToWrapper(),
VoteB: *s.VoteB.ToWrapper(),
}

if len(s.VoteAddr) != types.BLSPublicKeyLength {
log.Crit("wrong length of VoteAddr", "wanted", types.BLSPublicKeyLength, "get", len(s.VoteAddr))
}
wrapper.VoteAddr = common.Bytes2Hex(s.VoteAddr)

return json.Marshal(wrapper)
}

func (s *SlashIndicatorFinalityEvidence) UnmarshalJSON(data []byte) error {
var wrapper = &types.SlashIndicatorFinalityEvidenceWrapper{}
if err := json.Unmarshal(data, wrapper); err != nil {
log.Crit("failed to Unmarshal", "error", err)
}

s.VoteA.FromWrapper(&wrapper.VoteA)
s.VoteB.FromWrapper(&wrapper.VoteB)
if len(wrapper.VoteAddr) != types.BLSPublicKeyLength*2 {
log.Crit("wrong length of VoteAddr", "wanted", types.BLSPublicKeyLength*2, "get", len(wrapper.VoteAddr))
}
s.VoteAddr = common.Hex2Bytes(wrapper.VoteAddr)

return nil
}
23 changes: 23 additions & 0 deletions cmd/maliciousvote-submit/json_encoding_helper_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

import (
"os"
"testing"

"github.com/ethereum/go-ethereum/log"
)

func TestSlashIndicatorFinalityEvidenceEncoding(t *testing.T) {
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
evidence := `{"VoteA":{"SrcNum":1234,"SrcHash":"36068b819f244d27b5411d975f9ffd6d18c6084b50fb5595104ffd9de561a9f8","TarNum":1234,"TarHash":"36068b819f244d27b5411d975f9ffd6d18c6084b50fb5595104ffd9de561a9f8","Sig":"893682ebf26440a06daaff5695945ee2012146268f800c217bad9906ac64dc46996cd435e3e829529aa0445b52530070893682ebf26440a06daaff5695945ee2012146268f800c217bad9906ac64dc46996cd435e3e829529aa0445b52530070"},"VoteB":{"SrcNum":1234,"SrcHash":"36068b819f244d27b5411d975f9ffd6d18c6084b50fb5595104ffd9de561a9f8","TarNum":1234,"TarHash":"36068b819f244d27b5411d975f9ffd6d18c6084b50fb5595104ffd9de561a9f8","Sig":"893682ebf26440a06daaff5695945ee2012146268f800c217bad9906ac64dc46996cd435e3e829529aa0445b52530070893682ebf26440a06daaff5695945ee2012146268f800c217bad9906ac64dc46996cd435e3e829529aa0445b52530070"},"VoteAddr":"893682ebf26440a06daaff5695945ee2012146268f800c217bad9906ac64dc46996cd435e3e829529aa0445b52530070"}`

slashIndicatorFinalityEvidence := &SlashIndicatorFinalityEvidence{}
if err := slashIndicatorFinalityEvidence.UnmarshalJSON([]byte(evidence)); err != nil {
log.Crit("SlashIndicatorFinalityEvidence UnmarshalJSON failed")
}
if output, err := slashIndicatorFinalityEvidence.MarshalJSON(); err != nil {
log.Crit("SlashIndicatorFinalityEvidence MarshalJSON failed")
} else if string(output) != evidence {
log.Crit("SlashIndicatorFinalityEvidence UnmarshalJSON MarshalJSON mismatch", "output", string(output), "evidence", evidence)
}
}
140 changes: 140 additions & 0 deletions cmd/maliciousvote-submit/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
// submit the evidence of malicious voting
package main

import (
"context"
"fmt"
"math/big"
"os"
"strings"
"time"

"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/systemcontracts"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/internal/flags"
"github.com/ethereum/go-ethereum/log"
"gopkg.in/urfave/cli.v1"
)

var (
// Git SHA1 commit hash of the release (set via linker flags)
gitCommit = ""
gitDate = ""

app *cli.App

senderFlag = cli.StringFlag{
Name: "sender",
Usage: "raw private key in hex format without 0x prefix; check permission on your own",
}
nodeFlag = cli.StringFlag{
Name: "node",
Usage: "rpc endpoint, http,https,ws,wss,ipc are supported",
}
chainIdFlag = cli.UintFlag{
Name: "chainId",
Usage: "chainId, can get by eth_chainId",
}
evidenceFlag = cli.StringFlag{
Name: "evidence",
Usage: "params for submitFinalityViolationEvidence in json format; string",
}
)

func init() {
app = flags.NewApp(gitCommit, gitDate, "a tool for submitting the evidence of malicious voting")
app.Flags = []cli.Flag{
senderFlag,
nodeFlag,
chainIdFlag,
evidenceFlag,
}
app.Action = submitMaliciousVotes
cli.CommandHelpTemplate = flags.AppHelpTemplate
}

func submitMaliciousVotes(c *cli.Context) {
// get sender
senderRawKey := c.GlobalString(senderFlag.Name)
if senderRawKey == "" {
log.Crit("no sender specified (--sender)")
}
sender, err := crypto.HexToECDSA(senderRawKey)
if err != nil {
log.Crit("get sender failed", "error", err)
} else {
log.Info("get sender success")
}

// connect to the given URL
nodeURL := c.GlobalString(nodeFlag.Name)
if nodeURL == "" {
log.Crit("no node specified (--node)")
}
client, err := ethclient.Dial(nodeURL)
if err != nil {
log.Crit("Error connecting to client", "nodeURL", nodeURL, "error", err)
} else {
// when nodeURL is type of http or https, err==nil not mean successfully connected
if !strings.HasPrefix(nodeURL, "http") {
log.Info("Successfully connected to client", "nodeURL", nodeURL)
}
}

// get chainId
chainId := c.GlobalUint(chainIdFlag.Name)
if chainId == 0 {
log.Crit("no chainId specified (--chainId)")
} else {
log.Info("get chainId success", "chainId", chainId)
}

// get evidence
evidenceJson := c.GlobalString(evidenceFlag.Name)
if evidenceJson == "" {
log.Crit("no evidence specified (--evidence)")
}
var evidence SlashIndicatorFinalityEvidence
if err = evidence.UnmarshalJSON([]byte(evidenceJson)); err != nil {
log.Crit("Error parsing evidence", "error", err)
} else {
log.Info("get evidence success")
}

ops, _ := bind.NewKeyedTransactorWithChainID(sender, big.NewInt(int64(chainId)))
//ops.GasLimit = 800000
slashIndicator, _ := NewSlashIndicator(common.HexToAddress(systemcontracts.SlashContract), client)
tx, err := slashIndicator.SubmitFinalityViolationEvidence(ops, evidence)
if err != nil {
log.Crit("submitMaliciousVotes:", "error", err)
}
var rc *types.Receipt
for i := 0; i < 180; i++ {
rc, err = client.TransactionReceipt(context.Background(), tx.Hash())
if err == nil && rc.Status != 0 {
log.Info("submitMaliciousVotes: submit evidence success", "receipt", rc)
break
}
if rc != nil && rc.Status == 0 {
log.Crit("submitMaliciousVotes: tx failed: ", "error", err, "receipt", rc)
}
time.Sleep(100 * time.Millisecond)
}
if rc == nil {
log.Crit("submitMaliciousVotes: submit evidence failed")
}
}

func main() {
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))

if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}

}