Skip to content
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: adapt PlatformTestingTool to work with Bytes for system transactions #17367

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (C) 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.
*/

plugins {
id("org.hiero.gradle.module.application")
id("org.hiero.gradle.feature.test-timing-sensitive")
Expand All @@ -20,6 +35,7 @@ testModuleInfo {
requires("org.junit.jupiter.params")
requires("org.junit.jupiter.api")
requires("org.mockito")
requires("org.assertj.core")
}

timingSensitiveModuleInfo {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Hedera Hashgraph, LLC
* 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.
Expand All @@ -26,6 +26,10 @@
*/
public class PayloadConfig {

// Pre-append this byte as a marker for all application transactions, so that
// they are easily distinguishable from system transactions
public static final byte APPLICATION_TRANSACTION_MARKER = 1;

/**
* use this for all logging
*/
Expand All @@ -49,7 +53,7 @@ public class PayloadConfig {
* if payload type is TYPE_FCM_VIRTUAL_MIX, what percentage is FCM transactions, the remained is virtual merkle
* transaction
*/
private float ratioOfFCMTransaction;
private final float ratioOfFCMTransaction;

/**
* If it is true, treat handling transactions on deleted entities of MerkleMap as info/warn
Expand All @@ -72,7 +76,7 @@ public class PayloadConfig {
* If it is true, allow nodes performing operations only on the entities they created.
* If it is false, each node can perform operation on entities any node created.
*/
private boolean operateEntitiesOfSameNode = false;
private final boolean operateEntitiesOfSameNode = false;
/**
* when it is false, payload bytes size would be payloadByteSize;
* when it is true, payload bytes size be a random number in range [payloadByteSize, maxByteSize]
Expand All @@ -90,7 +94,7 @@ public class PayloadConfig {

private PayloadDistribution distribution = null;

private PayloadConfig(Builder builder) {
private PayloadConfig(final Builder builder) {
this.insertSeq = builder.insertSeq;
this.appendSig = builder.appendSig;
this.variedSize = builder.variedSize;
Expand Down Expand Up @@ -137,7 +141,7 @@ public double getInvalidSigRatio() {
return invalidSigRatio;
}

public void setPerformOnDeleted(boolean performOnDeleted) {
public void setPerformOnDeleted(final boolean performOnDeleted) {
this.performOnDeleted = performOnDeleted;
}

Expand Down Expand Up @@ -255,42 +259,42 @@ public static final class Builder {

private Builder() {}

public Builder setInsertSeq(boolean insertSeq) {
public Builder setInsertSeq(final boolean insertSeq) {
this.insertSeq = insertSeq;
return this;
}

public Builder setAppendSig(boolean appendSig) {
public Builder setAppendSig(final boolean appendSig) {
this.appendSig = appendSig;
return this;
}

public Builder setVariedSize(boolean variedSize) {
public Builder setVariedSize(final boolean variedSize) {
this.variedSize = variedSize;
return this;
}

public Builder setPayloadByteSize(int payloadByteSize) {
public Builder setPayloadByteSize(final int payloadByteSize) {
this.payloadByteSize = payloadByteSize;
return this;
}

public Builder setMaxByteSize(int maxByteSize) {
public Builder setMaxByteSize(final int maxByteSize) {
this.maxByteSize = maxByteSize;
return this;
}

public Builder setType(PAYLOAD_TYPE type) {
public Builder setType(final PAYLOAD_TYPE type) {
this.type = type;
return this;
}

public Builder setDistribution(PayloadDistribution distribution) {
public Builder setDistribution(final PayloadDistribution distribution) {
this.distribution = distribution;
return this;
}

public Builder setInvalidSigRatio(double invalidSigRatio) {
public Builder setInvalidSigRatio(final double invalidSigRatio) {
this.invalidSigRatio = invalidSigRatio;
return this;
}
Expand All @@ -301,27 +305,27 @@ public Builder setInvalidSigRatio(double invalidSigRatio) {
* @param ratioOfFCMTransaction
* The new ratio for FCM transactions.
*/
public Builder setRatioOfFCMTransaction(float ratioOfFCMTransaction) {
public Builder setRatioOfFCMTransaction(final float ratioOfFCMTransaction) {
this.ratioOfFCMTransaction = ratioOfFCMTransaction;
return this;
}

public Builder setPerformOnDeleted(boolean performOnDeleted) {
public Builder setPerformOnDeleted(final boolean performOnDeleted) {
this.performOnDeleted = performOnDeleted;
return this;
}

public Builder setCreateOnExistingEntities(boolean createOnExistingEntities) {
public Builder setCreateOnExistingEntities(final boolean createOnExistingEntities) {
this.createOnExistingEntities = createOnExistingEntities;
return this;
}

public Builder setPerformOnNonExistingEntities(boolean performOnNonExistingEntities) {
public Builder setPerformOnNonExistingEntities(final boolean performOnNonExistingEntities) {
this.performOnNonExistingEntities = performOnNonExistingEntities;
return this;
}

public Builder setOperateEntitiesOfSameNode(boolean operateEntitiesOfSameNode) {
public Builder setOperateEntitiesOfSameNode(final boolean operateEntitiesOfSameNode) {
this.operateEntitiesOfSameNode = operateEntitiesOfSameNode;
return this;
}
Expand Down
Loading