Skip to content

Commit

Permalink
chore: delete hasChildRecordCount() and rename hasNonStakingChildReco…
Browse files Browse the repository at this point in the history
…rdCount() to it.

Signed-off-by: Nikita Lebedev <nikita.lebedev@limechain.tech>
  • Loading branch information
thenswan committed Feb 5, 2024
1 parent f895c7b commit ad6fda3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,6 @@ public HapiGetTxnRecord assertingNothingAboutHashes() {
return this;
}

public HapiGetTxnRecord hasChildRecordCount(final int count) {
requestChildRecords = true;
childRecordsCount = OptionalInt.of(count);
return this;
}

public HapiGetTxnRecord hasNonStakingChildRecordCount(final int count) {
requestChildRecords = true;
includeStakingRecordsInCount = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ final HapiSpec revertedAutoCreationRollsBackEvenIfTopLevelSucceeds() {
.hasKnownStatus(SUCCESS));
}))
.then(
getTxnRecord(TRANSFER_TXN).hasChildRecordCount(1),
getTxnRecord(TRANSFER_TXN).hasNonStakingChildRecordCount(1),
childRecordsCheck(
TRANSFER_TXN,
SUCCESS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ final HapiSpec prngPrecompileHappyPathWorks() {
.logged()))
.then(getTxnRecord(randomBits)
.andAllChildRecords()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith()
.pseudoRandomBytes()
.contractCallResult(resultWith()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ final HapiSpec autoAccountCreationWorksWhenUsingAliasOfDeletedAccount() {
// HapiCryptoTransfer.tinyBarsFromToWithAlias("payer", "alias",
// ONE_HUNDRED_HBARS)).via(
// "txn2"),
// getTxnRecord("txn2").hasChildRecordCount(1).logged()
// getTxnRecord("txn2").hasNonStakingChildRecordCount(1).logged()
);
}

Expand Down Expand Up @@ -1395,7 +1395,7 @@ final HapiSpec transferHbarsToEVMAddressAlias() {
}))
.then(
getTxnRecord(HBAR_XFER)
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().status(SUCCESS).memo(LAZY_MEMO)),
// and transfers to the 0.0.ECDSA_BYTES alias should succeed.
cryptoTransfer(tinyBarsFromToWithAlias(PARTY, SECP_256K1_SOURCE_KEY, ONE_HBAR))
Expand Down Expand Up @@ -1544,7 +1544,7 @@ final HapiSpec transferFungibleToEVMAddressAlias() {
getHollowAccountInfoAfterTransfers);
}))
.then(getTxnRecord(FT_XFER)
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().status(SUCCESS).memo(LAZY_MEMO)));
}

Expand Down Expand Up @@ -1679,7 +1679,7 @@ final HapiSpec cannotAutoCreateWithTxnToLongZero() {
.then(withOpContext((spec, opLog) -> {
getTxnRecord("failedTxn").logged();
getTxnRecord("passedTxn")
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(
recordWith().status(SUCCESS).memo(LAZY_MEMO).alias(evmAddress.get()));
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ final HapiSpec secondOrderRewardSituationsWork() {
.andAllChildRecords()
.countStakingRecords()
.stakingFeeExempted()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO))
.hasPaidStakingRewards(List.of()),

Expand All @@ -372,7 +372,7 @@ final HapiSpec secondOrderRewardSituationsWork() {
.logged(),
getTxnRecord("endOfStakingPeriodXfer")
.andAllChildRecords()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.countStakingRecords()
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO)),
getAccountInfo(ALICE)
Expand All @@ -396,7 +396,7 @@ final HapiSpec secondOrderRewardSituationsWork() {
getTxnRecord("expectNoReward")
.andAllChildRecords()
.countStakingRecords()
.hasChildRecordCount(0)
.hasNonStakingChildRecordCount(0)
.hasStakingFeesPaid()
// .hasPaidStakingRewards(List.of())
.logged());
Expand All @@ -423,15 +423,15 @@ final HapiSpec pendingRewardsPaidBeforeStakedToMeUpdates() {
.andAllChildRecords()
.countStakingRecords()
.stakingFeeExempted()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO)),
// alice - 100, carol - 100
/* --- third period reward eligible from period 2--- */
waitUntilStartOfNextStakingPeriod(STAKING_PERIOD_MINS),
cryptoUpdate(CAROL).newStakedAccountId(ALICE).via("stakedIdUpdate"),
getTxnRecord("stakedIdUpdate")
.andAllChildRecords()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.countStakingRecords()
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO))
.hasPaidStakingRewardsCount(2)
Expand Down Expand Up @@ -537,7 +537,7 @@ final HapiSpec stakingMetadataUpdateIsRewardOpportunity() {
getTxnRecord(FIRST_TXN)
.andAllChildRecords()
.countStakingRecords()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO))
.hasPaidStakingRewards(List.of()),

Expand All @@ -552,7 +552,7 @@ final HapiSpec stakingMetadataUpdateIsRewardOpportunity() {
.logged()
.andAllChildRecords()
.countStakingRecords()
// .hasChildRecordCount(1)
// .hasNonStakingChildRecordCount(1)
//
// .hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO))
.hasPaidStakingRewards(List.of(Pair.of(PAYABLE_CONTRACT, 333333300L))),
Expand All @@ -563,7 +563,7 @@ final HapiSpec stakingMetadataUpdateIsRewardOpportunity() {
getTxnRecord("samePeriodTxn")
.andAllChildRecords()
.countStakingRecords()
.hasChildRecordCount(0)
.hasNonStakingChildRecordCount(0)
.hasPaidStakingRewards(List.of()),
waitUntilStartOfNextStakingPeriod(STAKING_PERIOD_MINS),
waitUntilStartOfNextStakingPeriod(STAKING_PERIOD_MINS),
Expand All @@ -576,7 +576,7 @@ final HapiSpec stakingMetadataUpdateIsRewardOpportunity() {
getTxnRecord("contractRewardTxn")
.andAllChildRecords()
.countStakingRecords()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO))
.logged()
// .hasPaidStakingRewards(List.of(Pair.of(PAYABLE_CONTRACT,
Expand All @@ -600,25 +600,25 @@ final HapiSpec endOfStakingPeriodRecTest() {
getTxnRecord("trigger")
.logged()
.countStakingRecords()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO)),
waitUntilStartOfNextStakingPeriod(STAKING_PERIOD_MINS),
cryptoTransfer(tinyBarsFromTo("a1", "a2", ONE_HBAR)).via("transfer"),
getTxnRecord("transfer")
.countStakingRecords()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO))
.logged(),
cryptoTransfer(tinyBarsFromTo("a1", "a2", ONE_HBAR)).via("noEndOfStakingPeriodRecord"),
getTxnRecord("noEndOfStakingPeriodRecord")
.countStakingRecords()
.hasChildRecordCount(0)
.hasNonStakingChildRecordCount(0)
.logged(),
waitUntilStartOfNextStakingPeriod(STAKING_PERIOD_MINS),
cryptoTransfer(tinyBarsFromTo("a1", "a2", ONE_HBAR)).via("transfer1"),
getTxnRecord("transfer1")
.countStakingRecords()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO))
.logged());
}
Expand All @@ -641,7 +641,7 @@ final HapiSpec rewardsOfDeletedAreRedirectedToBeneficiary() {
getTxnRecord(deletion)
.andAllChildRecords()
.countStakingRecords()
.hasChildRecordCount(1)
.hasNonStakingChildRecordCount(1)
.hasChildRecords(recordWith().memo(END_OF_STAKING_PERIOD_CALCULATIONS_MEMO))
.hasPaidStakingRewards(List.of(Pair.of(bob, 3333333000000L)))
.logged());
Expand Down

0 comments on commit ad6fda3

Please sign in to comment.