From c4e42d9d285c05475c2ece58b8f49e3a9b1b7325 Mon Sep 17 00:00:00 2001 From: Eric <45141191+zzphust@users.noreply.github.com> Date: Mon, 30 Oct 2023 13:38:47 +0800 Subject: [PATCH 1/4] fix: 2 APIs of get receipt related(#1950) * fix: GetTransactionReceiptsByBlockNumber & GetTransactionDataAndReceipt --- internal/ethapi/api.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 177ab97c1858..7af5fb5b84de 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1914,10 +1914,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceiptsByBlockNumber(ctx conte txReceipts := make([]map[string]interface{}, 0, len(txs)) for idx, receipt := range receipts { tx := txs[idx] - var signer types.Signer = types.FrontierSigner{} - if tx.Protected() { - signer = types.NewEIP155Signer(tx.ChainId()) - } + signer := types.MakeSigner(s.b.ChainConfig(), block.Number()) from, _ := types.Sender(signer, tx) fields := map[string]interface{}{ @@ -1932,6 +1929,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceiptsByBlockNumber(ctx conte "contractAddress": nil, "logs": receipt.Logs, "logsBloom": receipt.Bloom, + "type": hexutil.Uint(tx.Type()), } // Assign receipt status or post state. @@ -2005,6 +2003,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionDataAndReceipt(ctx context.Cont "contractAddress": nil, "logs": receipt.Logs, "logsBloom": receipt.Bloom, + "type": hexutil.Uint(tx.Type()), } // Assign receipt status or post state. From 6a24b47fa8300a153a8a57fa944e35f5d80cd63a Mon Sep 17 00:00:00 2001 From: lx <92799281+brilliant-lx@users.noreply.github.com> Date: Tue, 31 Oct 2023 11:32:31 +0800 Subject: [PATCH 2/4] trie: keep trie prefetch during validation phase (#1954) --- core/state/state_object.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/core/state/state_object.go b/core/state/state_object.go index 1ede96ec6385..a3b5b016a402 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -165,20 +165,20 @@ func (s *StateObject) getTrie(db Database) Trie { if s.trie == nil { // Try fetching from prefetcher first // We don't prefetch empty tries - prefetcher := s.db.prefetcher - if s.data.Root != emptyRoot && prefetcher != nil { - // When the miner is creating the pending state, there is no - // prefetcher - s.trie = prefetcher.trie(s.data.Root) - } - if s.trie == nil { - var err error - s.trie, err = db.OpenStorageTrie(s.addrHash, s.data.Root) - if err != nil { - s.trie, _ = db.OpenStorageTrie(s.addrHash, common.Hash{}) - s.setError(fmt.Errorf("can't create storage trie: %v", err)) - } + // prefetcher := s.db.prefetcher + // if s.data.Root != emptyRoot && prefetcher != nil { + // When the miner is creating the pending state, there is no + // prefetcher + // s.trie = prefetcher.trie(s.data.Root) + // } + // if s.trie == nil { + var err error + s.trie, err = db.OpenStorageTrie(s.addrHash, s.data.Root) + if err != nil { + s.trie, _ = db.OpenStorageTrie(s.addrHash, common.Hash{}) + s.setError(fmt.Errorf("can't create storage trie: %v", err)) } + // } } return s.trie } From 0bd3fb0b6f5ec6e008732e424ca77b23d5e3b37d Mon Sep 17 00:00:00 2001 From: "larry.lx" Date: Wed, 1 Nov 2023 14:47:30 +0800 Subject: [PATCH 3/4] release: prepare for release v1.2.13 --- CHANGELOG.md | 7 +++++++ params/version.go | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 848e37c864c9..3dd57b85f4dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ # Changelog +## v1.2.13 +IMPROVEMENT +* [\#1954](https://github.com/bnb-chain/bsc/pull/1954) performance: keep trie prefetch during validation phase + +BUGFIX +* [\#1950](https://github.com/bnb-chain/bsc/pull/1950) fix: 2 APIs of get receipt related(#1950) + ## v1.2.12 FEATURE * [\#1852](https://github.com/bnb-chain/bsc/pull/1852) discov: add hardcoded bootnodes diff --git a/params/version.go b/params/version.go index d9476925ce64..b8d7e5ab9b27 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 2 // Minor version component of the current release - VersionPatch = 12 // Patch version component of the current release + VersionPatch = 13 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string ) From f6ebc0e31d43cdee85415e9346e2b42385adbff7 Mon Sep 17 00:00:00 2001 From: "larry.lx" Date: Wed, 29 Nov 2023 12:37:43 +0800 Subject: [PATCH 4/4] fix: remove sharedPool --- CHANGELOG.md | 4 ++++ core/state_prefetcher.go | 8 ++++++-- params/version.go | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3dd57b85f4dc..7f27205db2df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Changelog +## v1.2.14 +BUGFIX +fix: remove sharedPool + ## v1.2.13 IMPROVEMENT * [\#1954](https://github.com/bnb-chain/bsc/pull/1954) performance: keep trie prefetch during validation phase diff --git a/core/state_prefetcher.go b/core/state_prefetcher.go index 4ec9fc3ecd78..0115dd9fe591 100644 --- a/core/state_prefetcher.go +++ b/core/state_prefetcher.go @@ -59,7 +59,9 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c for i := 0; i < prefetchThread; i++ { go func() { newStatedb := statedb.CopyDoPrefetch() - newStatedb.EnableWriteOnSharedStorage() + if header.Number.Uint64() < 33968300 { + newStatedb.EnableWriteOnSharedStorage() + } gaspool := new(GasPool).AddGas(block.GasLimit()) blockContext := NewEVMBlockContext(header, p.bc, nil) evm := vm.NewEVM(blockContext, vm.TxContext{}, statedb, p.config, *cfg) @@ -105,7 +107,9 @@ func (p *statePrefetcher) PrefetchMining(txs *types.TransactionsByPriceAndNonce, go func(startCh <-chan *types.Transaction, stopCh <-chan struct{}) { idx := 0 newStatedb := statedb.CopyDoPrefetch() - newStatedb.EnableWriteOnSharedStorage() + if header.Number.Uint64() < 33968300 { + newStatedb.EnableWriteOnSharedStorage() + } gaspool := new(GasPool).AddGas(gasLimit) blockContext := NewEVMBlockContext(header, p.bc, nil) evm := vm.NewEVM(blockContext, vm.TxContext{}, statedb, p.config, cfg) diff --git a/params/version.go b/params/version.go index b8d7e5ab9b27..e1cef233507d 100644 --- a/params/version.go +++ b/params/version.go @@ -23,7 +23,7 @@ import ( const ( VersionMajor = 1 // Major version component of the current release VersionMinor = 2 // Minor version component of the current release - VersionPatch = 13 // Patch version component of the current release + VersionPatch = 14 // Patch version component of the current release VersionMeta = "" // Version metadata to append to the version string )