@@ -40,6 +40,7 @@ import (
40
40
"github.com/ethereum/go-ethereum/ethdb"
41
41
"github.com/ethereum/go-ethereum/params"
42
42
"github.com/ethereum/go-ethereum/trie"
43
+ "github.com/holiman/uint256"
43
44
)
44
45
45
46
// So we can deterministically seed different blockchains
@@ -3567,7 +3568,7 @@ func testInitThenFailCreateContract(t *testing.T, scheme string) {
3567
3568
defer chain .Stop ()
3568
3569
3569
3570
statedb , _ := chain .State ()
3570
- if got , exp := statedb .GetBalance (aa ), big .NewInt (100000 ); got .Cmp (exp ) != 0 {
3571
+ if got , exp := statedb .GetBalance (aa ), uint256 .NewInt (100000 ); got .Cmp (exp ) != 0 {
3571
3572
t .Fatalf ("Genesis err, got %v exp %v" , got , exp )
3572
3573
}
3573
3574
// First block tries to create, but fails
@@ -3577,7 +3578,7 @@ func testInitThenFailCreateContract(t *testing.T, scheme string) {
3577
3578
t .Fatalf ("block %d: failed to insert into chain: %v" , block .NumberU64 (), err )
3578
3579
}
3579
3580
statedb , _ = chain .State ()
3580
- if got , exp := statedb .GetBalance (aa ), big .NewInt (100000 ); got .Cmp (exp ) != 0 {
3581
+ if got , exp := statedb .GetBalance (aa ), uint256 .NewInt (100000 ); got .Cmp (exp ) != 0 {
3581
3582
t .Fatalf ("block %d: got %v exp %v" , block .NumberU64 (), got , exp )
3582
3583
}
3583
3584
}
@@ -3763,17 +3764,17 @@ func testEIP1559Transition(t *testing.T, scheme string) {
3763
3764
state , _ := chain .State ()
3764
3765
3765
3766
// 3: Ensure that miner received only the tx's tip.
3766
- actual := state .GetBalance (block .Coinbase ())
3767
+ actual := state .GetBalance (block .Coinbase ()). ToBig ()
3767
3768
expected := new (big.Int ).Add (
3768
3769
new (big.Int ).SetUint64 (block .GasUsed ()* block .Transactions ()[0 ].GasTipCap ().Uint64 ()),
3769
- ethash .ConstantinopleBlockReward ,
3770
+ ethash .ConstantinopleBlockReward . ToBig () ,
3770
3771
)
3771
3772
if actual .Cmp (expected ) != 0 {
3772
3773
t .Fatalf ("miner balance incorrect: expected %d, got %d" , expected , actual )
3773
3774
}
3774
3775
3775
3776
// 4: Ensure the tx sender paid for the gasUsed * (tip + block baseFee).
3776
- actual = new (big.Int ).Sub (funds , state .GetBalance (addr1 ))
3777
+ actual = new (big.Int ).Sub (funds , state .GetBalance (addr1 ). ToBig () )
3777
3778
expected = new (big.Int ).SetUint64 (block .GasUsed () * (block .Transactions ()[0 ].GasTipCap ().Uint64 () + block .BaseFee ().Uint64 ()))
3778
3779
if actual .Cmp (expected ) != 0 {
3779
3780
t .Fatalf ("sender balance incorrect: expected %d, got %d" , expected , actual )
@@ -3803,17 +3804,17 @@ func testEIP1559Transition(t *testing.T, scheme string) {
3803
3804
effectiveTip := block .Transactions ()[0 ].GasTipCap ().Uint64 () - block .BaseFee ().Uint64 ()
3804
3805
3805
3806
// 6+5: Ensure that miner received only the tx's effective tip.
3806
- actual = state .GetBalance (block .Coinbase ())
3807
+ actual = state .GetBalance (block .Coinbase ()). ToBig ()
3807
3808
expected = new (big.Int ).Add (
3808
3809
new (big.Int ).SetUint64 (block .GasUsed ()* effectiveTip ),
3809
- ethash .ConstantinopleBlockReward ,
3810
+ ethash .ConstantinopleBlockReward . ToBig () ,
3810
3811
)
3811
3812
if actual .Cmp (expected ) != 0 {
3812
3813
t .Fatalf ("miner balance incorrect: expected %d, got %d" , expected , actual )
3813
3814
}
3814
3815
3815
3816
// 4: Ensure the tx sender paid for the gasUsed * (effectiveTip + block baseFee).
3816
- actual = new (big.Int ).Sub (funds , state .GetBalance (addr2 ))
3817
+ actual = new (big.Int ).Sub (funds , state .GetBalance (addr2 ). ToBig () )
3817
3818
expected = new (big.Int ).SetUint64 (block .GasUsed () * (effectiveTip + block .BaseFee ().Uint64 ()))
3818
3819
if actual .Cmp (expected ) != 0 {
3819
3820
t .Fatalf ("sender balance incorrect: expected %d, got %d" , expected , actual )
@@ -4628,14 +4629,14 @@ func TestEIP3651(t *testing.T) {
4628
4629
state , _ := chain .State ()
4629
4630
4630
4631
// 3: Ensure that miner received only the tx's tip.
4631
- actual := state .GetBalance (block .Coinbase ())
4632
+ actual := state .GetBalance (block .Coinbase ()). ToBig ()
4632
4633
expected := new (big.Int ).SetUint64 (block .GasUsed () * block .Transactions ()[0 ].GasTipCap ().Uint64 ())
4633
4634
if actual .Cmp (expected ) != 0 {
4634
4635
t .Fatalf ("miner balance incorrect: expected %d, got %d" , expected , actual )
4635
4636
}
4636
4637
4637
4638
// 4: Ensure the tx sender paid for the gasUsed * (tip + block baseFee).
4638
- actual = new (big.Int ).Sub (funds , state .GetBalance (addr1 ))
4639
+ actual = new (big.Int ).Sub (funds , state .GetBalance (addr1 ). ToBig () )
4639
4640
expected = new (big.Int ).SetUint64 (block .GasUsed () * (block .Transactions ()[0 ].GasTipCap ().Uint64 () + block .BaseFee ().Uint64 ()))
4640
4641
if actual .Cmp (expected ) != 0 {
4641
4642
t .Fatalf ("sender balance incorrect: expected %d, got %d" , expected , actual )
0 commit comments