Skip to content

Commit

Permalink
Change name of get graffiti in manager
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyeh committed Apr 19, 2024
1 parent b24311c commit ba2311a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private Optional<String> updateGraffiti(final BLSPublicKey publicKey, final Stri
return Optional.empty();
}

public Optional<Bytes32> getGraffitiFromStorage(final BLSPublicKey publicKey) {
public Optional<Bytes32> getGraffiti(final BLSPublicKey publicKey) {
final Path filePath = graffitiPath.resolve(resolveFileName(publicKey));
try {
return Optional.of(GraffitiParser.loadFromFile(filePath)).filter(this::graffitiNotEmpty);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void getGraffitiFromStorage_shouldGetGraffitiFromStorage(@TempDir final Path tem
Files.writeString(filePath, graffiti);

final Bytes32 expectedBytes = Bytes32Parser.toBytes32(graffiti);
assertThat(manager.getGraffitiFromStorage(publicKey)).hasValue(expectedBytes);
assertThat(manager.getGraffiti(publicKey)).hasValue(expectedBytes);
}

@Test
Expand All @@ -183,7 +183,7 @@ void getGraffitiFromStorage_shouldReturnEmptyWhenFileTooBig(@TempDir final Path
final Path filePath = getGraffitiManagementDir().resolve(getFileName(publicKey));
Files.writeString(filePath, invalidGraffiti);

assertThat(manager.getGraffitiFromStorage(publicKey)).isEmpty();
assertThat(manager.getGraffiti(publicKey)).isEmpty();
}

@Test
Expand All @@ -196,7 +196,7 @@ void getGraffitiFromStorage_shouldReturnEmptyWhenNotReadableFile(@TempDir final
Files.writeString(filePath, graffiti);
assertThat(filePath.toFile().setReadable(false)).isTrue();

assertThat(manager.getGraffitiFromStorage(publicKey)).isEmpty();
assertThat(manager.getGraffiti(publicKey)).isEmpty();
}

@Test
Expand All @@ -207,7 +207,7 @@ void getGraffitiFromStorage_shouldReturnEmptyWhenFileEmpty(@TempDir final Path t
final Path filePath = getGraffitiManagementDir().resolve(getFileName(publicKey));
assertThat(filePath.toFile().createNewFile()).isTrue();

assertThat(manager.getGraffitiFromStorage(publicKey)).isEmpty();
assertThat(manager.getGraffiti(publicKey)).isEmpty();
}

private Path getGraffitiManagementDir() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public static ValidatorClientService create(
config,
asyncRunner,
validatorApiConfig.isRestApiEnabled()
? graffitiManager::getGraffitiFromStorage
? graffitiManager::getGraffiti
: (publicKey) -> Optional.empty());
final ValidatorStatusProvider validatorStatusProvider =
new OwnedValidatorStatusProvider(
Expand Down

0 comments on commit ba2311a

Please sign in to comment.