Skip to content

Conversation

@mcdee
Copy link
Contributor

@mcdee mcdee commented Jan 31, 2025

Add clarifying text as to when to supply Attestation and when SingleAttestation

example: "phase0"
data:
anyOf:
oneOf:
Copy link
Member

Choose a reason for hiding this comment

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

I don't really see the difference between any and one of, it's mostly semantics but the usage of oneOf is problematic as it can cause an invalid oapi spec, see #421 and related issue #393.

The issue is that if you pass a value that matches multiple of the schemas then it fails when oneOf is used while it passes with anyOf. This causes false positives when running api spec tests and some schema parsers don't accept invalid oapi specs so we had to patch it locally before running our tests previously.

Now in this specific case I think it's not a issue since the both types are different enough and phase0.Attestation will not fit the schema of SingleAttestation (and vice versa) but this is something to keep in mind.

Copy link
Contributor

Choose a reason for hiding this comment

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

To me this is just documentation, so if a change to oneOf is a problem I'm fine with leaving it as anyOf. neither really enforces at slot X , type Y must be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main part of this is the clarifying text, if people want to keep it as anyOf then fair enough, although as mentioned there isn't an overlap situation here so anyOf should work.

Copy link
Member

Choose a reason for hiding this comment

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

I tested usage of oneOf in our spec tests and as expected it does not cause issues due to the difference in schemas, I am ok with keeping this change as it's seem to help in terms of semantics here

Copy link
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

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

LGTM - but might wanna rephrase the PR title a little

@rolfyone rolfyone changed the title Change anyOf to oneOf for attestation submissions. Clarify usage of Attestation vs SingleAttestation Feb 5, 2025
@rolfyone rolfyone merged commit fd60bee into ethereum:master Feb 5, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants