Skip to content

Commit

Permalink
Rename and/or move builder specific classes (#6082)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov authored Aug 17, 2022
1 parent 6ce95d3 commit fff8886
Show file tree
Hide file tree
Showing 64 changed files with 192 additions and 181 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBlockAndState;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.genesis.GenesisData;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;
import tech.pegasys.teku.spec.datastructures.operations.AttestationData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import tech.pegasys.teku.infrastructure.json.JsonUtil;
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.util.DataStructureUtil;

public class PostRegisterValidatorTest extends AbstractDataBackedRestAPIIntegrationTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import tech.pegasys.teku.beaconrestapi.AbstractMigratedBeaconHandlerTest;
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;

public class PostRegisterValidatorTest extends AbstractMigratedBeaconHandlerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.blocks.BeaconBlock;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.operations.Attestation;
import tech.pegasys.teku.spec.datastructures.operations.AttestationData;
import tech.pegasys.teku.spec.datastructures.operations.SignedAggregateAndProof;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@
import tech.pegasys.teku.spec.TestSpecContext;
import tech.pegasys.teku.spec.TestSpecInvocationContextProvider.SpecContext;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.builder.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;
import tech.pegasys.teku.spec.networks.Eth2Network;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsBellatrix;

@TestSpecContext(
milestone = SpecMilestone.BELLATRIX,
network = {Eth2Network.MAINNET})
class RestExecutionBuilderClientTest {
class RestBuilderClientTest {

private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

Expand Down Expand Up @@ -91,7 +91,7 @@ class RestExecutionBuilderClientTest {

private SchemaDefinitionsBellatrix schemaDefinitionsBellatrix;

private RestExecutionBuilderClient restExecutionBuilderClient;
private RestBuilderClient restBuilderClient;

@BeforeEach
void setUp(SpecContext specContext) throws IOException {
Expand All @@ -104,7 +104,7 @@ void setUp(SpecContext specContext) throws IOException {
.getSchemaDefinitions()
.toVersionBellatrix()
.orElseThrow();
this.restExecutionBuilderClient = new RestExecutionBuilderClient(okHttpRestClient, spec);
this.restBuilderClient = new RestBuilderClient(okHttpRestClient, spec);
}

@AfterEach
Expand All @@ -116,7 +116,7 @@ void afterEach() throws Exception {
void getStatus_success() {
mockWebServer.enqueue(new MockResponse().setResponseCode(200));

assertThat(restExecutionBuilderClient.status())
assertThat(restBuilderClient.status())
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -132,7 +132,7 @@ void getStatus_failures() {
mockWebServer.enqueue(
new MockResponse().setResponseCode(500).setBody(INTERNAL_SERVER_ERROR_MESSAGE));

assertThat(restExecutionBuilderClient.status())
assertThat(restBuilderClient.status())
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -151,7 +151,7 @@ void registerValidators_success() {
SszList<SignedValidatorRegistration> signedValidatorRegistrations =
createSignedValidatorRegistrations();

assertThat(restExecutionBuilderClient.registerValidators(SLOT, signedValidatorRegistrations))
assertThat(restBuilderClient.registerValidators(SLOT, signedValidatorRegistrations))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -168,7 +168,7 @@ void registerValidators_zeroRegistrationsDoesNotMakeRequest() {
SszList<SignedValidatorRegistration> zeroRegistrations =
SIGNED_VALIDATOR_REGISTRATIONS_SCHEMA.getDefault();

assertThat(restExecutionBuilderClient.registerValidators(SLOT, zeroRegistrations))
assertThat(restBuilderClient.registerValidators(SLOT, zeroRegistrations))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -189,7 +189,7 @@ void registerValidators_failures() {
SszList<SignedValidatorRegistration> signedValidatorRegistrations =
createSignedValidatorRegistrations();

assertThat(restExecutionBuilderClient.registerValidators(SLOT, signedValidatorRegistrations))
assertThat(restBuilderClient.registerValidators(SLOT, signedValidatorRegistrations))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -202,7 +202,7 @@ void registerValidators_failures() {
mockWebServer.enqueue(
new MockResponse().setResponseCode(500).setBody(INTERNAL_SERVER_ERROR_MESSAGE));

assertThat(restExecutionBuilderClient.registerValidators(SLOT, signedValidatorRegistrations))
assertThat(restBuilderClient.registerValidators(SLOT, signedValidatorRegistrations))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -219,7 +219,7 @@ void getExecutionPayloadHeader_success() {
mockWebServer.enqueue(
new MockResponse().setResponseCode(200).setBody(EXECUTION_PAYLOAD_HEADER_RESPONSE));

assertThat(restExecutionBuilderClient.getHeader(SLOT, PUB_KEY, PARENT_HASH))
assertThat(restBuilderClient.getHeader(SLOT, PUB_KEY, PARENT_HASH))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -237,7 +237,7 @@ void getExecutionPayloadHeader_noHeaderAvailable() {

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

assertThat(restExecutionBuilderClient.getHeader(SLOT, PUB_KEY, PARENT_HASH))
assertThat(restBuilderClient.getHeader(SLOT, PUB_KEY, PARENT_HASH))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -255,7 +255,7 @@ void getExecutionPayloadHeader_failures() {
"{\"code\":400,\"message\":\"Unknown hash: missing parent hash\"}";
mockWebServer.enqueue(new MockResponse().setResponseCode(400).setBody(missingParentHashError));

assertThat(restExecutionBuilderClient.getHeader(SLOT, PUB_KEY, PARENT_HASH))
assertThat(restBuilderClient.getHeader(SLOT, PUB_KEY, PARENT_HASH))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -268,7 +268,7 @@ void getExecutionPayloadHeader_failures() {
mockWebServer.enqueue(
new MockResponse().setResponseCode(500).setBody(INTERNAL_SERVER_ERROR_MESSAGE));

assertThat(restExecutionBuilderClient.getHeader(SLOT, PUB_KEY, PARENT_HASH))
assertThat(restBuilderClient.getHeader(SLOT, PUB_KEY, PARENT_HASH))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -287,7 +287,7 @@ void sendSignedBlindedBlock_success() {

SignedBeaconBlock signedBlindedBeaconBlock = createSignedBlindedBeaconBlock();

assertThat(restExecutionBuilderClient.getPayload(signedBlindedBeaconBlock))
assertThat(restBuilderClient.getPayload(signedBlindedBeaconBlock))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -308,7 +308,7 @@ void sendSignedBlindedBlock_failures() {

SignedBeaconBlock signedBlindedBeaconBlock = createSignedBlindedBeaconBlock();

assertThat(restExecutionBuilderClient.getPayload(signedBlindedBeaconBlock))
assertThat(restBuilderClient.getPayload(signedBlindedBeaconBlock))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand All @@ -321,7 +321,7 @@ void sendSignedBlindedBlock_failures() {
mockWebServer.enqueue(
new MockResponse().setResponseCode(500).setBody(INTERNAL_SERVER_ERROR_MESSAGE));

assertThat(restExecutionBuilderClient.getPayload(signedBlindedBeaconBlock))
assertThat(restBuilderClient.getPayload(signedBlindedBeaconBlock))
.succeedsWithin(WAIT_FOR_CALL_COMPLETION)
.satisfies(
response -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.builder.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;

public interface ExecutionBuilderClient {
public interface BuilderClient {

SafeFuture<Response<Void>> status();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
import tech.pegasys.teku.infrastructure.ssz.SszList;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.builder.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;

public class ThrottlingExecutionBuilderClient implements ExecutionBuilderClient {
private final ExecutionBuilderClient delegate;
public class ThrottlingBuilderClient implements BuilderClient {
private final BuilderClient delegate;
private final ThrottlingTaskQueue taskQueue;

public ThrottlingExecutionBuilderClient(
final ExecutionBuilderClient delegate,
public ThrottlingBuilderClient(
final BuilderClient delegate,
final int maximumConcurrentRequests,
final MetricsSystem metricsSystem) {
this.delegate = delegate;
Expand All @@ -42,7 +42,7 @@ public ThrottlingExecutionBuilderClient(
maximumConcurrentRequests,
metricsSystem,
TekuMetricCategory.BEACON,
"eb_request_queue_size");
"builder_request_queue_size");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.tuweni.bytes.Bytes32;
import org.hyperledger.besu.plugin.services.MetricsSystem;
import tech.pegasys.teku.bls.BLSPublicKey;
import tech.pegasys.teku.ethereum.executionclient.ExecutionBuilderClient;
import tech.pegasys.teku.ethereum.executionclient.BuilderClient;
import tech.pegasys.teku.ethereum.executionclient.schema.Response;
import tech.pegasys.teku.infrastructure.async.SafeFuture;
import tech.pegasys.teku.infrastructure.metrics.MetricsCountersByIntervals;
Expand All @@ -28,12 +28,12 @@
import tech.pegasys.teku.infrastructure.time.TimeProvider;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.builder.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;

public class MetricRecordingExecutionBuilderClient extends MetricRecordingAbstractClient
implements ExecutionBuilderClient {
public class MetricRecordingBuilderClient extends MetricRecordingAbstractClient
implements BuilderClient {

public static final String BUILDER_REQUESTS_COUNTER_NAME = "builder_requests_total";

Expand All @@ -42,10 +42,10 @@ public class MetricRecordingExecutionBuilderClient extends MetricRecordingAbstra
public static final String GET_HEADER_METHOD = "get_header";
public static final String GET_PAYLOAD_METHOD = "get_payload";

private final ExecutionBuilderClient delegate;
private final BuilderClient delegate;

public MetricRecordingExecutionBuilderClient(
final ExecutionBuilderClient delegate,
public MetricRecordingBuilderClient(
final BuilderClient delegate,
final TimeProvider timeProvider,
final MetricsSystem metricsSystem) {
super(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.tuweni.bytes.Bytes32;
import tech.pegasys.teku.bls.BLSPublicKey;
import tech.pegasys.teku.ethereum.executionclient.BuilderApiMethod;
import tech.pegasys.teku.ethereum.executionclient.ExecutionBuilderClient;
import tech.pegasys.teku.ethereum.executionclient.BuilderClient;
import tech.pegasys.teku.ethereum.executionclient.schema.BuilderApiResponse;
import tech.pegasys.teku.ethereum.executionclient.schema.Response;
import tech.pegasys.teku.infrastructure.async.SafeFuture;
Expand All @@ -36,15 +36,15 @@
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.SpecMilestone;
import tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock;
import tech.pegasys.teku.spec.datastructures.builder.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.builder.SignedBuilderBidSchema;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayload;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadSchema;
import tech.pegasys.teku.spec.datastructures.execution.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.execution.SignedBuilderBidSchema;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionCache;
import tech.pegasys.teku.spec.schemas.SchemaDefinitionsBellatrix;

public class RestExecutionBuilderClient implements ExecutionBuilderClient {
public class RestBuilderClient implements BuilderClient {

private final Map<
SpecMilestone, DeserializableTypeDefinition<BuilderApiResponse<ExecutionPayload>>>
Expand All @@ -57,7 +57,7 @@ public class RestExecutionBuilderClient implements ExecutionBuilderClient {
private final RestClient restClient;
private final SchemaDefinitionCache schemaDefinitionCache;

public RestExecutionBuilderClient(final RestClient restClient, final Spec spec) {
public RestBuilderClient(final RestClient restClient, final Spec spec) {
this.restClient = restClient;
this.schemaDefinitionCache = new SchemaDefinitionCache(spec);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
package tech.pegasys.teku.ethereum.executionlayer;

import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.datastructures.builder.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader;
import tech.pegasys.teku.spec.datastructures.execution.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;

@FunctionalInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import tech.pegasys.teku.infrastructure.logging.EventLogger;
import tech.pegasys.teku.infrastructure.unsigned.UInt64;
import tech.pegasys.teku.spec.Spec;
import tech.pegasys.teku.spec.datastructures.builder.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.builder.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.builder.ValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.eth1.Eth1Address;
import tech.pegasys.teku.spec.datastructures.execution.ExecutionPayloadHeader;
import tech.pegasys.teku.spec.datastructures.execution.SignedBuilderBid;
import tech.pegasys.teku.spec.datastructures.execution.SignedValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.execution.ValidatorRegistration;
import tech.pegasys.teku.spec.datastructures.state.beaconstate.BeaconState;
import tech.pegasys.teku.spec.logic.common.statetransition.exceptions.BlockProcessingException;

Expand Down
Loading

0 comments on commit fff8886

Please sign in to comment.