10
10
import static com .hedera .services .bdd .spec .keys .KeyShape .sigs ;
11
11
import static com .hedera .services .bdd .spec .keys .TrieSigMapGenerator .uniqueWithFullPrefixesFor ;
12
12
import static com .hedera .services .bdd .spec .queries .QueryVerbs .getAccountBalance ;
13
+ import static com .hedera .services .bdd .spec .queries .QueryVerbs .getAccountRecords ;
13
14
import static com .hedera .services .bdd .spec .queries .QueryVerbs .getAliasedAccountInfo ;
14
15
import static com .hedera .services .bdd .spec .queries .QueryVerbs .getReceipt ;
15
16
import static com .hedera .services .bdd .spec .queries .QueryVerbs .getTxnRecord ;
40
41
import static com .hedera .services .bdd .suites .HapiSuite .MAX_CALL_DATA_SIZE ;
41
42
import static com .hedera .services .bdd .suites .HapiSuite .ONE_HBAR ;
42
43
import static com .hedera .services .bdd .suites .HapiSuite .ONE_HUNDRED_HBARS ;
43
- import static com .hedera .services .bdd .suites .HapiSuite .ONE_MILLION_HBARS ;
44
44
import static com .hedera .services .bdd .suites .HapiSuite .SECP_256K1_SHAPE ;
45
45
import static com .hedera .services .bdd .suites .HapiSuite .SECP_256K1_SOURCE_KEY ;
46
46
import static com .hedera .services .bdd .suites .HapiSuite .THROTTLE_DEFS ;
49
49
import static com .hedera .services .bdd .suites .crypto .AutoCreateUtils .updateSpecFor ;
50
50
import static com .hedera .services .bdd .suites .utils .sysfiles .serdes .ThrottleDefsLoader .protoDefsFromResource ;
51
51
import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .INNER_TRANSACTION_FAILED ;
52
+ import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .INSUFFICIENT_PAYER_BALANCE ;
52
53
import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .SUCCESS ;
53
54
import static com .hederahashgraph .api .proto .java .ResponseCodeEnum .TRANSACTION_EXPIRED ;
55
+ import static org .junit .jupiter .api .Assertions .assertTrue ;
54
56
55
57
import com .hedera .node .app .hapi .utils .ethereum .EthTxData ;
56
58
import com .hedera .services .bdd .junit .HapiTest ;
@@ -438,20 +440,18 @@ final Stream<DynamicTest> batchFinalizeHollowAccount() {
438
440
final var alias = "alias" ;
439
441
final var batchOperator = "batchOperator" ;
440
442
return hapiTest (flattened (
443
+ cryptoCreate ("innerRecipient" ).balance (0L ),
441
444
cryptoCreate (batchOperator ),
442
445
newKeyNamed (alias ).shape (SECP_256K1_SHAPE ),
443
446
createHollowAccountFrom (alias ),
444
447
getAliasedAccountInfo (alias ).isHollow (),
445
- atomicBatch (cryptoCreate ("foo" )
446
- .payingWith (alias )
447
- .sigMapPrefixes (uniqueWithFullPrefixesFor (alias ))
448
+ atomicBatch (cryptoTransfer (tinyBarsFromTo (GENESIS , "innerRecipient" , 123L ))
448
449
.batchKey (batchOperator ))
449
450
.payingWith (alias )
450
451
.sigMapPrefixes (uniqueWithFullPrefixesFor (alias ))
451
452
.signedBy (alias , batchOperator ),
452
- getAliasedAccountInfo (alias )
453
- .has (accountWith ().hasNonEmptyKey ())
454
- .logged ()));
453
+ getAliasedAccountInfo (alias ).has (accountWith ().hasNonEmptyKey ()),
454
+ getAccountBalance ("innerRecipient" ).hasTinyBars (123L )));
455
455
}
456
456
457
457
@ HapiTest
@@ -461,19 +461,23 @@ final Stream<DynamicTest> failingBatchShouldFinalizeHollowAccount() {
461
461
final var alias = "alias" ;
462
462
final var batchOperator = "batchOperator" ;
463
463
return hapiTest (flattened (
464
+ cryptoCreate ("innerRecipient" ).balance (0L ),
464
465
cryptoCreate (batchOperator ),
465
466
newKeyNamed (alias ).shape (SECP_256K1_SHAPE ),
466
467
createHollowAccountFrom (alias ),
467
468
getAliasedAccountInfo (alias ).isHollow (),
468
- atomicBatch (cryptoTransfer (tinyBarsFromToWithAlias ( alias , GENESIS , ONE_MILLION_HBARS ))
469
- . payingWith ( alias )
470
- .sigMapPrefixes ( uniqueWithFullPrefixesFor ( alias ) )
469
+ atomicBatch (cryptoTransfer (tinyBarsFromTo ( GENESIS , "innerRecipient" , 123L ))
470
+ // Use a payer account with zero balance
471
+ .payingWith ( "innerRecipient" )
471
472
.batchKey (batchOperator ))
472
473
.payingWith (alias )
473
474
.sigMapPrefixes (uniqueWithFullPrefixesFor (alias ))
474
475
.signedBy (alias , batchOperator )
475
476
.hasKnownStatus (INNER_TRANSACTION_FAILED ),
476
- getAliasedAccountInfo (alias ).isNotHollow ()));
477
+ getAliasedAccountInfo (alias ).isNotHollow (),
478
+ getAccountRecords ("innerRecipient" )
479
+ .exposingTo (records -> assertTrue (records .stream ()
480
+ .anyMatch (r -> r .getReceipt ().getStatus () == INSUFFICIENT_PAYER_BALANCE )))));
477
481
}
478
482
479
483
@ HapiTest
0 commit comments