-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: HIP-551 atomic batch transactions #17333
base: 17360-combine-transaction-body-proto
Are you sure you want to change the base?
Changes from all commits
1327b7b
7a787be
80652d3
d501d47
3eb77d8
d902946
7a32d3d
b3a8f69
e6b9e4e
889e4a8
583a99a
bbf83b2
7c836a9
e351c4d
445eecc
134cff5
98aa4f6
11fabe3
49371d6
c1667be
cefff6d
818cdbc
e709eae
2cc60c3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (C) 2023-2025 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.config.data; | ||
|
||
import com.hedera.node.config.NetworkProperty; | ||
import com.swirlds.config.api.ConfigData; | ||
import com.swirlds.config.api.ConfigProperty; | ||
|
||
@ConfigData("atomicBatch") | ||
public record AtomicBatchConfig(@ConfigProperty(defaultValue = "true") @NetworkProperty boolean isEnabled) {} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright (C) 2022-2025 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.util.impl.handlers; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import com.hedera.hapi.node.base.HederaFunctionality; | ||
import com.hedera.hapi.node.transaction.TransactionBody; | ||
import com.hedera.node.app.spi.workflows.HandleContext; | ||
import com.hedera.node.app.spi.workflows.HandleException; | ||
import com.hedera.node.app.spi.workflows.PreCheckException; | ||
import com.hedera.node.app.spi.workflows.PreHandleContext; | ||
import com.hedera.node.app.spi.workflows.TransactionHandler; | ||
import com.hedera.node.config.data.AtomicBatchConfig; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
/** | ||
* This class contains all workflow-related functionality regarding {@link HederaFunctionality#ATOMIC_BATCH}. | ||
*/ | ||
@Singleton | ||
public class AtomicBatchHandler implements TransactionHandler { | ||
/** | ||
* Constructs a {@link AtomicBatchHandler} | ||
*/ | ||
@Inject | ||
public AtomicBatchHandler() { | ||
// exists for Dagger injection | ||
} | ||
|
||
/** | ||
* Performs checks independent of state or context. | ||
* | ||
* @param txn the transaction to check | ||
*/ | ||
@Override | ||
public void pureChecks(@NonNull final TransactionBody txn) throws PreCheckException { | ||
// TODO | ||
} | ||
Check warning on line 54 in hedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java Codecov / codecov/patchhedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java#L54
|
||
|
||
/** | ||
* This method is called during the pre-handle workflow. | ||
* | ||
* @param context the {@link PreHandleContext} which collects all information | ||
* @throws PreCheckException if any issue happens on the pre handle level | ||
*/ | ||
@Override | ||
public void preHandle(@NonNull final PreHandleContext context) throws PreCheckException { | ||
requireNonNull(context); | ||
Check warning on line 64 in hedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java Codecov / codecov/patchhedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java#L64
|
||
// TODO | ||
} | ||
Check warning on line 66 in hedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java Codecov / codecov/patchhedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java#L66
|
||
|
||
@Override | ||
public void handle(@NonNull final HandleContext handleContext) throws HandleException { | ||
requireNonNull(handleContext); | ||
Check warning on line 70 in hedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java Codecov / codecov/patchhedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java#L70
|
||
// TODO | ||
if (!handleContext | ||
.configuration() | ||
.getConfigData(AtomicBatchConfig.class) | ||
Check warning on line 74 in hedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java Codecov / codecov/patchhedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java#L72-L74
|
||
Comment on lines
+72
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I know, this check should be done in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw it in some other places in that place but happy to remove it to enable or disable a service |
||
.isEnabled()) { | ||
return; | ||
Check warning on line 76 in hedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java Codecov / codecov/patchhedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java#L76
|
||
} | ||
} | ||
Check warning on line 78 in hedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java Codecov / codecov/patchhedera-node/hedera-util-service-impl/src/main/java/com/hedera/node/app/service/util/impl/handlers/AtomicBatchHandler.java#L78
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the default should be false? Then we can enable it when we are ready or we can enable it only on specific environments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can change it later on before we merge it to main. this is only feature flag