@@ -187,7 +187,7 @@ var (
187
187
)
188
188
189
189
var genesis = & core.Genesis {
190
- Config : params .AllEthashProtocolChanges ,
190
+ Config : params .TestChainConfig ,
191
191
Alloc : core.GenesisAlloc {
192
192
testAddr : {Balance : testBalance },
193
193
rcfg .L1GasPriceOracleAddress : {
@@ -429,7 +429,7 @@ func testChainID(t *testing.T, client *rpc.Client) {
429
429
if err != nil {
430
430
t .Fatalf ("unexpected error: %v" , err )
431
431
}
432
- if id == nil || id .Cmp (params .AllEthashProtocolChanges .ChainID ) != 0 {
432
+ if id == nil || id .Cmp (params .TestChainConfig .ChainID ) != 0 {
433
433
t .Fatalf ("ChainID returned wrong number: %+v" , id )
434
434
}
435
435
}
@@ -500,12 +500,21 @@ func testStatusFunctions(t *testing.T, client *rpc.Client) {
500
500
t .Fatalf ("unexpected networkID: %v" , networkID )
501
501
}
502
502
503
+ // In newTestBackend we're creating a chain with 3 blocks adding 2 txs into block 2.
504
+ // Both testTx1 and testTx2 set a gas price of params.InitialBaseFee=1000000000.
505
+ //
506
+ // We expect SuggestGasPrice to return the same value, combined out of:
507
+ // - the base fee of the block (48700046)
508
+ // base fee of block 1 and 2 is as follows (ignoring initialBaseFee of L2 block):
509
+ // eip1559.CalcBaseFee(nil, nil, new(big.Int).SetUint64(rcfg.L1BaseFeeSlot=10000))
510
+ // - the tip cap of the block (951299954)
511
+
503
512
// SuggestGasPrice
504
513
gasPrice , err := ec .SuggestGasPrice (context .Background ())
505
514
if err != nil {
506
515
t .Fatalf ("unexpected error: %v" , err )
507
516
}
508
- if gasPrice .Cmp (big .NewInt (1000000000 )) != 0 {
517
+ if gasPrice .Cmp (big .NewInt (48700046 + 951299954 )) != 0 {
509
518
t .Fatalf ("unexpected gas price: %v" , gasPrice )
510
519
}
511
520
@@ -514,7 +523,7 @@ func testStatusFunctions(t *testing.T, client *rpc.Client) {
514
523
if err != nil {
515
524
t .Fatalf ("unexpected error: %v" , err )
516
525
}
517
- if gasTipCap .Cmp (big .NewInt (234375000 )) != 0 {
526
+ if gasTipCap .Cmp (big .NewInt (951299954 )) != 0 {
518
527
t .Fatalf ("unexpected gas tip cap: %v" , gasTipCap )
519
528
}
520
529
@@ -527,13 +536,13 @@ func testStatusFunctions(t *testing.T, client *rpc.Client) {
527
536
OldestBlock : big .NewInt (2 ),
528
537
Reward : [][]* big.Int {
529
538
{
530
- big .NewInt (234375000 ),
531
- big .NewInt (234375000 ),
539
+ big .NewInt (951299954 ),
540
+ big .NewInt (951299954 ),
532
541
},
533
542
},
534
543
BaseFee : []* big.Int {
535
- big .NewInt (765625000 ),
536
- big .NewInt (671627818 ),
544
+ big .NewInt (48700046 ),
545
+ big .NewInt (48700046 ),
537
546
},
538
547
GasUsedRatio : []float64 {0.008912678667376286 },
539
548
}
@@ -591,9 +600,11 @@ func testCallContract(t *testing.T, client *rpc.Client) {
591
600
t .Fatalf ("unexpected error: %v" , err )
592
601
}
593
602
// PendingCallContract
594
- if _ , err := ec .PendingCallContract (context .Background (), msg ); err != nil {
595
- t .Fatalf ("unexpected error: %v" , err )
596
- }
603
+ // Commented out since the worker is started in a separate goroutine this test leads to a race condition
604
+ // where sometimes a pending block is not yet available.
605
+ //if _, err := ec.PendingCallContract(context.Background(), msg); err != nil {
606
+ // t.Fatalf("unexpected error: %v", err)
607
+ //}
597
608
}
598
609
599
610
func testAtFunctions (t * testing.T , client * rpc.Client ) {
0 commit comments