From d9b19f387d7713f92291a8944e9c80f3c7da9003 Mon Sep 17 00:00:00 2001 From: courtneyeh Date: Fri, 12 Apr 2024 11:32:58 +1000 Subject: [PATCH] Update filenames --- .../teku/statetransition/util/DebugDataDumper.java | 7 +++---- .../statetransition/util/DebugDataDumperTest.java | 14 ++++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/DebugDataDumper.java b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/DebugDataDumper.java index 483963d6325..6790a91999f 100644 --- a/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/DebugDataDumper.java +++ b/ethereum/statetransition/src/main/java/tech/pegasys/teku/statetransition/util/DebugDataDumper.java @@ -58,7 +58,7 @@ public void saveGossipMessageDecodingError( if (!enabled) { return; } - final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, topic); + final String fileName = String.format("%s.ssz", arrivalTimestamp); final Path topicPath = Path.of(GOSSIP_MESSAGES_DIR).resolve(DECODING_ERROR_SUB_DIR).resolve(topic); saveBytesToFile( @@ -70,7 +70,7 @@ public void saveGossipRejectedMessageToFile( if (!enabled) { return; } - final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, topic); + final String fileName = String.format("%s.ssz", arrivalTimestamp); final Path topicPath = Path.of(GOSSIP_MESSAGES_DIR).resolve(REJECTED_SUB_DIR).resolve(topic); saveBytesToFile("rejected gossip message", topicPath.resolve(fileName), decodedMessage); } @@ -80,8 +80,7 @@ public void saveInvalidBlockToFile( if (!enabled) { return; } - final String fileName = - String.format("slot%s_root%s.ssz", slot, blockRoot.toUnprefixedHexString()); + final String fileName = String.format("%s_%s.ssz", slot, blockRoot.toUnprefixedHexString()); saveBytesToFile("invalid block", Path.of(INVALID_BLOCK_DIR).resolve(fileName), blockSsz); } diff --git a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/DebugDataDumperTest.java b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/DebugDataDumperTest.java index b226ca8f53c..4847c37a25f 100644 --- a/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/DebugDataDumperTest.java +++ b/ethereum/statetransition/src/test/java/tech/pegasys/teku/statetransition/util/DebugDataDumperTest.java @@ -43,7 +43,7 @@ void saveGossipMessageDecodingError_shouldSaveToFile(@TempDir Path tempDir) { final String topic = "test_topic"; manager.saveGossipMessageDecodingError("test_topic", arrivalTimestamp, messageBytes); - final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, topic); + final String fileName = String.format("%s.ssz", arrivalTimestamp); final Path expectedFile = tempDir .resolve("gossip_messages") @@ -61,7 +61,7 @@ void saveGossipMessageDecodingError_shouldNotSaveToFileWhenDisabled(@TempDir Pat manager.saveGossipMessageDecodingError("test_topic", arrivalTimestamp, messageBytes); assertThat(manager.isEnabled()).isFalse(); - final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, "test_topic"); + final String fileName = String.format("%s.ssz", arrivalTimestamp); final Path expectedFile = tempDir.resolve("gossip_messages").resolve("decoding_error").resolve(fileName); checkFileNotExist(expectedFile); @@ -75,7 +75,7 @@ void saveGossipRejectedMessageToFile_shouldSaveToFile(@TempDir Path tempDir) { final String topic = "test_topic"; manager.saveGossipRejectedMessageToFile("test_topic", arrivalTimestamp, messageBytes); - final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, topic); + final String fileName = String.format("%s.ssz", arrivalTimestamp); final Path expectedFile = tempDir.resolve("gossip_messages").resolve("rejected").resolve(topic).resolve(fileName); checkBytesSavedToFile(expectedFile, messageBytes); @@ -89,7 +89,7 @@ void saveGossipRejectedMessageToFile_shouldNotSaveToFileWhenDisabled(@TempDir Pa manager.saveGossipRejectedMessageToFile("test_topic", arrivalTimestamp, messageBytes); assertThat(manager.isEnabled()).isFalse(); - final String fileName = String.format("%s_%s.ssz", arrivalTimestamp, "test_topic"); + final String fileName = String.format("%s.ssz", arrivalTimestamp); final Path expectedFile = tempDir.resolve("gossip_messages").resolve("rejected").resolve(fileName); checkFileNotExist(expectedFile); @@ -102,8 +102,7 @@ void saveInvalidBlockToFile_shouldSaveToFile(@TempDir Path tempDir) { manager.saveInvalidBlockToFile(block.getSlot(), block.getRoot(), block.sszSerialize()); final String fileName = - String.format( - "slot%s_root%s.ssz", block.getSlot(), block.getRoot().toUnprefixedHexString()); + String.format("%s_%s.ssz", block.getSlot(), block.getRoot().toUnprefixedHexString()); final Path expectedFile = tempDir.resolve("invalid_blocks").resolve(fileName); checkBytesSavedToFile(expectedFile, block.sszSerialize()); } @@ -116,8 +115,7 @@ void saveInvalidBlockToFile_shouldNotSaveToFileWhenDisabled(@TempDir Path tempDi assertThat(manager.isEnabled()).isFalse(); final String fileName = - String.format( - "slot%s_root%s.ssz", block.getSlot(), block.getRoot().toUnprefixedHexString()); + String.format("%s_%s.ssz", block.getSlot(), block.getRoot().toUnprefixedHexString()); final Path expectedFile = tempDir.resolve("invalid_blocks").resolve(fileName); checkFileNotExist(expectedFile); }