Compare commits

..

6 Commits

Author SHA1 Message Date
lx
7a19cd27b6 Merge pull request #1833 from bnb-chain/develop
draft release v1.2.11
2023-08-23 11:32:08 +08:00
lx
c431373bd5 ci: increase header-max-length from 72 to 80 for master branch (#1834)
PR merge will append the PR number at the end, like:... (#1805), which
has extra 8 characters
2023-08-22 21:35:43 +08:00
lx
c035b0c816 release: prepare for release v1.2.11 (#1832) 2023-08-22 11:10:53 +08:00
lx
e2bf0f3fbd fix: lagging nodes failed to sync (#1829)
FastFinality puts more infor into the header.extra field to keep vote information.
For mainnet, on epoch height, it could be 1526 bytes, which was 517 bytes before.
So the hardcoded 700 bytes for header could be no longer enough, increase it by
2 times would be enough.

this bug could cause P2P sync failure for nodes that are lagging behind, since they
would request access of ancient db, and GetBlockHeaders could be failed.
2023-08-21 10:31:18 +08:00
NathanBSC
0bc5a2a2d7 client: add FinalizedHeader/Block to use the fast finality (#1797) 2023-08-15 11:40:52 +08:00
NathanBSC
9b95339c38 vote: remove DisableBscProtocol and add flag to skip votes assmebling (#1805) 2023-08-14 17:48:36 +08:00
13 changed files with 62 additions and 35 deletions

View File

@@ -36,7 +36,7 @@ module.exports = {
'header-max-length': [ 'header-max-length': [
2, 2,
'always', 'always',
72, 80,
], ],
}, },
helpUrl: helpUrl:

View File

@@ -1,10 +1,19 @@
# Changelog # Changelog
## v1.2.11
FEATURE
* [\#1797](https://github.com/bnb-chain/bsc/pull/1797) client: add FinalizedHeader/Block to use the fast finality
* [\#1805](https://github.com/bnb-chain/bsc/pull/1805) vote: remove DisableBscProtocol and add flag to skip votes assmebling
BUGFIX
* [\#1829](https://github.com/bnb-chain/bsc/pull/1829) fix: lagging nodes failed to sync
## v1.2.10 ## v1.2.10
FEATURE FEATURE
* [\#1780](https://github.com/bnb-chain/bsc/pull/1780) log: reduce logs when receiving too much votes from a peer * [\#1780](https://github.com/bnb-chain/bsc/pull/1780) log: reduce logs when receiving too much votes from a peer
* [\#1788](https://github.com/bnb-chain/bsc/pull/1788) metrics: add txpool config into metrics server * [\#1788](https://github.com/bnb-chain/bsc/pull/1788) metrics: add txpool config into metrics server
* [\#1789](https://github.com/bnb-chain/bsc/pull/1789) rpc: add GetFinalizedHeader/Block to simplify using the fast finality feature * [\#1789](https://github.com/bnb-chain/bsc/pull/1789) rpc: add GetFinalizedHeader/Block to simplify using the fast finality feature
* [\#1791](https://github.com/bnb-chain/bsc/pull/1791) finality: add more check to ensure result of assembleVoteAttestation * [\#1791](https://github.com/bnb-chain/bsc/pull/1791) finality: add more check to ensure result of assembleVoteAttestation
* [\#1795](https://github.com/bnb-chain/bsc/pull/1795) tool: add a tool extradump to parse extra data after luban
BUGFIX BUGFIX
* [\#1773](https://github.com/bnb-chain/bsc/pull/1773) discov: do not filter out bootnodes * [\#1773](https://github.com/bnb-chain/bsc/pull/1773) discov: do not filter out bootnodes

View File

@@ -72,7 +72,6 @@ var (
utils.DisableSnapProtocolFlag, utils.DisableSnapProtocolFlag,
utils.DisableDiffProtocolFlag, utils.DisableDiffProtocolFlag,
utils.EnableTrustProtocolFlag, utils.EnableTrustProtocolFlag,
utils.DisableBscProtocolFlag,
utils.DiffSyncFlag, utils.DiffSyncFlag,
utils.PipeCommitFlag, utils.PipeCommitFlag,
utils.RangeLimitFlag, utils.RangeLimitFlag,
@@ -171,6 +170,7 @@ var (
utils.CheckSnapshotWithMPT, utils.CheckSnapshotWithMPT,
utils.EnableDoubleSignMonitorFlag, utils.EnableDoubleSignMonitorFlag,
utils.VotingEnabledFlag, utils.VotingEnabledFlag,
utils.DisableVoteAttestationFlag,
utils.EnableMaliciousVoteMonitorFlag, utils.EnableMaliciousVoteMonitorFlag,
utils.BLSPasswordFileFlag, utils.BLSPasswordFileFlag,
utils.BLSWalletDirFlag, utils.BLSWalletDirFlag,

View File

@@ -43,7 +43,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.DisableSnapProtocolFlag, utils.DisableSnapProtocolFlag,
utils.DisableDiffProtocolFlag, utils.DisableDiffProtocolFlag,
utils.EnableTrustProtocolFlag, utils.EnableTrustProtocolFlag,
utils.DisableBscProtocolFlag,
utils.RangeLimitFlag, utils.RangeLimitFlag,
utils.SmartCardDaemonPathFlag, utils.SmartCardDaemonPathFlag,
utils.NetworkIdFlag, utils.NetworkIdFlag,
@@ -201,6 +200,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.MinerDelayLeftoverFlag, utils.MinerDelayLeftoverFlag,
utils.MinerNoVerfiyFlag, utils.MinerNoVerfiyFlag,
utils.VotingEnabledFlag, utils.VotingEnabledFlag,
utils.DisableVoteAttestationFlag,
}, },
}, },
{ {

View File

@@ -134,10 +134,6 @@ var (
Name: "enabletrustprotocol", Name: "enabletrustprotocol",
Usage: "Enable trust protocol", Usage: "Enable trust protocol",
} }
DisableBscProtocolFlag = cli.BoolFlag{
Name: "disablebscprotocol",
Usage: "Disable bsc protocol",
}
DiffSyncFlag = cli.BoolFlag{ DiffSyncFlag = cli.BoolFlag{
Name: "diffsync", Name: "diffsync",
@@ -908,6 +904,11 @@ var (
Usage: "Enable voting when mining", Usage: "Enable voting when mining",
} }
DisableVoteAttestationFlag = cli.BoolFlag{
Name: "disablevoteattestation",
Usage: "Disable assembling vote attestation ",
}
EnableMaliciousVoteMonitorFlag = cli.BoolFlag{ EnableMaliciousVoteMonitorFlag = cli.BoolFlag{
Name: "monitor.maliciousvote", Name: "monitor.maliciousvote",
Usage: "Enable malicious vote monitor to check whether any validator violates the voting rules of fast finality", Usage: "Enable malicious vote monitor to check whether any validator violates the voting rules of fast finality",
@@ -1562,6 +1563,9 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
if ctx.GlobalBool(VotingEnabledFlag.Name) { if ctx.GlobalBool(VotingEnabledFlag.Name) {
cfg.VoteEnable = true cfg.VoteEnable = true
} }
if ctx.GlobalBool(DisableVoteAttestationFlag.Name) {
cfg.DisableVoteAttestation = true
}
} }
func setWhitelist(ctx *cli.Context, cfg *ethconfig.Config) { func setWhitelist(ctx *cli.Context, cfg *ethconfig.Config) {
@@ -1720,9 +1724,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
if ctx.GlobalIsSet(EnableTrustProtocolFlag.Name) { if ctx.GlobalIsSet(EnableTrustProtocolFlag.Name) {
cfg.EnableTrustProtocol = ctx.GlobalIsSet(EnableTrustProtocolFlag.Name) cfg.EnableTrustProtocol = ctx.GlobalIsSet(EnableTrustProtocolFlag.Name)
} }
if ctx.GlobalIsSet(DisableBscProtocolFlag.Name) {
cfg.DisableBscProtocol = ctx.GlobalIsSet(DisableBscProtocolFlag.Name)
}
if ctx.GlobalIsSet(DiffSyncFlag.Name) { if ctx.GlobalIsSet(DiffSyncFlag.Name) {
log.Warn("The --diffsync flag is deprecated and will be removed in the future!") log.Warn("The --diffsync flag is deprecated and will be removed in the future!")
} }

View File

@@ -827,7 +827,7 @@ func (p *Parlia) assembleVoteAttestation(chain consensus.ChainHeaderReader, head
} }
if p.VotePool == nil { if p.VotePool == nil {
return errors.New("vote pool is nil") return nil
} }
// Fetch direct parent's votes // Fetch direct parent's votes

View File

@@ -318,7 +318,7 @@ func ReadHeaderRange(db ethdb.Reader, number uint64, count uint64) []rlp.RawValu
return rlpHeaders return rlpHeaders
} }
// read remaining from ancients // read remaining from ancients
max := count * 700 max := count * 700 * 3
data, err := db.AncientRange(freezerHeaderTable, i+1-count, count, max) data, err := db.AncientRange(freezerHeaderTable, i+1-count, count, max)
if err == nil && uint64(len(data)) == count { if err == nil && uint64(len(data)) == count {
// the data is on the order [h, h+1, .., n] -- reordering needed // the data is on the order [h, h+1, .., n] -- reordering needed

View File

@@ -284,7 +284,10 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
votePool := vote.NewVotePool(chainConfig, eth.blockchain, posa) votePool := vote.NewVotePool(chainConfig, eth.blockchain, posa)
eth.votePool = votePool eth.votePool = votePool
if parlia, ok := eth.engine.(*parlia.Parlia); ok { if parlia, ok := eth.engine.(*parlia.Parlia); ok {
if !config.Miner.DisableVoteAttestation {
// if there is no VotePool in Parlia Engine, the miner can't get votes for assembling
parlia.VotePool = votePool parlia.VotePool = votePool
}
} else { } else {
return nil, fmt.Errorf("Engine is not Parlia type") return nil, fmt.Errorf("Engine is not Parlia type")
} }
@@ -627,9 +630,8 @@ func (s *Ethereum) Protocols() []p2p.Protocol {
if s.config.EnableTrustProtocol { if s.config.EnableTrustProtocol {
protos = append(protos, trust.MakeProtocols((*trustHandler)(s.handler), s.snapDialCandidates)...) protos = append(protos, trust.MakeProtocols((*trustHandler)(s.handler), s.snapDialCandidates)...)
} }
if !s.config.DisableBscProtocol {
protos = append(protos, bsc.MakeProtocols((*bscHandler)(s.handler), s.bscDialCandidates)...) protos = append(protos, bsc.MakeProtocols((*bscHandler)(s.handler), s.bscDialCandidates)...)
}
return protos return protos
} }

View File

@@ -151,7 +151,6 @@ type Config struct {
DisableSnapProtocol bool //Whether disable snap protocol DisableSnapProtocol bool //Whether disable snap protocol
DisableDiffProtocol bool //Whether disable diff protocol DisableDiffProtocol bool //Whether disable diff protocol
EnableTrustProtocol bool //Whether enable trust protocol EnableTrustProtocol bool //Whether enable trust protocol
DisableBscProtocol bool //Whether disable bsc protocol
DiffSync bool // Whether support diff sync DiffSync bool // Whether support diff sync
PipeCommit bool PipeCommit bool
RangeLimit bool RangeLimit bool

View File

@@ -32,7 +32,6 @@ func (c Config) MarshalTOML() (interface{}, error) {
DisableSnapProtocol bool DisableSnapProtocol bool
DisableDiffProtocol bool DisableDiffProtocol bool
EnableTrustProtocol bool EnableTrustProtocol bool
DisableBscProtocol bool
DiffSync bool DiffSync bool
RangeLimit bool RangeLimit bool
TxLookupLimit uint64 `toml:",omitempty"` TxLookupLimit uint64 `toml:",omitempty"`
@@ -95,7 +94,6 @@ func (c Config) MarshalTOML() (interface{}, error) {
enc.DisableSnapProtocol = c.DisableSnapProtocol enc.DisableSnapProtocol = c.DisableSnapProtocol
enc.DisableDiffProtocol = c.DisableDiffProtocol enc.DisableDiffProtocol = c.DisableDiffProtocol
enc.EnableTrustProtocol = c.EnableTrustProtocol enc.EnableTrustProtocol = c.EnableTrustProtocol
enc.DisableBscProtocol = c.DisableBscProtocol
enc.DiffSync = c.DiffSync enc.DiffSync = c.DiffSync
enc.RangeLimit = c.RangeLimit enc.RangeLimit = c.RangeLimit
enc.TxLookupLimit = c.TxLookupLimit enc.TxLookupLimit = c.TxLookupLimit
@@ -163,7 +161,6 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
DisableSnapProtocol *bool DisableSnapProtocol *bool
DisableDiffProtocol *bool DisableDiffProtocol *bool
EnableTrustProtocol *bool EnableTrustProtocol *bool
DisableBscProtocol *bool
DiffSync *bool DiffSync *bool
RangeLimit *bool RangeLimit *bool
TxLookupLimit *uint64 `toml:",omitempty"` TxLookupLimit *uint64 `toml:",omitempty"`
@@ -255,9 +252,6 @@ func (c *Config) UnmarshalTOML(unmarshal func(interface{}) error) error {
if dec.EnableTrustProtocol != nil { if dec.EnableTrustProtocol != nil {
c.EnableTrustProtocol = *dec.EnableTrustProtocol c.EnableTrustProtocol = *dec.EnableTrustProtocol
} }
if dec.DisableBscProtocol != nil {
c.DisableBscProtocol = *dec.DisableBscProtocol
}
if dec.DiffSync != nil { if dec.DiffSync != nil {
c.DiffSync = *dec.DiffSync c.DiffSync = *dec.DiffSync
} }

View File

@@ -188,6 +188,27 @@ func (ec *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.H
return head, err return head, err
} }
// GetFinalizedHeader returns the requested finalized block header.
// - probabilisticFinalized should be in range [2,21],
// then the block header with number `max(fastFinalized, latest-probabilisticFinalized)` is returned
func (ec *Client) FinalizedHeader(ctx context.Context, probabilisticFinalized int64) (*types.Header, error) {
var head *types.Header
err := ec.c.CallContext(ctx, &head, "eth_getFinalizedHeader", probabilisticFinalized)
if err == nil && head == nil {
err = ethereum.NotFound
}
return head, err
}
// GetFinalizedBlock returns the requested finalized block.
// - probabilisticFinalized should be in range [2,21],
// then the block with number `max(fastFinalized, latest-probabilisticFinalized)` is returned
// - When fullTx is true all transactions in the block are returned, otherwise
// only the transaction hash is returned.
func (ec *Client) FinalizedBlock(ctx context.Context, probabilisticFinalized int64, fullTx bool) (*types.Block, error) {
return ec.getBlock(ctx, "eth_getFinalizedBlock", probabilisticFinalized, true)
}
// GetDiffAccounts returns changed accounts in a specific block number. // GetDiffAccounts returns changed accounts in a specific block number.
func (ec *Client) GetDiffAccounts(ctx context.Context, number *big.Int) ([]common.Address, error) { func (ec *Client) GetDiffAccounts(ctx context.Context, number *big.Int) ([]common.Address, error) {
accounts := make([]common.Address, 0) accounts := make([]common.Address, 0)

View File

@@ -55,6 +55,7 @@ type Config struct {
Recommit time.Duration // The time interval for miner to re-create mining work. Recommit time.Duration // The time interval for miner to re-create mining work.
Noverify bool // Disable remote mining solution verification(only useful in ethash). Noverify bool // Disable remote mining solution verification(only useful in ethash).
VoteEnable bool // Whether to vote when mining VoteEnable bool // Whether to vote when mining
DisableVoteAttestation bool // Whether to skip assembling vote attestation
} }
// Miner creates blocks and searches for proof-of-work values. // Miner creates blocks and searches for proof-of-work values.

View File

@@ -23,7 +23,7 @@ import (
const ( const (
VersionMajor = 1 // Major version component of the current release VersionMajor = 1 // Major version component of the current release
VersionMinor = 2 // Minor version component of the current release VersionMinor = 2 // Minor version component of the current release
VersionPatch = 10 // Patch version component of the current release VersionPatch = 11 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string VersionMeta = "" // Version metadata to append to the version string
) )