Skip to content

Commit 33226b8

Browse files
authored
Merge pull request #2843 from bnb-chain/develop
Draft release v1.5.3-beta
2 parents 3a6ef6a + 849d89d commit 33226b8

File tree

144 files changed

+1097
-378
lines changed

Some content is hidden

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

144 files changed

+1097
-378
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
# Changelog
2+
## v1.5.3
3+
### BUGFIX
4+
* [\#2827](https://github.com/bnb-chain/bsc/pull/2827) triedb/pathdb: fix nil field for stateSet
5+
* [\#2830](https://github.com/bnb-chain/bsc/pull/2830) fastnode: fix some pbss saving&rewind issues
6+
* [\#2835](https://github.com/bnb-chain/bsc/pull/2835) dep: fix nancy issues
7+
* [\#2836](https://github.com/bnb-chain/bsc/pull/2836) Revert "internal/ethapi: remove td field from block (#30386)"
8+
9+
### FEATURE
10+
NA
11+
12+
### IMPROVEMENT
13+
* [\#2834](https://github.com/bnb-chain/bsc/pull/2834) eth: make transaction acceptance depends on syncing status
14+
* [\#2844](https://github.com/bnb-chain/bsc/pull/2844) internal/ethapi: support GetFinalizedBlock by common ratio validators
15+
* [\#2772](https://github.com/bnb-chain/bsc/pull/2772) Push tracing of Parlia system transactions so that live tracers can properly traces those state changes
16+
* [\#2845](https://github.com/bnb-chain/bsc/pull/2845) feat: wait miner finish the later multi-proposals when restarting the node
17+
218
## v1.5.2
319
v1.5.2-alpha is another release for upstream code sync, it catches up with [go-ethereum release [v1.14.12]](https://github.com/ethereum/go-ethereum/releases/tag/v1.14.12) and supported 4 BEPs for BSC Pascal hard fork.
420
- BEP-439: Implement EIP-2537: Precompile for BLS12-381 curve operations

cmd/utils/flags.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,7 @@ func SetDNSDiscoveryDefaults(cfg *ethconfig.Config, genesis common.Hash) {
23032303

23042304
// RegisterEthService adds an Ethereum client to the stack.
23052305
// The second return value is the full node instance.
2306-
func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (*eth.EthAPIBackend, *eth.Ethereum) {
2306+
func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (ethapi.Backend, *eth.Ethereum) {
23072307
backend, err := eth.New(stack, cfg)
23082308
if err != nil {
23092309
Fatalf("Failed to register the Ethereum service: %v", err)
@@ -2313,7 +2313,7 @@ func RegisterEthService(stack *node.Node, cfg *ethconfig.Config) (*eth.EthAPIBac
23132313
}
23142314

23152315
// RegisterEthStatsService configures the Ethereum Stats daemon and adds it to the node.
2316-
func RegisterEthStatsService(stack *node.Node, backend *eth.EthAPIBackend, url string) {
2316+
func RegisterEthStatsService(stack *node.Node, backend ethapi.Backend, url string) {
23172317
if err := ethstats.New(stack, backend, backend.Engine(), url); err != nil {
23182318
Fatalf("Failed to register the Ethereum Stats service: %v", err)
23192319
}

consensus/beacon/consensus.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,10 @@ func (beacon *Beacon) Delay(_ consensus.ChainReader, _ *types.Header, _ *time.Du
369369
}
370370

371371
// Finalize implements consensus.Engine, setting the final state on the header
372-
func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state vm.StateDB, txs *[]*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal, _ *[]*types.Receipt, _ *[]*types.Transaction, _ *uint64) error {
372+
func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state vm.StateDB, txs *[]*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal, _ *[]*types.Receipt, _ *[]*types.Transaction, _ *uint64, tracer *tracing.Hooks) error {
373373
// Finalize is different with Prepare, it can be used in both block verification.
374374
if !beacon.IsPoSHeader(header) {
375-
beacon.ethone.Finalize(chain, header, state, txs, uncles, nil, nil, nil, nil)
375+
beacon.ethone.Finalize(chain, header, state, txs, uncles, nil, nil, nil, nil, tracer)
376376
return nil
377377
}
378378
// Withdrawals processing.
@@ -388,10 +388,10 @@ func (beacon *Beacon) Finalize(chain consensus.ChainHeaderReader, header *types.
388388

389389
// FinalizeAndAssemble implements consensus.Engine, setting the final state and
390390
// assembling the block.
391-
func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
391+
func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt, tracer *tracing.Hooks) (*types.Block, []*types.Receipt, error) {
392392
// FinalizeAndAssemble is different with Prepare, it can be used in both block generation.
393393
if !beacon.IsPoSHeader(header) {
394-
return beacon.ethone.FinalizeAndAssemble(chain, header, state, body, receipts)
394+
return beacon.ethone.FinalizeAndAssemble(chain, header, state, body, receipts, tracer)
395395
}
396396
shanghai := chain.Config().IsShanghai(header.Number, header.Time)
397397
if shanghai {
@@ -405,7 +405,7 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
405405
}
406406
}
407407
// Finalize and assemble the block.
408-
beacon.Finalize(chain, header, state, &body.Transactions, body.Uncles, body.Withdrawals, nil, nil, nil)
408+
beacon.Finalize(chain, header, state, &body.Transactions, body.Uncles, body.Withdrawals, nil, nil, nil, tracer)
409409

410410
// Assign the final state root to header.
411411
header.Root = state.IntermediateRoot(true)

consensus/clique/clique.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
"github.com/ethereum/go-ethereum/consensus/misc"
3737
"github.com/ethereum/go-ethereum/consensus/misc/eip1559"
3838
"github.com/ethereum/go-ethereum/core/state"
39+
"github.com/ethereum/go-ethereum/core/tracing"
3940
"github.com/ethereum/go-ethereum/core/types"
4041
"github.com/ethereum/go-ethereum/core/vm"
4142
"github.com/ethereum/go-ethereum/crypto"
@@ -592,19 +593,19 @@ func (c *Clique) Prepare(chain consensus.ChainHeaderReader, header *types.Header
592593
// Finalize implements consensus.Engine, ensuring no uncles are set, nor block
593594
// rewards given.
594595
func (c *Clique) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state vm.StateDB, _ *[]*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal,
595-
_ *[]*types.Receipt, _ *[]*types.Transaction, _ *uint64) (err error) {
596+
_ *[]*types.Receipt, _ *[]*types.Transaction, _ *uint64, tracer *tracing.Hooks) (err error) {
596597
// No block rewards in PoA, so the state remains as is
597598
return
598599
}
599600

600601
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
601602
// nor block rewards given, and returns the final block.
602-
func (c *Clique) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
603+
func (c *Clique) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt, tracer *tracing.Hooks) (*types.Block, []*types.Receipt, error) {
603604
if len(body.Withdrawals) > 0 {
604605
return nil, nil, errors.New("clique does not support withdrawals")
605606
}
606607
// Finalize block
607-
c.Finalize(chain, header, state, &body.Transactions, body.Uncles, nil, nil, nil, nil)
608+
c.Finalize(chain, header, state, &body.Transactions, body.Uncles, nil, nil, nil, nil, tracer)
608609

609610
// Assign the final state root to header.
610611
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))

consensus/consensus.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323

2424
"github.com/ethereum/go-ethereum/common"
2525
"github.com/ethereum/go-ethereum/core/state"
26+
"github.com/ethereum/go-ethereum/core/tracing"
2627
"github.com/ethereum/go-ethereum/core/types"
2728
"github.com/ethereum/go-ethereum/core/vm"
2829
"github.com/ethereum/go-ethereum/params"
@@ -117,14 +118,14 @@ type Engine interface {
117118
// Note: The state database might be updated to reflect any consensus rules
118119
// that happen at finalization (e.g. block rewards).
119120
Finalize(chain ChainHeaderReader, header *types.Header, state vm.StateDB, txs *[]*types.Transaction,
120-
uncles []*types.Header, withdrawals []*types.Withdrawal, receipts *[]*types.Receipt, systemTxs *[]*types.Transaction, usedGas *uint64) error
121+
uncles []*types.Header, withdrawals []*types.Withdrawal, receipts *[]*types.Receipt, systemTxs *[]*types.Transaction, usedGas *uint64, tracer *tracing.Hooks) error
121122

122123
// FinalizeAndAssemble runs any post-transaction state modifications (e.g. block
123124
// rewards or process withdrawals) and assembles the final block.
124125
//
125126
// Note: The block header and state database might be updated to reflect any
126127
// consensus rules that happen at finalization (e.g. block rewards).
127-
FinalizeAndAssemble(chain ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error)
128+
FinalizeAndAssemble(chain ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt, tracer *tracing.Hooks) (*types.Block, []*types.Receipt, error)
128129

129130
// Seal generates a new sealing request for the given input block and pushes
130131
// the result into the given channel.
@@ -161,4 +162,6 @@ type PoSA interface {
161162
GetFinalizedHeader(chain ChainHeaderReader, header *types.Header) *types.Header
162163
VerifyVote(chain ChainHeaderReader, vote *types.VoteEnvelope) error
163164
IsActiveValidatorAt(chain ChainHeaderReader, header *types.Header, checkVoteKeyFn func(bLSPublicKey *types.BLSPublicKey) bool) bool
165+
BlockInterval() uint64
166+
NextProposalBlock(chain ChainHeaderReader, header *types.Header, proposer common.Address) (uint64, uint64, error)
164167
}

consensus/ethash/consensus.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -515,20 +515,20 @@ func (ethash *Ethash) Prepare(chain consensus.ChainHeaderReader, header *types.H
515515
// Finalize implements consensus.Engine, accumulating the block and uncle rewards,
516516
// setting the final state on the header
517517
func (ethash *Ethash) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state vm.StateDB, _ *[]*types.Transaction, uncles []*types.Header, withdrawals []*types.Withdrawal,
518-
_ *[]*types.Receipt, _ *[]*types.Transaction, _ *uint64) (err error) {
518+
_ *[]*types.Receipt, _ *[]*types.Transaction, _ *uint64, tracer *tracing.Hooks) (err error) {
519519
// Accumulate any block and uncle rewards and commit the final state root
520520
accumulateRewards(chain.Config(), state, header, uncles)
521521
return
522522
}
523523

524524
// FinalizeAndAssemble implements consensus.Engine, accumulating the block and
525525
// uncle rewards, setting the final state and assembling the block.
526-
func (ethash *Ethash) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, []*types.Receipt, error) {
526+
func (ethash *Ethash) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt, tracer *tracing.Hooks) (*types.Block, []*types.Receipt, error) {
527527
if len(body.Withdrawals) > 0 {
528528
return nil, nil, errors.New("ethash does not support withdrawals")
529529
}
530530
// Finalize block
531-
ethash.Finalize(chain, header, state, &body.Transactions, body.Uncles, nil, nil, nil, nil)
531+
ethash.Finalize(chain, header, state, &body.Transactions, body.Uncles, nil, nil, nil, nil, tracer)
532532

533533
// Assign the final state root to header.
534534
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))

consensus/parlia/feynmanfork.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func isBreatheBlock(lastBlockTime, blockTime uint64) bool {
3030

3131
// initializeFeynmanContract initialize new contracts of Feynman fork
3232
func (p *Parlia) initializeFeynmanContract(state vm.StateDB, header *types.Header, chain core.ChainContext,
33-
txs *[]*types.Transaction, receipts *[]*types.Receipt, receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool,
33+
txs *[]*types.Transaction, receipts *[]*types.Receipt, receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool, vmConfig vm.Config,
3434
) error {
3535
// method
3636
method := "initialize"
@@ -53,7 +53,7 @@ func (p *Parlia) initializeFeynmanContract(state vm.StateDB, header *types.Heade
5353
msg := p.getSystemMessage(header.Coinbase, common.HexToAddress(c), data, common.Big0)
5454
// apply message
5555
log.Info("initialize feynman contract", "block number", header.Number.Uint64(), "contract", c)
56-
err = p.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining)
56+
err = p.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining, vmConfig)
5757
if err != nil {
5858
return err
5959
}
@@ -96,7 +96,7 @@ func (h *ValidatorHeap) Pop() interface{} {
9696
}
9797

9898
func (p *Parlia) updateValidatorSetV2(state vm.StateDB, header *types.Header, chain core.ChainContext,
99-
txs *[]*types.Transaction, receipts *[]*types.Receipt, receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool,
99+
txs *[]*types.Transaction, receipts *[]*types.Receipt, receivedTxs *[]*types.Transaction, usedGas *uint64, mining bool, vmConfig vm.Config,
100100
) error {
101101
// 1. get all validators and its voting power
102102
blockNr := rpc.BlockNumberOrHashWithHash(header.ParentHash, false)
@@ -123,7 +123,7 @@ func (p *Parlia) updateValidatorSetV2(state vm.StateDB, header *types.Header, ch
123123
// get system message
124124
msg := p.getSystemMessage(header.Coinbase, common.HexToAddress(systemcontracts.ValidatorContract), data, common.Big0)
125125
// apply message
126-
return p.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining)
126+
return p.applyTransaction(msg, state, header, chain, txs, receipts, receivedTxs, usedGas, mining, vmConfig)
127127
}
128128

129129
func (p *Parlia) getValidatorElectionInfo(blockNr rpc.BlockNumberOrHash) ([]ValidatorItem, error) {

0 commit comments

Comments
 (0)