@@ -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
@@ -3652,7 +3653,7 @@ func testInitThenFailCreateContract(t *testing.T, scheme string) {
3652
3653
defer chain .Stop ()
3653
3654
3654
3655
statedb , _ := chain .State ()
3655
- if got , exp := statedb .GetBalance (aa ), big .NewInt (100000 ); got .Cmp (exp ) != 0 {
3656
+ if got , exp := statedb .GetBalance (aa ), uint256 .NewInt (100000 ); got .Cmp (exp ) != 0 {
3656
3657
t .Fatalf ("Genesis err, got %v exp %v" , got , exp )
3657
3658
}
3658
3659
// First block tries to create, but fails
@@ -3662,7 +3663,7 @@ func testInitThenFailCreateContract(t *testing.T, scheme string) {
3662
3663
t .Fatalf ("block %d: failed to insert into chain: %v" , block .NumberU64 (), err )
3663
3664
}
3664
3665
statedb , _ = chain .State ()
3665
- if got , exp := statedb .GetBalance (aa ), big .NewInt (100000 ); got .Cmp (exp ) != 0 {
3666
+ if got , exp := statedb .GetBalance (aa ), uint256 .NewInt (100000 ); got .Cmp (exp ) != 0 {
3666
3667
t .Fatalf ("block %d: got %v exp %v" , block .NumberU64 (), got , exp )
3667
3668
}
3668
3669
}
@@ -3848,17 +3849,17 @@ func testEIP1559Transition(t *testing.T, scheme string) {
3848
3849
state , _ := chain .State ()
3849
3850
3850
3851
// 3: Ensure that miner received only the tx's tip.
3851
- actual := state .GetBalance (block .Coinbase ())
3852
+ actual := state .GetBalance (block .Coinbase ()). ToBig ()
3852
3853
expected := new (big.Int ).Add (
3853
3854
new (big.Int ).SetUint64 (block .GasUsed ()* block .Transactions ()[0 ].GasTipCap ().Uint64 ()),
3854
- ethash .ConstantinopleBlockReward ,
3855
+ ethash .ConstantinopleBlockReward . ToBig () ,
3855
3856
)
3856
3857
if actual .Cmp (expected ) != 0 {
3857
3858
t .Fatalf ("miner balance incorrect: expected %d, got %d" , expected , actual )
3858
3859
}
3859
3860
3860
3861
// 4: Ensure the tx sender paid for the gasUsed * (tip + block baseFee).
3861
- actual = new (big.Int ).Sub (funds , state .GetBalance (addr1 ))
3862
+ actual = new (big.Int ).Sub (funds , state .GetBalance (addr1 ). ToBig () )
3862
3863
expected = new (big.Int ).SetUint64 (block .GasUsed () * (block .Transactions ()[0 ].GasTipCap ().Uint64 () + block .BaseFee ().Uint64 ()))
3863
3864
if actual .Cmp (expected ) != 0 {
3864
3865
t .Fatalf ("sender balance incorrect: expected %d, got %d" , expected , actual )
@@ -3888,17 +3889,17 @@ func testEIP1559Transition(t *testing.T, scheme string) {
3888
3889
effectiveTip := block .Transactions ()[0 ].GasTipCap ().Uint64 () - block .BaseFee ().Uint64 ()
3889
3890
3890
3891
// 6+5: Ensure that miner received only the tx's effective tip.
3891
- actual = state .GetBalance (block .Coinbase ())
3892
+ actual = state .GetBalance (block .Coinbase ()). ToBig ()
3892
3893
expected = new (big.Int ).Add (
3893
3894
new (big.Int ).SetUint64 (block .GasUsed ()* effectiveTip ),
3894
- ethash .ConstantinopleBlockReward ,
3895
+ ethash .ConstantinopleBlockReward . ToBig () ,
3895
3896
)
3896
3897
if actual .Cmp (expected ) != 0 {
3897
3898
t .Fatalf ("miner balance incorrect: expected %d, got %d" , expected , actual )
3898
3899
}
3899
3900
3900
3901
// 4: Ensure the tx sender paid for the gasUsed * (effectiveTip + block baseFee).
3901
- actual = new (big.Int ).Sub (funds , state .GetBalance (addr2 ))
3902
+ actual = new (big.Int ).Sub (funds , state .GetBalance (addr2 ). ToBig () )
3902
3903
expected = new (big.Int ).SetUint64 (block .GasUsed () * (effectiveTip + block .BaseFee ().Uint64 ()))
3903
3904
if actual .Cmp (expected ) != 0 {
3904
3905
t .Fatalf ("sender balance incorrect: expected %d, got %d" , expected , actual )
@@ -4703,14 +4704,14 @@ func TestEIP3651(t *testing.T) {
4703
4704
state , _ := chain .State ()
4704
4705
4705
4706
// 3: Ensure that miner received only the tx's tip.
4706
- actual := state .GetBalance (block .Coinbase ())
4707
+ actual := state .GetBalance (block .Coinbase ()). ToBig ()
4707
4708
expected := new (big.Int ).SetUint64 (block .GasUsed () * block .Transactions ()[0 ].GasTipCap ().Uint64 ())
4708
4709
if actual .Cmp (expected ) != 0 {
4709
4710
t .Fatalf ("miner balance incorrect: expected %d, got %d" , expected , actual )
4710
4711
}
4711
4712
4712
4713
// 4: Ensure the tx sender paid for the gasUsed * (tip + block baseFee).
4713
- actual = new (big.Int ).Sub (funds , state .GetBalance (addr1 ))
4714
+ actual = new (big.Int ).Sub (funds , state .GetBalance (addr1 ). ToBig () )
4714
4715
expected = new (big.Int ).SetUint64 (block .GasUsed () * (block .Transactions ()[0 ].GasTipCap ().Uint64 () + block .BaseFee ().Uint64 ()))
4715
4716
if actual .Cmp (expected ) != 0 {
4716
4717
t .Fatalf ("sender balance incorrect: expected %d, got %d" , expected , actual )
0 commit comments