Skip to content

Commit 8389355

Browse files
committed
tests: adjust for new gas pricings
1 parent be55d32 commit 8389355

9 files changed

+38
-38
lines changed

core/blockchain_test.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ func TestFastVsFullChains(t *testing.T) {
605605
gendb = rawdb.NewMemoryDatabase()
606606
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
607607
address = crypto.PubkeyToAddress(key.PublicKey)
608-
funds = big.NewInt(10000000000000000)
608+
funds = big.NewInt(8000000000000000000)
609609
gspec = &Genesis{
610610
Config: params.TestChainConfig,
611611
Alloc: GenesisAlloc{address: {Balance: funds}},
@@ -867,9 +867,9 @@ func TestChainTxReorgs(t *testing.T) {
867867
Config: params.TestChainConfig,
868868
GasLimit: 3141592,
869869
Alloc: GenesisAlloc{
870-
addr1: {Balance: big.NewInt(10000000000000000)},
871-
addr2: {Balance: big.NewInt(10000000000000000)},
872-
addr3: {Balance: big.NewInt(10000000000000000)},
870+
addr1: {Balance: big.NewInt(100000000000000000)},
871+
addr2: {Balance: big.NewInt(100000000000000000)},
872+
addr3: {Balance: big.NewInt(100000000000000000)},
873873
},
874874
}
875875
genesis = gspec.MustCommit(db)
@@ -2145,7 +2145,7 @@ func TestTransactionIndices(t *testing.T) {
21452145
gendb = rawdb.NewMemoryDatabase()
21462146
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
21472147
address = crypto.PubkeyToAddress(key.PublicKey)
2148-
funds = big.NewInt(100000000000000000)
2148+
funds = big.NewInt(1000000000000000000)
21492149
gspec = &Genesis{
21502150
Config: params.TestChainConfig,
21512151
Alloc: GenesisAlloc{address: {Balance: funds}},
@@ -2276,7 +2276,7 @@ func TestSkipStaleTxIndicesInFastSync(t *testing.T) {
22762276
gendb = rawdb.NewMemoryDatabase()
22772277
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
22782278
address = crypto.PubkeyToAddress(key.PublicKey)
2279-
funds = big.NewInt(100000000000000000)
2279+
funds = big.NewInt(1000000000000000000)
22802280
gspec = &Genesis{Config: params.TestChainConfig, Alloc: GenesisAlloc{address: {Balance: funds}}}
22812281
genesis = gspec.MustCommit(gendb)
22822282
signer = types.LatestSigner(gspec.Config)
@@ -2601,7 +2601,7 @@ func TestDeleteRecreateSlots(t *testing.T) {
26012601
// A sender who makes transactions, has some funds
26022602
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
26032603
address = crypto.PubkeyToAddress(key.PublicKey)
2604-
funds = big.NewInt(10000000000000000)
2604+
funds = big.NewInt(100000000000000000)
26052605
bb = common.HexToAddress("0x000000000000000000000000000000000000bbbb")
26062606
aaStorage = make(map[common.Hash]common.Hash) // Initial storage in AA
26072607
aaCode = []byte{byte(vm.PC), byte(vm.SELFDESTRUCT)} // Code for AA (simple selfdestruct)
@@ -2728,7 +2728,7 @@ func TestDeleteRecreateAccount(t *testing.T) {
27282728
// A sender who makes transactions, has some funds
27292729
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
27302730
address = crypto.PubkeyToAddress(key.PublicKey)
2731-
funds = big.NewInt(10000000000000000)
2731+
funds = big.NewInt(100000000000000000)
27322732

27332733
aa = common.HexToAddress("0x7217d81b76bdd8707601e959454e3d776aee5f43")
27342734
aaStorage = make(map[common.Hash]common.Hash) // Initial storage in AA
@@ -2804,7 +2804,7 @@ func TestDeleteRecreateSlotsAcrossManyBlocks(t *testing.T) {
28042804
// A sender who makes transactions, has some funds
28052805
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
28062806
address = crypto.PubkeyToAddress(key.PublicKey)
2807-
funds = big.NewInt(100000000000000000)
2807+
funds = big.NewInt(1000000000000000000)
28082808
bb = common.HexToAddress("0x000000000000000000000000000000000000bbbb")
28092809
aaStorage = make(map[common.Hash]common.Hash) // Initial storage in AA
28102810
aaCode = []byte{byte(vm.PC), byte(vm.SELFDESTRUCT)} // Code for AA (simple selfdestruct)
@@ -3121,7 +3121,7 @@ func TestEIP2718Transition(t *testing.T) {
31213121
// A sender who makes transactions, has some funds
31223122
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
31233123
address = crypto.PubkeyToAddress(key.PublicKey)
3124-
funds = big.NewInt(10000000000000000)
3124+
funds = big.NewInt(100000000000000000)
31253125
gspec = &Genesis{
31263126
Config: params.TestChainConfig,
31273127
Alloc: GenesisAlloc{
@@ -3152,7 +3152,7 @@ func TestEIP2718Transition(t *testing.T) {
31523152
Nonce: 0,
31533153
To: &aa,
31543154
Gas: 30000,
3155-
GasPrice: big.NewInt(71000000000),
3155+
GasPrice: big.NewInt(81000000000),
31563156
AccessList: types.AccessList{{
31573157
Address: aa,
31583158
StorageKeys: []common.Hash{{0}},
@@ -3247,7 +3247,7 @@ func TestEIP1559Transition(t *testing.T) {
32473247
Nonce: 0,
32483248
To: &aa,
32493249
Gas: 30000,
3250-
GasFeeCap: newGwei(71),
3250+
GasFeeCap: newGwei(82),
32513251
GasTipCap: big.NewInt(2),
32523252
AccessList: accesses,
32533253
Data: []byte{},
@@ -3306,7 +3306,7 @@ func TestEIP1559Transition(t *testing.T) {
33063306
Nonce: 0,
33073307
To: &aa,
33083308
Gas: 30000,
3309-
GasPrice: newGwei(70),
3309+
GasPrice: newGwei(81),
33103310
}
33113311
tx := types.NewTx(txdata)
33123312
tx, _ = types.SignTx(tx, signer, key2)

core/state_processor_test.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func TestStateProcessorErrors(t *testing.T) {
8181
Config: config,
8282
Alloc: GenesisAlloc{
8383
common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"): GenesisAccount{
84-
Balance: big.NewInt(2000000000000000000), // 2 ether
84+
Balance: big.NewInt(4000000000000000000), // 4 ether
8585
Nonce: 0,
8686
},
8787
common.HexToAddress("0xfd0810DD14796680f72adf1a371963d0745BCc64"): GenesisAccount{
@@ -103,10 +103,10 @@ func TestStateProcessorErrors(t *testing.T) {
103103
}{
104104
{ // ErrNonceTooLow
105105
txs: []*types.Transaction{
106-
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas, big.NewInt(70000000000), nil),
107-
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas, big.NewInt(70000000000), nil),
106+
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas, big.NewInt(810000000000), nil),
107+
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas, big.NewInt(810000000000), nil),
108108
},
109-
want: "could not apply tx 1 [0x035a4d54498b8faecac7ead306be8d5c641d81150da56d4ca0011820c9d0e732]: nonce too low: address 0x71562b71999873DB5b286dF957af199Ec94617F7, tx: 0 state: 1",
109+
want: "could not apply tx 1 [0xff614db3c65e3d21b66c25829da0daadc6119feeb6ace13a5fc8e72f60f3b8e6]: nonce too low: address 0x71562b71999873DB5b286dF957af199Ec94617F7, tx: 0 state: 1",
110110
},
111111
{ // ErrNonceTooHigh
112112
txs: []*types.Transaction{
@@ -122,37 +122,37 @@ func TestStateProcessorErrors(t *testing.T) {
122122
},
123123
{ // ErrGasLimitReached
124124
txs: []*types.Transaction{
125-
makeTx(key1, 0, common.Address{}, big.NewInt(0), 21000000, big.NewInt(70000000000), nil),
125+
makeTx(key1, 0, common.Address{}, big.NewInt(0), 21000000, big.NewInt(81000000000), nil),
126126
},
127-
want: "could not apply tx 0 [0x71f496a82fafcb2e3cab0e27796b10984702fd00ea7ad648af22397cb05652a8]: gas limit reached",
127+
want: "could not apply tx 0 [0x8513c2ba1a55e84a30582ce8ece0c5ea5e446590cdcd8384506ee16cbfcede73]: gas limit reached",
128128
},
129129
{ // ErrInsufficientFundsForTransfer
130130
txs: []*types.Transaction{
131131
makeTx(key1, 0, common.Address{}, big.NewInt(1000000000000000000), params.TxGas, big.NewInt(800000000000000), nil),
132132
},
133-
want: "could not apply tx 0 [0x95c504430523b9af2e3765f7a79b5a77275dd329a1f79d7251121b286a80c667]: insufficient funds for gas * price + value: address 0x71562b71999873DB5b286dF957af199Ec94617F7 have 2000000000000000000 want 17800000000000000000",
133+
want: "could not apply tx 0 [0x95c504430523b9af2e3765f7a79b5a77275dd329a1f79d7251121b286a80c667]: insufficient funds for gas * price + value: address 0x71562b71999873DB5b286dF957af199Ec94617F7 have 4000000000000000000 want 17800000000000000000",
134134
},
135135
{ // ErrInsufficientFunds
136136
txs: []*types.Transaction{
137137
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas, big.NewInt(900000000000000000), nil),
138138
},
139-
want: "could not apply tx 0 [0x4a69690c4b0cd85e64d0d9ea06302455b01e10a83db964d60281739752003440]: insufficient funds for gas * price + value: address 0x71562b71999873DB5b286dF957af199Ec94617F7 have 2000000000000000000 want 18900000000000000000000",
139+
want: "could not apply tx 0 [0x4a69690c4b0cd85e64d0d9ea06302455b01e10a83db964d60281739752003440]: insufficient funds for gas * price + value: address 0x71562b71999873DB5b286dF957af199Ec94617F7 have 4000000000000000000 want 18900000000000000000000",
140140
},
141141
// ErrGasUintOverflow
142142
// One missing 'core' error is ErrGasUintOverflow: "gas uint64 overflow",
143143
// In order to trigger that one, we'd have to allocate a _huge_ chunk of data, such that the
144144
// multiplication len(data) +gas_per_byte overflows uint64. Not testable at the moment
145145
{ // ErrIntrinsicGas
146146
txs: []*types.Transaction{
147-
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas-1000, big.NewInt(70000000000), nil),
147+
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas-1000, big.NewInt(81000000000), nil),
148148
},
149-
want: "could not apply tx 0 [0x0d0ca7d886da6c28ac094d3c2d2d0783b3753c9b92fcd2987c8d21b87fceb69f]: intrinsic gas too low: have 20000, want 21000",
149+
want: "could not apply tx 0 [0xa1973160a53bd892ab1a7489c2aa84bf41ee3d13e383e84b49d29c02bb8348e7]: intrinsic gas too low: have 20000, want 21000",
150150
},
151151
{ // ErrGasLimitReached
152152
txs: []*types.Transaction{
153-
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas*1000, big.NewInt(70000000000), nil),
153+
makeTx(key1, 0, common.Address{}, big.NewInt(0), params.TxGas*1000, big.NewInt(81000000000), nil),
154154
},
155-
want: "could not apply tx 0 [0x71f496a82fafcb2e3cab0e27796b10984702fd00ea7ad648af22397cb05652a8]: gas limit reached",
155+
want: "could not apply tx 0 [0x8513c2ba1a55e84a30582ce8ece0c5ea5e446590cdcd8384506ee16cbfcede73]: gas limit reached",
156156
},
157157
{ // ErrFeeCapTooLow
158158
txs: []*types.Transaction{
@@ -187,13 +187,13 @@ func TestStateProcessorErrors(t *testing.T) {
187187
txs: []*types.Transaction{
188188
mkDynamicTx(0, common.Address{}, params.TxGas, big.NewInt(1), big.NewInt(500000000000000)),
189189
},
190-
want: "could not apply tx 0 [0x3e4bc338670810e7edcd7570dce67ee4e4ac9e38fcea6febc51f89d9bd7fe4ec]: insufficient funds for gas * price + value: address 0x71562b71999873DB5b286dF957af199Ec94617F7 have 2000000000000000000 want 10500000000000000000",
190+
want: "could not apply tx 0 [0x3e4bc338670810e7edcd7570dce67ee4e4ac9e38fcea6febc51f89d9bd7fe4ec]: insufficient funds for gas * price + value: address 0x71562b71999873DB5b286dF957af199Ec94617F7 have 4000000000000000000 want 10500000000000000000",
191191
},
192192
{ // Another ErrInsufficientFunds, this one to ensure that feecap/tip of max u256 is allowed
193193
txs: []*types.Transaction{
194194
mkDynamicTx(0, common.Address{}, params.TxGas, bigNumber, bigNumber),
195195
},
196-
want: "could not apply tx 0 [0xd82a0c2519acfeac9a948258c47e784acd20651d9d80f9a1c67b4137651c3a24]: insufficient funds for gas * price + value: address 0x71562b71999873DB5b286dF957af199Ec94617F7 have 2000000000000000000 want 2431633873983640103894990685182446064918669677978451844828609264166175722438635000",
196+
want: "could not apply tx 0 [0xd82a0c2519acfeac9a948258c47e784acd20651d9d80f9a1c67b4137651c3a24]: insufficient funds for gas * price + value: address 0x71562b71999873DB5b286dF957af199Ec94617F7 have 4000000000000000000 want 2431633873983640103894990685182446064918669677978451844828609264166175722438635000",
197197
},
198198
} {
199199
block := GenerateBadBlock(genesis, ubqhash.NewFaker(), tt.txs, gspec.Config)

eth/downloader/queue_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535

3636
var (
3737
testdb = rawdb.NewMemoryDatabase()
38-
genesis = core.GenesisBlockForTesting(testdb, testAddress, big.NewInt(10000000000000000))
38+
genesis = core.GenesisBlockForTesting(testdb, testAddress, big.NewInt(8000000000000000000))
3939
)
4040

4141
// makeChain creates a chain of n blocks starting at and including parent.

eth/downloader/testchain_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var (
3535
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
3636
testAddress = crypto.PubkeyToAddress(testKey.PublicKey)
3737
testDB = rawdb.NewMemoryDatabase()
38-
testGenesis = core.GenesisBlockForTesting(testDB, testAddress, big.NewInt(2000000000000000))
38+
testGenesis = core.GenesisBlockForTesting(testDB, testAddress, big.NewInt(800000000000000000))
3939
)
4040

4141
// The common prefix of all test chains:

eth/fetcher/block_fetcher_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var (
3838
testdb = rawdb.NewMemoryDatabase()
3939
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
4040
testAddress = crypto.PubkeyToAddress(testKey.PublicKey)
41-
genesis = core.GenesisBlockForTesting(testdb, testAddress, big.NewInt(8000000000000000))
41+
genesis = core.GenesisBlockForTesting(testdb, testAddress, big.NewInt(800000000000000000))
4242
unknownBlock = types.NewBlock(&types.Header{GasLimit: params.GenesisGasLimit, BaseFee: big.NewInt(params.InitialBaseFee)}, nil, nil, nil, trie.NewStackTrie(nil))
4343
)
4444

eth/gasprice/gasprice_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ func TestSuggestTipCap(t *testing.T) {
170170
expect *big.Int // Expected gasprice suggestion
171171
}{
172172
{nil, big.NewInt(params.GWei * int64(30))},
173-
{big.NewInt(0), big.NewInt(params.GWei * int64(30))}, // Fork point in genesis
174-
{big.NewInt(1), big.NewInt(params.GWei * int64(30))}, // Fork point in first block
173+
{big.NewInt(0), big.NewInt(params.GWei * int64(20))}, // Fork point in genesis
174+
{big.NewInt(1), big.NewInt(params.GWei * int64(20))}, // Fork point in first block
175175
{big.NewInt(32), big.NewInt(params.GWei * int64(29))}, // Fork point in last block
176176
{big.NewInt(33), big.NewInt(params.GWei * int64(30))}, // Fork point in the future
177177
}

ethclient/ethclient_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ func testStatusFunctions(t *testing.T, client *rpc.Client) {
493493
if err != nil {
494494
t.Fatalf("unexpected error: %v", err)
495495
}
496-
if gasPrice.Cmp(big.NewInt(80000000000)) != 0 {
496+
if gasPrice.Cmp(big.NewInt(81000000000)) != 0 {
497497
t.Fatalf("unexpected gas price: %v", gasPrice)
498498
}
499499

@@ -502,7 +502,7 @@ func testStatusFunctions(t *testing.T, client *rpc.Client) {
502502
if err != nil {
503503
t.Fatalf("unexpected error: %v", err)
504504
}
505-
if gasTipCap.Cmp(big.NewInt(18750000000)) != 0 {
505+
if gasTipCap.Cmp(big.NewInt(1000000000)) != 0 {
506506
t.Fatalf("unexpected gas tip cap: %v", gasTipCap)
507507
}
508508
}

ethclient/gethclient/gethclient_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import (
4040
var (
4141
testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
4242
testAddr = crypto.PubkeyToAddress(testKey.PublicKey)
43-
testBalance = big.NewInt(8e15)
43+
testBalance = big.NewInt(8e16)
4444
)
4545

4646
func newTestBackend(t *testing.T) (*node.Node, []*types.Block) {
@@ -141,7 +141,7 @@ func testAccessList(t *testing.T, client *rpc.Client) {
141141
From: testAddr,
142142
To: &common.Address{},
143143
Gas: 21000,
144-
GasPrice: big.NewInt(70000000000),
144+
GasPrice: big.NewInt(81000000000),
145145
Value: big.NewInt(1),
146146
}
147147
al, gas, vmErr, err := ec.CreateAccessList(context.Background(), msg)
@@ -162,7 +162,7 @@ func testAccessList(t *testing.T, client *rpc.Client) {
162162
From: testAddr,
163163
To: nil,
164164
Gas: 100000,
165-
GasPrice: big.NewInt(61250000000),
165+
GasPrice: big.NewInt(81000000000),
166166
Value: big.NewInt(1),
167167
Data: common.FromHex("0x608060806080608155fd"),
168168
}

graphql/graphql_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func createGQLServiceWithTransactions(t *testing.T, stack *node.Node) {
275275
// create backend
276276
key, _ := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
277277
address := crypto.PubkeyToAddress(key.PublicKey)
278-
funds := big.NewInt(10000000000000000)
278+
funds := big.NewInt(100000000000000000)
279279
dad := common.HexToAddress("0x0000000000000000000000000000000000000dad")
280280

281281
ethConf := &ethconfig.Config{

0 commit comments

Comments
 (0)