This repository was archived by the owner on Mar 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Added EIP-4844 Headers for BlockHeaderOutput. Issue: 6933 #6937
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
740bd93
Added EIP-4844 Headers for BlockHeaderOutput. getBlock() now referenc…
keennay 804ee89
Updated blockSchema & blockHeaderSchema to reflect shared properties.
keennay ec6a4fc
Removed changes from yarn.lock.
keennay d0a63c3
Removed author & excessDataGas from the BlockOutput interface.
keennay 38a5b21
Separated old and new properties in the BlockOutput interface.
keennay 8fdfa11
Moved the Withdrawals interface above BlockOutput.
keennay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 believe you would want to edit
blockSchemaand add the new properties there, not editing blockHeaderSchema and just using blockSchemaUh oh!
There was an error while loading. Please reload this page.
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.
Ok, yeah I'd noticed both the
withdrawals&withdrawalsRootproperties only appear underblockHeaderSchema, in theschemas.tsfile. When I call getBlock() on web3.js v1.9, it outputs both of those properties. This is why I'd assumedgetBlock()probably neededblockHeaderSchemadefined within v4'srpc_method_wrappers.tsfile instead ofblockSchema, and thought it was a typo.Should
blockSchema&blockHeaderSchemahave identical properties then?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.
Yea its a bit confusing, It seems like
blockSchemaneeds to also have updated properties ofwithdrawalsandwithdrawalsRoot.blockHeaderSchemais only being used for subscriptions. We may need to update the blockHeaderSchema as well, if you want to check and confirm result of a subscription the result you can also edit blockheaderSchema, otherwise you can focus on just updating blockSchemaUh oh!
There was an error while loading. Please reload this page.
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.
Ok, I've updated both blockSchema & blockHeaderSchema in
schemas.ts, with blockHeaderSchema retaining the below author & excessDataGas properties while missing from blockSchema. Please let me know if blockSchema should also have these.blockSchema & blockHeaderSchema also have different nested arrays for the
transactionsproperty, and were left as originally found.The BlockOutput & BlockHeaderOutput interfaces in
eth_types.tswere also updated accordingly.Under eth_types.ts, I'd noticed a number of properties are formatted as either
bigint | numberorNumbers, whether they are defined under BlockOutput or BlockHeaderOutput.For example: totalDifficulty in BlockOutput:
readonly totalDifficulty?: bigint | number;Whereas in BlockHeaderOutput, totalDifficulty is formatted as:
readonly totalDifficulty?: Numbers;I'm unsure if it should be one or the other, but I've left as-is. Also the extra properties: author & excessDataGas were not added to the BlockOutput interface, as they are not present in blockSchema. However I did add everything else from BlockHeaderOutput interface into BlockOutput, while formatting the ones with
Numbersasbigint | number. Please advise if that was the correct move.Also, let me know if those author & excessDataGase properites should also be present across blockSchema/blockHeaderSchema & BlockOutput/BlockHeaderOutput.
yarn.lockhad its changes reverted, as well asrpc_method_wrappers.ts.Uh oh!
There was an error while loading. Please reload this page.
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.
Also, it appears the 'newHeads' & 'newBlockHeaders' subscriptions only return formatted data from the
BlockBaseinterface ineth_types.ts, and not from theBlockHeaderOutputinterface.https://docs.web3js.org/api/web3-eth/class/NewHeadsSubscription
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.
Adding a note here so I don't forget after sleep. Looks like more parameters are missing from v4.6 yet present in v1.9, outside the scope of EIP-4844 changes, specifically across other
eth_*functions. I'll do a much proper rundown thru the next couple of days, likely into the weekend.For ex: the
idparameter is missing in thelogsarray, from eth_getTransactionReceipt. Example below from an ETH mainnet request:web3 v4.6:
{"address":"0xb584d4be1a5470ca1a8778e9b86c81e165204599","blockHash":"0x47c58ebbaaff9a9a9ee60d74029224df7cac63b5c09972d4306e7500d8078b55","blockNumber":"19529894","data":"0x0000000000000000000000000000000000000000000000000000022ecb25c000","logIndex":"469","removed":false,"topics":["0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15","0x0000000000000000000000000a25e45792fef9fb600a81f0d7ac4ab9e893fc71","0x0000000000000000000000000000000000000000000000000000000000000064"],"transactionHash":"0xe2bad713807549fe3bb0bf0a69dce0ddc634c8dbec655660ea038279ef5bdb91","transactionIndex":"170"}web3 v1.9:
{"address":"0xb584D4bE1A5470CA1a8778E9B86c81e165204599","blockHash":"0x47c58ebbaaff9a9a9ee60d74029224df7cac63b5c09972d4306e7500d8078b55","blockNumber":19529894,"data":"0x0000000000000000000000000000000000000000000000000000022ecb25c000","id":"log_ff3f9ddd","logIndex":469,"removed":false,"topics":["0x90890809c654f11d6e72a28fa60149770a0d11ec6c92319d6ceb2bb0a4ea1a15","0x0000000000000000000000000a25e45792fef9fb600a81f0d7ac4ab9e893fc71","0x0000000000000000000000000000000000000000000000000000000000000064"],"transactionHash":"0xe2bad713807549fe3bb0bf0a69dce0ddc634c8dbec655660ea038279ef5bdb91","transactionIndex":170}