-
Notifications
You must be signed in to change notification settings - Fork 20k
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
beacon/light/api: fixed blsync update query #30421
Conversation
Even after looking at this fix, and the previous fix, and playing with it in my IDE, I fail to spot the error. Please point it out to me... |
Ok, I got an explanation now, I'll post it here for visibility. There's this method
Which @s1na fixed to escape the func (api *BeaconLightApi) httpGetf(format string, params ...any) ([]byte, error) {
return api.httpGet(fmt.Sprintf(format, params...))
} called by func (api *BeaconLightApi) GetBestUpdatesAndCommittees(firstPeriod, count uint64) ([]*types.LightClientUpdate, []*types.SerializedSyncCommittee, error) {
resp, err := api.httpGetf("/eth/v1/beacon/light_client/updates?start_period=%d&count=%d", firstPeriod, count) So, the So it's a semantic mixup, IMO the |
7457d92
to
f63a89f
Compare
Now it's fixed in a nice way. |
beacon/light/api/light_api.go
Outdated
@@ -151,7 +152,7 @@ func (api *BeaconLightApi) httpGet(path string) ([]byte, error) { | |||
} | |||
|
|||
func (api *BeaconLightApi) httpGetf(format string, params ...any) ([]byte, error) { | |||
return api.httpGet(fmt.Sprintf(format, params...)) | |||
return api.httpGet(fmt.Sprintf(format, params...), nil) |
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.
This httpGetf
method is a bit useless, IMO. It's now used in three places, so they can write e.g
resp, err := api.httpGetf("/eth/v1/beacon/headers/%s", blockId)
instead of
resp, err := api.httpGet(fmt.Sprintf("/eth/v1/beacon/headers/%s", blockId))
I approve of this patch, but I also wouldn't mind dropping that method.
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 agree, httpGetf
removed.
This PR fixes what #30306 broke. Escaping the
?
in the event sub query was fixed in that PR but it was still escaped in theupdates
request. This PR adds a URL params argument tohttpGet
and fixesupdates
query formatting.