-
Notifications
You must be signed in to change notification settings - Fork 5
add DataGasUsed and DataGasPrice to the receipt #117
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
Conversation
571d9a3
to
67d0187
Compare
67d0187
to
ad8bc40
Compare
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 don't think we should be adding the fields during state transition as that means they get stored. AIUI, these fields should only be present at RPC.
It should suffice to update the types.DeriveFields such that the fields are computed when the receipt is read from storage.
The APIs also need to be updated to include the new fields - https://github.com/mdehoog/go-ethereum/blob/eip-4844/internal/ethapi/api.go#L1662
Oh hmm, looks like I'll have to figure out how to get excessDataGas in there. Seems easy enough from the RPC call point but there's this collectLogs function in core/blockchain.go that also calls it which could be messier. It looks like that function doesn't require the datagas fields... do you think it's OK to split out deriving the log fields from deriving everything else for this particular purpose? E.g. "DeriveLogFields" that gets called by "DeriveFields" and "collectLogs".
done |
68d0b19
to
00108d3
Compare
Updated to treat fields as derived. Was a bit messier than I'd hoped as I had to move stuff around a bit to avoid a cyclic dependency. |
core/types/receipt.go
Outdated
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.
not sure why this wasn't tagged omitempty before, as it seemed to be treated as such by the generated json marshaling code. when I regenerated this code it was no longer omitting it and it caused a test to fail due to "EffectiveGasPrice: null" starting to appear in the receipt json.
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.
According to this the effectiveGasPrice
is a required field. The test is broken and it shouldn't be omitempty
.
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.
indeed good catch. I will update the test.
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.
as discussed offline let me submit this fix upstream rather than in this PR.
core/types/gen_receipt_json.go
Outdated
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.
here's where it somehow got tagged omit empty in the generated code even though it wasn't tagged this way in the schema.
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.
probably an upstream bug.
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.
Looks good. The effectiveGasPrice
field in the receipt shouldn't be omitempty
per spec.
00108d3
to
fcc5f10
Compare
Add dataGasUsed and dataGasPrice to tx receipt per https://github.com/ethereum/execution-apis/pull/398/files