-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8424 attestations handler #8456
8424 attestations handler #8456
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Added
sendSignedAttestationsV2
method inbeacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java
- Introduced new tests for
sendSignedAttestationsV2
inbeacon/validator/src/test/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandlerTest.java
- Added JSON schema for
/eth/v2/beacon/pool/attestations
indata/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/paths/_eth_v2_beacon_pool_attestations.json
- Introduced
PostAttestationV2
endpoint indata/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/PostAttestationV2.java
- Added unit tests for
PostAttestationV2
indata/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/PostAttestationV2Test.java
26 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings
.../java/tech/pegasys/teku/validator/beaconnode/metrics/MetricRecordingValidatorApiChannel.java
Outdated
Show resolved
Hide resolved
...emote/src/main/java/tech/pegasys/teku/validator/remote/sentry/SentryValidatorApiChannel.java
Outdated
Show resolved
Hide resolved
...c/main/java/tech/pegasys/teku/validator/remote/typedef/handlers/PostAttestationsRequest.java
Outdated
Show resolved
Hide resolved
...c/main/java/tech/pegasys/teku/validator/remote/typedef/handlers/PostAttestationsRequest.java
Outdated
Show resolved
Hide resolved
beacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java
Fixed
Show fixed
Hide fixed
...tor/remote/src/main/java/tech/pegasys/teku/validator/remote/FailoverValidatorApiHandler.java
Fixed
Show fixed
Hide fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Added
sendSignedAttestationsV2
method withSpecMilestone
parameter invalidator/beaconnode/src/main/java/tech/pegasys/teku/validator/beaconnode/metrics/MetricRecordingValidatorApiChannel.java
- Removed unnecessary imports and redundant method in
validator/remote/src/integration-test/java/tech/pegasys/teku/validator/remote/typedef/handlers/PostAttestationsRequestTest.java
- Introduced
sendSignedAttestationsV2
method withSpecMilestone
parameter invalidator/remote/src/main/java/tech/pegasys/teku/validator/remote/sentry/SentryValidatorApiChannel.java
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
a3551d6
to
8e97d97
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Added
sendSignedAttestationsV2
method withSpecMilestone
parameter inbeacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java
- Added new test cases for
sendSignedAttestationsV2
inbeacon/validator/src/test/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandlerTest.java
- Introduced
PostAttestationsV2IntegrationTest
for new API endpoint indata/beaconrestapi/src/integration-test/java/tech/pegasys/teku/beaconrestapi/v2/beacon/PostAttestationsV2IntegrationTest.java
- Updated
JsonTypeDefinitionBeaconRestApi.java
to usePostAttestationsV2
- Renamed and updated
PostAttestationsV2.java
andPostAttestationsV2Test.java
to reflect new API endpoint
17 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings
this.spec = spec; | ||
} | ||
|
||
public Optional<PostDataFailureResponse> postAttestations( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic: Ensure that the attestations
list is not empty before proceeding with the request.
Map.of(HEADER_CONSENSUS_VERSION, specMilestone.name().toLowerCase(Locale.ROOT)), | ||
attestations, | ||
attestationsListTypeDefinition, | ||
new ResponseHandler<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic: Handle potential exceptions from the postJson
method to avoid unhandled runtime errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Introduced
sendSignedAttestationsV2
method inbeacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java
- Deprecated
sendSignedAttestations
method inbeacon/validator/src/main/java/tech/pegasys/teku/validator/coordinator/ValidatorApiHandler.java
sendSignedAttestationsV2
processes attestations individually and converts results into a list of errors- New method not yet used in production; activation via hidden option in a future PR
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Added new REST API endpoint
/eth/v2/beacon/pool/attestations
indata/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/PostAttestationsV2.java
- Updated tests for new API in
data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/PostAttestationsV2Test.java
- Introduced
submitAttestationsV2
method indata/provider/src/main/java/tech/pegasys/teku/api/ValidatorDataProvider.java
- Ensure
SpecMilestone
header is correctly provided and handled - Thorough testing recommended for new API and method
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Updated
data/beaconrestapi/src/integration-test/java/tech/pegasys/teku/beaconrestapi/v2/beacon/PostAttestationsV2IntegrationTest.java
to usesendSignedAttestationsV2
- Tests now cover successful posts, partial failures, and missing/incorrect consensus headers
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
74dde7e
to
1eab44e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
The pull request introduces the new PostAttestation V2 API to handle Electra attestations, along with several updates and refactors across the codebase to support this new functionality.
- Added
data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/PostAttestationsV2.java
to handle POST requests for submitting attestation objects. - Updated
data/provider/src/main/java/tech/pegasys/teku/api/ValidatorDataProvider.java
to include a new methodcreateAggregateAndMetaData
for the new API. - Introduced
data/beaconrestapi/src/test/java/tech/pegasys/teku/beaconrestapi/handlers/v2/beacon/PostAttestationsV2Test.java
to cover various scenarios for the new handler. - Modified
validator/remote/src/main/java/tech/pegasys/teku/validator/remote/typedef/handlers/PostAttestationsRequest.java
to support the new API endpoint. - Updated
data/beaconrestapi/src/integration-test/java/tech/pegasys/teku/beaconrestapi/v2/beacon/PostAttestationsV2IntegrationTest.java
to usesendSignedAttestationsV2
and cover successful posts, partial failures, and missing/incorrect consensus headers.
207 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings
...c/main/java/tech/pegasys/teku/validator/remote/typedef/handlers/PostAttestationsRequest.java
Outdated
Show resolved
Hide resolved
...c/main/java/tech/pegasys/teku/validator/remote/typedef/handlers/PostAttestationsRequest.java
Outdated
Show resolved
Hide resolved
1315851
to
fa1bc35
Compare
9a5aa5d
to
b0ae3eb
Compare
public SendSignedAttestationsRequest( | ||
final HttpUrl baseEndpoint, final OkHttpClient okHttpClient) { | ||
super(baseEndpoint, okHttpClient); | ||
} | ||
|
||
public List<SubmitDataError> submit(final List<Attestation> attestations) { | ||
public List<SubmitDataError> submit(final List<Attestation> attestations, final Spec spec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm lost on prs they all look so similar, but in teh same way i think maybe spec in the constructor is probably better....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same pattern but different APIs that's why they look the same :)
Anyway I refactored the request to pass the spec in the constructor. Left the attestations to the submit method though because we have to check if the list is empty and get the first element to get the slot and the milestone otherwise...
55cea7b
to
002096f
Compare
…estationsRequest class - removed an endpoint that had 1 usage in the AbstractTypeDefRequest class- if we're adding a parameter to a fn thats used in one place i'd prefer we dont make a new fn. - new test class for electra attestations (renamed the post test class) Signed-off-by: Paul Harris <[email protected]>
a0c5708
to
e2a9394
Compare
.../java/tech/pegasys/teku/validator/remote/typedef/handlers/SendSignedAttestationsRequest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally ok, need to clarify one thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR Description
Add
PostAttestationsRequest
for the new post attestations V2 API (remote validator api handler).The new
sendSignedAttesationsV2
isn't used in production code yet. A hidden option will be added in a separate PR in order to activate it progressively (same way for block v3).The
sendSignedAttestations
is deprecated and should be progressively replaced by the newsendSignedAttestationsV2
.Fixed Issue(s)
#8424
Documentation
doc-change-required
label to this PR if updates are required.Changelog