Skip to content
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

fix: required fields for transactions and receipts #719

Merged
merged 1 commit into from
May 10, 2024

Conversation

banteg
Copy link
Contributor

@banteg banteg commented May 10, 2024

Motivation

this reverts incorrect changes introduced in #523

in transaction info (for example eth_getTransactionByHash), these fields are required

required:
  - blockHash
  - blockNumber
  - from
  - hash
  - transactionIndex

in transaction receipts, there fields are required.

required:
  - blockHash
  - blockNumber
  - from
  - cumulativeGasUsed
  - gasUsed
  - logs
  - logsBloom
  - transactionHash
  - transactionIndex
  - effectiveGasPrice

moreover, the original justification is also incorrect, as the author has misunderstood how geth does the serialization. this screencap is freshly out of geth --dev. as you can see, the optional fields are present, and the linked code hasn't changed since 2019.

image

Solution

i removed skip_serializing_if for required fields.

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@mattsse mattsse merged commit 899fc51 into alloy-rs:main May 10, 2024
24 checks passed
@prestwich
Copy link
Member

prestwich commented May 10, 2024

if the fields are required, then removing the skip_serializing_if is not sufficient. Need to also make the prop not an Option type

@banteg

@banteg
Copy link
Contributor Author

banteg commented May 10, 2024

the keys are required in the payload, but the values can indeed be None, so the Option type seems appropriate

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.

3 participants