Skip to content

Commit 46df9b4

Browse files
authored
Merge pull request #2366 from bnb-chain/develop
Draft release v1.4.4-beta
2 parents 7f3f72e + 7dbafe7 commit 46df9b4

File tree

100 files changed

+3201
-261
lines changed

Some content is hidden

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

100 files changed

+3201
-261
lines changed

.github/CODEOWNERS

+1-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
11
# Lines starting with '#' are comments.
22
# Each line is a file pattern followed by one or more owners.
3-
4-
accounts/usbwallet @karalabe
5-
accounts/scwallet @gballet
6-
accounts/abi @gballet @MariusVanDerWijden
7-
cmd/clef @holiman
8-
consensus @karalabe
9-
core/ @karalabe @holiman @rjl493456442
10-
eth/ @karalabe @holiman @rjl493456442
11-
eth/catalyst/ @gballet
12-
eth/tracers/ @s1na
13-
graphql/ @s1na
14-
les/ @zsfelfoldi @rjl493456442
15-
light/ @zsfelfoldi @rjl493456442
16-
node/ @fjl
17-
p2p/ @fjl @zsfelfoldi
18-
rpc/ @fjl @holiman
19-
p2p/simulations @fjl
20-
p2p/protocols @fjl
21-
p2p/testing @fjl
22-
signer/ @holiman
3+
* @zzzckck @zjubfd

CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
# Changelog
2+
## v1.4.4
3+
### FEATURE
4+
* [\#2279](https://github.com/bnb-chain/bsc/pull/2279) BlobTx: implement EIP-4844 on BSC
5+
* [\#2337](https://github.com/bnb-chain/bsc/pull/2337) 4844: bugfix and improve
6+
* [\#2339](https://github.com/bnb-chain/bsc/pull/2339) fix: missing block asigment WithSidecars
7+
* [\#2350](https://github.com/bnb-chain/bsc/pull/2350) cancun: change empty withdrawHash value of header
8+
* [\#2335](https://github.com/bnb-chain/bsc/pull/2335) upgrade: update system contracts bytes code and hardfork time of Feynman upgrade
9+
* [\#2323](https://github.com/bnb-chain/bsc/pull/2323) feat: export GasCeil in mev_params
10+
* [\#2357](https://github.com/bnb-chain/bsc/pull/2357) feat: add bid fee ceil in mev_params
11+
12+
### IMPROVEMENT
13+
* [\#2321](https://github.com/bnb-chain/bsc/pull/2321) test: use full syncmode to run rpc node
14+
* [\#2338](https://github.com/bnb-chain/bsc/pull/2338) cmd: include more node info in metrics
15+
* [\#2342](https://github.com/bnb-chain/bsc/pull/2342) p2p: add metrics for inbound/outbound peers
16+
* [\#2334](https://github.com/bnb-chain/bsc/pull/2334) core: improve chain rewinding mechanism
17+
* [\#2352](https://github.com/bnb-chain/bsc/pull/2352) core: fix block report when chain is not setHead
18+
19+
### BUGFIX
20+
NA
21+
222
## v1.4.3
323
### FEATURE
424
* [\#2241](https://github.com/bnb-chain/bsc/pull/2241) cmd/utils, core/rawdb, triedb/pathdb: flip hash to path scheme

beacon/engine/types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func ExecutableDataToBlock(params ExecutableData, versionedHashes []common.Hash,
263263

264264
// BlockToExecutableData constructs the ExecutableData structure by filling the
265265
// fields from the given block. It assumes the given block is post-merge block.
266-
func BlockToExecutableData(block *types.Block, fees *big.Int, sidecars []*types.BlobTxSidecar) *ExecutionPayloadEnvelope {
266+
func BlockToExecutableData(block *types.Block, fees *big.Int, sidecars types.BlobSidecars) *ExecutionPayloadEnvelope {
267267
data := &ExecutableData{
268268
BlockHash: block.Hash(),
269269
ParentHash: block.ParentHash(),

cmd/geth/config.go

+14-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import (
2626
"strings"
2727
"unicode"
2828

29+
"github.com/ethereum/go-ethereum/eth/downloader"
30+
2931
"github.com/ethereum/go-ethereum/accounts"
3032
"github.com/ethereum/go-ethereum/accounts/external"
3133
"github.com/ethereum/go-ethereum/accounts/keystore"
@@ -199,6 +201,16 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
199201
v := ctx.Uint64(utils.OverrideFeynmanFix.Name)
200202
cfg.Eth.OverrideFeynmanFix = &v
201203
}
204+
if ctx.IsSet(utils.OverrideFullImmutabilityThreshold.Name) {
205+
params.FullImmutabilityThreshold = ctx.Uint64(utils.OverrideFullImmutabilityThreshold.Name)
206+
downloader.FullMaxForkAncestry = ctx.Uint64(utils.OverrideFullImmutabilityThreshold.Name)
207+
}
208+
if ctx.IsSet(utils.OverrideMinBlocksForBlobRequests.Name) {
209+
params.MinBlocksForBlobRequests = ctx.Uint64(utils.OverrideMinBlocksForBlobRequests.Name)
210+
}
211+
if ctx.IsSet(utils.OverrideDefaultExtraReserveForBlobRequests.Name) {
212+
params.DefaultExtraReserveForBlobRequests = ctx.Uint64(utils.OverrideDefaultExtraReserveForBlobRequests.Name)
213+
}
202214
if ctx.IsSet(utils.SeparateDBFlag.Name) && !stack.IsSeparatedDB() {
203215
utils.Fatalf("Failed to locate separate database subdirectory when separatedb parameter has been set")
204216
}
@@ -233,8 +245,8 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
233245
git, _ := version.VCS()
234246
utils.SetupMetrics(ctx,
235247
utils.EnableBuildInfo(git.Commit, git.Date),
236-
utils.EnableMinerInfo(ctx, cfg.Eth.Miner),
237-
utils.EnableNodeInfo(cfg.Eth.TxPool),
248+
utils.EnableMinerInfo(ctx, &cfg.Eth.Miner),
249+
utils.EnableNodeInfo(&cfg.Eth.TxPool, stack.Server().NodeInfo()),
238250
)
239251
return stack, backend
240252
}

cmd/geth/main.go

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ var (
7474
utils.OverrideVerkle,
7575
utils.OverrideFeynman,
7676
utils.OverrideFeynmanFix,
77+
utils.OverrideFullImmutabilityThreshold,
78+
utils.OverrideMinBlocksForBlobRequests,
79+
utils.OverrideDefaultExtraReserveForBlobRequests,
7780
utils.EnablePersonal,
7881
utils.TxPoolLocalsFlag,
7982
utils.TxPoolNoLocalsFlag,
@@ -172,6 +175,7 @@ var (
172175
utils.VoteJournalDirFlag,
173176
utils.LogDebugFlag,
174177
utils.LogBacktraceAtFlag,
178+
utils.BlobExtraReserveFlag,
175179
}, utils.NetworkFlags, utils.DatabaseFlags)
176180

177181
rpcFlags = []cli.Flag{

cmd/utils/flags.go

+44-4
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,25 @@ var (
321321
Category: flags.EthCategory,
322322
}
323323
OverrideFeynmanFix = &cli.Uint64Flag{
324-
Name: "override.feynmanfix",
325-
Usage: "Manually specify the FeynmanFix fork timestamp, overriding the bundled setting",
324+
Name: "override.feynmanfix",
325+
Usage: "Manually specify the FeynmanFix fork timestamp, overriding the bundled setting",
326+
}
327+
OverrideFullImmutabilityThreshold = &cli.Uint64Flag{
328+
Name: "override.immutabilitythreshold",
329+
Usage: "It is the number of blocks after which a chain segment is considered immutable, only for testing purpose",
330+
Value: params.FullImmutabilityThreshold,
331+
Category: flags.EthCategory,
332+
}
333+
OverrideMinBlocksForBlobRequests = &cli.Uint64Flag{
334+
Name: "override.minforblobrequest",
335+
Usage: "It keeps blob data available for min blocks in local, only for testing purpose",
336+
Value: params.MinBlocksForBlobRequests,
337+
Category: flags.EthCategory,
338+
}
339+
OverrideDefaultExtraReserveForBlobRequests = &cli.Uint64Flag{
340+
Name: "override.defaultextrareserve",
341+
Usage: "It adds more extra time for expired blobs for some request cases, only for testing purpose",
342+
Value: params.DefaultExtraReserveForBlobRequests,
326343
Category: flags.EthCategory,
327344
}
328345
SyncModeFlag = &flags.TextMarshalerFlag{
@@ -1101,6 +1118,14 @@ Please note that --` + MetricsHTTPFlag.Name + ` must be set to start the server.
11011118
Usage: "Path for the voteJournal dir in fast finality feature (default = inside the datadir)",
11021119
Category: flags.FastFinalityCategory,
11031120
}
1121+
1122+
// Blob setting
1123+
BlobExtraReserveFlag = &cli.Uint64Flag{
1124+
Name: "blob.extra-reserve",
1125+
Usage: "Extra reserve threshold for blob, blob never expires when 0 is set, default 28800",
1126+
Value: params.DefaultExtraReserveForBlobRequests,
1127+
Category: flags.MiscCategory,
1128+
}
11041129
)
11051130

11061131
var (
@@ -2134,6 +2159,18 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
21342159
if err := kzg4844.UseCKZG(ctx.String(CryptoKZGFlag.Name) == "ckzg"); err != nil {
21352160
Fatalf("Failed to set KZG library implementation to %s: %v", ctx.String(CryptoKZGFlag.Name), err)
21362161
}
2162+
2163+
// blob setting
2164+
if ctx.IsSet(OverrideDefaultExtraReserveForBlobRequests.Name) {
2165+
cfg.BlobExtraReserve = ctx.Uint64(OverrideDefaultExtraReserveForBlobRequests.Name)
2166+
}
2167+
if ctx.IsSet(BlobExtraReserveFlag.Name) {
2168+
extraReserve := ctx.Uint64(BlobExtraReserveFlag.Name)
2169+
if extraReserve > 0 && extraReserve < params.DefaultExtraReserveForBlobRequests {
2170+
extraReserve = params.DefaultExtraReserveForBlobRequests
2171+
}
2172+
cfg.BlobExtraReserve = extraReserve
2173+
}
21372174
}
21382175

21392176
// SetDNSDiscoveryDefaults configures DNS discovery with the given URL if
@@ -2193,7 +2230,7 @@ func EnableBuildInfo(gitCommit, gitDate string) SetupMetricsOption {
21932230
}
21942231
}
21952232

2196-
func EnableMinerInfo(ctx *cli.Context, minerConfig miner.Config) SetupMetricsOption {
2233+
func EnableMinerInfo(ctx *cli.Context, minerConfig *miner.Config) SetupMetricsOption {
21972234
return func() {
21982235
if ctx.Bool(MiningEnabledFlag.Name) {
21992236
// register miner info into metrics
@@ -2216,10 +2253,13 @@ func RegisterFilterAPI(stack *node.Node, backend ethapi.Backend, ethcfg *ethconf
22162253
return filterSystem
22172254
}
22182255

2219-
func EnableNodeInfo(poolConfig legacypool.Config) SetupMetricsOption {
2256+
func EnableNodeInfo(poolConfig *legacypool.Config, nodeInfo *p2p.NodeInfo) SetupMetricsOption {
22202257
return func() {
22212258
// register node info into metrics
22222259
metrics.NewRegisteredLabel("node-info", nil).Mark(map[string]interface{}{
2260+
"Enode": nodeInfo.Enode,
2261+
"ENR": nodeInfo.ENR,
2262+
"ID": nodeInfo.ID,
22232263
"PriceLimit": poolConfig.PriceLimit,
22242264
"PriceBump": poolConfig.PriceBump,
22252265
"AccountSlots": poolConfig.AccountSlots,

consensus/clique/clique.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ func (c *Clique) snapshot(chain consensus.ChainHeaderReader, number uint64, hash
407407
// at a checkpoint block without a parent (light client CHT), or we have piled
408408
// up more headers than allowed to be reorged (chain reinit from a freezer),
409409
// consider the checkpoint trusted and snapshot it.
410-
if number == 0 || (number%c.config.Epoch == 0 && (len(headers) > params.FullImmutabilityThreshold || chain.GetHeaderByNumber(number-1) == nil)) {
410+
if number == 0 || (number%c.config.Epoch == 0 && (len(headers) > int(params.FullImmutabilityThreshold) || chain.GetHeaderByNumber(number-1) == nil)) {
411411
checkpoint := chain.GetHeaderByNumber(number)
412412
if checkpoint != nil {
413413
hash := checkpoint.Hash()

consensus/consensus.go

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ type ChainHeaderReader interface {
5858

5959
// GetHighestVerifiedHeader retrieves the highest header verified.
6060
GetHighestVerifiedHeader() *types.Header
61+
62+
// ChasingHead return the best chain head of peers.
63+
ChasingHead() *types.Header
6164
}
6265

6366
type VotePool interface {

consensus/parlia/parlia.go

+17-17
Original file line numberDiff line numberDiff line change
@@ -583,23 +583,27 @@ func (p *Parlia) verifyHeader(chain consensus.ChainHeaderReader, header *types.H
583583
return err
584584
}
585585

586-
// Verify existence / non-existence of withdrawalsHash.
587-
if header.WithdrawalsHash != nil {
588-
return fmt.Errorf("invalid withdrawalsHash: have %x, expected nil", header.WithdrawalsHash)
589-
}
590-
// Verify the existence / non-existence of cancun-specific header fields
591-
if header.ParentBeaconRoot != nil {
592-
return fmt.Errorf("invalid parentBeaconRoot, have %#x, expected nil", header.ParentBeaconRoot)
593-
}
594586
cancun := chain.Config().IsCancun(header.Number, header.Time)
595587
if !cancun {
596588
switch {
597589
case header.ExcessBlobGas != nil:
598590
return fmt.Errorf("invalid excessBlobGas: have %d, expected nil", header.ExcessBlobGas)
599591
case header.BlobGasUsed != nil:
600592
return fmt.Errorf("invalid blobGasUsed: have %d, expected nil", header.BlobGasUsed)
593+
case header.ParentBeaconRoot != nil:
594+
return fmt.Errorf("invalid parentBeaconRoot, have %#x, expected nil", header.ParentBeaconRoot)
595+
case header.WithdrawalsHash != nil:
596+
return fmt.Errorf("invalid WithdrawalsHash, have %#x, expected nil", header.WithdrawalsHash)
601597
}
602598
} else {
599+
switch {
600+
case header.ParentBeaconRoot != nil:
601+
return fmt.Errorf("invalid parentBeaconRoot, have %#x, expected nil", header.ParentBeaconRoot)
602+
// types.EmptyWithdrawalsHash represents a empty value when EIP-4895 enabled,
603+
// here, EIP-4895 still be disabled, value expected to be `types.EmptyWithdrawalsHash` is only to feet the demand of rlp encode/decode
604+
case header.WithdrawalsHash == nil || *header.WithdrawalsHash != types.EmptyWithdrawalsHash:
605+
return errors.New("header has wrong WithdrawalsHash")
606+
}
603607
if err := eip4844.VerifyEIP4844Header(parent, header); err != nil {
604608
return err
605609
}
@@ -697,10 +701,8 @@ func (p *Parlia) snapshot(chain consensus.ChainHeaderReader, number uint64, hash
697701
}
698702
}
699703

700-
// If we're at the genesis, snapshot the initial state. Alternatively if we have
701-
// piled up more headers than allowed to be reorged (chain reinit from a freezer),
702-
// consider the checkpoint trusted and snapshot it.
703-
if number == 0 || (number%p.config.Epoch == 0 && (len(headers) > params.FullImmutabilityThreshold/10)) {
704+
// If we're at the genesis, snapshot the initial state.
705+
if number == 0 {
704706
checkpoint := chain.GetHeaderByNumber(number)
705707
if checkpoint != nil {
706708
// get checkpoint data
@@ -714,12 +716,10 @@ func (p *Parlia) snapshot(chain consensus.ChainHeaderReader, number uint64, hash
714716

715717
// new snapshot
716718
snap = newSnapshot(p.config, p.signatures, number, hash, validators, voteAddrs, p.ethAPI)
717-
if snap.Number%checkpointInterval == 0 { // snapshot will only be loaded when snap.Number%checkpointInterval == 0
718-
if err := snap.store(p.db); err != nil {
719-
return nil, err
720-
}
721-
log.Info("Stored checkpoint snapshot to disk", "number", number, "hash", hash)
719+
if err := snap.store(p.db); err != nil {
720+
return nil, err
722721
}
722+
log.Info("Stored checkpoint snapshot to disk", "number", number, "hash", hash)
723723
break
724724
}
725725
}

core/block_validator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error {
9696
},
9797
func() error {
9898
// Withdrawals are present after the Shanghai fork.
99-
if header.WithdrawalsHash != nil {
99+
if !header.EmptyWithdrawalsHash() {
100100
// Withdrawals list must be present in body after Shanghai.
101101
if block.Withdrawals() == nil {
102102
return errors.New("missing withdrawals in block body")
103103
}
104104
if hash := types.DeriveSha(block.Withdrawals(), trie.NewStackTrie(nil)); hash != *header.WithdrawalsHash {
105105
return fmt.Errorf("withdrawals root hash mismatch (header value %x, calculated %x)", *header.WithdrawalsHash, hash)
106106
}
107-
} else if block.Withdrawals() != nil {
107+
} else if len(block.Withdrawals()) != 0 { // Withdrawals turn into empty from nil when BlockBody has Sidecars
108108
// Withdrawals are not allowed prior to shanghai fork
109109
return errors.New("withdrawals present in block body")
110110
}

0 commit comments

Comments
 (0)