revert cleanup: ressurect most tests

This commit is contained in:
Lindsey Gray 2023-12-29 15:20:44 -06:00
parent 239012343a
commit c405487fca
8 changed files with 27 additions and 25 deletions

View file

@ -96,7 +96,7 @@ func TestRemoteNotifyFull(t *testing.T) {
config := Config{ config := Config{
PowMode: ModeTest, PowMode: ModeTest,
NotifyFull: true, NotifyFull: true,
Log: testlog.Logger(t, log.LvlWarn), Log: testlog.Logger(t, log.LevelWarn),
} }
ethash := New(config, []string{server.URL}, false) ethash := New(config, []string{server.URL}, false)
defer ethash.Close() defer ethash.Close()
@ -139,7 +139,7 @@ func TestRemoteMultiNotify(t *testing.T) {
// Create the custom ethash engine. // Create the custom ethash engine.
ethash := NewTester([]string{server.URL}, false) ethash := NewTester([]string{server.URL}, false)
ethash.config.Log = testlog.Logger(t, log.LvlWarn) ethash.config.Log = testlog.Logger(t, log.LevelWarn)
defer ethash.Close() defer ethash.Close()
// Provide a results reader. // Provide a results reader.
@ -186,7 +186,7 @@ func TestRemoteMultiNotifyFull(t *testing.T) {
config := Config{ config := Config{
PowMode: ModeTest, PowMode: ModeTest,
NotifyFull: true, NotifyFull: true,
Log: testlog.Logger(t, log.LvlWarn), Log: testlog.Logger(t, log.LevelWarn),
} }
ethash := New(config, []string{server.URL}, false) ethash := New(config, []string{server.URL}, false)
defer ethash.Close() defer ethash.Close()

View file

@ -18,6 +18,7 @@ package core
import ( import (
"math/big" "math/big"
"runtime"
"testing" "testing"
"time" "time"

View file

@ -1065,7 +1065,7 @@ func testLightVsFastVsFullChainHeads(t *testing.T, scheme string) {
defer lightDb.Close() defer lightDb.Close()
light, _ := NewBlockChain(lightDb, DefaultCacheConfigWithScheme(scheme), gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil) light, _ := NewBlockChain(lightDb, DefaultCacheConfigWithScheme(scheme), gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil)
if n, err := light.InsertHeaderChain(headers); err != nil { if n, err := light.InsertHeaderChain(headers, 1); err != nil {
t.Fatalf("failed to insert header %d: %v", n, err) t.Fatalf("failed to insert header %d: %v", n, err)
} }
defer light.Stop() defer light.Stop()

View file

@ -30,7 +30,7 @@ import (
"github.com/ethereum/go-ethereum/common/fdlimit" "github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool" "github.com/ethereum/go-ethereum/core/txpool/legacypool"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth"
@ -49,7 +49,7 @@ var (
) )
func main() { func main() {
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
fdlimit.Raise(2048) fdlimit.Raise(2048)
// Generate a batch of accounts to seal and fund with // Generate a batch of accounts to seal and fund with
@ -130,8 +130,9 @@ func main() {
// Create a self transaction and inject into the pool. The legacy // Create a self transaction and inject into the pool. The legacy
// and 1559 transactions can all be created by random even if the // and 1559 transactions can all be created by random even if the
// fork is not happened. // fork is not happened.
tx := makeTransaction(nonces[index], faucets[index], signer, baseFee) ttx := makeTransaction(nonces[index], faucets[index], signer, baseFee)
if err := backend.TxPool().AddLocal(tx); err != nil { tx := []*types.Transaction{ttx}
if err := backend.TxPool().Add(tx, true, true); err != nil {
continue continue
} }
nonces[index]++ nonces[index]++
@ -246,7 +247,7 @@ func makeMiner(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) {
SyncMode: downloader.FullSync, SyncMode: downloader.FullSync,
DatabaseCache: 256, DatabaseCache: 256,
DatabaseHandles: 256, DatabaseHandles: 256,
TxPool: txpool.DefaultConfig, TxPool: legacypool.DefaultConfig,
GPO: ethconfig.Defaults.GPO, GPO: ethconfig.Defaults.GPO,
Ethash: ethconfig.Defaults.Ethash, Ethash: ethconfig.Defaults.Ethash,
Miner: miner.Config{ Miner: miner.Config{

View file

@ -32,7 +32,7 @@ import (
"github.com/ethereum/go-ethereum/common/fdlimit" "github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool" "github.com/ethereum/go-ethereum/core/txpool/legacypool"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth"
@ -134,8 +134,6 @@ func newNode(typ nodetype, genesis *core.Genesis, enodes []*enode.Node) *ethNode
typ: typ, typ: typ,
api: api, api: api,
ethBackend: ethBackend, ethBackend: ethBackend,
lapi: lapi,
lesBackend: lesBackend,
stack: stack, stack: stack,
enode: enode, enode: enode,
} }
@ -192,7 +190,7 @@ func (n *ethNode) insertBlockAndSetHead(parent *types.Header, ed engine.Executab
if err := n.insertBlock(ed); err != nil { if err := n.insertBlock(ed); err != nil {
return err return err
} }
block, err := engine.ExecutableDataToBlock(ed) block, err := engine.ExecutableDataToBlock(ed, nil, nil)
if err != nil { if err != nil {
return err return err
} }
@ -347,7 +345,7 @@ func (mgr *nodeManager) run() {
log.Error("Failed to assemble the block", "err", err) log.Error("Failed to assemble the block", "err", err)
continue continue
} }
block, _ := engine.ExecutableDataToBlock(*ed) block, _ := engine.ExecutableDataToBlock(*ed, nil, nil)
nodes := mgr.getNodes(eth2MiningNode) nodes := mgr.getNodes(eth2MiningNode)
nodes = append(nodes, mgr.getNodes(eth2NormalNode)...) nodes = append(nodes, mgr.getNodes(eth2NormalNode)...)
@ -365,7 +363,7 @@ func (mgr *nodeManager) run() {
} }
func main() { func main() {
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
fdlimit.Raise(2048) fdlimit.Raise(2048)
// Generate a batch of accounts to seal and fund with // Generate a batch of accounts to seal and fund with
@ -404,11 +402,12 @@ func main() {
node := nodes[index%len(nodes)] node := nodes[index%len(nodes)]
// Create a self transaction and inject into the pool // Create a self transaction and inject into the pool
tx, err := types.SignTx(types.NewTransaction(nonces[index], crypto.PubkeyToAddress(faucets[index].PublicKey), new(big.Int), 21000, big.NewInt(10_000_000_000+rand.Int63n(6_553_600_000)), nil), types.HomesteadSigner{}, faucets[index]) ttx, err := types.SignTx(types.NewTransaction(nonces[index], crypto.PubkeyToAddress(faucets[index].PublicKey), new(big.Int), 21000, big.NewInt(10_000_000_000+rand.Int63n(6_553_600_000)), nil), types.HomesteadSigner{}, faucets[index])
if err != nil { if err != nil {
panic(err) panic(err)
} }
if err := node.ethBackend.TxPool().AddLocal(tx); err != nil { tx := []*types.Transaction{ttx}
if err := node.ethBackend.TxPool().Add(tx, true, true); err != nil {
panic(err) panic(err)
} }
nonces[index]++ nonces[index]++
@ -466,7 +465,7 @@ func makeFullNode(genesis *core.Genesis) (*node.Node, *eth.Ethereum, *ethcatalys
SyncMode: downloader.FullSync, SyncMode: downloader.FullSync,
DatabaseCache: 256, DatabaseCache: 256,
DatabaseHandles: 256, DatabaseHandles: 256,
TxPool: txpool.DefaultConfig, TxPool: legacypool.DefaultConfig,
GPO: ethconfig.Defaults.GPO, GPO: ethconfig.Defaults.GPO,
Ethash: ethconfig.Defaults.Ethash, Ethash: ethconfig.Defaults.Ethash,
Miner: miner.Config{ Miner: miner.Config{

View file

@ -29,7 +29,7 @@ import (
"github.com/ethereum/go-ethereum/common/fdlimit" "github.com/ethereum/go-ethereum/common/fdlimit"
"github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/consensus/ethash"
"github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/txpool" "github.com/ethereum/go-ethereum/core/txpool/legacypool"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth"
@ -44,7 +44,7 @@ import (
) )
func main() { func main() {
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
fdlimit.Raise(2048) fdlimit.Raise(2048)
// Generate a batch of accounts to seal and fund with // Generate a batch of accounts to seal and fund with
@ -115,11 +115,12 @@ func main() {
backend := nodes[index%len(nodes)] backend := nodes[index%len(nodes)]
// Create a self transaction and inject into the pool // Create a self transaction and inject into the pool
tx, err := types.SignTx(types.NewTransaction(nonces[index], crypto.PubkeyToAddress(faucets[index].PublicKey), new(big.Int), 21000, big.NewInt(100000000000+rand.Int63n(65536)), nil), types.HomesteadSigner{}, faucets[index]) ttx, err := types.SignTx(types.NewTransaction(nonces[index], crypto.PubkeyToAddress(faucets[index].PublicKey), new(big.Int), 21000, big.NewInt(100000000000+rand.Int63n(65536)), nil), types.HomesteadSigner{}, faucets[index])
if err != nil { if err != nil {
panic(err) panic(err)
} }
if err := backend.TxPool().AddLocal(tx); err != nil { tx := []*types.Transaction{ttx}
if err := backend.TxPool().Add(tx, true, true); err != nil {
panic(err) panic(err)
} }
nonces[index]++ nonces[index]++
@ -175,7 +176,7 @@ func makeMiner(genesis *core.Genesis) (*node.Node, *eth.Ethereum, error) {
SyncMode: downloader.FullSync, SyncMode: downloader.FullSync,
DatabaseCache: 256, DatabaseCache: 256,
DatabaseHandles: 256, DatabaseHandles: 256,
TxPool: txpool.DefaultConfig, TxPool: legacypool.DefaultConfig,
GPO: ethconfig.Defaults.GPO, GPO: ethconfig.Defaults.GPO,
Ethash: ethconfig.Defaults.Ethash, Ethash: ethconfig.Defaults.Ethash,
Miner: miner.Config{ Miner: miner.Config{

View file

@ -157,7 +157,7 @@ var (
PragueTime: nil, PragueTime: nil,
VerkleTime: nil, VerkleTime: nil,
TerminalTotalDifficulty: nil, TerminalTotalDifficulty: nil,
TerminalTotalDifficultyPassed: false, TerminalTotalDifficultyPassed: true,
Ethash: new(EthashConfig), Ethash: new(EthashConfig),
Clique: nil, Clique: nil,
} }