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

eth.getBlock with hydrated = true returning empty transaction objects #5556

Merged

Conversation

nikoulai
Copy link
Contributor

@nikoulai nikoulai commented Oct 24, 2022

Description

Solution for #5470

eth.getBlock was returning an empty object for block.transactions.

The error was in

const schemaProp = findSchemaByDataPath(schema, dataPath);
inside findSchemaByDataPath, which doesn't handle the oneOf type ( and couldn't since no info is passed in order to choose the right one.)

My proposed solution is to save the options of oneOf and pass them to findSchemaByDataPath.

This was my testcase

                        const web3 = new Web3Eth(
				'https://mainnet.infura.io/v3/6120b2e72c304b4eadafe2bf33862ac4',
			);
			const blocks = await web3.getBlock(15602045, true);
			console.log(blocks.transactions);

@nikoulai nikoulai marked this pull request as draft October 24, 2022 09:10
@nikoulai nikoulai force-pushed the nikos/5470/eth-getBlock-hydrated-empty-transactions-object branch from 8b65b2d to 729b1ac Compare October 24, 2022 14:16
@nikoulai nikoulai self-assigned this Oct 25, 2022
@nikoulai nikoulai added the 4.x 4.0 related label Oct 25, 2022
@nikoulai nikoulai marked this pull request as ready for review October 25, 2022 08:57
Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

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

In existing integration test , there should be additional check of transactions list present in case of hydrated true. or we can add a new test for querying a block with txs on some existing testnet.

@nikoulai nikoulai requested a review from jdevcs October 31, 2022 07:18
@jdevcs jdevcs merged commit 07396b7 into 4.x Nov 1, 2022
@jdevcs jdevcs deleted the nikos/5470/eth-getBlock-hydrated-empty-transactions-object branch November 1, 2022 09:05
@jdevcs jdevcs mentioned this pull request Nov 1, 2022
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.

4 participants