@@ -1343,130 +1343,6 @@ public void OrderTxsForEvaluation(
1343
1343
. Select ( tx => tx . Signer . ToString ( ) ) ) ) ;
1344
1344
}
1345
1345
1346
- [ Fact ]
1347
- public void EvaluateActionAndCollectFee ( )
1348
- {
1349
- var privateKey = new PrivateKey ( ) ;
1350
- var address = privateKey . Address ;
1351
- Currency foo = Currency . Uncapped (
1352
- "FOO" ,
1353
- 18 ,
1354
- null
1355
- ) ;
1356
-
1357
- var freeGasAction = new UseGasAction ( )
1358
- {
1359
- GasUsage = 0 ,
1360
- Memo = "FREE" ,
1361
- MintValue = FungibleAssetValue . FromRawValue ( foo , 10 ) ,
1362
- Receiver = address ,
1363
- } ;
1364
-
1365
- var payGasAction = new UseGasAction ( )
1366
- {
1367
- GasUsage = 1 ,
1368
- Memo = "CHARGE" ,
1369
- } ;
1370
-
1371
- var store = new MemoryStore ( ) ;
1372
- var stateStore = new TrieStateStore ( new MemoryKeyValueStore ( ) ) ;
1373
- var chain = TestUtils . MakeBlockChain (
1374
- policy : new BlockPolicy ( ) ,
1375
- actions : new [ ] { freeGasAction , } ,
1376
- store : store ,
1377
- stateStore : stateStore ,
1378
- actionLoader : new SingleActionLoader ( typeof ( UseGasAction ) ) ) ;
1379
- var tx = Transaction . Create (
1380
- nonce : 0 ,
1381
- privateKey : privateKey ,
1382
- genesisHash : chain . Genesis . Hash ,
1383
- maxGasPrice : FungibleAssetValue . FromRawValue ( foo , 1 ) ,
1384
- gasLimit : 3 ,
1385
- actions : new [ ]
1386
- {
1387
- payGasAction ,
1388
- } . ToPlainValues ( ) ) ;
1389
-
1390
- chain . StageTransaction ( tx ) ;
1391
- var miner = new PrivateKey ( ) ;
1392
- Block block = chain . ProposeBlock ( miner ) ;
1393
-
1394
- var evaluations = chain . ActionEvaluator . Evaluate (
1395
- block , chain . GetNextStateRootHash ( ( BlockHash ) block . PreviousHash ) ) ;
1396
-
1397
- Assert . False ( evaluations [ 0 ] . InputContext . IsPolicyAction ) ;
1398
- Assert . Single ( evaluations ) ;
1399
- Assert . Null ( evaluations . Single ( ) . Exception ) ;
1400
- Assert . Equal ( 2 , GasTracer . GasAvailable ) ;
1401
- Assert . Equal ( 1 , GasTracer . GasUsed ) ;
1402
- }
1403
-
1404
- [ Fact ]
1405
- public void EvaluateThrowingExceedGasLimit ( )
1406
- {
1407
- var privateKey = new PrivateKey ( ) ;
1408
- var address = privateKey . Address ;
1409
- Currency foo = Currency . Uncapped (
1410
- "FOO" ,
1411
- 18 ,
1412
- null
1413
- ) ;
1414
-
1415
- var freeGasAction = new UseGasAction ( )
1416
- {
1417
- GasUsage = 0 ,
1418
- Memo = "FREE" ,
1419
- MintValue = FungibleAssetValue . FromRawValue ( foo , 10 ) ,
1420
- Receiver = address ,
1421
- } ;
1422
-
1423
- var payGasAction = new UseGasAction ( )
1424
- {
1425
- GasUsage = 10 ,
1426
- Memo = "CHARGE" ,
1427
- } ;
1428
-
1429
- var store = new MemoryStore ( ) ;
1430
- var stateStore = new TrieStateStore ( new MemoryKeyValueStore ( ) ) ;
1431
- var chain = TestUtils . MakeBlockChain (
1432
- policy : new BlockPolicy ( ) ,
1433
- actions : new [ ]
1434
- {
1435
- freeGasAction ,
1436
- } ,
1437
- store : store ,
1438
- stateStore : stateStore ,
1439
- actionLoader : new SingleActionLoader ( typeof ( UseGasAction ) ) ) ;
1440
- var tx = Transaction . Create (
1441
- nonce : 0 ,
1442
- privateKey : privateKey ,
1443
- genesisHash : chain . Genesis . Hash ,
1444
- maxGasPrice : FungibleAssetValue . FromRawValue ( foo , 1 ) ,
1445
- gasLimit : 5 ,
1446
- actions : new [ ]
1447
- {
1448
- payGasAction ,
1449
- } . ToPlainValues ( ) ) ;
1450
-
1451
- chain . StageTransaction ( tx ) ;
1452
- var miner = new PrivateKey ( ) ;
1453
- Block block = chain . ProposeBlock ( miner ) ;
1454
-
1455
- var evaluations = chain . ActionEvaluator . Evaluate (
1456
- block ,
1457
- chain . GetNextStateRootHash ( ( BlockHash ) block . PreviousHash ) ) ;
1458
-
1459
- Assert . False ( evaluations [ 0 ] . InputContext . IsPolicyAction ) ;
1460
- Assert . Single ( evaluations ) ;
1461
- Assert . NotNull ( evaluations . Single ( ) . Exception ) ;
1462
- Assert . NotNull ( evaluations . Single ( ) . Exception ? . InnerException ) ;
1463
- Assert . Equal (
1464
- typeof ( GasLimitExceededException ) ,
1465
- evaluations . Single ( ) . Exception ? . InnerException ? . GetType ( ) ) ;
1466
- Assert . Equal ( 0 , GasTracer . GasAvailable ) ;
1467
- Assert . Equal ( 5 , GasTracer . GasUsed ) ;
1468
- }
1469
-
1470
1346
[ Fact ]
1471
1347
public void GenerateRandomSeed ( )
1472
1348
{
0 commit comments