Skip to content

Commit

Permalink
fix: throw errir if log.block_number is null
Browse files Browse the repository at this point in the history
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
  • Loading branch information
quiet-node committed Jan 7, 2025
1 parent 8687322 commit 9f2e473
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,20 @@ export class CommonService implements ICommonService {

const logs: Log[] = [];
for (const log of logResults) {
if (!log.block_number) {
if (this.logger.isLevelEnabled('debug')) {
this.logger.debug(

Check warning on line 351 in packages/relay/src/lib/services/ethService/ethCommonService/index.ts

View check run for this annotation

Codecov / codecov/patch

packages/relay/src/lib/services/ethService/ethCommonService/index.ts#L351

Added line #L351 was not covered by tests
`${requestDetails.formattedRequestId} Log entry is missing the block number: log=${JSON.stringify(log)}`,
);
}
throw predefined.INTERNAL_ERROR(`The log entry is missing a required block number.`);
}

logs.push(
new Log({
address: log.address,
blockHash: toHash32(log.block_hash),
blockNumber: nullableNumberTo0x(log.block_number),
blockNumber: numberTo0x(log.block_number),
data: log.data,
logIndex: nullableNumberTo0x(log.index),
removed: false,
Expand Down

0 comments on commit 9f2e473

Please sign in to comment.