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

Change skip_randao_verification param to string #8338

Merged
merged 18 commits into from
Jun 6, 2024

Conversation

gfukushima
Copy link
Contributor

PR Description

This PR changes the skip_randao_verification to comply with the changes in ethereum/beacon-APIs#444 to a string flag like. The impact for us here is pretty much minimal since we ignore that param.

Fixed Issue(s)

Fixes #8223

Documentation

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

Changelog

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

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
@gfukushima gfukushima changed the title Skip randao string Change skip_randao_verification param to string May 28, 2024
@gfukushima gfukushima requested a review from tbenr May 28, 2024 03:35
Copy link
Contributor

@tbenr tbenr left a comment

Choose a reason for hiding this comment

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

Since we are not using it, and we never added this param to the previous API versions, I'd be tempted to solve this by removing the definition completely.

We added in V3 by just following the new API spec without really thinking about previous version.

The only side-effect is us printing a swagger which is not 100% compliant but I don't think it's a big deal in this case.

WDYT?
cc @rolfyone

maybe we could add a note in the descriptions saying that Teku doesn't verify the field

@@ -473,10 +489,24 @@ public EndpointMetaDataBuilder queryParam(final ParameterMetadata<?> parameterMe
return this;
}

public EndpointMetaDataBuilder queryParamAllowsEmpty(
final ParameterMetadata<?> parameterMetadata) {
Copy link
Contributor

Choose a reason for hiding this comment

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

intelliJ suggesting to move to a dedicated method this snippet:

final String param = parameterMetadata.getName();
if (queryParams.containsKey(param)
|| queryParamsAllowEmpty.containsKey(param)
|| requiredQueryParams.containsKey(param)
|| queryListParams.containsKey(param)) {
throw new IllegalStateException("Query parameters already contains " + param);
}

makes sense to me

Copy link
Contributor

Choose a reason for hiding this comment

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

oh i thought this was used somewhere - technically a list could be expressed as
validator_id=[1,2,3,4] or validator_id=1&validator_id=2&validator_id=3&validator_id=4 if you really want to make your life difficult...
eg. https://medium.com/@AADota/spring-passing-list-and-array-of-values-as-url-parameters-1ed9bbdf0cb2

anyway - TL/DR, lets not do this.

@gfukushima
Copy link
Contributor Author

tbh, I'm about not adding unnecessary code but since this is pretty much done and the changes required weren't too big I think there might be some value in keeping it in case any other param go through the same change.

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
…rrently ignored by impl

Signed-off-by: Gabriel Fukushima <gabrielfukushima@gmail.com>
@rolfyone
Copy link
Contributor

We added in V3 by just following the new API spec without really thinking about previous version.

The only side-effect is us printing a swagger which is not 100% compliant but I don't think it's a big deal in this case.

really depends on the beacon-api spec.
If we define in beacon-api it's needed i'd be happy with listing it in the type but noting that we don't pay attention to the field...

"in" : "query",
"schema" : {
"type" : "string",
"description" : "Skip verification of the `randao_reveal` value (currently ignored by Teku implementation). If this flag is set then the\n `randao_reveal` must be set to the point at infinity (`0xc0..00`). This query parameter\n is a flag and does not take a value",
Copy link
Contributor

Choose a reason for hiding this comment

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

there's a must here - do we care?
i'm wondering if we check that at all, im guessing not. i'd just truncate before 'if this flag is set'
Skip verification of the randao_reveal value. Ignored in the Teku implementation.

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 think we don't care based on this comment: ethereum/beacon-APIs#222 (comment). Cehcked the other impl blockV2 and blinded_block didn't care about this param.
Changed the description as you suggested.

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.

LGTM i think... im not sure where discussions landed but i think we could live with this in its current form.

@tbenr
Copy link
Contributor

tbenr commented Jun 5, 2024

I don't oppose to merge it.

Just for the records: the reason why I'm not convinced is because in my opinion our swagger should reflect our functionalities. I think there is no point being compliant with swagger-doc and ignoring the underlying behaviour.
Advertising the param in swagger and saying "hey bare in mind we ignore it", is more confusing than not showing the param at all (which obviously means we don't support the param and we ignore it)

But this is just an opinion and it isn't super strong, so go for it!

@gfukushima
Copy link
Contributor Author

Thanks everyone for the input!
To your point @tbenr, I'm slightly inclined towards having in swagger and making it clear to users that we ignore that parameter rather than not displaying it and having users confused and asking why we don't have that param specified in our API.

@gfukushima gfukushima merged commit d76da3e into Consensys:master Jun 6, 2024
16 checks passed
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.

[beacon api] check if we need to fix anything in our definitions
3 participants