From 764a7a23729ae62e0ffc297c013c8b19dcb4ff63 Mon Sep 17 00:00:00 2001 From: Igor Sereda Date: Fri, 12 Jul 2024 02:13:29 +0300 Subject: [PATCH] Subsquid deserialization fixes * Fixed float `timestamp` field on Subsquid deserialization * Fixed empty `gas_used` field on Subsquid Event deserialization --- CHANGELOG.md | 7 +++++++ src/dipdup/models/evm.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ddddd2642..6b16bdb13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/dipdup/models/evm.py b/src/dipdup/models/evm.py index e9a66db27..125551edb 100644 --- a/src/dipdup/models/evm.py +++ b/src/dipdup/models/evm.py @@ -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'], @@ -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'], @@ -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'],