-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
internal/ethapi: remove header.Size in rpc getHeaderByXXX #27347
Conversation
Signed-off-by: jsvisa <delweng@gmail.com>
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 mostly agree with dropping this, but I am unsure why we even have it in the first place. It has "always" been there, and as far as I can tell it has "always" been wrong, using usafe.sizeOf and thus obtaining a platform-dependent value for size.
IMO we should either return e.g. the rlp-encoded size or nothing at all. But IMO needs some more backstory.
Interesting, I thought our "eth" methods match the specs with the exception of |
Judging from
It shouldn't be returned from API. |
I know what's going on, this field is changed in 530f78e?diff=unified#diff-c426ecd2f7d247753b9ea8c1cc003f21fa412661c1f967d203d4edf8163da344L939-R980 And the old code is correct, equals to |
We have several ways to do this:
My personal preference 3 > 2 > 1 |
I think 2 doesn't make sense. Since the header has mostly information about the block, not itself. I'm slightly in favor of 1 than 3. We have the field already and block size could possibly be useful. |
Nope, that commit added the So |
IMHO, If someone is interested in the size of the block, he has to retrieve it via |
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
RPC methods `eth_getHeaderBy*` returned a size value which was meant for internal processes. Please instead use `size` field returned by `eth_getBlockBy*` if you're interested in the RLP encoded storage size of the block. Signed-off-by: jsvisa <delweng@gmail.com>
As discussed with @rjl493456442 and also in #27325 (comment). Currently, the PRC of
eth_getHeaderByXXX
's response will return the header's Size, which depends on thestruct Header
's size:go-ethereum/core/types/block.go
Lines 116 to 126 in dc8d91a
And this struct's size differs in the different distros(x32 VS x64), so I proposed to remove this field for:
getHeaderByXXX
is Geth's own RPC, not in standard ones;