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

Add missing blockHeaderSchema properties #6243

Merged
merged 9 commits into from
Jul 19, 2023

Conversation

spacesailor24
Copy link
Contributor

@spacesailor24 spacesailor24 commented Jun 28, 2023

closes #6198

@spacesailor24 spacesailor24 added the 4.x 4.0 related label Jun 28, 2023
@spacesailor24 spacesailor24 self-assigned this Jun 28, 2023
@github-actions
Copy link

github-actions bot commented Jun 28, 2023

Bundle Stats

Hey there, this message comes from a github action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Asset Old size New size Diff Diff %
Total 648 KB 649 KB 569 bytes 0.09%
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset Old size New size Diff Diff %
web3.min.js 631 KB 631 KB 569 bytes 0.09%
../lib/commonjs/index.d.ts 8.56 KB 8.56 KB 0 0.00%
../lib/commonjs/accounts.d.ts 3.67 KB 3.67 KB 0 0.00%
../lib/commonjs/types.d.ts 2.45 KB 2.45 KB 0 0.00%
../lib/commonjs/web3.d.ts 1.14 KB 1.14 KB 0 0.00%
../lib/commonjs/abi.d.ts 1000 bytes 1000 bytes 0 0.00%
../lib/commonjs/eth.exports.d.ts 280 bytes 280 bytes 0 0.00%
../lib/commonjs/providers.exports.d.ts 148 bytes 148 bytes 0 0.00%
../lib/commonjs/version.d.ts 60 bytes 60 bytes 0 0.00%

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jun 28, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b50a093
Status: ✅  Deploy successful!
Preview URL: https://3884ef45.web3-js-docs.pages.dev
Branch Preview URL: https://wyatt-4-x-6198-missing-info.web3-js-docs.pages.dev

View logs

@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Merging #6243 (b50a093) into 4.x (b93934a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##              4.x    #6243   +/-   ##
=======================================
  Coverage   88.72%   88.72%           
=======================================
  Files         198      198           
  Lines        7608     7609    +1     
  Branches     2094     2094           
=======================================
+ Hits         6750     6751    +1     
  Misses        858      858           
Flag Coverage Δ
UnitTests 88.72% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
web3 ∅ <ø> (∅)
web3-core ∅ <ø> (∅)
web3-errors ∅ <ø> (∅)
web3-eth ∅ <ø> (∅)
web3-eth-abi ∅ <ø> (∅)
web3-eth-accounts ∅ <ø> (∅)
web3-eth-contract ∅ <ø> (∅)
web3-eth-ens ∅ <ø> (∅)
web3-eth-iban ∅ <ø> (∅)
web3-eth-personal ∅ <ø> (∅)
web3-net ∅ <ø> (∅)
web3-providers-http ∅ <ø> (∅)
web3-providers-ipc ∅ <ø> (∅)
web3-providers-ws ∅ <ø> (∅)
web3-rpc-methods ∅ <ø> (∅)
web3-utils ∅ <ø> (∅)
web3-validator ∅ <ø> (∅)

export const blockHeaderSchema = {
type: 'object',
properties: {
author: {
Copy link
Contributor

Choose a reason for hiding this comment

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

some of these fields are not aligned with EL specs, there can be possibilities:

  • EL specs not updated
  • geth specific fields

so could you add an integration test , so when we add more EL clients we can catch issue earlier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jdevcs What EL spec are you looking at? I've been using this one and don't even see eth_subscribe listed

Regardless, these added fields don't exist on Geth's response, but are instead from Nethermind's. It's okay and actually necessary to have these fields in the blockHeaderSchema, because it's used to format responses. Meaning as is, any fields not mentioned in this schema will be dropped from the response before it's returned to the user. No error is caused if the fields are not present. This does, however, beg the question of how do we declare the BlockHeaderOutput type - do we include these properties as optional since they could be there if the connected RPC client uses them? Or do we only include the common ones as the type is declared now?

The extra fields included by Nethermind that don't seem to be available using Geth:

  • author
  • totalDifficulty
  • size
  • excessDataGas
  • mixHash
  • transactions
  • uncles
  • withdrawals

Copy link
Contributor

Choose a reason for hiding this comment

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

I wasnt able to find author field in EL Specs https://github.com/ethereum/execution-apis/blob/4da6a02f094d9d8c826272f6ceac2d751866f132/src/schemas/block.yaml#L22 in block schema at first place, and later there is no eth_subscribe in EL specs ( as you found as well in specs doc).

If we include integration tests ( we will need to have a check for Nethermind in tests and expect that these additional fields are present), if its breaking in future for Nethermind we will be able to detect. Currently we dnt have NM, so it can be skipped.

This does, however, beg the question of how do we declare the BlockHeaderOutput type - do we include these properties as optional since they could be there if the connected RPC client uses them? Or do we only include the common ones as the type is declared now?

I'll suggest lets have additional types as optional and add doc comments that these are specific for NM.

Copy link
Contributor

@avkos avkos left a comment

Choose a reason for hiding this comment

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

LGTM

@spacesailor24 spacesailor24 merged commit 7d0a91d into 4.x Jul 19, 2023
67 checks passed
@spacesailor24 spacesailor24 deleted the wyatt/4.x/6198-missing-info-block-headers branch July 19, 2023 01:31
@jdevcs jdevcs mentioned this pull request Aug 3, 2023
@jdevcs jdevcs mentioned this pull request Aug 9, 2023
sanyu1225 pushed a commit to blocto/web3.js that referenced this pull request Aug 30, 2023
* Add missing blockHeaderSchema properties

* Update CHANGELOGs

* Update BlockHeaderOutput

* Refactor subscript new heads integration test

* Add try/catch to new heads sub test for faster failing

* Init e2e new heads subscription test

* Debug failing tests

* Debugging failing tests for cypress
sanyu1225 pushed a commit to blocto/web3.js that referenced this pull request Aug 30, 2023
* Add missing blockHeaderSchema properties

* Update CHANGELOGs

* Update BlockHeaderOutput

* Refactor subscript new heads integration test

* Add try/catch to new heads sub test for faster failing

* Init e2e new heads subscription test

* Debug failing tests

* Debugging failing tests for cypress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

web3.eth.subscribe newHeads missing keys in response
4 participants