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

Do not index data when fullBlock does not exist logs #350

Merged
merged 6 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed
- When there is no log data for fullBlock, it is determined as lightBlock. (#350)

## [5.1.6] - 2024-10-23
### Changed
- Bump `@subql/common` dependency
Expand Down
4 changes: 4 additions & 0 deletions packages/node/src/ethereum/api.ethereum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ describe('Api.ethereum', () => {
expect(isFullBlock(blockData)).toBeTruthy();
expect(isFullBlock(lightBlock)).toBeFalsy();

// block with transactions, but no logs 4913287
const noLogBlockData = (await (ethApi as any).fetchBlock(4913287)).block;
expect(isFullBlock(noLogBlockData)).toBeTruthy();

// block without transaction
const block10001 = (await (ethApi as any).fetchBlock(10001)).block;
const lightBlock10001 = (await (ethApi as any).fetchLightBlock(10001))
Expand Down
2 changes: 1 addition & 1 deletion packages/node/src/ethereum/block.ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function isFullBlock(block: BlockContent): block is EthereumBlock {
// Light etherum block just contains transaction hashes for transactions.
// If the block has no transactions then both types would be the same

if (block.transactions.length && block.logs.length) {
if (block.transactions.length) {
return typeof (block as EthereumBlock).transactions[0] !== 'string';
}
return false;
Expand Down
Loading