@@ -8,18 +8,20 @@ import (
8
8
"github.com/ledgerwatch/erigon-lib/common/hexutil"
9
9
10
10
"github.com/holiman/uint256"
11
- "github.com/ledgerwatch/erigon-lib/common"
12
11
"github.com/stretchr/testify/assert"
13
12
13
+ "github.com/ledgerwatch/erigon-lib/common"
14
+
14
15
"github.com/ledgerwatch/erigon-lib/kv/kvcache"
15
16
"github.com/ledgerwatch/erigon/core"
16
17
"github.com/ledgerwatch/erigon/rpc"
17
18
"github.com/ledgerwatch/erigon/rpc/rpccfg"
18
19
"github.com/ledgerwatch/erigon/turbo/adapter/ethapi"
19
20
"github.com/ledgerwatch/erigon/turbo/stages/mock"
20
21
21
- "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest"
22
22
"github.com/ledgerwatch/log/v3"
23
+
24
+ "github.com/ledgerwatch/erigon/cmd/rpcdaemon/rpcdaemontest"
23
25
)
24
26
25
27
func newBaseApiForTest (m * mock.MockSentry ) * BaseAPI {
@@ -55,7 +57,7 @@ func TestGetTransactionReceipt(t *testing.T) {
55
57
db := m .DB
56
58
agg := m .HistoryV3Components ()
57
59
stateCache := kvcache .New (kvcache .DefaultCoherentConfig )
58
- api := NewEthAPI (NewBaseApi (nil , stateCache , m .BlockReader , agg , false , rpccfg .DefaultEvmCallTimeout , m .Engine , m .Dirs ), db , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
60
+ api := NewEthAPI (NewBaseApi (nil , stateCache , m .BlockReader , agg , false , rpccfg .DefaultEvmCallTimeout , m .Engine , m .Dirs ), db , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
59
61
// Call GetTransactionReceipt for transaction which is not in the database
60
62
if _ , err := api .GetTransactionReceipt (context .Background (), common.Hash {}); err != nil {
61
63
t .Errorf ("calling GetTransactionReceipt with empty hash: %v" , err )
@@ -64,7 +66,7 @@ func TestGetTransactionReceipt(t *testing.T) {
64
66
65
67
func TestGetTransactionReceiptUnprotected (t * testing.T ) {
66
68
m , _ , _ := rpcdaemontest .CreateTestSentry (t )
67
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
69
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
68
70
// Call GetTransactionReceipt for un-protected transaction
69
71
if _ , err := api .GetTransactionReceipt (context .Background (), common .HexToHash ("0x3f3cb8a0e13ed2481f97f53f7095b9cbc78b6ffb779f2d3e565146371a8830ea" )); err != nil {
70
72
t .Errorf ("calling GetTransactionReceipt for unprotected tx: %v" , err )
@@ -76,7 +78,7 @@ func TestGetTransactionReceiptUnprotected(t *testing.T) {
76
78
func TestGetStorageAt_ByBlockNumber_WithRequireCanonicalDefault (t * testing.T ) {
77
79
assert := assert .New (t )
78
80
m , _ , _ := rpcdaemontest .CreateTestSentry (t )
79
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
81
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
80
82
addr := common .HexToAddress ("0x71562b71999873db5b286df957af199ec94617f7" )
81
83
82
84
result , err := api .GetStorageAt (context .Background (), addr , "0x0" , rpc .BlockNumberOrHashWithNumber (0 ))
@@ -90,7 +92,7 @@ func TestGetStorageAt_ByBlockNumber_WithRequireCanonicalDefault(t *testing.T) {
90
92
func TestGetStorageAt_ByBlockHash_WithRequireCanonicalDefault (t * testing.T ) {
91
93
assert := assert .New (t )
92
94
m , _ , _ := rpcdaemontest .CreateTestSentry (t )
93
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
95
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
94
96
addr := common .HexToAddress ("0x71562b71999873db5b286df957af199ec94617f7" )
95
97
96
98
result , err := api .GetStorageAt (context .Background (), addr , "0x0" , rpc .BlockNumberOrHashWithHash (m .Genesis .Hash (), false ))
@@ -104,7 +106,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalDefault(t *testing.T) {
104
106
func TestGetStorageAt_ByBlockHash_WithRequireCanonicalTrue (t * testing.T ) {
105
107
assert := assert .New (t )
106
108
m , _ , _ := rpcdaemontest .CreateTestSentry (t )
107
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
109
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
108
110
addr := common .HexToAddress ("0x71562b71999873db5b286df957af199ec94617f7" )
109
111
110
112
result , err := api .GetStorageAt (context .Background (), addr , "0x0" , rpc .BlockNumberOrHashWithHash (m .Genesis .Hash (), true ))
@@ -117,7 +119,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalTrue(t *testing.T) {
117
119
118
120
func TestGetStorageAt_ByBlockHash_WithRequireCanonicalDefault_BlockNotFoundError (t * testing.T ) {
119
121
m , _ , _ := rpcdaemontest .CreateTestSentry (t )
120
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
122
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
121
123
addr := common .HexToAddress ("0x71562b71999873db5b286df957af199ec94617f7" )
122
124
123
125
offChain , err := core .GenerateChain (m .ChainConfig , m .Genesis , m .Engine , m .DB , 1 , func (i int , block * core.BlockGen ) {
@@ -138,7 +140,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalDefault_BlockNotFoundError
138
140
139
141
func TestGetStorageAt_ByBlockHash_WithRequireCanonicalTrue_BlockNotFoundError (t * testing.T ) {
140
142
m , _ , _ := rpcdaemontest .CreateTestSentry (t )
141
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
143
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
142
144
addr := common .HexToAddress ("0x71562b71999873db5b286df957af199ec94617f7" )
143
145
144
146
offChain , err := core .GenerateChain (m .ChainConfig , m .Genesis , m .Engine , m .DB , 1 , func (i int , block * core.BlockGen ) {
@@ -160,7 +162,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalTrue_BlockNotFoundError(t
160
162
func TestGetStorageAt_ByBlockHash_WithRequireCanonicalDefault_NonCanonicalBlock (t * testing.T ) {
161
163
assert := assert .New (t )
162
164
m , _ , orphanedChain := rpcdaemontest .CreateTestSentry (t )
163
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
165
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
164
166
addr := common .HexToAddress ("0x71562b71999873db5b286df957af199ec94617f7" )
165
167
166
168
orphanedBlock := orphanedChain [0 ].Blocks [0 ]
@@ -179,7 +181,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalDefault_NonCanonicalBlock(
179
181
180
182
func TestGetStorageAt_ByBlockHash_WithRequireCanonicalTrue_NonCanonicalBlock (t * testing.T ) {
181
183
m , _ , orphanedChain := rpcdaemontest .CreateTestSentry (t )
182
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
184
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
183
185
addr := common .HexToAddress ("0x71562b71999873db5b286df957af199ec94617f7" )
184
186
185
187
orphanedBlock := orphanedChain [0 ].Blocks [0 ]
@@ -195,7 +197,7 @@ func TestGetStorageAt_ByBlockHash_WithRequireCanonicalTrue_NonCanonicalBlock(t *
195
197
196
198
func TestCall_ByBlockHash_WithRequireCanonicalDefault_NonCanonicalBlock (t * testing.T ) {
197
199
m , _ , orphanedChain := rpcdaemontest .CreateTestSentry (t )
198
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
200
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
199
201
from := common .HexToAddress ("0x71562b71999873db5b286df957af199ec94617f7" )
200
202
to := common .HexToAddress ("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e" )
201
203
@@ -218,7 +220,7 @@ func TestCall_ByBlockHash_WithRequireCanonicalDefault_NonCanonicalBlock(t *testi
218
220
219
221
func TestCall_ByBlockHash_WithRequireCanonicalTrue_NonCanonicalBlock (t * testing.T ) {
220
222
m , _ , orphanedChain := rpcdaemontest .CreateTestSentry (t )
221
- api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 100_000 , false , 100_000 , 128 , log .New ())
223
+ api := NewEthAPI (newBaseApiForTest (m ), m .DB , nil , nil , nil , 5000000 , 1e18 , 100_000 , false , 100_000 , 128 , log .New ())
222
224
from := common .HexToAddress ("0x71562b71999873db5b286df957af199ec94617f7" )
223
225
to := common .HexToAddress ("0x0d3ab14bbad3d99f4203bd7a11acb94882050e7e" )
224
226
0 commit comments