Skip to content

Commit 90d4e8e

Browse files
authored
Merge pull request #3438 from bnb-chain/develop
Draft release v1.6.3
2 parents d7e572d + 21cc14a commit 90d4e8e

File tree

13 files changed

+53
-41
lines changed

13 files changed

+53
-41
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
# Changelog
2+
## v1.6.3
3+
### FEATURE
4+
NA
5+
6+
### BUGFIX
7+
[\#3429](https://github.com/bnb-chain/bsc/pull/3429) build(deps): bump github.com/consensys/gnark-crypto
8+
[\#3433](https://github.com/bnb-chain/bsc/pull/3433) internal/ethapi: fix eth_simulateV1
9+
[\#3431](https://github.com/bnb-chain/bsc/pull/3431) eth/tracers: fix crasher in TraceCall with BlockOverrides
10+
11+
### IMPROVEMENT
12+
[\#3436](https://github.com/bnb-chain/bsc/pull/3436) revert: revert the nano check in parlia
13+
[\#3435](https://github.com/bnb-chain/bsc/pull/3435) eth: fix stuck when handleBlockBroadcast
214

315
## v1.6.2
416
### FEATURE

consensus/parlia/parlia.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,9 +1416,6 @@ func (p *Parlia) Finalize(chain consensus.ChainHeaderReader, header *types.Heade
14161416

14171417
systemcontracts.TryUpdateBuildInSystemContract(p.chainConfig, header.Number, parent.Time, header.Time, state, false)
14181418

1419-
if err := p.checkNanoBlackList(state, header); err != nil {
1420-
return err
1421-
}
14221419
if p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) {
14231420
err := p.initializeFeynmanContract(state, header, cx, txs, receipts, systemTxs, usedGas, false, tracer)
14241421
if err != nil {
@@ -1518,10 +1515,6 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *
15181515

15191516
systemcontracts.TryUpdateBuildInSystemContract(p.chainConfig, header.Number, parent.Time, header.Time, state, false)
15201517

1521-
if err := p.checkNanoBlackList(state, header); err != nil {
1522-
return nil, nil, err
1523-
}
1524-
15251518
if p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) {
15261519
err := p.initializeFeynmanContract(state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true, tracer)
15271520
if err != nil {
@@ -2434,18 +2427,6 @@ func (p *Parlia) NextProposalBlock(chain consensus.ChainHeaderReader, header *ty
24342427
return snap.nextProposalBlock(proposer)
24352428
}
24362429

2437-
func (p *Parlia) checkNanoBlackList(state vm.StateDB, header *types.Header) error {
2438-
if p.chainConfig.IsNano(header.Number) {
2439-
for _, blackListAddr := range types.NanoBlackList {
2440-
if state.IsAddressInMutations(blackListAddr) {
2441-
log.Error("blacklisted address found", "address", blackListAddr)
2442-
return fmt.Errorf("block contains blacklisted address: %s", blackListAddr.Hex())
2443-
}
2444-
}
2445-
}
2446-
return nil
2447-
}
2448-
24492430
func (p *Parlia) detectNewVersionWithFork(chain consensus.ChainHeaderReader, header *types.Header, state vm.StateDB) {
24502431
// Ignore blocks that are considered too old
24512432
const maxBlockReceiveDelay = 10 * time.Second

core/state/statedb.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,11 +1687,6 @@ func (s *StateDB) AccessEvents() *AccessEvents {
16871687
return s.accessEvents
16881688
}
16891689

1690-
func (s *StateDB) IsAddressInMutations(addr common.Address) bool {
1691-
_, ok := s.mutations[addr]
1692-
return ok
1693-
}
1694-
16951690
func (s *StateDB) DumpAccessList(block *types.Block) {
16961691
if s.blockAccessList == nil {
16971692
return

core/state/statedb_hooked.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,3 @@ func (s *hookedStateDB) Finalise(deleteEmptyObjects bool) {
304304
func (s *hookedStateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
305305
return s.inner.IntermediateRoot(deleteEmptyObjects)
306306
}
307-
308-
func (s *hookedStateDB) IsAddressInMutations(addr common.Address) bool {
309-
return s.inner.IsAddressInMutations(addr)
310-
}

core/vm/interface.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,4 @@ type StateDB interface {
109109
// Finalise must be invoked at the end of a transaction
110110
Finalise(bool)
111111
IntermediateRoot(deleteEmptyObjects bool) common.Hash
112-
113-
IsAddressInMutations(addr common.Address) bool
114112
}

eth/handler_eth.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ func (h *ethHandler) handleBlockBroadcast(peer *eth.Peer, packet *eth.NewBlockPa
149149
log.Debug("handleBlockBroadcast", "peer", peer.ID(), "block", block.Number(), "hash", block.Hash())
150150
h.blockFetcher.Enqueue(peer.ID(), block)
151151
stats := h.chain.GetBlockStats(block.Hash())
152+
blockFirstReceived := false
152153
if stats.RecvNewBlockTime.Load() == 0 {
154+
blockFirstReceived = true
153155
stats.RecvNewBlockTime.Store(time.Now().UnixMilli())
154156
addr := peer.RemoteAddr()
155157
if addr != nil {
@@ -166,7 +168,9 @@ func (h *ethHandler) handleBlockBroadcast(peer *eth.Peer, packet *eth.NewBlockPa
166168
// Update the peer's total difficulty if better than the previous
167169
if _, td := peer.Head(); trueTD.Cmp(td) > 0 {
168170
peer.SetHead(trueHead, trueTD)
169-
h.chainSync.handlePeerEvent()
171+
if blockFirstReceived {
172+
h.chainSync.handlePeerEvent()
173+
}
170174
}
171175
return nil
172176
}

eth/sync.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ type chainSyncOp struct {
7979
func newChainSyncer(handler *handler) *chainSyncer {
8080
return &chainSyncer{
8181
handler: handler,
82-
peerEventCh: make(chan struct{}),
82+
peerEventCh: make(chan struct{}, 10),
8383
}
8484
}
8585

@@ -186,9 +186,9 @@ func (cs *chainSyncer) nextSyncOp() *chainSyncOp {
186186
} else if op.td.Cmp(new(big.Int).Add(ourTD, common.Big2)) <= 0 { // common.Big2: difficulty of an in-turn block
187187
// On BSC, blocks are produced much faster than on Ethereum.
188188
// If the node is only slightly behind (e.g., 1 block), syncing is unnecessary.
189-
// It's likely still processing broadcasted blocks or block hash announcements.
190-
// In most cases, the node will catch up within 3 seconds.
191-
time.Sleep(3 * time.Second)
189+
// It's likely still processing broadcasted blocks(such as including a big tx) or block hash announcements.
190+
// In most cases, the node will catch up within 2 seconds.
191+
time.Sleep(2 * time.Second)
192192

193193
// Re-check local head to see if it has caught up
194194
if _, latestTD := cs.modeAndLocalHead(); ourTD.Cmp(latestTD) < 0 {

eth/tracers/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc
10901090

10911091
// Apply the customization rules if required.
10921092
if config != nil {
1093-
if config.BlockOverrides != nil && config.BlockOverrides.Number.ToInt().Uint64() == h.Number.Uint64()+1 {
1093+
if config.BlockOverrides != nil && config.BlockOverrides.Number != nil && config.BlockOverrides.Number.ToInt().Uint64() == h.Number.Uint64()+1 {
10941094
// Overriding the block number to n+1 is a common way for wallets to
10951095
// simulate transactions, however without the following fix, a contract
10961096
// can assert it is being simulated by checking if blockhash(n) == 0x0 and

eth/tracers/api_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,20 @@ func TestTraceCall(t *testing.T) {
468468
{"pc":0,"op":"NUMBER","gas":24946984,"gasCost":2,"depth":1,"stack":[]},
469469
{"pc":1,"op":"STOP","gas":24946982,"gasCost":0,"depth":1,"stack":["0x1337"]}]}`,
470470
},
471+
// Tests issue #33014 where accessing nil block number override panics.
472+
{
473+
blockNumber: rpc.BlockNumber(0),
474+
call: ethapi.TransactionArgs{
475+
From: &accounts[0].addr,
476+
To: &accounts[1].addr,
477+
Value: (*hexutil.Big)(big.NewInt(1000)),
478+
},
479+
config: &TraceCallConfig{
480+
BlockOverrides: &override.BlockOverrides{},
481+
},
482+
expectErr: nil,
483+
expect: `{"gas":21000,"failed":false,"returnValue":"0x","structLogs":[]}`,
484+
},
471485
}
472486
for i, testspec := range testSuite {
473487
result, err := api.TraceCall(context.Background(), testspec.call, rpc.BlockNumberOrHash{BlockNumber: &testspec.blockNumber}, testspec.config)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/cloudflare/cloudflare-go v0.114.0
1717
github.com/cockroachdb/pebble v1.1.5
1818
github.com/cometbft/cometbft v0.37.0
19-
github.com/consensys/gnark-crypto v0.18.0
19+
github.com/consensys/gnark-crypto v0.18.1
2020
github.com/crate-crypto/go-eth-kzg v1.3.0
2121
github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a
2222
github.com/crate-crypto/go-kzg-4844 v1.1.0

0 commit comments

Comments
 (0)