ethereum / beacon-APIs

Collection of RESTful APIs provided by Ethereum Beacon nodes
https://ethereum.github.io/beacon-APIs/
Creative Commons Zero v1.0 Universal
335 stars 169 forks source link

gwei vs wei in block v3 #397

Closed michaelsproul closed 9 months ago

michaelsproul commented 10 months ago

I found a discrepancy between Teku and Lighthouse's implementation of the block v3 endpoint. Lighthouse returns the consensus block value in gwei and the execution payload value in wei. Teku uses wei for both.

Arguably both are reasonable interpretations of the current spec, because we usually use gwei on the consensus layer (we can't represent sub-gwei units on the CL). On the other hand, using wei for both is nice from a consistency point of view.

We should choose between gwei+wei, or wei everywhere and then update the descriptions of the block v3 headers accordingly. The current descriptions leave a lot to be desired:

Eth-Execution-Payload-Value: Required in response so client can determine relative value of execution payloads. Eth-Consensus-Block-Value: Required in response so client can determine relative value of consensus blocks.

michaelsproul commented 10 months ago

I think my preference is for wei everywhere for consistency, even though it means padding values with 9 zeroes and introducing unnecessary precision.

rolfyone commented 10 months ago

If we're just adding 9 0's everywhere maybe gwei is more sensible?

michaelsproul commented 10 months ago

I guess consumers of the API should read the docs, and might be used to getting CL values in gwei and EL values in wei?

rolfyone commented 10 months ago

I guess consumers of the API should read the docs, and might be used to getting CL values in gwei and EL values in wei?

True, the problem is this grey area where things are moving around for EL value, I could understand either interpretation, good issue to define it.