Skip to content

Commit 230ac89

Browse files
author
Austin Littley
committed
Merge branch 'release/0.52' into 13924-52-health-monitor
2 parents 4986b78 + e451ef0 commit 230ac89

File tree

28 files changed

+27
-165
lines changed

28 files changed

+27
-165
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
base.example.server.port=8000
22
base.example.server.basePath=/swirlds
33
prometheus.endpointPortNumber=9999
4-
sale.preferredStockHandling=LIFO
4+
sale.preferredStockHandling=LIFO

hedera-node/configuration/dev/bootstrap.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ staking.periodMins=1
1010
staking.fees.nodeRewardPercentage=10
1111
staking.fees.stakingRewardPercentage=10
1212

13-
contracts.knownBlockHash=
13+
contracts.knownBlockHash=

hedera-node/configuration/mainnet/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# hedera-config), this requirement will no longer be valid.
44
# It's used by modular code for property overrides, taking hedera-config/ as the base,
55
# with overrides from this file (configuration/mainnet/application.properties).
6-
ledger.id=0x00
6+
ledger.id=0x00

hedera-node/configuration/mainnet/bootstrap.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
#
44
# This file MUST match application.properties exactly as they are both a replica of file 121 on mainnet and
55
# this file is utilized by the mono-service config for property overrides whereas application.properties is utilized as
6-
# an override by the hedera-config base config.
6+
# an override by the hedera-config base config.

hedera-node/configuration/mainnet/upgrade/feeSchedules.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7258,4 +7258,4 @@
72587258
}
72597259
]
72607260
}
7261-
]
7261+
]

hedera-node/configuration/mainnet/upgrade/throttles.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,4 @@
180180
]
181181
}
182182
]
183-
}
183+
}

hedera-node/configuration/preprod/api-permission.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ networkGetExecutionTime=2-50
6666
systemDelete=2-59
6767
systemUndelete=2-60
6868
freeze=2-58
69-
getAccountDetails=2-50
69+
getAccountDetails=2-50
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
contracts.chainId=298
2-
entities.unlimitedAutoAssociationsEnabled=true
2+
entities.unlimitedAutoAssociationsEnabled=true

hedera-node/configuration/preprod/bootstrap.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ bootstrap.throttleDefsJson.resource=genesis/throttles.json
33
accounts.blocklist.enabled=false
44
accounts.blocklist.path=
55

6-
contracts.knownBlockHash=
6+
contracts.knownBlockHash=

hedera-node/configuration/previewnet/bootstrap.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ accounts.blocklist.path=
66
contracts.evm.version.dynamic=true
77
contracts.maxNumWithHapiSigsAccess=0
88

9-
contracts.knownBlockHash=
9+
contracts.knownBlockHash=

hedera-node/configuration/testnet/api-permission.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ systemUndelete=2-60
6767
freeze=2-58
6868
getAccountDetails=2-50
6969
# Util
70-
utilPrng=0-*
70+
utilPrng=0-*

hedera-node/configuration/testnet/bootstrap.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
ledger.id=0x01
1414
contracts.chainId=296
1515
bootstrap.genesisPublicKey=e06b22e0966108fa5d63fc6ae53f9824319b891cd4d6050dbf2b242be7e13344
16-
contracts.knownBlockHash=
16+
contracts.knownBlockHash=

hedera-node/configuration/testnet/upgrade/feeSchedules.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6852,4 +6852,4 @@
68526852
{
68536853
"expiryTime" : 1633392000
68546854
} ]
6855-
} ]
6855+
} ]

hedera-node/configuration/testnet/upgrade/throttles.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,4 @@
180180
]
181181
}
182182
]
183-
}
183+
}

hedera-node/data/config/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ tokens.nfts.useVirtualMerkle=true
1313
records.useConsolidatedFcq=true
1414
cache.cryptoTransfer.warmThreads=30
1515
contracts.maxNumWithHapiSigsAccess=0
16-
tokens.balancesInQueries.enabled=true
16+
tokens.balancesInQueries.enabled=true

hedera-node/data/config/genesis.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
#
1717
# This file is needed for JRS tests of the configuration and should not be deleted until we can change it to look
1818
# for the file in a different location
19-
bar.test=genesis
19+
bar.test=genesis

hedera-node/hedera-app/data/config/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
#
1717
# This file is needed for unit tests of the configuration and should not be deleted!
1818
foo.test=123
19-
bar.test=456
19+
bar.test=456

hedera-node/hedera-app/data/config/genesis.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#
1616
#
1717
# This file is needed for unit tests of the configuration and should not be deleted!
18-
bar.test=genesis
18+
bar.test=genesis

hedera-node/hedera-app/for-test/application.properties.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
# This file is needed for unit tests of the configuration and should not be deleted!
1818

1919
foo.test=123Test
20-
bar.test=456Test
20+
bar.test=456Test

hedera-node/hedera-app/for-test/genesis.properties.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
#
1717
# This file is needed for unit tests of the configuration and should not be deleted!
1818

19-
bar.test=genesisTest
19+
bar.test=genesisTest
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a=b
1+
a=b

hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenRejectHandler.java

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,13 @@
7272
import com.hedera.node.app.spi.workflows.PreHandleContext;
7373
import com.hedera.node.app.spi.workflows.TransactionHandler;
7474
import com.hedera.node.config.data.FeesConfig;
75-
import com.hedera.node.config.data.HederaConfig;
7675
import com.hedera.node.config.data.LedgerConfig;
7776
import com.hedera.node.config.data.TokensConfig;
7877
import com.swirlds.base.utility.Pair;
7978
import edu.umd.cs.findbugs.annotations.NonNull;
8079
import java.util.ArrayList;
8180
import java.util.HashSet;
8281
import java.util.List;
83-
import java.util.Objects;
8482
import java.util.stream.Collectors;
8583
import javax.inject.Inject;
8684
import javax.inject.Singleton;
@@ -172,7 +170,6 @@ public void handle(@NonNull final HandleContext context) throws HandleException
172170
final var rejectingAccountID = op.ownerOrElse(context.payer());
173171
final var rejections = op.rejections();
174172

175-
final var hederaConfig = context.configuration().getConfigData(HederaConfig.class);
176173
final var ledgerConfig = context.configuration().getConfigData(LedgerConfig.class);
177174
final var tokensConfig = context.configuration().getConfigData(TokensConfig.class);
178175
validateTrue(tokensConfig.tokenRejectEnabled(), NOT_SUPPORTED);
@@ -186,18 +183,12 @@ public void handle(@NonNull final HandleContext context) throws HandleException
186183
final var processedRejectTransfers = processRejectionsForTransfer(rejections, context, rejectingAccount);
187184

188185
// Apply all changes to the handleContext's states by performing the transfer to the treasuries
186+
// Allowances will not be affected with the token reject
189187
final var transferContext = new TransferContextImpl(context);
190188
final var fungibleTokensStep = new AdjustFungibleTokenChangesStep(processedRejectTransfers, context.payer());
191189
final var nftOwnersChangeStep = new NFTOwnersChangeStep(processedRejectTransfers, context.payer());
192190
fungibleTokensStep.doIn(transferContext);
193191
nftOwnersChangeStep.doIn(transferContext);
194-
195-
// Update the token allowances
196-
if (hederaConfig.allowancesIsEnabled()) {
197-
final var nftStore = context.storeFactory().writableStore(WritableNftStore.class);
198-
updateFungibleAllowances(rejectingAccount, rejections, accountStore);
199-
updateNFTAllowances(rejections, nftStore);
200-
}
201192
}
202193

203194
/**
@@ -290,49 +281,6 @@ private TokenTransferList processFungibleTokenRejection(
290281
return createFungibleTransfer(tokenId, accountID, tokenRelation.balance(), token.treasuryAccountId());
291282
}
292283

293-
/**
294-
* Updates the NFT allowances in the state after the token transfers have been processed,
295-
* by setting the spender to null.
296-
*
297-
* @param tokenReferences The list of tokens that were rejected.
298-
* @param nftStore The store to access writable NFT information.
299-
*/
300-
private void updateNFTAllowances(
301-
@NonNull final List<TokenReference> tokenReferences, @NonNull final WritableNftStore nftStore) {
302-
tokenReferences.stream()
303-
.filter(TokenReference::hasNft)
304-
.map(reference -> getIfUsable(reference.nftOrThrow(), nftStore))
305-
.forEach(nft -> {
306-
if (nft.hasSpenderId()) {
307-
nftStore.put(
308-
nft.copyBuilder().spenderId((AccountID) null).build());
309-
}
310-
});
311-
}
312-
313-
/**
314-
* Updates the fungible token allowances in the state after the token transfers to the treasuries have been processed.
315-
*
316-
* @param rejectingAccount The account rejecting the tokens.
317-
* @param tokenReferences The list of tokens that were rejected.
318-
* @param accountStore The store to access writable account information.
319-
*/
320-
private void updateFungibleAllowances(
321-
@NonNull final Account rejectingAccount,
322-
@NonNull final List<TokenReference> tokenReferences,
323-
@NonNull final WritableAccountStore accountStore) {
324-
final var updatedFungibleTokenAllowances = new ArrayList<>(rejectingAccount.tokenAllowances());
325-
updatedFungibleTokenAllowances.removeIf(allowance -> tokenReferences.stream()
326-
.filter(TokenReference::hasFungibleToken)
327-
.anyMatch(fungibleToken -> Objects.equals(fungibleToken.fungibleToken(), allowance.tokenId())));
328-
329-
final var updatedAccount = rejectingAccount
330-
.copyBuilder()
331-
.tokenAllowances(updatedFungibleTokenAllowances)
332-
.build();
333-
accountStore.put(updatedAccount);
334-
}
335-
336284
@NonNull
337285
@Override
338286
public Fees calculateFees(final FeeContext feeContext) {

hedera-node/test-clients/config/umbrellaTest-Crypto.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ transactionBodyFormat=Random
8282
#
8383
#
8484
## flag whether or not to use system accounts (i.e. account number under 100 excluding genesis and node accounts)
85-
useSystemAccountAsPayer=false
85+
useSystemAccountAsPayer=false

hedera-node/test-clients/config/umbrellaTest.properties.alt1k

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ transactionBodyFormat=Random
8282
#
8383
#
8484
## flag whether or not to use system accounts (i.e. account number under 100 excluding genesis and node accounts)
85-
useSystemAccountAsPayer=false
85+
useSystemAccountAsPayer=false

hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/contract/precompile/TokenRejectSuite.java

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@
1919
import static com.google.protobuf.ByteString.copyFromUtf8;
2020
import static com.hedera.services.bdd.junit.TestTags.TOKEN;
2121
import static com.hedera.services.bdd.spec.HapiSpec.defaultHapiSpec;
22-
import static com.hedera.services.bdd.spec.assertions.AccountDetailsAsserts.accountDetailsWith;
2322
import static com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance;
24-
import static com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountDetails;
2523
import static com.hedera.services.bdd.spec.queries.QueryVerbs.getTokenNftInfo;
2624
import static com.hedera.services.bdd.spec.queries.QueryVerbs.getTxnRecord;
27-
import static com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoApproveAllowance;
2825
import static com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoCreate;
2926
import static com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoTransfer;
3027
import static com.hedera.services.bdd.spec.transactions.TxnVerbs.mintToken;
@@ -42,13 +39,9 @@
4239
import static com.hedera.services.bdd.spec.transactions.token.HapiTokenReject.rejectingToken;
4340
import static com.hedera.services.bdd.spec.transactions.token.TokenMovement.moving;
4441
import static com.hedera.services.bdd.spec.transactions.token.TokenMovement.movingUnique;
45-
import static com.hedera.services.bdd.spec.transactions.token.TokenMovement.movingWithAllowance;
4642
import static com.hedera.services.bdd.spec.utilops.CustomSpecAssert.allRunFor;
4743
import static com.hedera.services.bdd.spec.utilops.UtilVerbs.newKeyNamed;
4844
import static com.hedera.services.bdd.spec.utilops.UtilVerbs.withOpContext;
49-
import static com.hedera.services.bdd.suites.HapiSuite.DEFAULT_PAYER;
50-
import static com.hedera.services.bdd.suites.HapiSuite.GENESIS;
51-
import static com.hedera.services.bdd.suites.HapiSuite.ONE_HBAR;
5245
import static com.hedera.services.bdd.suites.HapiSuite.ONE_HUNDRED_HBARS;
5346
import static com.hedera.services.bdd.suites.HapiSuite.ONE_MILLION_HBARS;
5447
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.ACCOUNT_AMOUNT_TRANSFERS_ONLY_ALLOWED_FOR_FUNGIBLE_COMMON;
@@ -60,7 +53,6 @@
6053
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_NFT_ID;
6154
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_OWNER_ID;
6255
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_SIGNATURE;
63-
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.SPENDER_DOES_NOT_HAVE_ALLOWANCE;
6456
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_IS_PAUSED;
6557
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_NOT_ASSOCIATED_TO_ACCOUNT;
6658
import static com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_REFERENCE_REPEATED;
@@ -213,84 +205,6 @@ final Stream<DynamicTest> tokenRejectWorksWithFungibleAndNFTTokens() {
213205
getAccountBalance(TOKEN_TREASURY).logged().hasTokenBalance(FUNGIBLE_TOKEN_A, 1000L));
214206
}
215207

216-
@HapiTest
217-
final Stream<DynamicTest> tokenRejectWorksWithFungibleAndNFTTokensAndRemovesAllowancesCorrectly() {
218-
return defaultHapiSpec("tokenRejectWorksWithFungibleAndNFTTokensAndRemovesAllowances")
219-
.given(
220-
newKeyNamed(MULTI_KEY),
221-
cryptoCreate(ACCOUNT).balance(ONE_HUNDRED_HBARS).maxAutomaticTokenAssociations(3),
222-
cryptoCreate(ACCOUNT_1).maxAutomaticTokenAssociations(3),
223-
cryptoCreate(SPENDER).balance(ONE_HUNDRED_HBARS).maxAutomaticTokenAssociations(3),
224-
cryptoCreate(TOKEN_TREASURY),
225-
tokenCreate(FUNGIBLE_TOKEN_A)
226-
.initialSupply(TOTAL_SUPPLY)
227-
.adminKey(MULTI_KEY)
228-
.supplyKey(MULTI_KEY)
229-
.treasury(TOKEN_TREASURY),
230-
tokenCreate(NON_FUNGIBLE_TOKEN_B)
231-
.initialSupply(0)
232-
.adminKey(MULTI_KEY)
233-
.supplyKey(MULTI_KEY)
234-
.treasury(TOKEN_TREASURY)
235-
.tokenType(TokenType.NON_FUNGIBLE_UNIQUE),
236-
tokenAssociate(ACCOUNT, FUNGIBLE_TOKEN_A, NON_FUNGIBLE_TOKEN_B),
237-
mintToken(NON_FUNGIBLE_TOKEN_B, List.of(copyFromUtf8("memo"), copyFromUtf8("memo"))),
238-
cryptoTransfer(
239-
moving(250L, FUNGIBLE_TOKEN_A).between(TOKEN_TREASURY, ACCOUNT),
240-
movingUnique(NON_FUNGIBLE_TOKEN_B, 1L, 2L).between(TOKEN_TREASURY, ACCOUNT)),
241-
cryptoApproveAllowance()
242-
.payingWith(DEFAULT_PAYER)
243-
.addTokenAllowance(ACCOUNT, FUNGIBLE_TOKEN_A, SPENDER, 200L)
244-
.addTokenAllowance(TOKEN_TREASURY, FUNGIBLE_TOKEN_A, ACCOUNT, 50L)
245-
.signedBy(DEFAULT_PAYER, ACCOUNT, SPENDER, TOKEN_TREASURY)
246-
.fee(ONE_HBAR),
247-
// Verify Account's allowance works and exists:
248-
cryptoTransfer(movingWithAllowance(50, FUNGIBLE_TOKEN_A).between(ACCOUNT, ACCOUNT_1))
249-
.payingWith(SPENDER)
250-
.signedBy(SPENDER),
251-
getAccountDetails(ACCOUNT)
252-
.payingWith(GENESIS)
253-
.logged()
254-
.has(accountDetailsWith().tokenAllowancesContaining(FUNGIBLE_TOKEN_A, SPENDER, 150)))
255-
.when(withOpContext((spec, opLog) -> allRunFor(
256-
spec,
257-
// Try rejecting only when having allowance, without balance
258-
tokenAssociate(SPENDER, FUNGIBLE_TOKEN_A),
259-
tokenReject(SPENDER, rejectingToken(FUNGIBLE_TOKEN_A))
260-
.hasKnownStatus(INSUFFICIENT_TOKEN_BALANCE),
261-
tokenReject(
262-
ACCOUNT,
263-
rejectingToken(FUNGIBLE_TOKEN_A),
264-
rejectingNFT(NON_FUNGIBLE_TOKEN_B, 1L),
265-
rejectingNFT(NON_FUNGIBLE_TOKEN_B, 2L))
266-
.via("tokenRejectRemovesAllowance"),
267-
// Verify Spender's allowance is removed:
268-
cryptoTransfer(movingWithAllowance(50, FUNGIBLE_TOKEN_A).between(ACCOUNT, ACCOUNT_1))
269-
.payingWith(ACCOUNT)
270-
.signedBy(ACCOUNT)
271-
.hasKnownStatus(SPENDER_DOES_NOT_HAVE_ALLOWANCE))))
272-
.then(
273-
getTxnRecord("tokenRejectRemovesAllowance")
274-
.andAllChildRecords()
275-
.logged(),
276-
getTokenNftInfo(NON_FUNGIBLE_TOKEN_B, 1L)
277-
.hasAccountID(TOKEN_TREASURY)
278-
.hasNoSpender(),
279-
getTokenNftInfo(NON_FUNGIBLE_TOKEN_B, 2L)
280-
.hasAccountID(TOKEN_TREASURY)
281-
.hasNoSpender(),
282-
getAccountBalance(ACCOUNT).logged().hasTokenBalance(FUNGIBLE_TOKEN_A, 0L),
283-
getAccountDetails(ACCOUNT)
284-
.payingWith(GENESIS)
285-
.logged()
286-
.has(accountDetailsWith().noAllowances()),
287-
getAccountDetails(TOKEN_TREASURY)
288-
.payingWith(GENESIS)
289-
.logged()
290-
.has(accountDetailsWith().tokenAllowancesContaining(FUNGIBLE_TOKEN_A, ACCOUNT, 50)),
291-
getAccountBalance(TOKEN_TREASURY).logged().hasTokenBalance(FUNGIBLE_TOKEN_A, 950L));
292-
}
293-
294208
@HapiTest
295209
final Stream<DynamicTest> tokenRejectCasesWhileFreezeOrPausedOrSigRequired() {
296210
return defaultHapiSpec("tokenRejectWorksWhileFreezeOrPausedOrSigRequired")

hedera-node/test-clients/src/main/resource/contract/contracts/GlobalProperties/GlobalProperties.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@
5151
"stateMutability": "view",
5252
"type": "function"
5353
}
54-
]
54+
]

hedera-node/test-clients/src/main/resource/eet-config/hollow-account-fuzzing.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ randomTransferFromHollowAccount.bias=10
1414
randomAccountUpdate.bias=10
1515
randomContract.bias=1
1616
randomContract.ceilingNum=50
17-
randomContractDeletion.bias=10
17+
randomContractDeletion.bias=10

hedera-node/test-clients/src/main/resource/eet-config/id-fuzzing.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ randomAccount.bias=60
77
randomAccount.ceilingNum=100
88
randomAccountUpdate.bias=30
99
randomTransfer.bias=100
10-
randomEthereumTransactionTransfer.bias=100
10+
randomEthereumTransactionTransfer.bias=100

0 commit comments

Comments
 (0)