Skip to content

Commit

Permalink
Subsquid deserialization fixes
Browse files Browse the repository at this point in the history
* Fixed float `timestamp` field on Subsquid deserialization
* Fixed empty `gas_used` field on Subsquid Event deserialization
  • Loading branch information
igorsereda committed Dec 21, 2024
1 parent d9dff22 commit 764a7a2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic

Releases prior to 7.0 has been removed from this file to declutter search results; see the [archived copy](https://github.com/dipdup-io/dipdup/blob/8.0.0b5/CHANGELOG.md) for the full list.

## [Unreleased]

### Fixed

- subsquid: Fixed float type for `timestamp` field on event / transaction deserialization.
- subsquid: Fixed empty field base conversion on event deserialization.

## [8.1.3] - 2024-12-20

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/dipdup/models/evm.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def from_subsquid_json(cls, event_json: dict[str, Any], header: dict[str, Any])
data=event_json['data'],
level=header['number'],
log_index=event_json['logIndex'],
timestamp=header['timestamp'],
timestamp=int(header['timestamp']),
topics=tuple(event_json['topics']),
removed=False,
transaction_hash=event_json['transactionHash'],
Expand Down Expand Up @@ -163,7 +163,7 @@ def from_subsquid_json(
from_=transaction_json['from'],
gas=int(transaction_json['gas'], 16),
gas_price=int(transaction_json['gasPrice'], 16),
gas_used=int(transaction_json['gasUsed'], 16),
gas_used=int(transaction_json['gasUsed'], 16) if transaction_json['gasUsed'] else None,
hash=transaction_json['hash'],
input=transaction_json['input'],
level=header['number'],
Expand All @@ -174,7 +174,7 @@ def from_subsquid_json(
s=transaction_json['s'],
# sighash=transaction_json['sighash'],
status=transaction_json['status'],
timestamp=header['timestamp'],
timestamp=int(header['timestamp']),
to=transaction_json['to'],
transaction_index=transaction_json['transactionIndex'],
type=transaction_json['type'],
Expand Down

0 comments on commit 764a7a2

Please sign in to comment.