mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
fix tests
This commit is contained in:
parent
ea2cd2dc5d
commit
a0d10ec572
3 changed files with 13 additions and 14 deletions
|
|
@ -270,8 +270,6 @@ func TestGraphQLHTTPOnSamePort_GQLRequest_Unsuccessful(t *testing.T) {
|
||||||
|
|
||||||
// nolint:typecheck
|
// nolint:typecheck
|
||||||
func TestGraphQLConcurrentResolvers(t *testing.T) {
|
func TestGraphQLConcurrentResolvers(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
key, _ = crypto.GenerateKey()
|
key, _ = crypto.GenerateKey()
|
||||||
addr = crypto.PubkeyToAddress(key.PublicKey)
|
addr = crypto.PubkeyToAddress(key.PublicKey)
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ func TestBuildPayload(t *testing.T) {
|
||||||
recipient = common.HexToAddress("0xdeadbeef")
|
recipient = common.HexToAddress("0xdeadbeef")
|
||||||
)
|
)
|
||||||
|
|
||||||
w, b, _ := newTestWorker(t, params.TestChainConfig, ethash.NewFaker(), db, 0, false, 0, 0)
|
w, b, _ := newTestWorker(t, params.TestChainConfig, ethash.NewFaker(), db, false, 0, 0)
|
||||||
defer w.close()
|
defer w.close()
|
||||||
|
|
||||||
timestamp := uint64(time.Now().Unix())
|
timestamp := uint64(time.Now().Unix())
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ func testGenerateBlockAndImport(t *testing.T, isClique bool, isBor bool) {
|
||||||
|
|
||||||
defer engine.Close()
|
defer engine.Close()
|
||||||
|
|
||||||
w, b, _ := newTestWorker(t, &chainConfig, engine, db, 0, false, 0, 0)
|
w, b, _ := newTestWorker(t, &chainConfig, engine, db, false, 0, 0)
|
||||||
defer w.close()
|
defer w.close()
|
||||||
|
|
||||||
// This test chain imports the mined blocks.
|
// This test chain imports the mined blocks.
|
||||||
|
|
@ -118,7 +118,7 @@ func testGenerateBlockAndImport(t *testing.T, isClique bool, isBor bool) {
|
||||||
t.Fatal("while adding a local transaction", err)
|
t.Fatal("while adding a local transaction", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = b.txPool.Add([]*txpool.Transaction{{Tx: b.newRandomTx(false)}}, true, false)[0]
|
err = b.txPool.Add([]*txpool.Transaction{{Tx: b.newRandomTx(false)}}, false, false)[0]
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("while adding a remote transaction", err)
|
t.Fatal("while adding a remote transaction", err)
|
||||||
}
|
}
|
||||||
|
|
@ -348,7 +348,7 @@ func (b *testWorkerBackend) newStorageContractCallTx(to common.Address, nonce ui
|
||||||
return tx
|
return tx
|
||||||
}
|
}
|
||||||
|
|
||||||
func newTestWorker(t TensingObject, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, blocks int, noempty bool, delay uint, opcodeDelay uint) (*worker, *testWorkerBackend, func()) {
|
func newTestWorker(t TensingObject, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, noempty bool, delay uint, opcodeDelay uint) (*worker, *testWorkerBackend, func()) {
|
||||||
backend := newTestWorkerBackend(t, chainConfig, engine, db)
|
backend := newTestWorkerBackend(t, chainConfig, engine, db)
|
||||||
backend.txPool.Add(pendingTxs, true, false)
|
backend.txPool.Add(pendingTxs, true, false)
|
||||||
var w *worker
|
var w *worker
|
||||||
|
|
@ -361,6 +361,7 @@ func newTestWorker(t TensingObject, chainConfig *params.ChainConfig, engine cons
|
||||||
}
|
}
|
||||||
w.setEtherbase(testBankAddress)
|
w.setEtherbase(testBankAddress)
|
||||||
// enable empty blocks
|
// enable empty blocks
|
||||||
|
w.noempty.Store(noempty)
|
||||||
return w, backend, w.close
|
return w, backend, w.close
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -372,7 +373,7 @@ func TestGenerateAndImportBlock(t *testing.T) {
|
||||||
config.Clique = ¶ms.CliqueConfig{Period: 1, Epoch: 30000}
|
config.Clique = ¶ms.CliqueConfig{Period: 1, Epoch: 30000}
|
||||||
engine := clique.New(config.Clique, db)
|
engine := clique.New(config.Clique, db)
|
||||||
|
|
||||||
w, b, _ := newTestWorker(t, &config, engine, db, 0, false, 0, 0)
|
w, b, _ := newTestWorker(t, &config, engine, db, false, 0, 0)
|
||||||
defer w.close()
|
defer w.close()
|
||||||
|
|
||||||
// This test chain imports the mined blocks.
|
// This test chain imports the mined blocks.
|
||||||
|
|
@ -450,7 +451,7 @@ func testEmptyWork(t *testing.T, chainConfig *params.ChainConfig, engine consens
|
||||||
t.Helper()
|
t.Helper()
|
||||||
defer engine.Close()
|
defer engine.Close()
|
||||||
|
|
||||||
w, _, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, false, 0, 0)
|
w, _, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), false, 0, 0)
|
||||||
defer w.close()
|
defer w.close()
|
||||||
|
|
||||||
taskCh := make(chan struct{}, 2)
|
taskCh := make(chan struct{}, 2)
|
||||||
|
|
@ -497,7 +498,7 @@ func TestAdjustIntervalClique(t *testing.T) {
|
||||||
func testAdjustInterval(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine) {
|
func testAdjustInterval(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine) {
|
||||||
defer engine.Close()
|
defer engine.Close()
|
||||||
|
|
||||||
w, _, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, false, 0, 0)
|
w, _, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), false, 0, 0)
|
||||||
defer w.close()
|
defer w.close()
|
||||||
|
|
||||||
w.skipSealHook = func(task *task) bool {
|
w.skipSealHook = func(task *task) bool {
|
||||||
|
|
@ -599,7 +600,7 @@ func TestGetSealingWorkPostMerge(t *testing.T) {
|
||||||
func testGetSealingWork(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine) {
|
func testGetSealingWork(t *testing.T, chainConfig *params.ChainConfig, engine consensus.Engine) {
|
||||||
defer engine.Close()
|
defer engine.Close()
|
||||||
|
|
||||||
w, b, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, false, 0, 0)
|
w, b, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), false, 0, 0)
|
||||||
defer w.close()
|
defer w.close()
|
||||||
|
|
||||||
w.setExtra([]byte{0x01, 0x02})
|
w.setExtra([]byte{0x01, 0x02})
|
||||||
|
|
@ -759,7 +760,7 @@ func testCommitInterruptExperimentBorContract(t *testing.T, delay uint, txCount
|
||||||
|
|
||||||
engine, _ = getFakeBorFromConfig(t, chainConfig)
|
engine, _ = getFakeBorFromConfig(t, chainConfig)
|
||||||
|
|
||||||
w, b, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, false, 0, 0)
|
w, b, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), true, delay, opcodeDelay)
|
||||||
defer w.close()
|
defer w.close()
|
||||||
|
|
||||||
// nonce 0 tx
|
// nonce 0 tx
|
||||||
|
|
@ -813,7 +814,7 @@ func testCommitInterruptExperimentBor(t *testing.T, delay uint, txCount int, opc
|
||||||
|
|
||||||
engine, ctrl = getFakeBorFromConfig(t, chainConfig)
|
engine, ctrl = getFakeBorFromConfig(t, chainConfig)
|
||||||
|
|
||||||
w, b, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, false, 0, 0)
|
w, b, _ := newTestWorker(t, chainConfig, engine, rawdb.NewMemoryDatabase(), true, delay, opcodeDelay)
|
||||||
defer func() {
|
defer func() {
|
||||||
w.close()
|
w.close()
|
||||||
engine.Close()
|
engine.Close()
|
||||||
|
|
@ -877,7 +878,7 @@ func BenchmarkBorMining(b *testing.B) {
|
||||||
|
|
||||||
chainConfig.LondonBlock = big.NewInt(0)
|
chainConfig.LondonBlock = big.NewInt(0)
|
||||||
|
|
||||||
w, back, _ := newTestWorker(b, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, false, 0, 0)
|
w, back, _ := newTestWorker(b, chainConfig, engine, rawdb.NewMemoryDatabase(), false, 0, 0)
|
||||||
defer w.close()
|
defer w.close()
|
||||||
|
|
||||||
chain, _ := core.NewBlockChain(rawdb.NewMemoryDatabase(), nil, back.genesis, nil, engine, vm.Config{}, nil, nil, nil)
|
chain, _ := core.NewBlockChain(rawdb.NewMemoryDatabase(), nil, back.genesis, nil, engine, vm.Config{}, nil, nil, nil)
|
||||||
|
|
@ -974,7 +975,7 @@ func BenchmarkBorMiningBlockSTMMetadata(b *testing.B) {
|
||||||
|
|
||||||
chainConfig.LondonBlock = big.NewInt(0)
|
chainConfig.LondonBlock = big.NewInt(0)
|
||||||
|
|
||||||
w, back, _ := newTestWorker(b, chainConfig, engine, rawdb.NewMemoryDatabase(), 0, false, 0, 0)
|
w, back, _ := newTestWorker(b, chainConfig, engine, rawdb.NewMemoryDatabase(), false, 0, 0)
|
||||||
defer w.close()
|
defer w.close()
|
||||||
|
|
||||||
// This test chain imports the mined blocks.
|
// This test chain imports the mined blocks.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue