Skip to content

Commit

Permalink
Naming, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout committed Jan 24, 2024
1 parent 9d03a97 commit 2fba8dd
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 17 deletions.
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].

## [7.3.0] - 2024-01-23
## [Unreleased]

### Added

- evm.subsquid.transactions: Added `evm.subsquid.transactions` index kind to process EVM transactions.

### Fixed

- codegen: Don't create intermediate `events.json` file in ABI directory.
- evm.subsquid: When request to worker fails, ask router for another one instead of retrying the same worker.

## [7.3.0] - 2024-01-23

### Added

- tezos.tzkt.operations: Added new operation type `sr_execute` for Etherlink smart rollups.

### Fixed

- abi.etherscan: Fixed handling "rate limit reached" errors.
- cli: Fixed setting logger levels based on config and env variables.
- codegen: Don't create intermediate file `events.json` in ABI directory.
- evm.subsquid: When request to worker fails, ask router for another one instead of retrying the same worker.
- http: Fixed incorrect number of retries performed on failed requests.

## [7.2.2] - 2023-12-27
Expand Down
7 changes: 4 additions & 3 deletions src/dipdup/config/evm_subsquid_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dipdup.config.evm import EvmContractConfig
from dipdup.config.evm_subsquid import SubsquidDatasourceConfig
from dipdup.config.evm_subsquid import SubsquidIndexConfig
from dipdup.models.evm_node import EvmNodeHeadsSubscription
from dipdup.models.evm_node import EvmNodeHeadSubscription
from dipdup.models.evm_node import EvmNodeLogsSubscription
from dipdup.utils import pascal_to_snake
from dipdup.utils import snake_to_pascal
Expand Down Expand Up @@ -73,7 +73,8 @@ class SubsquidEventsIndexConfig(SubsquidIndexConfig):
last_level: int = 0

def get_subscriptions(self) -> set[Subscription]:
subs: set[Subscription] = {EvmNodeHeadsSubscription()}
subs: set[Subscription] = {EvmNodeHeadSubscription()}
for handler in self.handlers:
subs.add(EvmNodeLogsSubscription(address=handler.contract.address))
if address := handler.contract.address:
subs.add(EvmNodeLogsSubscription(address=address))
return subs
4 changes: 2 additions & 2 deletions src/dipdup/config/evm_subsquid_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from dipdup.config.evm import EvmContractConfig
from dipdup.config.evm_subsquid import SubsquidDatasourceConfig
from dipdup.config.evm_subsquid import SubsquidIndexConfig
from dipdup.models.evm_node import EvmNodeHeadsSubscription
from dipdup.models.evm_node import EvmNodeHeadSubscription
from dipdup.subscriptions import Subscription
from dipdup.utils import pascal_to_snake
from dipdup.utils import snake_to_pascal
Expand Down Expand Up @@ -78,4 +78,4 @@ class SubsquidTransactionsIndexConfig(SubsquidIndexConfig):
last_level: int = 0

def get_subscriptions(self) -> set[Subscription]:
return {EvmNodeHeadsSubscription(transactions=True)}
return {EvmNodeHeadSubscription(transactions=True)}
4 changes: 2 additions & 2 deletions src/dipdup/datasources/evm_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from dipdup.exceptions import FrameworkException
from dipdup.models import MessageType
from dipdup.models.evm_node import EvmNodeHeadData
from dipdup.models.evm_node import EvmNodeHeadsSubscription
from dipdup.models.evm_node import EvmNodeHeadSubscription
from dipdup.models.evm_node import EvmNodeLogData
from dipdup.models.evm_node import EvmNodeLogsSubscription
from dipdup.models.evm_node import EvmNodeSubscription
Expand Down Expand Up @@ -349,7 +349,7 @@ async def _on_message(self, message: Message) -> None:
raise DatasourceError(f'Unknown message: {data}', self.name)

async def _handle_subscription(self, subscription: EvmNodeSubscription, data: Any) -> None:
if isinstance(subscription, EvmNodeHeadsSubscription):
if isinstance(subscription, EvmNodeHeadSubscription):
known_level = max(self._level_data or (0,))
head = EvmNodeHeadData.from_json(data)
level_data = self._level_data[head.level]
Expand Down
4 changes: 2 additions & 2 deletions src/dipdup/datasources/evm_subsquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
'block': {
'timestamp': True,
},
# FIXME: All available, likely not needed
'transaction': {
'chainId': True,
'contractAddress': True,
Expand Down Expand Up @@ -200,7 +199,8 @@ async def iter_transactions(
transactions: deque[SubsquidTransactionData] = deque()
for raw_transaction in level_item['transactions']:
transaction = SubsquidTransactionData.from_json(raw_transaction, level, timestamp)
# NOTE: `None` for chains and block ranges not compliant with the post-Byzantinum hard fork EVM specification (e.g. 0-4,369,999 on Ethereum).
# NOTE: `None` falue is for chains and block ranges not compliant with the post-Byzantinum
# hard fork EVM specification (e.g. before 4.370,000 on Ethereum).
if transaction.status != 0:
transactions.append(transaction)
yield tuple(transactions)
Expand Down
3 changes: 1 addition & 2 deletions src/dipdup/indexes/evm_subsquid.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async def _get_node_sync_level(self, subsquid_level: int, index_level: int) -> i
if subsquid_available < NODE_LAST_MILE:
return node_sync_level
if self._config.node_only:
self._logger.debug('Using node anyway')
self._logger.debug('`node_only` flag is set; using node anyway')
return node_sync_level
return None

Expand All @@ -174,7 +174,6 @@ async def _synchronize(self, sync_level: int) -> None:
return

levels_left = sync_level - index_level

if levels_left <= 0:
return

Expand Down
1 change: 0 additions & 1 deletion src/dipdup/indexes/evm_subsquid_events/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ async def _synchronize_subsquid(self, sync_level: int) -> None:
Metrics.set_sqd_processor_last_block(_level)

async def _synchronize_node(self, sync_level: int) -> None:
# NOTE: Requesting logs by batches of NODE_BATCH_SIZE.
batch_first_level = self.state.level + 1
while batch_first_level <= sync_level:
batch_last_level = min(batch_first_level + NODE_BATCH_SIZE, sync_level)
Expand Down
1 change: 0 additions & 1 deletion src/dipdup/indexes/evm_subsquid_transactions/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ async def _synchronize_subsquid(self, sync_level: int) -> None:
Metrics.set_sqd_processor_last_block(_level)

async def _synchronize_node(self, sync_level: int) -> None:
# NOTE: Requesting logs by batches of NODE_BATCH_SIZE.
batch_first_level = self.state.level + 1
while batch_first_level <= sync_level:
batch_last_level = min(batch_first_level + NODE_BATCH_SIZE, sync_level)
Expand Down
2 changes: 1 addition & 1 deletion src/dipdup/models/evm_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_params(self) -> list[Any]:


@dataclass(frozen=True)
class EvmNodeHeadsSubscription(EvmNodeSubscription):
class EvmNodeHeadSubscription(EvmNodeSubscription):
name: Literal['newHeads'] = 'newHeads'
transactions: bool = False

Expand Down

0 comments on commit 2fba8dd

Please sign in to comment.