Skip to content

Conversation

roberto-bayardo
Copy link
Collaborator

Add dataGasUsed and dataGasPrice to tx receipt per https://github.com/ethereum/execution-apis/pull/398/files

@roberto-bayardo roberto-bayardo changed the title add UsedDataGas and DataGasPrice to the receipt add DataGasUsed and DataGasPrice to the receipt Apr 15, 2023
@roberto-bayardo roberto-bayardo requested a review from Inphi April 15, 2023 19:53
Copy link
Collaborator

@Inphi Inphi left a 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

@roberto-bayardo
Copy link
Collaborator Author

It should suffice to update the types.DeriveFields such that the fields are computed when the receipt is read from storage.

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".

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

done

@roberto-bayardo roberto-bayardo force-pushed the datagas branch 4 times, most recently from 68d0b19 to 00108d3 Compare April 18, 2023 01:34
@roberto-bayardo
Copy link
Collaborator Author

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.

@roberto-bayardo roberto-bayardo requested a review from Inphi April 18, 2023 01:36
Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

probably an upstream bug.

Copy link
Collaborator

@Inphi Inphi left a 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.

@roberto-bayardo roberto-bayardo merged commit a05b83b into eip-4844 Apr 18, 2023
@roberto-bayardo roberto-bayardo deleted the datagas branch April 18, 2023 15:23
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.

2 participants