Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi committed Jul 19, 2024
1 parent cff6669 commit 8e97d97
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ public SafeFuture<List<SubmitDataError>> sendSignedAttestationsV2(
final SpecMilestone specMilestone, final List<Attestation> attestations) {
try (final OperationTimer.TimingContext context =
startTimer(dutyTimer, ATTESTATION_PRODUCTION.getName(), SEND.getName())) {
SafeFuture<List<SubmitDataError>> request = delegate.sendSignedAttestations(attestations);
SafeFuture<List<SubmitDataError>> request =
delegate.sendSignedAttestationsV2(specMilestone, attestations);
request.always(context::stopTimer);
return countSendRequest(request, BeaconNodeRequestLabels.PUBLISH_ATTESTATION_METHOD);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.fail;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_BAD_REQUEST;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK;
import static tech.pegasys.teku.infrastructure.http.RestApiConstants.HEADER_CONSENSUS_VERSION;
import static tech.pegasys.teku.spec.SpecMilestone.ELECTRA;
import static tech.pegasys.teku.spec.SpecMilestone.PHASE0;

import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
Expand All @@ -31,7 +29,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestTemplate;
import tech.pegasys.teku.api.response.v1.beacon.PostDataFailureResponse;
import tech.pegasys.teku.provider.JsonProvider;
import tech.pegasys.teku.spec.TestSpecContext;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;
import tech.pegasys.teku.spec.networks.Eth2Network;
Expand All @@ -43,7 +40,6 @@
public class PostAttestationsRequestTest extends AbstractTypeDefRequestTestBase {

private PostAttestationsRequest request;
private final JsonProvider jsonProvider = new JsonProvider();

@BeforeEach
void setupRequest() {
Expand Down Expand Up @@ -78,13 +74,4 @@ public void shouldHandleBadRequest() throws InterruptedException {
assertThat(recordedRequest.getHeader(HEADER_CONSENSUS_VERSION))
.isEqualTo(specMilestone.name().toLowerCase(Locale.ROOT));
}

private String asJson(final Object object) {
try {
return jsonProvider.objectToJSON(object);
} catch (JsonProcessingException e) {
fail("Error conversing object to json", e);
return "";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public SafeFuture<List<SubmitDataError>> sendSignedAttestationsV2(
final SpecMilestone specMilestone, final List<Attestation> attestations) {
return attestationPublisherChannel
.orElse(dutiesProviderChannel)
.sendSignedAttestations(attestations);
.sendSignedAttestationsV2(specMilestone, attestations);
}

@Override
Expand Down

0 comments on commit 8e97d97

Please sign in to comment.