upstream: fixed a few unit tests

This commit is contained in:
Pratik Patil 2025-05-06 17:53:46 +05:30
parent 6f7df946d3
commit 0ecde767da
No known key found for this signature in database
GPG key ID: AFDCA496554874B3
3 changed files with 20 additions and 3 deletions

View file

@ -33,6 +33,7 @@ import (
"github.com/ethereum/go-ethereum/common/math"
"github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/filtermaps"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
@ -99,6 +100,8 @@ func NewSimulatedBackendWithDatabase(database ethdb.Database, alloc types.Genesi
config: genesis.Config,
}
filterBackend := &filterBackend{database, blockchain, backend}
backend.filterSystem = filters.NewFilterSystem(filterBackend, filters.Config{})
backend.events = filters.NewEventSystem(backend.filterSystem)
header := backend.blockchain.CurrentBlock()
@ -970,6 +973,10 @@ func (fb *filterBackend) CurrentHeader() *types.Header {
panic("not supported")
}
func (fb *filterBackend) NewMatcherBackend() filtermaps.MatcherBackend {
panic("not supported")
}
func nullSubscription() event.Subscription {
return event.NewSubscription(func(quit <-chan struct{}) error {
<-quit

View file

@ -27,7 +27,17 @@ import (
func TestCalcExcessBlobGas(t *testing.T) {
var (
config = params.MainnetChainConfig
config = &params.ChainConfig{
LondonBlock: big.NewInt(0),
CancunBlock: big.NewInt(0),
BlobScheduleConfig: &params.BlobScheduleConfig{
Cancun: &params.BlobConfig{
Target: 3,
Max: 6,
UpdateFraction: 3338477,
},
},
}
targetBlobs = targetBlobsPerBlock(config, uint64(0))
targetBlobGas = uint64(targetBlobs) * params.BlobTxBlobGasPerBlob
)

View file

@ -2292,7 +2292,7 @@ func testSideImport(t *testing.T, numCanonBlocksInSidechain, blocksBetweenCommon
mergeBlock = 0
// Set the terminal total difficulty in the config
gspec.Config.TerminalTotalDifficulty = big.NewInt(0)
chain.Config().TerminalTotalDifficulty = big.NewInt(0)
}
genDb, blocks, _ := GenerateChainWithGenesis(gspec, engine, 2*state.TriesInMemory, func(i int, gen *BlockGen) {
tx, err := types.SignTx(types.NewTransaction(nonce, common.HexToAddress("deadbeef"), big.NewInt(100), 21000, big.NewInt(int64(i+1)*params.GWei), nil), signer, key)
@ -2329,7 +2329,7 @@ func testSideImport(t *testing.T, numCanonBlocksInSidechain, blocksBetweenCommon
// Set the terminal total difficulty in the config
ttd := big.NewInt(int64(len(blocks)))
ttd.Mul(ttd, params.GenesisDifficulty)
gspec.Config.TerminalTotalDifficulty = ttd
chain.Config().TerminalTotalDifficulty = ttd
mergeBlock = len(blocks)
}