Skip to content

Commit d8e1658

Browse files
Use DEFAULT_MAX_DEPTH in parse() overrides
Signed-off-by: Michael Tinker <[email protected]>
1 parent eb0be76 commit d8e1658

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

hedera-node/hapi-utils/src/main/java/com/hedera/node/app/hapi/utils/blocks/BlockStreamAccess.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import static com.hedera.node.app.hapi.utils.CommonPbjConverters.MAX_PBJ_RECORD_SIZE;
55
import static com.hedera.node.app.hapi.utils.exports.recordstreaming.RecordStreamingUtils.SIDECAR_ONLY_TOKEN;
6+
import static com.hedera.pbj.runtime.Codec.DEFAULT_MAX_DEPTH;
67
import static java.util.Comparator.comparing;
78

89
import com.hedera.hapi.block.stream.Block;
@@ -164,15 +165,15 @@ public static Block blockFrom(@NonNull final Path path) {
164165
Bytes.wrap(in.readAllBytes()).toReadableSequentialData(),
165166
false,
166167
false,
167-
Integer.MAX_VALUE,
168+
DEFAULT_MAX_DEPTH,
168169
MAX_PBJ_RECORD_SIZE);
169170
}
170171
} else {
171172
return Block.PROTOBUF.parse(
172173
Bytes.wrap(Files.readAllBytes(path)).toReadableSequentialData(),
173174
false,
174175
false,
175-
Integer.MAX_VALUE,
176+
DEFAULT_MAX_DEPTH,
176177
MAX_PBJ_RECORD_SIZE);
177178
}
178179
} catch (IOException | ParseException e) {

hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/TransactionChecker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static com.hedera.node.app.spi.validation.PreCheckValidator.checkMemo;
2222
import static com.hedera.node.app.spi.workflows.PreCheckException.validateFalsePreCheck;
2323
import static com.hedera.node.app.spi.workflows.PreCheckException.validateTruePreCheck;
24+
import static com.hedera.pbj.runtime.Codec.DEFAULT_MAX_DEPTH;
2425
import static java.util.Objects.requireNonNull;
2526

2627
import com.google.common.annotations.VisibleForTesting;
@@ -628,7 +629,7 @@ private <T> T parseStrict(
628629
final int maxSize)
629630
throws PreCheckException {
630631
try {
631-
return codec.parse(data, true, false, Integer.MAX_VALUE, maxSize);
632+
return codec.parse(data, true, false, DEFAULT_MAX_DEPTH, maxSize);
632633
} catch (ParseException e) {
633634
if (e.getCause() instanceof UnknownFieldException) {
634635
// We do not allow newer clients to send transactions to older networks.

hedera-node/test-clients/src/main/java/com/hedera/services/bdd/junit/support/translators/inputs/TransactionParts.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import static com.hedera.hapi.util.HapiUtils.functionOf;
55
import static com.hedera.node.app.hapi.utils.CommonPbjConverters.MAX_PBJ_RECORD_SIZE;
6+
import static com.hedera.pbj.runtime.Codec.DEFAULT_MAX_DEPTH;
67
import static java.util.Objects.requireNonNull;
78

89
import com.hedera.hapi.node.base.HederaFunctionality;
@@ -46,7 +47,7 @@ public static TransactionParts from(@NonNull final Bytes serializedSignedTx) {
4647
serializedSignedTx.toReadableSequentialData(),
4748
false,
4849
false,
49-
Integer.MAX_VALUE,
50+
DEFAULT_MAX_DEPTH,
5051
MAX_PBJ_RECORD_SIZE);
5152
final Transaction wrapper;
5253
if (signedTx.useSerializedTxMessageHashAlgorithm()) {
@@ -63,7 +64,7 @@ public static TransactionParts from(@NonNull final Bytes serializedSignedTx) {
6364
signedTx.bodyBytes().toReadableSequentialData(),
6465
false,
6566
false,
66-
Integer.MAX_VALUE,
67+
DEFAULT_MAX_DEPTH,
6768
MAX_PBJ_RECORD_SIZE);
6869
return new TransactionParts(wrapper, body, functionOf(body));
6970
} catch (ParseException | UnknownHederaFunctionality e) {

platform-sdk/swirlds-virtualmap/src/main/java/com/swirlds/virtualmap/VirtualMap.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: Apache-2.0
22
package com.swirlds.virtualmap;
33

4+
import static com.hedera.pbj.runtime.Codec.DEFAULT_MAX_DEPTH;
45
import static com.swirlds.common.io.streams.StreamDebugUtils.deserializeAndDebugOnFailure;
56
import static com.swirlds.common.threading.manager.AdHocThreadManager.getStaticThreadManager;
67
import static com.swirlds.logging.legacy.LogMarker.EXCEPTION;
@@ -692,7 +693,7 @@ public <V> V remove(@NonNull final Bytes key, @NonNull final Codec<V> valueCodec
692693
removedValueBytes.toReadableSequentialData(),
693694
false,
694695
false,
695-
Integer.MAX_VALUE,
696+
DEFAULT_MAX_DEPTH,
696697
MAX_PBJ_RECORD_SIZE);
697698
} catch (final ParseException e) {
698699
throw new RuntimeException("Failed to deserialize a value from bytes", e);

0 commit comments

Comments
 (0)