24
24
import static tech .pegasys .teku .infrastructure .http .HttpStatusCodes .SC_NO_CONTENT ;
25
25
import static tech .pegasys .teku .infrastructure .http .HttpStatusCodes .SC_OK ;
26
26
import static tech .pegasys .teku .infrastructure .json .JsonUtil .serialize ;
27
+ import static tech .pegasys .teku .spec .config .SpecConfig .FAR_FUTURE_EPOCH ;
27
28
28
29
import com .fasterxml .jackson .core .JsonProcessingException ;
29
30
import com .fasterxml .jackson .databind .ObjectMapper ;
39
40
import org .junit .jupiter .params .provider .ValueSource ;
40
41
import tech .pegasys .teku .api .exceptions .RemoteServiceNotAvailableException ;
41
42
import tech .pegasys .teku .api .response .v1 .beacon .ValidatorStatus ;
43
+ import tech .pegasys .teku .api .schema .BLSPubKey ;
42
44
import tech .pegasys .teku .ethereum .json .types .beacon .StateValidatorData ;
43
45
import tech .pegasys .teku .infrastructure .ssz .SszDataAssert ;
44
46
import tech .pegasys .teku .infrastructure .ssz .SszList ;
51
53
import tech .pegasys .teku .spec .datastructures .builder .SignedValidatorRegistration ;
52
54
import tech .pegasys .teku .spec .datastructures .metadata .BlockContainerAndMetaData ;
53
55
import tech .pegasys .teku .spec .datastructures .metadata .ObjectAndMetaData ;
56
+ import tech .pegasys .teku .spec .datastructures .state .Validator ;
54
57
import tech .pegasys .teku .spec .networks .Eth2Network ;
55
58
import tech .pegasys .teku .spec .schemas .ApiSchemas ;
56
59
import tech .pegasys .teku .validator .api .SendSignedBlockResult ;
@@ -375,10 +378,8 @@ public void postValidators_WhenSuccess_ReturnsResponse() throws JsonProcessingEx
375
378
final ObjectAndMetaData <List <StateValidatorData >> response =
376
379
new ObjectAndMetaData <>(expected , specMilestone , false , true , false );
377
380
378
- mockWebServer .enqueue (
379
- new MockResponse ()
380
- .setResponseCode (SC_OK )
381
- .setBody (serialize (response , STATE_VALIDATORS_RESPONSE_TYPE )));
381
+ final String body = serialize (response , STATE_VALIDATORS_RESPONSE_TYPE );
382
+ mockWebServer .enqueue (new MockResponse ().setResponseCode (SC_OK ).setBody (body ));
382
383
383
384
Optional <List <StateValidatorData >> result =
384
385
okHttpValidatorTypeDefClient .postStateValidators (List .of ("1" , "2" ));
@@ -388,11 +389,22 @@ public void postValidators_WhenSuccess_ReturnsResponse() throws JsonProcessingEx
388
389
}
389
390
390
391
private StateValidatorData generateStateValidatorData () {
392
+ final long index = dataStructureUtil .randomLong ();
393
+ final Validator validator =
394
+ new Validator (
395
+ dataStructureUtil .randomPublicKey (),
396
+ dataStructureUtil .randomBytes32 (),
397
+ dataStructureUtil .randomUInt64 (),
398
+ false ,
399
+ UInt64 .ZERO ,
400
+ UInt64 .ZERO ,
401
+ FAR_FUTURE_EPOCH ,
402
+ FAR_FUTURE_EPOCH );
391
403
return new StateValidatorData (
392
- dataStructureUtil . randomValidatorIndex ( ),
393
- dataStructureUtil .randomUInt64 (),
394
- ValidatorStatus .active_ongoing ,
395
- dataStructureUtil . randomValidator () );
404
+ UInt64 . valueOf ( index ),
405
+ dataStructureUtil .randomUInt64 (),
406
+ ValidatorStatus .active_ongoing ,
407
+ validator );
396
408
}
397
409
398
410
private void verifyRegisterValidatorsPostRequest (
0 commit comments