From 0a60f2e0283b65cde49a4fadc05820bfe2174178 Mon Sep 17 00:00:00 2001 From: Eric <45141191+zlacfzy@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:00:25 +0800 Subject: [PATCH 1/6] revert: revert the nano check in parlia (#3436) --- consensus/parlia/parlia.go | 19 ------------------- core/state/statedb.go | 5 ----- core/state/statedb_hooked.go | 4 ---- core/vm/interface.go | 2 -- 4 files changed, 30 deletions(-) diff --git a/consensus/parlia/parlia.go b/consensus/parlia/parlia.go index e6d77c6c15..72c73589a0 100644 --- a/consensus/parlia/parlia.go +++ b/consensus/parlia/parlia.go @@ -1416,9 +1416,6 @@ func (p *Parlia) Finalize(chain consensus.ChainHeaderReader, header *types.Heade systemcontracts.TryUpdateBuildInSystemContract(p.chainConfig, header.Number, parent.Time, header.Time, state, false) - if err := p.checkNanoBlackList(state, header); err != nil { - return err - } if p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) { err := p.initializeFeynmanContract(state, header, cx, txs, receipts, systemTxs, usedGas, false, tracer) if err != nil { @@ -1518,10 +1515,6 @@ func (p *Parlia) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header * systemcontracts.TryUpdateBuildInSystemContract(p.chainConfig, header.Number, parent.Time, header.Time, state, false) - if err := p.checkNanoBlackList(state, header); err != nil { - return nil, nil, err - } - if p.chainConfig.IsOnFeynman(header.Number, parent.Time, header.Time) { err := p.initializeFeynmanContract(state, header, cx, &body.Transactions, &receipts, nil, &header.GasUsed, true, tracer) if err != nil { @@ -2434,18 +2427,6 @@ func (p *Parlia) NextProposalBlock(chain consensus.ChainHeaderReader, header *ty return snap.nextProposalBlock(proposer) } -func (p *Parlia) checkNanoBlackList(state vm.StateDB, header *types.Header) error { - if p.chainConfig.IsNano(header.Number) { - for _, blackListAddr := range types.NanoBlackList { - if state.IsAddressInMutations(blackListAddr) { - log.Error("blacklisted address found", "address", blackListAddr) - return fmt.Errorf("block contains blacklisted address: %s", blackListAddr.Hex()) - } - } - } - return nil -} - func (p *Parlia) detectNewVersionWithFork(chain consensus.ChainHeaderReader, header *types.Header, state vm.StateDB) { // Ignore blocks that are considered too old const maxBlockReceiveDelay = 10 * time.Second diff --git a/core/state/statedb.go b/core/state/statedb.go index 11744ef91e..2623132f54 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -1687,11 +1687,6 @@ func (s *StateDB) AccessEvents() *AccessEvents { return s.accessEvents } -func (s *StateDB) IsAddressInMutations(addr common.Address) bool { - _, ok := s.mutations[addr] - return ok -} - func (s *StateDB) DumpAccessList(block *types.Block) { if s.blockAccessList == nil { return diff --git a/core/state/statedb_hooked.go b/core/state/statedb_hooked.go index c8e4511944..9597178a79 100644 --- a/core/state/statedb_hooked.go +++ b/core/state/statedb_hooked.go @@ -304,7 +304,3 @@ func (s *hookedStateDB) Finalise(deleteEmptyObjects bool) { func (s *hookedStateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash { return s.inner.IntermediateRoot(deleteEmptyObjects) } - -func (s *hookedStateDB) IsAddressInMutations(addr common.Address) bool { - return s.inner.IsAddressInMutations(addr) -} diff --git a/core/vm/interface.go b/core/vm/interface.go index 5aed16c144..d9bafdad2a 100644 --- a/core/vm/interface.go +++ b/core/vm/interface.go @@ -109,6 +109,4 @@ type StateDB interface { // Finalise must be invoked at the end of a transaction Finalise(bool) IntermediateRoot(deleteEmptyObjects bool) common.Hash - - IsAddressInMutations(addr common.Address) bool } From 171443a5efae428aa724e40c806d11e4efe2a305 Mon Sep 17 00:00:00 2001 From: formless <213398294+allformless@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:26:53 +0800 Subject: [PATCH 2/6] eth: fix stuck when handleBlockBroadcast (#3435) --- eth/handler_eth.go | 6 +++++- eth/sync.go | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/eth/handler_eth.go b/eth/handler_eth.go index ff8cfdf5a6..0099fb0873 100644 --- a/eth/handler_eth.go +++ b/eth/handler_eth.go @@ -149,7 +149,9 @@ func (h *ethHandler) handleBlockBroadcast(peer *eth.Peer, packet *eth.NewBlockPa log.Debug("handleBlockBroadcast", "peer", peer.ID(), "block", block.Number(), "hash", block.Hash()) h.blockFetcher.Enqueue(peer.ID(), block) stats := h.chain.GetBlockStats(block.Hash()) + blockFirstReceived := false if stats.RecvNewBlockTime.Load() == 0 { + blockFirstReceived = true stats.RecvNewBlockTime.Store(time.Now().UnixMilli()) addr := peer.RemoteAddr() if addr != nil { @@ -166,7 +168,9 @@ func (h *ethHandler) handleBlockBroadcast(peer *eth.Peer, packet *eth.NewBlockPa // Update the peer's total difficulty if better than the previous if _, td := peer.Head(); trueTD.Cmp(td) > 0 { peer.SetHead(trueHead, trueTD) - h.chainSync.handlePeerEvent() + if blockFirstReceived { + h.chainSync.handlePeerEvent() + } } return nil } diff --git a/eth/sync.go b/eth/sync.go index 3bf2046741..9c608f374c 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -79,7 +79,7 @@ type chainSyncOp struct { func newChainSyncer(handler *handler) *chainSyncer { return &chainSyncer{ handler: handler, - peerEventCh: make(chan struct{}), + peerEventCh: make(chan struct{}, 10), } } @@ -186,9 +186,9 @@ func (cs *chainSyncer) nextSyncOp() *chainSyncOp { } else if op.td.Cmp(new(big.Int).Add(ourTD, common.Big2)) <= 0 { // common.Big2: difficulty of an in-turn block // On BSC, blocks are produced much faster than on Ethereum. // If the node is only slightly behind (e.g., 1 block), syncing is unnecessary. - // It's likely still processing broadcasted blocks or block hash announcements. - // In most cases, the node will catch up within 3 seconds. - time.Sleep(3 * time.Second) + // It's likely still processing broadcasted blocks(such as including a big tx) or block hash announcements. + // In most cases, the node will catch up within 2 seconds. + time.Sleep(2 * time.Second) // Re-check local head to see if it has caught up if _, latestTD := cs.modeAndLocalHead(); ourTD.Cmp(latestTD) < 0 { From 26bc693f4799113fce666b482a85f766896e329c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:34:26 +0800 Subject: [PATCH 3/6] build(deps): bump github.com/consensys/gnark-crypto (#3429) Bumps [github.com/consensys/gnark-crypto](https://github.com/consensys/gnark-crypto) from 0.18.0 to 0.18.1. - [Release notes](https://github.com/consensys/gnark-crypto/releases) - [Changelog](https://github.com/Consensys/gnark-crypto/blob/v0.18.1/CHANGELOG.md) - [Commits](https://github.com/consensys/gnark-crypto/compare/v0.18.0...v0.18.1) --- updated-dependencies: - dependency-name: github.com/consensys/gnark-crypto dependency-version: 0.18.1 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8654f46e54..ad228f96db 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/cloudflare/cloudflare-go v0.114.0 github.com/cockroachdb/pebble v1.1.5 github.com/cometbft/cometbft v0.37.0 - github.com/consensys/gnark-crypto v0.18.0 + github.com/consensys/gnark-crypto v0.18.1 github.com/crate-crypto/go-eth-kzg v1.3.0 github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a github.com/crate-crypto/go-kzg-4844 v1.1.0 diff --git a/go.sum b/go.sum index b7000cfa85..b333de6c62 100644 --- a/go.sum +++ b/go.sum @@ -205,8 +205,8 @@ github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1: github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= -github.com/consensys/gnark-crypto v0.18.0 h1:vIye/FqI50VeAr0B3dx+YjeIvmc3LWz4yEfbWBpTUf0= -github.com/consensys/gnark-crypto v0.18.0/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c= +github.com/consensys/gnark-crypto v0.18.1 h1:RyLV6UhPRoYYzaFnPQA4qK3DyuDgkTgskDdoGqFt3fI= +github.com/consensys/gnark-crypto v0.18.1/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c= github.com/containerd/cgroups v0.0.0-20201119153540-4cbc285b3327/go.mod h1:ZJeTFisyysqgcCdecO57Dj79RfL0LNeGiFUqLYQRYLE= github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= From 0c3fdafc1c5baa8d55c28b48d324b031e67c40ed Mon Sep 17 00:00:00 2001 From: Eric <45141191+zlacfzy@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:39:01 +0800 Subject: [PATCH 4/6] internal/ethapi: fix eth_simulateV1 (#3433) --- internal/ethapi/simulate.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/internal/ethapi/simulate.go b/internal/ethapi/simulate.go index 1b69f4977f..5c99aaad25 100644 --- a/internal/ethapi/simulate.go +++ b/internal/ethapi/simulate.go @@ -36,6 +36,7 @@ import ( "github.com/ethereum/go-ethereum/internal/ethapi/override" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" + "github.com/ethereum/go-ethereum/trie" ) const ( @@ -371,7 +372,7 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header, } blockBody := &types.Body{Transactions: txes, Withdrawals: *block.BlockOverrides.Withdrawals} chainHeadReader := &simChainHeadReader{ctx, sim.b} - b, _, err := sim.b.Engine().FinalizeAndAssemble(chainHeadReader, header, sim.state, blockBody, receipts, nil) + b, err := sim.FinalizeAndAssemble(chainHeadReader, header, sim.state, blockBody, receipts) if err != nil { return nil, nil, nil, err } @@ -527,6 +528,17 @@ func (sim *simulator) newSimulatedChainContext(ctx context.Context, headers []*t return NewChainContext(ctx, &simBackend{base: sim.base, b: sim.b, headers: headers}) } +func (sim *simulator) FinalizeAndAssemble(chain *simChainHeadReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, error) { + header.Root = sim.state.IntermediateRoot(true) + if sim.chainConfig.IsShanghai(header.Number, header.Time) { + if body.Withdrawals == nil { + body.Withdrawals = make([]*types.Withdrawal, 0) + } + } + block := types.NewBlock(header, body, receipts, trie.NewStackTrie(nil)) + return block, nil +} + type simBackend struct { b ChainContextBackend base *types.Header From 8139edee158154e0158d09065adbdb4c469298d8 Mon Sep 17 00:00:00 2001 From: Eric <45141191+zlacfzy@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:39:40 +0800 Subject: [PATCH 5/6] eth/tracers: fix crasher in TraceCall with BlockOverrides (#3431) --- eth/tracers/api.go | 2 +- eth/tracers/api_test.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 8bf6ca0d99..42fbd62770 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -1090,7 +1090,7 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, bloc // Apply the customization rules if required. if config != nil { - if config.BlockOverrides != nil && config.BlockOverrides.Number.ToInt().Uint64() == h.Number.Uint64()+1 { + if config.BlockOverrides != nil && config.BlockOverrides.Number != nil && config.BlockOverrides.Number.ToInt().Uint64() == h.Number.Uint64()+1 { // Overriding the block number to n+1 is a common way for wallets to // simulate transactions, however without the following fix, a contract // can assert it is being simulated by checking if blockhash(n) == 0x0 and diff --git a/eth/tracers/api_test.go b/eth/tracers/api_test.go index cf8aa9587a..4de656e686 100644 --- a/eth/tracers/api_test.go +++ b/eth/tracers/api_test.go @@ -468,6 +468,20 @@ func TestTraceCall(t *testing.T) { {"pc":0,"op":"NUMBER","gas":24946984,"gasCost":2,"depth":1,"stack":[]}, {"pc":1,"op":"STOP","gas":24946982,"gasCost":0,"depth":1,"stack":["0x1337"]}]}`, }, + // Tests issue #33014 where accessing nil block number override panics. + { + blockNumber: rpc.BlockNumber(0), + call: ethapi.TransactionArgs{ + From: &accounts[0].addr, + To: &accounts[1].addr, + Value: (*hexutil.Big)(big.NewInt(1000)), + }, + config: &TraceCallConfig{ + BlockOverrides: &override.BlockOverrides{}, + }, + expectErr: nil, + expect: `{"gas":21000,"failed":false,"returnValue":"0x","structLogs":[]}`, + }, } for i, testspec := range testSuite { result, err := api.TraceCall(context.Background(), testspec.call, rpc.BlockNumberOrHash{BlockNumber: &testspec.blockNumber}, testspec.config) From 21cc14a732577f0c28d2e1cc9521c4f8764196fa Mon Sep 17 00:00:00 2001 From: zzzckck <152148891+zzzckck@users.noreply.github.com> Date: Thu, 6 Nov 2025 16:53:33 +0800 Subject: [PATCH 6/6] release: prepare for release v1.6.3 (#3437) --- CHANGELOG.md | 12 ++++++++++++ version/version.go | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55d10340e9..90be155caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,16 @@ # Changelog +## v1.6.3 +### FEATURE +NA + +### BUGFIX +[\#3429](https://github.com/bnb-chain/bsc/pull/3429) build(deps): bump github.com/consensys/gnark-crypto +[\#3433](https://github.com/bnb-chain/bsc/pull/3433) internal/ethapi: fix eth_simulateV1 +[\#3431](https://github.com/bnb-chain/bsc/pull/3431) eth/tracers: fix crasher in TraceCall with BlockOverrides + +### IMPROVEMENT +[\#3436](https://github.com/bnb-chain/bsc/pull/3436) revert: revert the nano check in parlia +[\#3435](https://github.com/bnb-chain/bsc/pull/3435) eth: fix stuck when handleBlockBroadcast ## v1.6.2 ### FEATURE diff --git a/version/version.go b/version/version.go index d0b4c648e1..d7fef55d94 100644 --- a/version/version.go +++ b/version/version.go @@ -19,6 +19,6 @@ package version const ( Major = 1 // Major version component of the current release Minor = 6 // Minor version component of the current release - Patch = 2 // Patch version component of the current release + Patch = 3 // Patch version component of the current release Meta = "" // Version metadata to append to the version string )