From b26d20bff801e3ac18a10346b837f97f05655330 Mon Sep 17 00:00:00 2001 From: Hendrik Ebbers Date: Tue, 25 Apr 2023 13:45:22 +0200 Subject: [PATCH 1/6] Dagger module for token service Signed-off-by: Hendrik Ebbers --- .../java/com/hedera/node/app/HederaApp.java | 75 +++--- .../node/app/services/ServiceModule.java | 7 - .../app/workflows/handle/HandlersModule.java | 64 ++--- .../workflows/query/QueryWorkflowModule.java | 32 +-- .../handle/HandleWorkflowModuleTest.java | 50 ++-- .../impl/CryptoSignatureWaiversImpl.java | 9 +- .../{TokenComponent.java => TokenModule.java} | 22 +- .../token/impl/handlers/TokenComponent.java | 251 ++++++++++++++++++ .../token/impl/test/TokenComponentTest.java | 65 ----- .../handlers/CryptoCreateHandlerTest.java | 2 +- 10 files changed, 383 insertions(+), 194 deletions(-) rename hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/{TokenComponent.java => TokenModule.java} (92%) create mode 100644 hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java delete mode 100644 hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/TokenComponentTest.java diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java index cead06cae185..f1468d92d924 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java @@ -49,6 +49,7 @@ import com.hedera.node.app.service.mono.throttling.ThrottlingModule; import com.hedera.node.app.service.mono.txns.TransactionsModule; import com.hedera.node.app.service.mono.txns.submission.SubmissionModule; +import com.hedera.node.app.service.token.impl.components.TokenModule; import com.hedera.node.app.services.ServiceModule; import com.hedera.node.app.solvency.SolvencyModule; import com.hedera.node.app.state.HederaStateModule; @@ -70,47 +71,47 @@ import javax.inject.Singleton; /** - * The infrastructure used to implement the platform contract for a Hedera Services node. - * This is needed for adding dagger subcomponents. - * Currently, it extends {@link com.hedera.node.app.service.mono.ServicesApp}. But, - * in the future this class will be cleaned up to not have multiple module dependencies + * The infrastructure used to implement the platform contract for a Hedera Services node. This is needed for adding + * dagger subcomponents. Currently, it extends {@link com.hedera.node.app.service.mono.ServicesApp}. But, in the future + * this class will be cleaned up to not have multiple module dependencies */ @Singleton @Component( modules = { - TaskModule.class, - FeesModule.class, - KeysModule.class, - SigsModule.class, - GrpcModule.class, - ConfigModule.class, - StatsModule.class, - StateModule.class, - FilesModule.class, - LedgerModule.class, - StoresModule.class, - ContextModule.class, - RecordsModule.class, - QueriesModule.class, - ContractsModule.class, - PropertiesModule.class, - ThrottlingModule.class, - SubmissionModule.class, - TransactionsModule.class, - ExpiryModule.class, - ServiceModule.class, - IngestModule.class, - QueryWorkflowModule.class, - HandleWorkflowModule.class, - PreHandleWorkflowModule.class, - HederaStateModule.class, - AdaptedFeeCalculatorModule.class, - HederaStateModule.class, - MetricsDaggerModule.class, - AuthorizerDaggerModule.class, - InfoDaggerModule.class, - ThrottleModule.class, - SolvencyModule.class + TaskModule.class, + FeesModule.class, + KeysModule.class, + SigsModule.class, + GrpcModule.class, + ConfigModule.class, + StatsModule.class, + StateModule.class, + FilesModule.class, + LedgerModule.class, + StoresModule.class, + ContextModule.class, + RecordsModule.class, + QueriesModule.class, + ContractsModule.class, + PropertiesModule.class, + ThrottlingModule.class, + SubmissionModule.class, + TransactionsModule.class, + ExpiryModule.class, + ServiceModule.class, + IngestModule.class, + QueryWorkflowModule.class, + HandleWorkflowModule.class, + PreHandleWorkflowModule.class, + HederaStateModule.class, + AdaptedFeeCalculatorModule.class, + HederaStateModule.class, + MetricsDaggerModule.class, + AuthorizerDaggerModule.class, + InfoDaggerModule.class, + ThrottleModule.class, + SolvencyModule.class, + TokenModule.class }) public interface HederaApp extends ServicesApp { /* Needed by ServicesState */ diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/services/ServiceModule.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/services/ServiceModule.java index 6eb5e5789588..657600ebb219 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/services/ServiceModule.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/services/ServiceModule.java @@ -28,8 +28,6 @@ import com.hedera.node.app.service.network.impl.components.NetworkComponent; import com.hedera.node.app.service.schedule.impl.components.DaggerScheduleComponent; import com.hedera.node.app.service.schedule.impl.components.ScheduleComponent; -import com.hedera.node.app.service.token.impl.components.DaggerTokenComponent; -import com.hedera.node.app.service.token.impl.components.TokenComponent; import com.hedera.node.app.service.util.impl.components.DaggerUtilComponent; import com.hedera.node.app.service.util.impl.components.UtilComponent; import dagger.Module; @@ -80,9 +78,4 @@ static ScheduleComponent provideScheduleComponent() { return DaggerScheduleComponent.create(); } - @Provides - @Singleton - static TokenComponent provideTokenComponent() { - return DaggerTokenComponent.create(); - } } diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandlersModule.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandlersModule.java index d30aedd161ee..57b636d20327 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandlersModule.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandlersModule.java @@ -22,7 +22,7 @@ import com.hedera.node.app.service.file.impl.components.FileComponent; import com.hedera.node.app.service.network.impl.components.NetworkComponent; import com.hedera.node.app.service.schedule.impl.components.ScheduleComponent; -import com.hedera.node.app.service.token.impl.components.TokenComponent; +import com.hedera.node.app.service.token.impl.handlers.TokenComponent; import com.hedera.node.app.service.util.impl.components.UtilComponent; import com.hedera.node.app.workflows.dispatcher.TransactionHandlers; import dagger.Module; @@ -35,14 +35,14 @@ public interface HandlersModule { @Provides @Singleton static TransactionHandlers provideTransactionHandlers( - @NonNull AdminComponent adminComponent, - @NonNull ConsensusComponent consensusComponent, - @NonNull FileComponent fileComponent, - @NonNull NetworkComponent networkComponent, - @NonNull ContractComponent contractComponent, - @NonNull ScheduleComponent scheduleComponent, - @NonNull TokenComponent tokenComponent, - @NonNull UtilComponent utilComponent) { + @NonNull final AdminComponent adminComponent, + @NonNull final ConsensusComponent consensusComponent, + @NonNull final FileComponent fileComponent, + @NonNull final NetworkComponent networkComponent, + @NonNull final ContractComponent contractComponent, + @NonNull final ScheduleComponent scheduleComponent, + @NonNull final TokenComponent tokenComponent, + @NonNull final UtilComponent utilComponent) { return new TransactionHandlers( consensusComponent.consensusCreateTopicHandler(), consensusComponent.consensusUpdateTopicHandler(), @@ -55,14 +55,14 @@ static TransactionHandlers provideTransactionHandlers( contractComponent.contractSystemDeleteHandler(), contractComponent.contractSystemUndeleteHandler(), contractComponent.etherumTransactionHandler(), - tokenComponent.cryptoCreateHandler(), - tokenComponent.cryptoUpdateHandler(), - tokenComponent.cryptoTransferHandler(), - tokenComponent.cryptoDeleteHandler(), - tokenComponent.cryptoApproveAllowanceHandler(), - tokenComponent.cryptoDeleteAllowanceHandler(), - tokenComponent.cryptoAddLiveHashHandler(), - tokenComponent.cryptoDeleteLiveHashHandler(), + tokenComponent.getCryptoCreateHandler(), + tokenComponent.getCryptoUpdateHandler(), + tokenComponent.getCryptoTransferHandler(), + tokenComponent.getCryptoDeleteHandler(), + tokenComponent.getCryptoApproveAllowanceHandler(), + tokenComponent.getCryptoDeleteAllowanceHandler(), + tokenComponent.getCryptoAddLiveHashHandler(), + tokenComponent.getCryptoDeleteLiveHashHandler(), fileComponent.fileCreateHandler(), fileComponent.fileUpdateHandler(), fileComponent.fileDeleteHandler(), @@ -74,21 +74,21 @@ static TransactionHandlers provideTransactionHandlers( scheduleComponent.scheduleCreateHandler(), scheduleComponent.scheduleSignHandler(), scheduleComponent.scheduleDeleteHandler(), - tokenComponent.tokenCreateHandler(), - tokenComponent.tokenUpdateHandler(), - tokenComponent.tokenMintHandler(), - tokenComponent.tokenBurnHandler(), - tokenComponent.tokenDeleteHandler(), - tokenComponent.tokenAccountWipeHandler(), - tokenComponent.tokenFreezeAccountHandler(), - tokenComponent.tokenUnfreezeAccountHandler(), - tokenComponent.tokenGrantKycToAccountHandler(), - tokenComponent.tokenRevokeKycFromAccountHandler(), - tokenComponent.tokenAssociateToAccountHandler(), - tokenComponent.tokenDissociateFromAccountHandler(), - tokenComponent.tokenFeeScheduleUpdateHandler(), - tokenComponent.tokenPauseHandler(), - tokenComponent.tokenUnpauseHandler(), + tokenComponent.getTokenCreateHandler(), + tokenComponent.getTokenUpdateHandler(), + tokenComponent.getTokenMintHandler(), + tokenComponent.getTokenBurnHandler(), + tokenComponent.getTokenDeleteHandler(), + tokenComponent.getTokenAccountWipeHandler(), + tokenComponent.getTokenFreezeAccountHandler(), + tokenComponent.getTokenUnfreezeAccountHandler(), + tokenComponent.getTokenGrantKycToAccountHandler(), + tokenComponent.getTokenRevokeKycFromAccountHandler(), + tokenComponent.getTokenAssociateToAccountHandler(), + tokenComponent.getTokenDissociateFromAccountHandler(), + tokenComponent.getTokenFeeScheduleUpdateHandler(), + tokenComponent.getTokenPauseHandler(), + tokenComponent.getTokenUnpauseHandler(), utilComponent.prngHandler()); } } diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/query/QueryWorkflowModule.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/query/QueryWorkflowModule.java index ed505778a7b5..e4217606a1c4 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/query/QueryWorkflowModule.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/query/QueryWorkflowModule.java @@ -26,7 +26,7 @@ import com.hedera.node.app.service.file.impl.components.FileComponent; import com.hedera.node.app.service.network.impl.components.NetworkComponent; import com.hedera.node.app.service.schedule.impl.components.ScheduleComponent; -import com.hedera.node.app.service.token.impl.components.TokenComponent; +import com.hedera.node.app.service.token.impl.handlers.TokenComponent; import com.hedera.node.app.state.HederaState; import com.hedera.pbj.runtime.Codec; import com.swirlds.common.system.Platform; @@ -62,12 +62,12 @@ static Function> provideStateAcc @Provides static QueryHandlers provideQueryHandlers( - @NonNull ConsensusComponent consensusComponent, - @NonNull FileComponent fileComponent, - @NonNull NetworkComponent networkComponent, - @NonNull ContractComponent contractComponent, - @NonNull ScheduleComponent scheduleComponent, - @NonNull TokenComponent tokenComponent) { + @NonNull final ConsensusComponent consensusComponent, + @NonNull final FileComponent fileComponent, + @NonNull final NetworkComponent networkComponent, + @NonNull final ContractComponent contractComponent, + @NonNull final ScheduleComponent scheduleComponent, + @NonNull final TokenComponent tokenComponent) { return new QueryHandlers( consensusComponent.consensusGetTopicInfoHandler(), contractComponent.contractGetBySolidityIDHandler(), @@ -75,11 +75,11 @@ static QueryHandlers provideQueryHandlers( contractComponent.contractGetInfoHandler(), contractComponent.contractGetBytecodeHandler(), contractComponent.contractGetRecordsHandler(), - tokenComponent.cryptoGetAccountBalanceHandler(), - tokenComponent.cryptoGetAccountInfoHandler(), - tokenComponent.cryptoGetAccountRecordsHandler(), - tokenComponent.cryptoGetLiveHashHandler(), - tokenComponent.cryptoGetStakersHandler(), + tokenComponent.getCryptoGetAccountBalanceHandler(), + tokenComponent.getCryptoGetAccountInfoHandler(), + tokenComponent.getCryptoGetAccountRecordsHandler(), + tokenComponent.getCryptoGetLiveHashHandler(), + tokenComponent.getCryptoGetStakersHandler(), fileComponent.fileGetContentsHandler(), fileComponent.fileGetInfoHandler(), networkComponent.networkGetAccountDetailsHandler(), @@ -89,10 +89,10 @@ static QueryHandlers provideQueryHandlers( networkComponent.networkTransactionGetReceiptHandler(), networkComponent.networkTransactionGetRecordHandler(), scheduleComponent.scheduleGetInfoHandler(), - tokenComponent.tokenGetInfoHandler(), - tokenComponent.tokenGetAccountNftInfosHandler(), - tokenComponent.tokenGetNftInfoHandler(), - tokenComponent.tokenGetNftInfosHandler()); + tokenComponent.getTokenGetInfoHandler(), + tokenComponent.getTokenGetAccountNftInfosHandler(), + tokenComponent.getTokenGetNftInfoHandler(), + tokenComponent.getTokenGetNftInfosHandler()); } @Provides diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/HandleWorkflowModuleTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/HandleWorkflowModuleTest.java index e6dd90410c86..6b488f9205bc 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/HandleWorkflowModuleTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/HandleWorkflowModuleTest.java @@ -16,7 +16,7 @@ package com.hedera.node.app.workflows.handle; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.mockito.BDDMockito.given; import com.hedera.node.app.service.admin.impl.components.AdminComponent; @@ -47,7 +47,6 @@ import com.hedera.node.app.service.schedule.impl.handlers.ScheduleCreateHandler; import com.hedera.node.app.service.schedule.impl.handlers.ScheduleDeleteHandler; import com.hedera.node.app.service.schedule.impl.handlers.ScheduleSignHandler; -import com.hedera.node.app.service.token.impl.components.TokenComponent; import com.hedera.node.app.service.token.impl.handlers.CryptoAddLiveHashHandler; import com.hedera.node.app.service.token.impl.handlers.CryptoApproveAllowanceHandler; import com.hedera.node.app.service.token.impl.handlers.CryptoCreateHandler; @@ -59,6 +58,7 @@ import com.hedera.node.app.service.token.impl.handlers.TokenAccountWipeHandler; import com.hedera.node.app.service.token.impl.handlers.TokenAssociateToAccountHandler; import com.hedera.node.app.service.token.impl.handlers.TokenBurnHandler; +import com.hedera.node.app.service.token.impl.handlers.TokenComponent; import com.hedera.node.app.service.token.impl.handlers.TokenCreateHandler; import com.hedera.node.app.service.token.impl.handlers.TokenDeleteHandler; import com.hedera.node.app.service.token.impl.handlers.TokenDissociateFromAccountHandler; @@ -256,14 +256,14 @@ void usesComponentsToGetHandlers() { given(contractComponent.contractSystemDeleteHandler()).willReturn(contractSystemDeleteHandler); given(contractComponent.contractSystemUndeleteHandler()).willReturn(contractSystemUndeleteHandler); given(contractComponent.etherumTransactionHandler()).willReturn(etherumTransactionHandler); - given(tokenComponent.cryptoCreateHandler()).willReturn(cryptoCreateHandler); - given(tokenComponent.cryptoUpdateHandler()).willReturn(cryptoUpdateHandler); - given(tokenComponent.cryptoTransferHandler()).willReturn(cryptoTransferHandler); - given(tokenComponent.cryptoDeleteHandler()).willReturn(cryptoDeleteHandler); - given(tokenComponent.cryptoApproveAllowanceHandler()).willReturn(cryptoApproveAllowanceHandler); - given(tokenComponent.cryptoDeleteAllowanceHandler()).willReturn(cryptoDeleteAllowanceHandler); - given(tokenComponent.cryptoAddLiveHashHandler()).willReturn(cryptoAddLiveHashHandler); - given(tokenComponent.cryptoDeleteLiveHashHandler()).willReturn(cryptoDeleteLiveHashHandler); + given(tokenComponent.getCryptoCreateHandler()).willReturn(cryptoCreateHandler); + given(tokenComponent.getCryptoUpdateHandler()).willReturn(cryptoUpdateHandler); + given(tokenComponent.getCryptoTransferHandler()).willReturn(cryptoTransferHandler); + given(tokenComponent.getCryptoDeleteHandler()).willReturn(cryptoDeleteHandler); + given(tokenComponent.getCryptoApproveAllowanceHandler()).willReturn(cryptoApproveAllowanceHandler); + given(tokenComponent.getCryptoDeleteAllowanceHandler()).willReturn(cryptoDeleteAllowanceHandler); + given(tokenComponent.getCryptoAddLiveHashHandler()).willReturn(cryptoAddLiveHashHandler); + given(tokenComponent.getCryptoDeleteLiveHashHandler()).willReturn(cryptoDeleteLiveHashHandler); given(fileComponent.fileCreateHandler()).willReturn(fileCreateHandler); given(fileComponent.fileUpdateHandler()).willReturn(fileUpdateHandler); given(fileComponent.fileDeleteHandler()).willReturn(fileDeleteHandler); @@ -275,21 +275,21 @@ void usesComponentsToGetHandlers() { given(scheduleComponent.scheduleCreateHandler()).willReturn(scheduleCreateHandler); given(scheduleComponent.scheduleSignHandler()).willReturn(scheduleSignHandler); given(scheduleComponent.scheduleDeleteHandler()).willReturn(scheduleDeleteHandler); - given(tokenComponent.tokenCreateHandler()).willReturn(tokenCreateHandler); - given(tokenComponent.tokenUpdateHandler()).willReturn(tokenUpdateHandler); - given(tokenComponent.tokenMintHandler()).willReturn(tokenMintHandler); - given(tokenComponent.tokenBurnHandler()).willReturn(tokenBurnHandler); - given(tokenComponent.tokenDeleteHandler()).willReturn(tokenDeleteHandler); - given(tokenComponent.tokenAccountWipeHandler()).willReturn(tokenAccountWipeHandler); - given(tokenComponent.tokenFreezeAccountHandler()).willReturn(tokenFreezeAccountHandler); - given(tokenComponent.tokenUnfreezeAccountHandler()).willReturn(tokenUnfreezeAccountHandler); - given(tokenComponent.tokenGrantKycToAccountHandler()).willReturn(tokenGrantKycToAccountHandler); - given(tokenComponent.tokenRevokeKycFromAccountHandler()).willReturn(tokenRevokeKycFromAccountHandler); - given(tokenComponent.tokenAssociateToAccountHandler()).willReturn(tokenAssociateToAccountHandler); - given(tokenComponent.tokenDissociateFromAccountHandler()).willReturn(tokenDissociateFromAccountHandler); - given(tokenComponent.tokenFeeScheduleUpdateHandler()).willReturn(tokenFeeScheduleUpdateHandler); - given(tokenComponent.tokenPauseHandler()).willReturn(tokenPauseHandler); - given(tokenComponent.tokenUnpauseHandler()).willReturn(tokenUnpauseHandler); + given(tokenComponent.getTokenCreateHandler()).willReturn(tokenCreateHandler); + given(tokenComponent.getTokenUpdateHandler()).willReturn(tokenUpdateHandler); + given(tokenComponent.getTokenMintHandler()).willReturn(tokenMintHandler); + given(tokenComponent.getTokenBurnHandler()).willReturn(tokenBurnHandler); + given(tokenComponent.getTokenDeleteHandler()).willReturn(tokenDeleteHandler); + given(tokenComponent.getTokenAccountWipeHandler()).willReturn(tokenAccountWipeHandler); + given(tokenComponent.getTokenFreezeAccountHandler()).willReturn(tokenFreezeAccountHandler); + given(tokenComponent.getTokenUnfreezeAccountHandler()).willReturn(tokenUnfreezeAccountHandler); + given(tokenComponent.getTokenGrantKycToAccountHandler()).willReturn(tokenGrantKycToAccountHandler); + given(tokenComponent.getTokenRevokeKycFromAccountHandler()).willReturn(tokenRevokeKycFromAccountHandler); + given(tokenComponent.getTokenAssociateToAccountHandler()).willReturn(tokenAssociateToAccountHandler); + given(tokenComponent.getTokenDissociateFromAccountHandler()).willReturn(tokenDissociateFromAccountHandler); + given(tokenComponent.getTokenFeeScheduleUpdateHandler()).willReturn(tokenFeeScheduleUpdateHandler); + given(tokenComponent.getTokenPauseHandler()).willReturn(tokenPauseHandler); + given(tokenComponent.getTokenUnpauseHandler()).willReturn(tokenUnpauseHandler); given(utilComponent.prngHandler()).willReturn(utilPrngHandler); final var handlers = HandlersModule.provideTransactionHandlers( diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/CryptoSignatureWaiversImpl.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/CryptoSignatureWaiversImpl.java index 792ca4f28bed..f6e31e7e982b 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/CryptoSignatureWaiversImpl.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/CryptoSignatureWaiversImpl.java @@ -24,13 +24,18 @@ import com.hedera.node.app.service.token.TokenService; import com.hedera.node.app.spi.numbers.HederaAccountNumbers; import edu.umd.cs.findbugs.annotations.NonNull; +import javax.inject.Inject; +import javax.inject.Singleton; import org.apache.commons.lang3.NotImplementedException; /** - * A Singleton implementation of signature waivers needed for transactions in {@link TokenService}. - * NOTE: FUTURE - These will be implemented in the coming PR and this class should be a singleton. + * A Singleton implementation of signature waivers needed for transactions in {@link TokenService}. NOTE: FUTURE - These + * will be implemented in the coming PR and this class should be a singleton. */ +@Singleton public class CryptoSignatureWaiversImpl implements CryptoSignatureWaivers { + + @Inject public CryptoSignatureWaiversImpl(@NonNull final HederaAccountNumbers accountNumbers) { requireNonNull(accountNumbers); } diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenComponent.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenModule.java similarity index 92% rename from hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenComponent.java rename to hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenModule.java index 1957dfa1abc0..710ee2cb5601 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenComponent.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenModule.java @@ -16,6 +16,8 @@ package com.hedera.node.app.service.token.impl.components; +import com.hedera.node.app.service.token.CryptoSignatureWaivers; +import com.hedera.node.app.service.token.impl.CryptoSignatureWaiversImpl; import com.hedera.node.app.service.token.impl.handlers.CryptoAddLiveHashHandler; import com.hedera.node.app.service.token.impl.handlers.CryptoApproveAllowanceHandler; import com.hedera.node.app.service.token.impl.handlers.CryptoCreateHandler; @@ -32,6 +34,7 @@ import com.hedera.node.app.service.token.impl.handlers.TokenAccountWipeHandler; import com.hedera.node.app.service.token.impl.handlers.TokenAssociateToAccountHandler; import com.hedera.node.app.service.token.impl.handlers.TokenBurnHandler; +import com.hedera.node.app.service.token.impl.handlers.TokenComponent; import com.hedera.node.app.service.token.impl.handlers.TokenCreateHandler; import com.hedera.node.app.service.token.impl.handlers.TokenDeleteHandler; import com.hedera.node.app.service.token.impl.handlers.TokenDissociateFromAccountHandler; @@ -48,16 +51,15 @@ import com.hedera.node.app.service.token.impl.handlers.TokenUnfreezeAccountHandler; import com.hedera.node.app.service.token.impl.handlers.TokenUnpauseHandler; import com.hedera.node.app.service.token.impl.handlers.TokenUpdateHandler; -import dagger.Component; -import javax.inject.Singleton; +import dagger.Binds; +import dagger.Module; -@Singleton -@Component -public interface TokenComponent { - @Component.Factory - interface Factory { - TokenComponent create(); - } + +@Module +public interface TokenModule { + + @Binds + CryptoSignatureWaivers cryptoSignatureWaivers(CryptoSignatureWaiversImpl impl); CryptoAddLiveHashHandler cryptoAddLiveHashHandler(); @@ -122,4 +124,6 @@ interface Factory { TokenUnpauseHandler tokenUnpauseHandler(); TokenUpdateHandler tokenUpdateHandler(); + + TokenComponent tokenComponent(); } diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java new file mode 100644 index 000000000000..0e965a9f9c0e --- /dev/null +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java @@ -0,0 +1,251 @@ +/* + * Copyright (C) 2023 Hedera Hashgraph, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.hedera.node.app.service.token.impl.handlers; + +import edu.umd.cs.findbugs.annotations.NonNull; +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton +public class TokenComponent { + + private final CryptoCreateHandler cryptoCreateHandler; + private final CryptoUpdateHandler cryptoUpdateHandler; + private final CryptoTransferHandler cryptoTransferHandler; + private final CryptoDeleteHandler cryptoDeleteHandler; + private final CryptoApproveAllowanceHandler cryptoApproveAllowanceHandler; + private final CryptoDeleteAllowanceHandler cryptoDeleteAllowanceHandler; + private final CryptoAddLiveHashHandler cryptoAddLiveHashHandler; + private final CryptoDeleteLiveHashHandler cryptoDeleteLiveHashHandler; + private final TokenCreateHandler tokenCreateHandler; + private final TokenUpdateHandler tokenUpdateHandler; + private final TokenMintHandler tokenMintHandler; + private final TokenBurnHandler tokenBurnHandler; + private final TokenDeleteHandler tokenDeleteHandler; + private final TokenAccountWipeHandler tokenAccountWipeHandler; + private final TokenFreezeAccountHandler tokenFreezeAccountHandler; + private final TokenUnfreezeAccountHandler tokenUnfreezeAccountHandler; + private final TokenGrantKycToAccountHandler tokenGrantKycToAccountHandler; + private final TokenRevokeKycFromAccountHandler tokenRevokeKycFromAccountHandler; + private final TokenAssociateToAccountHandler tokenAssociateToAccountHandler; + private final TokenDissociateFromAccountHandler tokenDissociateFromAccountHandler; + private final TokenFeeScheduleUpdateHandler tokenFeeScheduleUpdateHandler; + private final TokenPauseHandler tokenPauseHandler; + private final TokenUnpauseHandler tokenUnpauseHandler; + private final CryptoGetAccountBalanceHandler cryptoGetAccountBalanceHandler; + private final CryptoGetAccountInfoHandler cryptoGetAccountInfoHandler; + private final CryptoGetAccountRecordsHandler cryptoGetAccountRecordsHandler; + private final CryptoGetLiveHashHandler cryptoGetLiveHashHandler; + private final CryptoGetStakersHandler cryptoGetStakersHandler; + private final TokenGetInfoHandler tokenGetInfoHandler; + private final TokenGetAccountNftInfosHandler tokenGetAccountNftInfosHandler; + private final TokenGetNftInfoHandler tokenGetNftInfoHandler; + private final TokenGetNftInfosHandler tokenGetNftInfosHandler; + + @Inject + public TokenComponent(@NonNull final CryptoCreateHandler cryptoCreateHandler, + @NonNull final CryptoUpdateHandler cryptoUpdateHandler, + @NonNull final CryptoTransferHandler cryptoTransferHandler, + @NonNull final CryptoDeleteHandler cryptoDeleteHandler, + @NonNull final CryptoApproveAllowanceHandler cryptoApproveAllowanceHandler, + @NonNull final CryptoDeleteAllowanceHandler cryptoDeleteAllowanceHandler, + @NonNull final CryptoAddLiveHashHandler cryptoAddLiveHashHandler, + @NonNull final CryptoDeleteLiveHashHandler cryptoDeleteLiveHashHandler, + @NonNull final TokenCreateHandler tokenCreateHandler, @NonNull final TokenUpdateHandler tokenUpdateHandler, + @NonNull final TokenMintHandler tokenMintHandler, @NonNull final TokenBurnHandler tokenBurnHandler, + @NonNull final TokenDeleteHandler tokenDeleteHandler, + @NonNull final TokenAccountWipeHandler tokenAccountWipeHandler, + @NonNull final TokenFreezeAccountHandler tokenFreezeAccountHandler, + @NonNull final TokenUnfreezeAccountHandler tokenUnfreezeAccountHandler, + @NonNull final TokenGrantKycToAccountHandler tokenGrantKycToAccountHandler, + @NonNull final TokenRevokeKycFromAccountHandler tokenRevokeKycFromAccountHandler, + @NonNull final TokenAssociateToAccountHandler tokenAssociateToAccountHandler, + @NonNull final TokenDissociateFromAccountHandler tokenDissociateFromAccountHandler, + @NonNull final TokenFeeScheduleUpdateHandler tokenFeeScheduleUpdateHandler, + @NonNull final TokenPauseHandler tokenPauseHandler, @NonNull final TokenUnpauseHandler tokenUnpauseHandler, + @NonNull final CryptoGetAccountBalanceHandler cryptoGetAccountBalanceHandler, + @NonNull final CryptoGetAccountInfoHandler cryptoGetAccountInfoHandler, + @NonNull final CryptoGetAccountRecordsHandler cryptoGetAccountRecordsHandler, + @NonNull final CryptoGetLiveHashHandler cryptoGetLiveHashHandler, + @NonNull final CryptoGetStakersHandler cryptoGetStakersHandler, + @NonNull final TokenGetInfoHandler tokenGetInfoHandler, + @NonNull final TokenGetAccountNftInfosHandler tokenGetAccountNftInfosHandler, + @NonNull final TokenGetNftInfoHandler tokenGetNftInfoHandler, + @NonNull final TokenGetNftInfosHandler tokenGetNftInfosHandler) { + this.cryptoCreateHandler = cryptoCreateHandler; + this.cryptoUpdateHandler = cryptoUpdateHandler; + this.cryptoTransferHandler = cryptoTransferHandler; + this.cryptoDeleteHandler = cryptoDeleteHandler; + this.cryptoApproveAllowanceHandler = cryptoApproveAllowanceHandler; + this.cryptoDeleteAllowanceHandler = cryptoDeleteAllowanceHandler; + this.cryptoAddLiveHashHandler = cryptoAddLiveHashHandler; + this.cryptoDeleteLiveHashHandler = cryptoDeleteLiveHashHandler; + this.tokenCreateHandler = tokenCreateHandler; + this.tokenUpdateHandler = tokenUpdateHandler; + this.tokenMintHandler = tokenMintHandler; + this.tokenBurnHandler = tokenBurnHandler; + this.tokenDeleteHandler = tokenDeleteHandler; + this.tokenAccountWipeHandler = tokenAccountWipeHandler; + this.tokenFreezeAccountHandler = tokenFreezeAccountHandler; + this.tokenUnfreezeAccountHandler = tokenUnfreezeAccountHandler; + this.tokenGrantKycToAccountHandler = tokenGrantKycToAccountHandler; + this.tokenRevokeKycFromAccountHandler = tokenRevokeKycFromAccountHandler; + this.tokenAssociateToAccountHandler = tokenAssociateToAccountHandler; + this.tokenDissociateFromAccountHandler = tokenDissociateFromAccountHandler; + this.tokenFeeScheduleUpdateHandler = tokenFeeScheduleUpdateHandler; + this.tokenPauseHandler = tokenPauseHandler; + this.tokenUnpauseHandler = tokenUnpauseHandler; + this.cryptoGetAccountBalanceHandler = cryptoGetAccountBalanceHandler; + this.cryptoGetAccountInfoHandler = cryptoGetAccountInfoHandler; + this.cryptoGetAccountRecordsHandler = cryptoGetAccountRecordsHandler; + this.cryptoGetLiveHashHandler = cryptoGetLiveHashHandler; + this.cryptoGetStakersHandler = cryptoGetStakersHandler; + this.tokenGetInfoHandler = tokenGetInfoHandler; + this.tokenGetAccountNftInfosHandler = tokenGetAccountNftInfosHandler; + this.tokenGetNftInfoHandler = tokenGetNftInfoHandler; + this.tokenGetNftInfosHandler = tokenGetNftInfosHandler; + } + + public CryptoCreateHandler getCryptoCreateHandler() { + return cryptoCreateHandler; + } + + public CryptoUpdateHandler getCryptoUpdateHandler() { + return cryptoUpdateHandler; + } + + public CryptoTransferHandler getCryptoTransferHandler() { + return cryptoTransferHandler; + } + + public CryptoDeleteHandler getCryptoDeleteHandler() { + return cryptoDeleteHandler; + } + + public CryptoApproveAllowanceHandler getCryptoApproveAllowanceHandler() { + return cryptoApproveAllowanceHandler; + } + + public CryptoDeleteAllowanceHandler getCryptoDeleteAllowanceHandler() { + return cryptoDeleteAllowanceHandler; + } + + public CryptoAddLiveHashHandler getCryptoAddLiveHashHandler() { + return cryptoAddLiveHashHandler; + } + + public CryptoDeleteLiveHashHandler getCryptoDeleteLiveHashHandler() { + return cryptoDeleteLiveHashHandler; + } + + public TokenCreateHandler getTokenCreateHandler() { + return tokenCreateHandler; + } + + public TokenUpdateHandler getTokenUpdateHandler() { + return tokenUpdateHandler; + } + + public TokenMintHandler getTokenMintHandler() { + return tokenMintHandler; + } + + public TokenBurnHandler getTokenBurnHandler() { + return tokenBurnHandler; + } + + public TokenDeleteHandler getTokenDeleteHandler() { + return tokenDeleteHandler; + } + + public TokenAccountWipeHandler getTokenAccountWipeHandler() { + return tokenAccountWipeHandler; + } + + public TokenFreezeAccountHandler getTokenFreezeAccountHandler() { + return tokenFreezeAccountHandler; + } + + public TokenUnfreezeAccountHandler getTokenUnfreezeAccountHandler() { + return tokenUnfreezeAccountHandler; + } + + public TokenGrantKycToAccountHandler getTokenGrantKycToAccountHandler() { + return tokenGrantKycToAccountHandler; + } + + public TokenRevokeKycFromAccountHandler getTokenRevokeKycFromAccountHandler() { + return tokenRevokeKycFromAccountHandler; + } + + public TokenAssociateToAccountHandler getTokenAssociateToAccountHandler() { + return tokenAssociateToAccountHandler; + } + + public TokenDissociateFromAccountHandler getTokenDissociateFromAccountHandler() { + return tokenDissociateFromAccountHandler; + } + + public TokenFeeScheduleUpdateHandler getTokenFeeScheduleUpdateHandler() { + return tokenFeeScheduleUpdateHandler; + } + + public TokenPauseHandler getTokenPauseHandler() { + return tokenPauseHandler; + } + + public TokenUnpauseHandler getTokenUnpauseHandler() { + return tokenUnpauseHandler; + } + + public CryptoGetAccountBalanceHandler getCryptoGetAccountBalanceHandler() { + return cryptoGetAccountBalanceHandler; + } + + public CryptoGetAccountInfoHandler getCryptoGetAccountInfoHandler() { + return cryptoGetAccountInfoHandler; + } + + public CryptoGetAccountRecordsHandler getCryptoGetAccountRecordsHandler() { + return cryptoGetAccountRecordsHandler; + } + + public CryptoGetLiveHashHandler getCryptoGetLiveHashHandler() { + return cryptoGetLiveHashHandler; + } + + public CryptoGetStakersHandler getCryptoGetStakersHandler() { + return cryptoGetStakersHandler; + } + + public TokenGetInfoHandler getTokenGetInfoHandler() { + return tokenGetInfoHandler; + } + + public TokenGetAccountNftInfosHandler getTokenGetAccountNftInfosHandler() { + return tokenGetAccountNftInfosHandler; + } + + public TokenGetNftInfoHandler getTokenGetNftInfoHandler() { + return tokenGetNftInfoHandler; + } + + public TokenGetNftInfosHandler getTokenGetNftInfosHandler() { + return tokenGetNftInfosHandler; + } +} diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/TokenComponentTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/TokenComponentTest.java deleted file mode 100644 index bd8430d2fc95..000000000000 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/TokenComponentTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2023 Hedera Hashgraph, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.hedera.node.app.service.token.impl.test; - -import static org.junit.jupiter.api.Assertions.*; - -import com.hedera.node.app.service.token.impl.components.DaggerTokenComponent; -import com.hedera.node.app.service.token.impl.components.TokenComponent; -import org.junit.jupiter.api.Test; - -class TokenComponentTest { - @Test - void objectGraphRootsAreAvailable() { - // given: - TokenComponent subject = DaggerTokenComponent.factory().create(); - - // expect: - assertNotNull(subject.cryptoAddLiveHashHandler()); - assertNotNull(subject.cryptoApproveAllowanceHandler()); - assertNotNull(subject.cryptoCreateHandler()); - assertNotNull(subject.cryptoDeleteAllowanceHandler()); - assertNotNull(subject.cryptoDeleteHandler()); - assertNotNull(subject.cryptoDeleteLiveHashHandler()); - assertNotNull(subject.cryptoGetAccountBalanceHandler()); - assertNotNull(subject.cryptoGetAccountInfoHandler()); - assertNotNull(subject.cryptoGetAccountRecordsHandler()); - assertNotNull(subject.cryptoGetLiveHashHandler()); - assertNotNull(subject.cryptoGetStakersHandler()); - assertNotNull(subject.cryptoTransferHandler()); - assertNotNull(subject.cryptoUpdateHandler()); - assertNotNull(subject.tokenAccountWipeHandler()); - assertNotNull(subject.tokenAssociateToAccountHandler()); - assertNotNull(subject.tokenBurnHandler()); - assertNotNull(subject.tokenCreateHandler()); - assertNotNull(subject.tokenDeleteHandler()); - assertNotNull(subject.tokenDissociateFromAccountHandler()); - assertNotNull(subject.tokenFeeScheduleUpdateHandler()); - assertNotNull(subject.tokenFreezeAccountHandler()); - assertNotNull(subject.tokenGetAccountNftInfosHandler()); - assertNotNull(subject.tokenGetInfoHandler()); - assertNotNull(subject.tokenGetNftInfoHandler()); - assertNotNull(subject.tokenGetNftInfosHandler()); - assertNotNull(subject.tokenGrantKycToAccountHandler()); - assertNotNull(subject.tokenMintHandler()); - assertNotNull(subject.tokenPauseHandler()); - assertNotNull(subject.tokenRevokeKycFromAccountHandler()); - assertNotNull(subject.tokenUnfreezeAccountHandler()); - assertNotNull(subject.tokenUnpauseHandler()); - assertNotNull(subject.tokenUpdateHandler()); - } -} diff --git a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoCreateHandlerTest.java b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoCreateHandlerTest.java index fe022ef2e128..415555d62c6e 100644 --- a/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoCreateHandlerTest.java +++ b/hedera-node/hedera-token-service-impl/src/test/java/com/hedera/node/app/service/token/impl/test/handlers/CryptoCreateHandlerTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test; class CryptoCreateHandlerTest extends CryptoHandlerTestBase { - private CryptoCreateHandler subject = new CryptoCreateHandler(); + private final CryptoCreateHandler subject = new CryptoCreateHandler(); @BeforeEach public void setUp() { From 52ad54520af9b7b6ddf5b699dc95f459027632cc Mon Sep 17 00:00:00 2001 From: Hendrik Ebbers Date: Tue, 25 Apr 2023 13:51:19 +0200 Subject: [PATCH 2/6] Javadoc Signed-off-by: Hendrik Ebbers --- .../java/com/hedera/node/app/HederaApp.java | 4 +- ...kenModule.java => TokenServiceModule.java} | 6 +- .../token/impl/handlers/TokenComponent.java | 197 ++++++++++++++++++ 3 files changed, 203 insertions(+), 4 deletions(-) rename hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/{TokenModule.java => TokenServiceModule.java} (98%) diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java index f1468d92d924..0e2650813d66 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java @@ -49,7 +49,7 @@ import com.hedera.node.app.service.mono.throttling.ThrottlingModule; import com.hedera.node.app.service.mono.txns.TransactionsModule; import com.hedera.node.app.service.mono.txns.submission.SubmissionModule; -import com.hedera.node.app.service.token.impl.components.TokenModule; +import com.hedera.node.app.service.token.impl.components.TokenServiceModule; import com.hedera.node.app.services.ServiceModule; import com.hedera.node.app.solvency.SolvencyModule; import com.hedera.node.app.state.HederaStateModule; @@ -111,7 +111,7 @@ InfoDaggerModule.class, ThrottleModule.class, SolvencyModule.class, - TokenModule.class + TokenServiceModule.class }) public interface HederaApp extends ServicesApp { /* Needed by ServicesState */ diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenModule.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenServiceModule.java similarity index 98% rename from hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenModule.java rename to hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenServiceModule.java index 710ee2cb5601..cec8f161c0cf 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenModule.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/components/TokenServiceModule.java @@ -54,9 +54,11 @@ import dagger.Binds; import dagger.Module; - +/** + * Dagger module of the token service + */ @Module -public interface TokenModule { +public interface TokenServiceModule { @Binds CryptoSignatureWaivers cryptoSignatureWaivers(CryptoSignatureWaiversImpl impl); diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java index 0e965a9f9c0e..33c425ee6e9b 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java @@ -21,6 +21,9 @@ import javax.inject.Inject; import javax.inject.Singleton; +/** + * Wrapper class for all handlers of the token service + */ @Singleton public class TokenComponent { @@ -57,6 +60,40 @@ public class TokenComponent { private final TokenGetNftInfoHandler tokenGetNftInfoHandler; private final TokenGetNftInfosHandler tokenGetNftInfosHandler; + /** + * @param cryptoCreateHandler the cryptoCreateHandler + * @param cryptoUpdateHandler the cryptoUpdateHandler + * @param cryptoTransferHandler the cryptoTransferHandler + * @param cryptoDeleteHandler the cryptoDeleteHandler + * @param cryptoApproveAllowanceHandler the cryptoApproveAllowanceHandler + * @param cryptoDeleteAllowanceHandler the cryptoDeleteAllowanceHandler + * @param cryptoAddLiveHashHandler the cryptoAddLiveHashHandler + * @param cryptoDeleteLiveHashHandler the cryptoDeleteLiveHashHandler + * @param tokenCreateHandler the tokenCreateHandler + * @param tokenUpdateHandler the tokenUpdateHandler + * @param tokenMintHandler the tokenMintHandler + * @param tokenBurnHandler the tokenBurnHandler + * @param tokenDeleteHandler the tokenDeleteHandler + * @param tokenAccountWipeHandler the tokenAccountWipeHandler + * @param tokenFreezeAccountHandler the tokenFreezeAccountHandler + * @param tokenUnfreezeAccountHandler the tokenUnfreezeAccountHandler + * @param tokenGrantKycToAccountHandler the tokenGrantKycToAccountHandler + * @param tokenRevokeKycFromAccountHandler the tokenRevokeKycFromAccountHandler + * @param tokenAssociateToAccountHandler the tokenAssociateToAccountHandler + * @param tokenDissociateFromAccountHandler the tokenDissociateFromAccountHandler + * @param tokenFeeScheduleUpdateHandler the tokenFeeScheduleUpdateHandler + * @param tokenPauseHandler the tokenPauseHandler + * @param tokenUnpauseHandler the tokenUnpauseHandler + * @param cryptoGetAccountBalanceHandler the cryptoGetAccountBalanceHandler + * @param cryptoGetAccountInfoHandler the cryptoGetAccountInfoHandler + * @param cryptoGetAccountRecordsHandler the cryptoGetAccountRecordsHandler + * @param cryptoGetLiveHashHandler the cryptoGetLiveHashHandler + * @param cryptoGetStakersHandler the cryptoGetStakersHandler + * @param tokenGetInfoHandler the tokenGetInfoHandler + * @param tokenGetAccountNftInfosHandler the tokenGetAccountNftInfosHandler + * @param tokenGetNftInfoHandler the tokenGetNftInfoHandler + * @param tokenGetNftInfosHandler the tokenGetNftInfosHandler + */ @Inject public TokenComponent(@NonNull final CryptoCreateHandler cryptoCreateHandler, @NonNull final CryptoUpdateHandler cryptoUpdateHandler, @@ -121,130 +158,290 @@ public TokenComponent(@NonNull final CryptoCreateHandler cryptoCreateHandler, this.tokenGetNftInfosHandler = tokenGetNftInfosHandler; } + /** + * Gets the cryptoCreateHandler. + * + * @return the cryptoCreateHandler + */ public CryptoCreateHandler getCryptoCreateHandler() { return cryptoCreateHandler; } + /** + * Gets the cryptoUpdateHandler. + * + * @return the cryptoUpdateHandler + */ public CryptoUpdateHandler getCryptoUpdateHandler() { return cryptoUpdateHandler; } + /** + * Gets the cryptoTransferHandler. + * + * @return the cryptoTransferHandler + */ public CryptoTransferHandler getCryptoTransferHandler() { return cryptoTransferHandler; } + /** + * Gets the cryptoDeleteHandler. + * + * @return the cryptoDeleteHandler + */ public CryptoDeleteHandler getCryptoDeleteHandler() { return cryptoDeleteHandler; } + /** + * Gets the cryptoApproveAllowanceHandler. + * + * @return the cryptoApproveAllowanceHandler + */ public CryptoApproveAllowanceHandler getCryptoApproveAllowanceHandler() { return cryptoApproveAllowanceHandler; } + /** + * Gets the cryptoDeleteAllowanceHandler. + * + * @return the cryptoDeleteAllowanceHandler + */ public CryptoDeleteAllowanceHandler getCryptoDeleteAllowanceHandler() { return cryptoDeleteAllowanceHandler; } + /** + * Gets the cryptoAddLiveHashHandler. + * + * @return the cryptoAddLiveHashHandler + */ public CryptoAddLiveHashHandler getCryptoAddLiveHashHandler() { return cryptoAddLiveHashHandler; } + /** + * Gets the cryptoDeleteLiveHashHandler. + * + * @return the cryptoDeleteLiveHashHandler + */ public CryptoDeleteLiveHashHandler getCryptoDeleteLiveHashHandler() { return cryptoDeleteLiveHashHandler; } + /** + * Gets the tokenCreateHandler. + * + * @return the tokenCreateHandler + */ public TokenCreateHandler getTokenCreateHandler() { return tokenCreateHandler; } + /** + * Gets the tokenUpdateHandler. + * + * @return the tokenUpdateHandler + */ public TokenUpdateHandler getTokenUpdateHandler() { return tokenUpdateHandler; } + /** + * Gets the tokenMintHandler. + * + * @return the tokenMintHandler + */ public TokenMintHandler getTokenMintHandler() { return tokenMintHandler; } + /** + * Gets the tokenBurnHandler. + * + * @return the tokenBurnHandler + */ public TokenBurnHandler getTokenBurnHandler() { return tokenBurnHandler; } + /** + * Gets the tokenDeleteHandler. + * + * @return the tokenDeleteHandler + */ public TokenDeleteHandler getTokenDeleteHandler() { return tokenDeleteHandler; } + /** + * Gets the tokenAccountWipeHandler. + * + * @return the tokenAccountWipeHandler + */ public TokenAccountWipeHandler getTokenAccountWipeHandler() { return tokenAccountWipeHandler; } + /** + * Gets the tokenFreezeAccountHandler. + * + * @return the tokenFreezeAccountHandler + */ public TokenFreezeAccountHandler getTokenFreezeAccountHandler() { return tokenFreezeAccountHandler; } + /** + * Gets the tokenUnfreezeAccountHandler. + * + * @return the tokenUnfreezeAccountHandler + */ public TokenUnfreezeAccountHandler getTokenUnfreezeAccountHandler() { return tokenUnfreezeAccountHandler; } + /** + * Gets the tokenGrantKycToAccountHandler. + * + * @return the tokenGrantKycToAccountHandler + */ public TokenGrantKycToAccountHandler getTokenGrantKycToAccountHandler() { return tokenGrantKycToAccountHandler; } + /** + * Gets the tokenRevokeKycFromAccountHandler. + * + * @return the tokenRevokeKycFromAccountHandler + */ public TokenRevokeKycFromAccountHandler getTokenRevokeKycFromAccountHandler() { return tokenRevokeKycFromAccountHandler; } + /** + * Gets the tokenAssociateToAccountHandler. + * + * @return the tokenAssociateToAccountHandler + */ public TokenAssociateToAccountHandler getTokenAssociateToAccountHandler() { return tokenAssociateToAccountHandler; } + /** + * Gets the tokenDissociateFromAccountHandler. + * + * @return the tokenDissociateFromAccountHandler + */ public TokenDissociateFromAccountHandler getTokenDissociateFromAccountHandler() { return tokenDissociateFromAccountHandler; } + /** + * Gets the tokenFeeScheduleUpdateHandler. + * + * @return the tokenFeeScheduleUpdateHandler + */ public TokenFeeScheduleUpdateHandler getTokenFeeScheduleUpdateHandler() { return tokenFeeScheduleUpdateHandler; } + /** + * Gets the tokenFeeScheduleUpdateHandler. + * + * @return the tokenFeeScheduleUpdateHandler + */ public TokenPauseHandler getTokenPauseHandler() { return tokenPauseHandler; } + /** + * Gets the tokenFeeScheduleUpdateHandler. + * + * @return the tokenFeeScheduleUpdateHandler + */ public TokenUnpauseHandler getTokenUnpauseHandler() { return tokenUnpauseHandler; } + /** + * Gets the tokenFeeScheduleUpdateHandler. + * + * @return the tokenFeeScheduleUpdateHandler + */ public CryptoGetAccountBalanceHandler getCryptoGetAccountBalanceHandler() { return cryptoGetAccountBalanceHandler; } + /** + * Gets the cryptoGetAccountRecordsHandler. + * + * @return the cryptoGetAccountRecordsHandler + */ public CryptoGetAccountInfoHandler getCryptoGetAccountInfoHandler() { return cryptoGetAccountInfoHandler; } + /** + * Gets the cryptoGetAccountRecordsHandler. + * + * @return the cryptoGetAccountRecordsHandler + */ public CryptoGetAccountRecordsHandler getCryptoGetAccountRecordsHandler() { return cryptoGetAccountRecordsHandler; } + /** + * Gets the cryptoGetAccountRecordsHandler. + * + * @return the cryptoGetAccountRecordsHandler + */ public CryptoGetLiveHashHandler getCryptoGetLiveHashHandler() { return cryptoGetLiveHashHandler; } + /** + * Gets the cryptoGetAccountRecordsHandler. + * + * @return the cryptoGetAccountRecordsHandler + */ public CryptoGetStakersHandler getCryptoGetStakersHandler() { return cryptoGetStakersHandler; } + /** + * Gets the cryptoGetAccountRecordsHandler. + * + * @return the cryptoGetAccountRecordsHandler + */ public TokenGetInfoHandler getTokenGetInfoHandler() { return tokenGetInfoHandler; } + /** + * Gets the cryptoGetAccountRecordsHandler. + * + * @return the cryptoGetAccountRecordsHandler + */ public TokenGetAccountNftInfosHandler getTokenGetAccountNftInfosHandler() { return tokenGetAccountNftInfosHandler; } + /** + * Gets the cryptoGetAccountRecordsHandler. + * + * @return the cryptoGetAccountRecordsHandler + */ public TokenGetNftInfoHandler getTokenGetNftInfoHandler() { return tokenGetNftInfoHandler; } + /** + * Gets the cryptoGetAccountRecordsHandler. + * + * @return the cryptoGetAccountRecordsHandler + */ public TokenGetNftInfosHandler getTokenGetNftInfosHandler() { return tokenGetNftInfosHandler; } From 4e92ab1b8f76ac154ce2b9dc9bad0bc947cde372 Mon Sep 17 00:00:00 2001 From: Hendrik Ebbers Date: Tue, 25 Apr 2023 13:51:55 +0200 Subject: [PATCH 3/6] spotless Signed-off-by: Hendrik Ebbers --- .../java/com/hedera/node/app/HederaApp.java | 68 +++++++++---------- .../node/app/services/ServiceModule.java | 1 - .../token/impl/handlers/TokenComponent.java | 15 ++-- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java index 0e2650813d66..102b2d0a555e 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/HederaApp.java @@ -78,40 +78,40 @@ @Singleton @Component( modules = { - TaskModule.class, - FeesModule.class, - KeysModule.class, - SigsModule.class, - GrpcModule.class, - ConfigModule.class, - StatsModule.class, - StateModule.class, - FilesModule.class, - LedgerModule.class, - StoresModule.class, - ContextModule.class, - RecordsModule.class, - QueriesModule.class, - ContractsModule.class, - PropertiesModule.class, - ThrottlingModule.class, - SubmissionModule.class, - TransactionsModule.class, - ExpiryModule.class, - ServiceModule.class, - IngestModule.class, - QueryWorkflowModule.class, - HandleWorkflowModule.class, - PreHandleWorkflowModule.class, - HederaStateModule.class, - AdaptedFeeCalculatorModule.class, - HederaStateModule.class, - MetricsDaggerModule.class, - AuthorizerDaggerModule.class, - InfoDaggerModule.class, - ThrottleModule.class, - SolvencyModule.class, - TokenServiceModule.class + TaskModule.class, + FeesModule.class, + KeysModule.class, + SigsModule.class, + GrpcModule.class, + ConfigModule.class, + StatsModule.class, + StateModule.class, + FilesModule.class, + LedgerModule.class, + StoresModule.class, + ContextModule.class, + RecordsModule.class, + QueriesModule.class, + ContractsModule.class, + PropertiesModule.class, + ThrottlingModule.class, + SubmissionModule.class, + TransactionsModule.class, + ExpiryModule.class, + ServiceModule.class, + IngestModule.class, + QueryWorkflowModule.class, + HandleWorkflowModule.class, + PreHandleWorkflowModule.class, + HederaStateModule.class, + AdaptedFeeCalculatorModule.class, + HederaStateModule.class, + MetricsDaggerModule.class, + AuthorizerDaggerModule.class, + InfoDaggerModule.class, + ThrottleModule.class, + SolvencyModule.class, + TokenServiceModule.class }) public interface HederaApp extends ServicesApp { /* Needed by ServicesState */ diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/services/ServiceModule.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/services/ServiceModule.java index 657600ebb219..6348298128bd 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/services/ServiceModule.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/services/ServiceModule.java @@ -77,5 +77,4 @@ static ContractComponent provideContractComponent() { static ScheduleComponent provideScheduleComponent() { return DaggerScheduleComponent.create(); } - } diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java index 33c425ee6e9b..1c4f5e0f81d6 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java @@ -5,14 +5,13 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package com.hedera.node.app.service.token.impl.handlers; @@ -95,7 +94,8 @@ public class TokenComponent { * @param tokenGetNftInfosHandler the tokenGetNftInfosHandler */ @Inject - public TokenComponent(@NonNull final CryptoCreateHandler cryptoCreateHandler, + public TokenComponent( + @NonNull final CryptoCreateHandler cryptoCreateHandler, @NonNull final CryptoUpdateHandler cryptoUpdateHandler, @NonNull final CryptoTransferHandler cryptoTransferHandler, @NonNull final CryptoDeleteHandler cryptoDeleteHandler, @@ -103,8 +103,10 @@ public TokenComponent(@NonNull final CryptoCreateHandler cryptoCreateHandler, @NonNull final CryptoDeleteAllowanceHandler cryptoDeleteAllowanceHandler, @NonNull final CryptoAddLiveHashHandler cryptoAddLiveHashHandler, @NonNull final CryptoDeleteLiveHashHandler cryptoDeleteLiveHashHandler, - @NonNull final TokenCreateHandler tokenCreateHandler, @NonNull final TokenUpdateHandler tokenUpdateHandler, - @NonNull final TokenMintHandler tokenMintHandler, @NonNull final TokenBurnHandler tokenBurnHandler, + @NonNull final TokenCreateHandler tokenCreateHandler, + @NonNull final TokenUpdateHandler tokenUpdateHandler, + @NonNull final TokenMintHandler tokenMintHandler, + @NonNull final TokenBurnHandler tokenBurnHandler, @NonNull final TokenDeleteHandler tokenDeleteHandler, @NonNull final TokenAccountWipeHandler tokenAccountWipeHandler, @NonNull final TokenFreezeAccountHandler tokenFreezeAccountHandler, @@ -114,7 +116,8 @@ public TokenComponent(@NonNull final CryptoCreateHandler cryptoCreateHandler, @NonNull final TokenAssociateToAccountHandler tokenAssociateToAccountHandler, @NonNull final TokenDissociateFromAccountHandler tokenDissociateFromAccountHandler, @NonNull final TokenFeeScheduleUpdateHandler tokenFeeScheduleUpdateHandler, - @NonNull final TokenPauseHandler tokenPauseHandler, @NonNull final TokenUnpauseHandler tokenUnpauseHandler, + @NonNull final TokenPauseHandler tokenPauseHandler, + @NonNull final TokenUnpauseHandler tokenUnpauseHandler, @NonNull final CryptoGetAccountBalanceHandler cryptoGetAccountBalanceHandler, @NonNull final CryptoGetAccountInfoHandler cryptoGetAccountInfoHandler, @NonNull final CryptoGetAccountRecordsHandler cryptoGetAccountRecordsHandler, From 4ac211c059cf817402d6eb333865580fec101124 Mon Sep 17 00:00:00 2001 From: Hendrik Ebbers Date: Tue, 25 Apr 2023 14:03:40 +0200 Subject: [PATCH 4/6] gradle file refactored Signed-off-by: Hendrik Ebbers --- .../build.gradle.kts | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/hedera-node/hedera-token-service-impl/build.gradle.kts b/hedera-node/hedera-token-service-impl/build.gradle.kts index 6a2ff1eacd2b..b34369a6bafc 100644 --- a/hedera-node/hedera-token-service-impl/build.gradle.kts +++ b/hedera-node/hedera-token-service-impl/build.gradle.kts @@ -19,27 +19,27 @@ plugins { id("com.hedera.hashgraph.conventions") } description = "Default Hedera Token Service Implementation" configurations.all { - exclude("javax.annotation", "javax.annotation-api") + exclude("javax.annotation", "javax.annotation-api") - exclude("io.grpc", "grpc-core") - exclude("io.grpc", "grpc-context") - exclude("io.grpc", "grpc-api") - exclude("io.grpc", "grpc-testing") + exclude("io.grpc", "grpc-core") + exclude("io.grpc", "grpc-context") + exclude("io.grpc", "grpc-api") + exclude("io.grpc", "grpc-testing") } dependencies { - implementation(project(":hedera-node:hapi")) - annotationProcessor(libs.dagger.compiler) - api(project(":hedera-node:hedera-token-service")) - implementation(project(":hedera-node:hedera-mono-service")) - implementation(libs.bundles.di) - implementation(libs.pbj.runtime) + annotationProcessor(libs.dagger.compiler) + api(project(":hedera-node:hedera-token-service")) + implementation(project(":hedera-node:hapi")) + implementation(project(":hedera-node:hedera-mono-service")) + implementation(libs.bundles.di) + implementation(libs.pbj.runtime) + implementation(libs.swirlds.virtualmap) + implementation(libs.swirlds.jasperdb) - implementation(libs.swirlds.virtualmap) - implementation(libs.swirlds.jasperdb) - testImplementation(testLibs.bundles.testing) - testImplementation(testFixtures(project(":hedera-node:hedera-mono-service"))) - testImplementation(testFixtures(project(":hedera-node:hedera-app-spi"))) - testImplementation(testLibs.mockito.inline) - testImplementation(project(":hedera-node:hedera-app-spi")) + testImplementation(testLibs.bundles.testing) + testImplementation(testFixtures(project(":hedera-node:hedera-mono-service"))) + testImplementation(testFixtures(project(":hedera-node:hedera-app-spi"))) + testImplementation(testLibs.mockito.inline) + testImplementation(project(":hedera-node:hedera-app-spi")) } From 86382065ea32c79718011a307790d91d83a3ad7d Mon Sep 17 00:00:00 2001 From: Hendrik Ebbers Date: Tue, 25 Apr 2023 16:46:16 +0200 Subject: [PATCH 5/6] spotless Signed-off-by: Hendrik Ebbers --- .../app/workflows/handle/HandlersModule.java | 46 ++++++------- .../workflows/query/QueryWorkflowModule.java | 18 ++--- .../handle/HandleWorkflowModuleTest.java | 46 ++++++------- .../build.gradle.kts | 36 +++++----- .../token/impl/handlers/TokenComponent.java | 67 ++++++++++--------- 5 files changed, 107 insertions(+), 106 deletions(-) diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandlersModule.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandlersModule.java index 57b636d20327..b3cb4f6178da 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandlersModule.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/handle/HandlersModule.java @@ -55,14 +55,14 @@ static TransactionHandlers provideTransactionHandlers( contractComponent.contractSystemDeleteHandler(), contractComponent.contractSystemUndeleteHandler(), contractComponent.etherumTransactionHandler(), - tokenComponent.getCryptoCreateHandler(), - tokenComponent.getCryptoUpdateHandler(), - tokenComponent.getCryptoTransferHandler(), - tokenComponent.getCryptoDeleteHandler(), - tokenComponent.getCryptoApproveAllowanceHandler(), - tokenComponent.getCryptoDeleteAllowanceHandler(), - tokenComponent.getCryptoAddLiveHashHandler(), - tokenComponent.getCryptoDeleteLiveHashHandler(), + tokenComponent.cryptoCreateHandler(), + tokenComponent.cryptoUpdateHandler(), + tokenComponent.cryptoTransferHandler(), + tokenComponent.cryptoDeleteHandler(), + tokenComponent.cryptoApproveAllowanceHandler(), + tokenComponent.cryptoDeleteAllowanceHandler(), + tokenComponent.cryptoAddLiveHashHandler(), + tokenComponent.cryptoDeleteLiveHashHandler(), fileComponent.fileCreateHandler(), fileComponent.fileUpdateHandler(), fileComponent.fileDeleteHandler(), @@ -74,21 +74,21 @@ static TransactionHandlers provideTransactionHandlers( scheduleComponent.scheduleCreateHandler(), scheduleComponent.scheduleSignHandler(), scheduleComponent.scheduleDeleteHandler(), - tokenComponent.getTokenCreateHandler(), - tokenComponent.getTokenUpdateHandler(), - tokenComponent.getTokenMintHandler(), - tokenComponent.getTokenBurnHandler(), - tokenComponent.getTokenDeleteHandler(), - tokenComponent.getTokenAccountWipeHandler(), - tokenComponent.getTokenFreezeAccountHandler(), - tokenComponent.getTokenUnfreezeAccountHandler(), - tokenComponent.getTokenGrantKycToAccountHandler(), - tokenComponent.getTokenRevokeKycFromAccountHandler(), - tokenComponent.getTokenAssociateToAccountHandler(), - tokenComponent.getTokenDissociateFromAccountHandler(), - tokenComponent.getTokenFeeScheduleUpdateHandler(), - tokenComponent.getTokenPauseHandler(), - tokenComponent.getTokenUnpauseHandler(), + tokenComponent.tokenCreateHandler(), + tokenComponent.tokenUpdateHandler(), + tokenComponent.tokenMintHandler(), + tokenComponent.tokenBurnHandler(), + tokenComponent.tokenDeleteHandler(), + tokenComponent.tokenAccountWipeHandler(), + tokenComponent.tokenFreezeAccountHandler(), + tokenComponent.tokenUnfreezeAccountHandler(), + tokenComponent.tokenGrantKycToAccountHandler(), + tokenComponent.tokenRevokeKycFromAccountHandler(), + tokenComponent.tokenAssociateToAccountHandler(), + tokenComponent.tokenDissociateFromAccountHandler(), + tokenComponent.tokenFeeScheduleUpdateHandler(), + tokenComponent.tokenPauseHandler(), + tokenComponent.tokenUnpauseHandler(), utilComponent.prngHandler()); } } diff --git a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/query/QueryWorkflowModule.java b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/query/QueryWorkflowModule.java index e4217606a1c4..e3e0681e32bd 100644 --- a/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/query/QueryWorkflowModule.java +++ b/hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/query/QueryWorkflowModule.java @@ -75,11 +75,11 @@ static QueryHandlers provideQueryHandlers( contractComponent.contractGetInfoHandler(), contractComponent.contractGetBytecodeHandler(), contractComponent.contractGetRecordsHandler(), - tokenComponent.getCryptoGetAccountBalanceHandler(), - tokenComponent.getCryptoGetAccountInfoHandler(), - tokenComponent.getCryptoGetAccountRecordsHandler(), - tokenComponent.getCryptoGetLiveHashHandler(), - tokenComponent.getCryptoGetStakersHandler(), + tokenComponent.cryptoGetAccountBalanceHandler(), + tokenComponent.cryptoGetAccountInfoHandler(), + tokenComponent.cryptoGetAccountRecordsHandler(), + tokenComponent.cryptoGetLiveHashHandler(), + tokenComponent.cryptoGetStakersHandler(), fileComponent.fileGetContentsHandler(), fileComponent.fileGetInfoHandler(), networkComponent.networkGetAccountDetailsHandler(), @@ -89,10 +89,10 @@ static QueryHandlers provideQueryHandlers( networkComponent.networkTransactionGetReceiptHandler(), networkComponent.networkTransactionGetRecordHandler(), scheduleComponent.scheduleGetInfoHandler(), - tokenComponent.getTokenGetInfoHandler(), - tokenComponent.getTokenGetAccountNftInfosHandler(), - tokenComponent.getTokenGetNftInfoHandler(), - tokenComponent.getTokenGetNftInfosHandler()); + tokenComponent.tokenGetInfoHandler(), + tokenComponent.tokenGetAccountNftInfosHandler(), + tokenComponent.tokenGetNftInfoHandler(), + tokenComponent.tokenGetNftInfosHandler()); } @Provides diff --git a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/HandleWorkflowModuleTest.java b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/HandleWorkflowModuleTest.java index 6b488f9205bc..6b07157c5523 100644 --- a/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/HandleWorkflowModuleTest.java +++ b/hedera-node/hedera-app/src/test/java/com/hedera/node/app/workflows/handle/HandleWorkflowModuleTest.java @@ -256,14 +256,14 @@ void usesComponentsToGetHandlers() { given(contractComponent.contractSystemDeleteHandler()).willReturn(contractSystemDeleteHandler); given(contractComponent.contractSystemUndeleteHandler()).willReturn(contractSystemUndeleteHandler); given(contractComponent.etherumTransactionHandler()).willReturn(etherumTransactionHandler); - given(tokenComponent.getCryptoCreateHandler()).willReturn(cryptoCreateHandler); - given(tokenComponent.getCryptoUpdateHandler()).willReturn(cryptoUpdateHandler); - given(tokenComponent.getCryptoTransferHandler()).willReturn(cryptoTransferHandler); - given(tokenComponent.getCryptoDeleteHandler()).willReturn(cryptoDeleteHandler); - given(tokenComponent.getCryptoApproveAllowanceHandler()).willReturn(cryptoApproveAllowanceHandler); - given(tokenComponent.getCryptoDeleteAllowanceHandler()).willReturn(cryptoDeleteAllowanceHandler); - given(tokenComponent.getCryptoAddLiveHashHandler()).willReturn(cryptoAddLiveHashHandler); - given(tokenComponent.getCryptoDeleteLiveHashHandler()).willReturn(cryptoDeleteLiveHashHandler); + given(tokenComponent.cryptoCreateHandler()).willReturn(cryptoCreateHandler); + given(tokenComponent.cryptoUpdateHandler()).willReturn(cryptoUpdateHandler); + given(tokenComponent.cryptoTransferHandler()).willReturn(cryptoTransferHandler); + given(tokenComponent.cryptoDeleteHandler()).willReturn(cryptoDeleteHandler); + given(tokenComponent.cryptoApproveAllowanceHandler()).willReturn(cryptoApproveAllowanceHandler); + given(tokenComponent.cryptoDeleteAllowanceHandler()).willReturn(cryptoDeleteAllowanceHandler); + given(tokenComponent.cryptoAddLiveHashHandler()).willReturn(cryptoAddLiveHashHandler); + given(tokenComponent.cryptoDeleteLiveHashHandler()).willReturn(cryptoDeleteLiveHashHandler); given(fileComponent.fileCreateHandler()).willReturn(fileCreateHandler); given(fileComponent.fileUpdateHandler()).willReturn(fileUpdateHandler); given(fileComponent.fileDeleteHandler()).willReturn(fileDeleteHandler); @@ -275,21 +275,21 @@ void usesComponentsToGetHandlers() { given(scheduleComponent.scheduleCreateHandler()).willReturn(scheduleCreateHandler); given(scheduleComponent.scheduleSignHandler()).willReturn(scheduleSignHandler); given(scheduleComponent.scheduleDeleteHandler()).willReturn(scheduleDeleteHandler); - given(tokenComponent.getTokenCreateHandler()).willReturn(tokenCreateHandler); - given(tokenComponent.getTokenUpdateHandler()).willReturn(tokenUpdateHandler); - given(tokenComponent.getTokenMintHandler()).willReturn(tokenMintHandler); - given(tokenComponent.getTokenBurnHandler()).willReturn(tokenBurnHandler); - given(tokenComponent.getTokenDeleteHandler()).willReturn(tokenDeleteHandler); - given(tokenComponent.getTokenAccountWipeHandler()).willReturn(tokenAccountWipeHandler); - given(tokenComponent.getTokenFreezeAccountHandler()).willReturn(tokenFreezeAccountHandler); - given(tokenComponent.getTokenUnfreezeAccountHandler()).willReturn(tokenUnfreezeAccountHandler); - given(tokenComponent.getTokenGrantKycToAccountHandler()).willReturn(tokenGrantKycToAccountHandler); - given(tokenComponent.getTokenRevokeKycFromAccountHandler()).willReturn(tokenRevokeKycFromAccountHandler); - given(tokenComponent.getTokenAssociateToAccountHandler()).willReturn(tokenAssociateToAccountHandler); - given(tokenComponent.getTokenDissociateFromAccountHandler()).willReturn(tokenDissociateFromAccountHandler); - given(tokenComponent.getTokenFeeScheduleUpdateHandler()).willReturn(tokenFeeScheduleUpdateHandler); - given(tokenComponent.getTokenPauseHandler()).willReturn(tokenPauseHandler); - given(tokenComponent.getTokenUnpauseHandler()).willReturn(tokenUnpauseHandler); + given(tokenComponent.tokenCreateHandler()).willReturn(tokenCreateHandler); + given(tokenComponent.tokenUpdateHandler()).willReturn(tokenUpdateHandler); + given(tokenComponent.tokenMintHandler()).willReturn(tokenMintHandler); + given(tokenComponent.tokenBurnHandler()).willReturn(tokenBurnHandler); + given(tokenComponent.tokenDeleteHandler()).willReturn(tokenDeleteHandler); + given(tokenComponent.tokenAccountWipeHandler()).willReturn(tokenAccountWipeHandler); + given(tokenComponent.tokenFreezeAccountHandler()).willReturn(tokenFreezeAccountHandler); + given(tokenComponent.tokenUnfreezeAccountHandler()).willReturn(tokenUnfreezeAccountHandler); + given(tokenComponent.tokenGrantKycToAccountHandler()).willReturn(tokenGrantKycToAccountHandler); + given(tokenComponent.tokenRevokeKycFromAccountHandler()).willReturn(tokenRevokeKycFromAccountHandler); + given(tokenComponent.tokenAssociateToAccountHandler()).willReturn(tokenAssociateToAccountHandler); + given(tokenComponent.tokenDissociateFromAccountHandler()).willReturn(tokenDissociateFromAccountHandler); + given(tokenComponent.tokenFeeScheduleUpdateHandler()).willReturn(tokenFeeScheduleUpdateHandler); + given(tokenComponent.tokenPauseHandler()).willReturn(tokenPauseHandler); + given(tokenComponent.tokenUnpauseHandler()).willReturn(tokenUnpauseHandler); given(utilComponent.prngHandler()).willReturn(utilPrngHandler); final var handlers = HandlersModule.provideTransactionHandlers( diff --git a/hedera-node/hedera-token-service-impl/build.gradle.kts b/hedera-node/hedera-token-service-impl/build.gradle.kts index b34369a6bafc..97ee02032355 100644 --- a/hedera-node/hedera-token-service-impl/build.gradle.kts +++ b/hedera-node/hedera-token-service-impl/build.gradle.kts @@ -19,27 +19,27 @@ plugins { id("com.hedera.hashgraph.conventions") } description = "Default Hedera Token Service Implementation" configurations.all { - exclude("javax.annotation", "javax.annotation-api") + exclude("javax.annotation", "javax.annotation-api") - exclude("io.grpc", "grpc-core") - exclude("io.grpc", "grpc-context") - exclude("io.grpc", "grpc-api") - exclude("io.grpc", "grpc-testing") + exclude("io.grpc", "grpc-core") + exclude("io.grpc", "grpc-context") + exclude("io.grpc", "grpc-api") + exclude("io.grpc", "grpc-testing") } dependencies { - annotationProcessor(libs.dagger.compiler) - api(project(":hedera-node:hedera-token-service")) - implementation(project(":hedera-node:hapi")) - implementation(project(":hedera-node:hedera-mono-service")) - implementation(libs.bundles.di) - implementation(libs.pbj.runtime) - implementation(libs.swirlds.virtualmap) - implementation(libs.swirlds.jasperdb) + annotationProcessor(libs.dagger.compiler) + api(project(":hedera-node:hedera-token-service")) + implementation(project(":hedera-node:hapi")) + implementation(project(":hedera-node:hedera-mono-service")) + implementation(libs.bundles.di) + implementation(libs.pbj.runtime) + implementation(libs.swirlds.virtualmap) + implementation(libs.swirlds.jasperdb) - testImplementation(testLibs.bundles.testing) - testImplementation(testFixtures(project(":hedera-node:hedera-mono-service"))) - testImplementation(testFixtures(project(":hedera-node:hedera-app-spi"))) - testImplementation(testLibs.mockito.inline) - testImplementation(project(":hedera-node:hedera-app-spi")) + testImplementation(testLibs.bundles.testing) + testImplementation(testFixtures(project(":hedera-node:hedera-mono-service"))) + testImplementation(testFixtures(project(":hedera-node:hedera-app-spi"))) + testImplementation(testLibs.mockito.inline) + testImplementation(project(":hedera-node:hedera-app-spi")) } diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java index 1c4f5e0f81d6..fee6db5c5776 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/TokenComponent.java @@ -21,7 +21,8 @@ import javax.inject.Singleton; /** - * Wrapper class for all handlers of the token service + * Wrapper class for all handlers of the token service. This should be a {@code record} but it looks like Dagger does + * not support Java records */ @Singleton public class TokenComponent { @@ -166,7 +167,7 @@ public TokenComponent( * * @return the cryptoCreateHandler */ - public CryptoCreateHandler getCryptoCreateHandler() { + public CryptoCreateHandler cryptoCreateHandler() { return cryptoCreateHandler; } @@ -175,7 +176,7 @@ public CryptoCreateHandler getCryptoCreateHandler() { * * @return the cryptoUpdateHandler */ - public CryptoUpdateHandler getCryptoUpdateHandler() { + public CryptoUpdateHandler cryptoUpdateHandler() { return cryptoUpdateHandler; } @@ -184,7 +185,7 @@ public CryptoUpdateHandler getCryptoUpdateHandler() { * * @return the cryptoTransferHandler */ - public CryptoTransferHandler getCryptoTransferHandler() { + public CryptoTransferHandler cryptoTransferHandler() { return cryptoTransferHandler; } @@ -193,7 +194,7 @@ public CryptoTransferHandler getCryptoTransferHandler() { * * @return the cryptoDeleteHandler */ - public CryptoDeleteHandler getCryptoDeleteHandler() { + public CryptoDeleteHandler cryptoDeleteHandler() { return cryptoDeleteHandler; } @@ -202,7 +203,7 @@ public CryptoDeleteHandler getCryptoDeleteHandler() { * * @return the cryptoApproveAllowanceHandler */ - public CryptoApproveAllowanceHandler getCryptoApproveAllowanceHandler() { + public CryptoApproveAllowanceHandler cryptoApproveAllowanceHandler() { return cryptoApproveAllowanceHandler; } @@ -211,7 +212,7 @@ public CryptoApproveAllowanceHandler getCryptoApproveAllowanceHandler() { * * @return the cryptoDeleteAllowanceHandler */ - public CryptoDeleteAllowanceHandler getCryptoDeleteAllowanceHandler() { + public CryptoDeleteAllowanceHandler cryptoDeleteAllowanceHandler() { return cryptoDeleteAllowanceHandler; } @@ -220,7 +221,7 @@ public CryptoDeleteAllowanceHandler getCryptoDeleteAllowanceHandler() { * * @return the cryptoAddLiveHashHandler */ - public CryptoAddLiveHashHandler getCryptoAddLiveHashHandler() { + public CryptoAddLiveHashHandler cryptoAddLiveHashHandler() { return cryptoAddLiveHashHandler; } @@ -229,7 +230,7 @@ public CryptoAddLiveHashHandler getCryptoAddLiveHashHandler() { * * @return the cryptoDeleteLiveHashHandler */ - public CryptoDeleteLiveHashHandler getCryptoDeleteLiveHashHandler() { + public CryptoDeleteLiveHashHandler cryptoDeleteLiveHashHandler() { return cryptoDeleteLiveHashHandler; } @@ -238,7 +239,7 @@ public CryptoDeleteLiveHashHandler getCryptoDeleteLiveHashHandler() { * * @return the tokenCreateHandler */ - public TokenCreateHandler getTokenCreateHandler() { + public TokenCreateHandler tokenCreateHandler() { return tokenCreateHandler; } @@ -247,7 +248,7 @@ public TokenCreateHandler getTokenCreateHandler() { * * @return the tokenUpdateHandler */ - public TokenUpdateHandler getTokenUpdateHandler() { + public TokenUpdateHandler tokenUpdateHandler() { return tokenUpdateHandler; } @@ -256,7 +257,7 @@ public TokenUpdateHandler getTokenUpdateHandler() { * * @return the tokenMintHandler */ - public TokenMintHandler getTokenMintHandler() { + public TokenMintHandler tokenMintHandler() { return tokenMintHandler; } @@ -265,7 +266,7 @@ public TokenMintHandler getTokenMintHandler() { * * @return the tokenBurnHandler */ - public TokenBurnHandler getTokenBurnHandler() { + public TokenBurnHandler tokenBurnHandler() { return tokenBurnHandler; } @@ -274,7 +275,7 @@ public TokenBurnHandler getTokenBurnHandler() { * * @return the tokenDeleteHandler */ - public TokenDeleteHandler getTokenDeleteHandler() { + public TokenDeleteHandler tokenDeleteHandler() { return tokenDeleteHandler; } @@ -283,7 +284,7 @@ public TokenDeleteHandler getTokenDeleteHandler() { * * @return the tokenAccountWipeHandler */ - public TokenAccountWipeHandler getTokenAccountWipeHandler() { + public TokenAccountWipeHandler tokenAccountWipeHandler() { return tokenAccountWipeHandler; } @@ -292,7 +293,7 @@ public TokenAccountWipeHandler getTokenAccountWipeHandler() { * * @return the tokenFreezeAccountHandler */ - public TokenFreezeAccountHandler getTokenFreezeAccountHandler() { + public TokenFreezeAccountHandler tokenFreezeAccountHandler() { return tokenFreezeAccountHandler; } @@ -301,7 +302,7 @@ public TokenFreezeAccountHandler getTokenFreezeAccountHandler() { * * @return the tokenUnfreezeAccountHandler */ - public TokenUnfreezeAccountHandler getTokenUnfreezeAccountHandler() { + public TokenUnfreezeAccountHandler tokenUnfreezeAccountHandler() { return tokenUnfreezeAccountHandler; } @@ -310,7 +311,7 @@ public TokenUnfreezeAccountHandler getTokenUnfreezeAccountHandler() { * * @return the tokenGrantKycToAccountHandler */ - public TokenGrantKycToAccountHandler getTokenGrantKycToAccountHandler() { + public TokenGrantKycToAccountHandler tokenGrantKycToAccountHandler() { return tokenGrantKycToAccountHandler; } @@ -319,7 +320,7 @@ public TokenGrantKycToAccountHandler getTokenGrantKycToAccountHandler() { * * @return the tokenRevokeKycFromAccountHandler */ - public TokenRevokeKycFromAccountHandler getTokenRevokeKycFromAccountHandler() { + public TokenRevokeKycFromAccountHandler tokenRevokeKycFromAccountHandler() { return tokenRevokeKycFromAccountHandler; } @@ -328,7 +329,7 @@ public TokenRevokeKycFromAccountHandler getTokenRevokeKycFromAccountHandler() { * * @return the tokenAssociateToAccountHandler */ - public TokenAssociateToAccountHandler getTokenAssociateToAccountHandler() { + public TokenAssociateToAccountHandler tokenAssociateToAccountHandler() { return tokenAssociateToAccountHandler; } @@ -337,7 +338,7 @@ public TokenAssociateToAccountHandler getTokenAssociateToAccountHandler() { * * @return the tokenDissociateFromAccountHandler */ - public TokenDissociateFromAccountHandler getTokenDissociateFromAccountHandler() { + public TokenDissociateFromAccountHandler tokenDissociateFromAccountHandler() { return tokenDissociateFromAccountHandler; } @@ -346,7 +347,7 @@ public TokenDissociateFromAccountHandler getTokenDissociateFromAccountHandler() * * @return the tokenFeeScheduleUpdateHandler */ - public TokenFeeScheduleUpdateHandler getTokenFeeScheduleUpdateHandler() { + public TokenFeeScheduleUpdateHandler tokenFeeScheduleUpdateHandler() { return tokenFeeScheduleUpdateHandler; } @@ -355,7 +356,7 @@ public TokenFeeScheduleUpdateHandler getTokenFeeScheduleUpdateHandler() { * * @return the tokenFeeScheduleUpdateHandler */ - public TokenPauseHandler getTokenPauseHandler() { + public TokenPauseHandler tokenPauseHandler() { return tokenPauseHandler; } @@ -364,7 +365,7 @@ public TokenPauseHandler getTokenPauseHandler() { * * @return the tokenFeeScheduleUpdateHandler */ - public TokenUnpauseHandler getTokenUnpauseHandler() { + public TokenUnpauseHandler tokenUnpauseHandler() { return tokenUnpauseHandler; } @@ -373,7 +374,7 @@ public TokenUnpauseHandler getTokenUnpauseHandler() { * * @return the tokenFeeScheduleUpdateHandler */ - public CryptoGetAccountBalanceHandler getCryptoGetAccountBalanceHandler() { + public CryptoGetAccountBalanceHandler cryptoGetAccountBalanceHandler() { return cryptoGetAccountBalanceHandler; } @@ -382,7 +383,7 @@ public CryptoGetAccountBalanceHandler getCryptoGetAccountBalanceHandler() { * * @return the cryptoGetAccountRecordsHandler */ - public CryptoGetAccountInfoHandler getCryptoGetAccountInfoHandler() { + public CryptoGetAccountInfoHandler cryptoGetAccountInfoHandler() { return cryptoGetAccountInfoHandler; } @@ -391,7 +392,7 @@ public CryptoGetAccountInfoHandler getCryptoGetAccountInfoHandler() { * * @return the cryptoGetAccountRecordsHandler */ - public CryptoGetAccountRecordsHandler getCryptoGetAccountRecordsHandler() { + public CryptoGetAccountRecordsHandler cryptoGetAccountRecordsHandler() { return cryptoGetAccountRecordsHandler; } @@ -400,7 +401,7 @@ public CryptoGetAccountRecordsHandler getCryptoGetAccountRecordsHandler() { * * @return the cryptoGetAccountRecordsHandler */ - public CryptoGetLiveHashHandler getCryptoGetLiveHashHandler() { + public CryptoGetLiveHashHandler cryptoGetLiveHashHandler() { return cryptoGetLiveHashHandler; } @@ -409,7 +410,7 @@ public CryptoGetLiveHashHandler getCryptoGetLiveHashHandler() { * * @return the cryptoGetAccountRecordsHandler */ - public CryptoGetStakersHandler getCryptoGetStakersHandler() { + public CryptoGetStakersHandler cryptoGetStakersHandler() { return cryptoGetStakersHandler; } @@ -418,7 +419,7 @@ public CryptoGetStakersHandler getCryptoGetStakersHandler() { * * @return the cryptoGetAccountRecordsHandler */ - public TokenGetInfoHandler getTokenGetInfoHandler() { + public TokenGetInfoHandler tokenGetInfoHandler() { return tokenGetInfoHandler; } @@ -427,7 +428,7 @@ public TokenGetInfoHandler getTokenGetInfoHandler() { * * @return the cryptoGetAccountRecordsHandler */ - public TokenGetAccountNftInfosHandler getTokenGetAccountNftInfosHandler() { + public TokenGetAccountNftInfosHandler tokenGetAccountNftInfosHandler() { return tokenGetAccountNftInfosHandler; } @@ -436,7 +437,7 @@ public TokenGetAccountNftInfosHandler getTokenGetAccountNftInfosHandler() { * * @return the cryptoGetAccountRecordsHandler */ - public TokenGetNftInfoHandler getTokenGetNftInfoHandler() { + public TokenGetNftInfoHandler tokenGetNftInfoHandler() { return tokenGetNftInfoHandler; } @@ -445,7 +446,7 @@ public TokenGetNftInfoHandler getTokenGetNftInfoHandler() { * * @return the cryptoGetAccountRecordsHandler */ - public TokenGetNftInfosHandler getTokenGetNftInfosHandler() { + public TokenGetNftInfosHandler tokenGetNftInfosHandler() { return tokenGetNftInfosHandler; } } From a04321d6320094c35b06f5bd609ec7a796625e93 Mon Sep 17 00:00:00 2001 From: Hendrik Ebbers Date: Tue, 25 Apr 2023 17:31:05 +0200 Subject: [PATCH 6/6] old constructor removed Signed-off-by: Hendrik Ebbers --- .../service/token/impl/handlers/CryptoUpdateHandler.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/CryptoUpdateHandler.java b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/CryptoUpdateHandler.java index 41dfa404cb2e..d299611262b5 100644 --- a/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/CryptoUpdateHandler.java +++ b/hedera-node/hedera-token-service-impl/src/main/java/com/hedera/node/app/service/token/impl/handlers/CryptoUpdateHandler.java @@ -37,15 +37,7 @@ public class CryptoUpdateHandler implements TransactionHandler { private final CryptoSignatureWaivers waivers; - /** - * @deprecated Exists until I figured out how to configure Dagger to inject the waivers - */ @Inject - @Deprecated(forRemoval = true) - public CryptoUpdateHandler() { - this.waivers = null; - } - public CryptoUpdateHandler(@NonNull final CryptoSignatureWaivers waivers) { this.waivers = requireNonNull(waivers, "The supplied argument 'waivers' must not be null"); }