Skip to content
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

[Merge] add merge Beacon API support #4537

Merged
merged 22 commits into from
Nov 5, 2021
Merged

Conversation

tbenr
Copy link
Contributor

@tbenr tbenr commented Oct 28, 2021

PR Description

add Merge support in REST beacon APIs

related to #4504

  • reorganize SignedBeaconBlock and BeaconBlock*

Documentation

  • I thought about documentation and added the documentation label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

@tbenr tbenr mentioned this pull request Oct 28, 2021
25 tasks
@rolfyone
Copy link
Contributor

rolfyone commented Nov 1, 2021

it's looking pretty good!

the merge types need a whole lot of schema annotations to illustrate their types. without it, they come out like:
Screen Shot 2021-11-01 at 10 22 20 am

In most other areas you'll see that they're basically 'string' type, defined by schema manually on each field...

also in beacon state, the enum updated but there's no merge state
Screen Shot 2021-11-01 at 10 17 56 am

@tbenr tbenr marked this pull request as ready for review November 2, 2021 19:14
@tbenr tbenr mentioned this pull request Nov 3, 2021
2 tasks
@@ -30,39 +28,38 @@
public final UInt64 slot;

@Schema(type = "string", format = "uint64")
public final UInt64 proposer_index;
public final UInt64 proposerIndex;
Copy link
Contributor

@rolfyone rolfyone Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so by doing this, we effectively create some duplication - now the interface isn't sure about whether its proposer_index or proposerIndex, so we have both.
Need to at least put @JsonProperty("proposer_index") to define it. this will also get rid of the typing issue appearing because of the proposer_index type not being given a schema definition.
same goes for all renamed fields here.
The standard dictates the names of these fields, so it's important they're consistent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other option is leave them named the way the api requires them, given that it's only an object that the api uses...

Comment on lines +109 to +113
this.previousEpochParticipation = previousEpochParticipation;
this.currentEpochParticipation = currentEpochParticipation;
this.inactivityScores = inactivityScores;
this.currentSyncCommittee = currentSyncCommittee;
this.nextSyncCommittee = nextSyncCommittee;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of a repeat, but basically all these fields are now incorrect in the api returns, which is why I'm suggesting putting their names back unless we have a good reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the end I was more close to have cammelCase stuff, if you agree, so lets have it as it is for now and wait for the new API framework to clean everything up

Comment on lines +33 to +40
@Schema(
name = "parent_hash",
type = "string",
format = "byte",
pattern = PATTERN_BYTES32,
description = DESCRIPTION_BYTES32)
public final Bytes32 parentHash;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think all of these have come out incorrectly because of the abstract class usage. i'm not sure how you'd get around that, but the swagger is all busted for this class...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you are not seeing the latest version, can you do a clean rebuild?

@tbenr tbenr force-pushed the merge_beacon_apis branch 2 times, most recently from cbf5bcf to 866d70a Compare November 4, 2021 15:18
@tbenr
Copy link
Contributor Author

tbenr commented Nov 4, 2021

getState API
Schermata 2021-11-04 alle 16 21 44

getBlock API
Schermata 2021-11-04 alle 16 37 12

@rolfyone to me looks ok now.. hopefully!

improvement in BeaconBlock* constructors
add BeaconStateMerge in State schema annotation
add BeaconBlockMerge in UnsignedBlock schema annotation
fix BeaconStateAltair schema properties names
add BeaconStateMerge in State schema annotation
add BeaconBlockMerge in UnsignedBlock schema annotation
fix BeaconStateAltair schema properties names
add UInt256 serializer\deserializer
expand BeaconState api UT
…rge, ExecutionPayload and ExecutionPayloadHeader
Copy link
Contributor

@rolfyone rolfyone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to easily run it today, just had a messed up environment of my own, but from the screenshots it looks like exactly what we talked about - looks good!

@tbenr tbenr merged commit 601311b into Consensys:master Nov 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants