Skip to content

Commit

Permalink
rename request
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdi-aouadi committed Aug 2, 2024
1 parent e9b0bc1 commit b8ec4ff
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@
@TestSpecContext(
milestone = {PHASE0, ELECTRA},
network = Eth2Network.MINIMAL)
public class GetAggregateAttestationRequestV2Test extends AbstractTypeDefRequestTestBase {
public class CreateAggregateAttestationRequestV2Test extends AbstractTypeDefRequestTestBase {

private GetAggregateAttestationRequestV2 getAggregateAttestationRequestV2;
private CreateAggregateAttestationRequestV2 createAggregateAttestationRequestV2;
private Buffer responseBodyBuffer;
private final UInt64 slot = UInt64.ONE;

@BeforeEach
void setupRequest() {
getAggregateAttestationRequestV2 =
new GetAggregateAttestationRequestV2(mockWebServer.url("/"), okHttpClient, spec, slot);
createAggregateAttestationRequestV2 =
new CreateAggregateAttestationRequestV2(mockWebServer.url("/"), okHttpClient, spec, slot);
responseBodyBuffer = new Buffer();
}

Expand All @@ -69,7 +69,7 @@ public void getAggregateAttestation_makesExpectedRequest() throws Exception {

mockWebServer.enqueue(new MockResponse().setResponseCode(SC_NO_CONTENT));

getAggregateAttestationRequestV2.createAggregate(attestationHashTreeRoot, committeeIndex);
createAggregateAttestationRequestV2.createAggregate(attestationHashTreeRoot, committeeIndex);

final RecordedRequest request = mockWebServer.takeRequest();

Expand All @@ -85,9 +85,9 @@ public void getAggregateAttestation_makesExpectedRequest() throws Exception {
@TestTemplate
public void shouldGetAggregateAttestation() {
final Attestation attestation = dataStructureUtil.randomAttestation();
final GetAggregateAttestationRequestV2.GetAggregateAttestationResponse
final CreateAggregateAttestationRequestV2.GetAggregateAttestationResponse
getAggregateAttestationResponse =
new GetAggregateAttestationRequestV2.GetAggregateAttestationResponse(attestation);
new CreateAggregateAttestationRequestV2.GetAggregateAttestationResponse(attestation);

final String mockResponse = readExpectedJsonResource(specMilestone);

Expand All @@ -100,7 +100,7 @@ public void shouldGetAggregateAttestation() {
: attestation.getData().getIndex();

final Optional<ObjectAndMetaData<Attestation>> maybeAttestationAndMetaData =
getAggregateAttestationRequestV2.createAggregate(
createAggregateAttestationRequestV2.createAggregate(
attestation.hashTreeRoot(), committeeIndex);
assertThat(maybeAttestationAndMetaData).isPresent();
assertThat(maybeAttestationAndMetaData.get().getData())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public SafeFuture<Optional<Attestation>> createAggregate(
return sendRequest(
() ->
typeDefClient
.createAggregate(slot, attestationHashTreeRoot, committeeIndex.get())
.createAggregateV2(slot, attestationHashTreeRoot, committeeIndex.get())
.map(ObjectAndMetaData::getData));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
import tech.pegasys.teku.validator.api.SendSignedBlockResult;
import tech.pegasys.teku.validator.api.required.SyncingStatus;
import tech.pegasys.teku.validator.remote.typedef.handlers.BeaconCommitteeSelectionsRequest;
import tech.pegasys.teku.validator.remote.typedef.handlers.CreateAggregateAttestationRequestV2;
import tech.pegasys.teku.validator.remote.typedef.handlers.CreateAttestationDataRequest;
import tech.pegasys.teku.validator.remote.typedef.handlers.CreateBlockRequest;
import tech.pegasys.teku.validator.remote.typedef.handlers.CreateSyncCommitteeContributionRequest;
import tech.pegasys.teku.validator.remote.typedef.handlers.GetAggregateAttestationRequestV2;
import tech.pegasys.teku.validator.remote.typedef.handlers.GetPeerCountRequest;
import tech.pegasys.teku.validator.remote.typedef.handlers.GetProposerDutiesRequest;
import tech.pegasys.teku.validator.remote.typedef.handlers.GetStateValidatorsRequest;
Expand Down Expand Up @@ -261,11 +261,11 @@ public void prepareBeaconProposer(
prepareBeaconProposersRequest.submit(beaconPreparableProposers);
}

public Optional<ObjectAndMetaData<Attestation>> createAggregate(
public Optional<ObjectAndMetaData<Attestation>> createAggregateV2(
final UInt64 slot, final Bytes32 attestationHashTreeRoot, final UInt64 committeeIndex) {
GetAggregateAttestationRequestV2 getAggregateAttestationRequestV2 =
new GetAggregateAttestationRequestV2(getBaseEndpoint(), getOkHttpClient(), spec, slot);
return getAggregateAttestationRequestV2.createAggregate(
CreateAggregateAttestationRequestV2 createAggregateAttestationRequestV2 =
new CreateAggregateAttestationRequestV2(getBaseEndpoint(), getOkHttpClient(), spec, slot);
return createAggregateAttestationRequestV2.createAggregate(
attestationHashTreeRoot, committeeIndex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import tech.pegasys.teku.spec.datastructures.operations.AttestationSchema;
import tech.pegasys.teku.validator.remote.typedef.ResponseHandler;

public class GetAggregateAttestationRequestV2 extends AbstractTypeDefRequest {
public class CreateAggregateAttestationRequestV2 extends AbstractTypeDefRequest {

final AttestationSchema<Attestation> attestationSchema;
final UInt64 slot;
Expand All @@ -43,7 +43,7 @@ public class GetAggregateAttestationRequestV2 extends AbstractTypeDefRequest {
private final DeserializableTypeDefinition<GetAggregateAttestationResponse>
getAggregateAttestationTypeDef;

public GetAggregateAttestationRequestV2(
public CreateAggregateAttestationRequestV2(
final HttpUrl baseEndpoint,
final OkHttpClient okHttpClient,
final Spec spec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ public void createAggregate_ShouldUseV1ApiPreElectra() {
ignoreFuture(apiHandler.createAggregate(slot, attHashTreeRoot, Optional.empty()));
asyncRunner.executeQueuedActions();

verify(typeDefClient, never()).createAggregate(any(), any(), any());
verify(typeDefClient, never()).createAggregateV2(any(), any(), any());
verify(apiClient).createAggregate(slot, attHashTreeRoot);
}

Expand All @@ -671,7 +671,7 @@ public void createAggregate_ShouldUseV2ApiPostElectra() {
asyncRunner.executeQueuedActions();

verify(apiClient, never()).createAggregate(any(), any());
verify(typeDefClient).createAggregate(slot, attHashTreeRoot, committeeIndex);
verify(typeDefClient).createAggregateV2(slot, attHashTreeRoot, committeeIndex);
}

@SuppressWarnings("unchecked")
Expand Down

0 comments on commit b8ec4ff

Please sign in to comment.