Skip to content

Commit

Permalink
Make execution_optimistic required field in GetProposerDuties
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Apr 19, 2023
1 parent d96d04d commit 33bf9f3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"title" : "GetAttesterDutiesResponse",
"type" : "object",
"required" : [ "execution_optimistic", "finalized", "dependent_root", "data" ],
"required" : [ "dependent_root", "execution_optimistic", "finalized", "data" ],
"properties" : {
"execution_optimistic" : {
"type" : "boolean"
},
"finalized" : {
"type" : "boolean"
},
"dependent_root" : {
"type" : "string",
"description" : "Bytes32 hexadecimal",
"example" : "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"format" : "byte"
},
"execution_optimistic" : {
"type" : "boolean"
},
"finalized" : {
"type" : "boolean"
},
"data" : {
"type" : "array",
"items" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"title" : "GetProposerDutiesResponse",
"type" : "object",
"required" : [ "dependent_root", "data" ],
"required" : [ "dependent_root", "execution_optimistic", "data" ],
"properties" : {
"execution_optimistic" : {
"type" : "boolean"
},
"dependent_root" : {
"type" : "string",
"description" : "Bytes32 hexadecimal",
"example" : "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"format" : "byte"
},
"execution_optimistic" : {
"type" : "boolean"
},
"data" : {
"type" : "array",
"items" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,8 @@ public class GetProposerDuties extends RestApiEndpoint {
private static final SerializableTypeDefinition<ProposerDuties> RESPONSE_TYPE =
SerializableTypeDefinition.object(ProposerDuties.class)
.name("GetProposerDutiesResponse")
.withOptionalField(
EXECUTION_OPTIMISTIC,
BOOLEAN_TYPE,
(proposerDuties) ->
proposerDuties.isExecutionOptimistic() ? Optional.of(true) : Optional.empty())
.withField("dependent_root", BYTES32_TYPE, ProposerDuties::getDependentRoot)
.withField(EXECUTION_OPTIMISTIC, BOOLEAN_TYPE, ProposerDuties::isExecutionOptimistic)
.withField("data", listOf(PROPOSER_DUTY_TYPE), ProposerDuties::getDuties)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ public class PostAttesterDuties extends RestApiEndpoint {
private static final SerializableTypeDefinition<AttesterDuties> RESPONSE_TYPE =
SerializableTypeDefinition.object(AttesterDuties.class)
.name("GetAttesterDutiesResponse")
.withField("dependent_root", BYTES32_TYPE, AttesterDuties::getDependentRoot)
.withField(EXECUTION_OPTIMISTIC, BOOLEAN_TYPE, AttesterDuties::isExecutionOptimistic)
.withField(FINALIZED, BOOLEAN_TYPE, AttesterDuties::isFinalized)
.withField("dependent_root", BYTES32_TYPE, AttesterDuties::getDependentRoot)
.withField(
"data",
SerializableTypeDefinition.listOf(ATTESTER_DUTY_TYPE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import static tech.pegasys.teku.ethereum.json.types.EthereumTypes.PUBLIC_KEY_TYPE;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK;
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_SERVICE_UNAVAILABLE;
import static tech.pegasys.teku.infrastructure.http.RestApiConstants.EXECUTION_OPTIMISTIC;
import static tech.pegasys.teku.infrastructure.http.RestApiConstants.SERVICE_UNAVAILABLE;
import static tech.pegasys.teku.infrastructure.http.RestApiConstants.TAG_VALIDATOR;
import static tech.pegasys.teku.infrastructure.http.RestApiConstants.TAG_VALIDATOR_REQUIRED;
Expand Down Expand Up @@ -61,8 +62,7 @@ public class PostSyncDuties extends RestApiEndpoint {
private static final SerializableTypeDefinition<SyncCommitteeDuties> RESPONSE_TYPE =
SerializableTypeDefinition.object(SyncCommitteeDuties.class)
.name("GetSyncCommitteeDutiesResponse")
.withField(
"execution_optimistic", BOOLEAN_TYPE, SyncCommitteeDuties::isExecutionOptimistic)
.withField(EXECUTION_OPTIMISTIC, BOOLEAN_TYPE, SyncCommitteeDuties::isExecutionOptimistic)
.withField(
"data",
SerializableTypeDefinition.listOf(SYNC_COMMITTEE_DUTY_TYPE),
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"dependent_root":"0x0000000000000000000000000000000000000000000000000000000000001234","data":[{"pubkey":"0x8c43edcff6f1d56f2a42072637c0cfd9467ddfccb918ce1a8c2d1babb9cdd6584b601dde9b2bafe027be489bbdcf82ef","validator_index":"2","slot":"800"}]}
{"dependent_root":"0x0000000000000000000000000000000000000000000000000000000000001234","execution_optimistic":false,"data":[{"pubkey":"0x8c43edcff6f1d56f2a42072637c0cfd9467ddfccb918ce1a8c2d1babb9cdd6584b601dde9b2bafe027be489bbdcf82ef","validator_index":"2","slot":"800"}]}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"execution_optimistic":false,"finalized":false,"dependent_root":"0x367cbd40ac7318427aadb97345a91fa2e965daf3158d7f1846f1306305f41bef","data":[{"pubkey":"0xa4654ac3105a58c7634031b5718c4880c87300f72091cfbc69fe490b71d93a671e00e80a388e1ceb8ea1de112003e976","validator_index":"1","committee_index":"0","committee_length":"2","committees_at_slot":"2","validator_committee_index":"1","slot":"1"}]}
{"dependent_root":"0x367cbd40ac7318427aadb97345a91fa2e965daf3158d7f1846f1306305f41bef","execution_optimistic":false,"finalized":false,"data":[{"pubkey":"0xa4654ac3105a58c7634031b5718c4880c87300f72091cfbc69fe490b71d93a671e00e80a388e1ceb8ea1de112003e976","validator_index":"1","committee_index":"0","committee_length":"2","committees_at_slot":"2","validator_committee_index":"1","slot":"1"}]}

0 comments on commit 33bf9f3

Please sign in to comment.