@@ -207,11 +207,7 @@ func NewRandomWeightedTest(
207207 }, nil
208208}
209209
210- func (r * RandomWeightedTest ) Run (
211- tc tests.TestContext ,
212- ctx context.Context ,
213- wallet * Wallet ,
214- ) {
210+ func (r * RandomWeightedTest ) Run (tc tests.TestContext , wallet * Wallet ) {
215211 require := require .New (tc )
216212
217213 r .mu .Lock ()
@@ -221,7 +217,7 @@ func (r *RandomWeightedTest) Run(
221217 index , ok := r .weighted .Sample (uint64 (sampleValue ))
222218 require .True (ok )
223219
224- r .tests [index ].Run (tc , ctx , wallet )
220+ r .tests [index ].Run (tc , wallet )
225221}
226222
227223type WeightedTest struct {
@@ -233,11 +229,7 @@ type TransferTest struct {
233229 Value * big.Int
234230}
235231
236- func (t TransferTest ) Run (
237- tc tests.TestContext ,
238- ctx context.Context ,
239- wallet * Wallet ,
240- ) {
232+ func (t TransferTest ) Run (tc tests.TestContext , wallet * Wallet ) {
241233 require := require .New (tc )
242234
243235 maxValue := int64 (100 * 1_000_000_000 / params .TxGas )
@@ -263,20 +255,16 @@ func (t TransferTest) Run(
263255 })
264256 require .NoError (err )
265257
266- require .NoError (wallet .SendTx (ctx , tx ))
258+ require .NoError (wallet .SendTx (tc . GetDefaultContextParent () , tx ))
267259}
268260
269261type ReadTest struct {
270262 Contract * contracts.EVMLoadSimulator
271263 Count * big.Int
272264}
273265
274- func (r ReadTest ) Run (
275- tc tests.TestContext ,
276- ctx context.Context ,
277- wallet * Wallet ,
278- ) {
279- executeContractTx (tc , ctx , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
266+ func (r ReadTest ) Run (tc tests.TestContext , wallet * Wallet ) {
267+ executeContractTx (tc , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
280268 return r .Contract .SimulateReads (txOpts , r .Count )
281269 })
282270}
@@ -286,12 +274,8 @@ type WriteTest struct {
286274 Count * big.Int
287275}
288276
289- func (w WriteTest ) Run (
290- tc tests.TestContext ,
291- ctx context.Context ,
292- wallet * Wallet ,
293- ) {
294- executeContractTx (tc , ctx , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
277+ func (w WriteTest ) Run (tc tests.TestContext , wallet * Wallet ) {
278+ executeContractTx (tc , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
295279 return w .Contract .SimulateRandomWrite (txOpts , w .Count )
296280 })
297281}
@@ -301,12 +285,8 @@ type StateModificationTest struct {
301285 Count * big.Int
302286}
303287
304- func (s StateModificationTest ) Run (
305- tc tests.TestContext ,
306- ctx context.Context ,
307- wallet * Wallet ,
308- ) {
309- executeContractTx (tc , ctx , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
288+ func (s StateModificationTest ) Run (tc tests.TestContext , wallet * Wallet ) {
289+ executeContractTx (tc , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
310290 return s .Contract .SimulateModification (txOpts , s .Count )
311291 })
312292}
@@ -316,12 +296,8 @@ type HashingTest struct {
316296 Count * big.Int
317297}
318298
319- func (h HashingTest ) Run (
320- tc tests.TestContext ,
321- ctx context.Context ,
322- wallet * Wallet ,
323- ) {
324- executeContractTx (tc , ctx , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
299+ func (h HashingTest ) Run (tc tests.TestContext , wallet * Wallet ) {
300+ executeContractTx (tc , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
325301 return h .Contract .SimulateHashing (txOpts , h .Count )
326302 })
327303}
@@ -331,12 +307,8 @@ type MemoryTest struct {
331307 Count * big.Int
332308}
333309
334- func (m MemoryTest ) Run (
335- tc tests.TestContext ,
336- ctx context.Context ,
337- wallet * Wallet ,
338- ) {
339- executeContractTx (tc , ctx , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
310+ func (m MemoryTest ) Run (tc tests.TestContext , wallet * Wallet ) {
311+ executeContractTx (tc , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
340312 return m .Contract .SimulateMemory (txOpts , m .Count )
341313 })
342314}
@@ -346,12 +318,8 @@ type CallDepthTest struct {
346318 Count * big.Int
347319}
348320
349- func (c CallDepthTest ) Run (
350- tc tests.TestContext ,
351- ctx context.Context ,
352- wallet * Wallet ,
353- ) {
354- executeContractTx (tc , ctx , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
321+ func (c CallDepthTest ) Run (tc tests.TestContext , wallet * Wallet ) {
322+ executeContractTx (tc , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
355323 return c .Contract .SimulateCallDepth (txOpts , c .Count )
356324 })
357325}
@@ -360,25 +328,17 @@ type ContractCreationTest struct {
360328 Contract * contracts.EVMLoadSimulator
361329}
362330
363- func (c ContractCreationTest ) Run (
364- tc tests.TestContext ,
365- ctx context.Context ,
366- wallet * Wallet ,
367- ) {
368- executeContractTx (tc , ctx , wallet , c .Contract .SimulateContractCreation )
331+ func (c ContractCreationTest ) Run (tc tests.TestContext , wallet * Wallet ) {
332+ executeContractTx (tc , wallet , c .Contract .SimulateContractCreation )
369333}
370334
371335type PureComputeTest struct {
372336 Contract * contracts.EVMLoadSimulator
373337 NumIterations * big.Int
374338}
375339
376- func (p PureComputeTest ) Run (
377- tc tests.TestContext ,
378- ctx context.Context ,
379- wallet * Wallet ,
380- ) {
381- executeContractTx (tc , ctx , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
340+ func (p PureComputeTest ) Run (tc tests.TestContext , wallet * Wallet ) {
341+ executeContractTx (tc , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
382342 return p .Contract .SimulatePureCompute (txOpts , p .NumIterations )
383343 })
384344}
@@ -388,12 +348,8 @@ type LargeEventTest struct {
388348 NumEvents * big.Int
389349}
390350
391- func (l LargeEventTest ) Run (
392- tc tests.TestContext ,
393- ctx context.Context ,
394- wallet * Wallet ,
395- ) {
396- executeContractTx (tc , ctx , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
351+ func (l LargeEventTest ) Run (tc tests.TestContext , wallet * Wallet ) {
352+ executeContractTx (tc , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
397353 return l .Contract .SimulateLargeEvent (txOpts , l .NumEvents )
398354 })
399355}
@@ -402,32 +358,23 @@ type ExternalCallTest struct {
402358 Contract * contracts.EVMLoadSimulator
403359}
404360
405- func (e ExternalCallTest ) Run (
406- tc tests.TestContext ,
407- ctx context.Context ,
408- wallet * Wallet ,
409- ) {
410- executeContractTx (tc , ctx , wallet , e .Contract .SimulateExternalCall )
361+ func (e ExternalCallTest ) Run (tc tests.TestContext , wallet * Wallet ) {
362+ executeContractTx (tc , wallet , e .Contract .SimulateExternalCall )
411363}
412364
413365type TrieStressTest struct {
414366 Contract * contracts.TrieStressTest
415367 NumValues * big.Int
416368}
417369
418- func (t TrieStressTest ) Run (
419- tc tests.TestContext ,
420- ctx context.Context ,
421- wallet * Wallet ,
422- ) {
423- executeContractTx (tc , ctx , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
370+ func (t TrieStressTest ) Run (tc tests.TestContext , wallet * Wallet ) {
371+ executeContractTx (tc , wallet , func (txOpts * bind.TransactOpts ) (* types.Transaction , error ) {
424372 return t .Contract .WriteValues (txOpts , t .NumValues )
425373 })
426374}
427375
428376func executeContractTx (
429377 tc tests.TestContext ,
430- ctx context.Context ,
431378 wallet * Wallet ,
432379 txFunc func (* bind.TransactOpts ) (* types.Transaction , error ),
433380) {
@@ -439,7 +386,7 @@ func executeContractTx(
439386 tx , err := txFunc (txOpts )
440387 require .NoError (err )
441388
442- require .NoError (wallet .SendTx (ctx , tx ))
389+ require .NoError (wallet .SendTx (tc . GetDefaultContextParent () , tx ))
443390}
444391
445392// newTxOpts returns transactions options for contract calls, with sending disabled
0 commit comments