Skip to content

Commit

Permalink
Optimize ERC20/721 indexing in batches
Browse files Browse the repository at this point in the history
  • Loading branch information
Uxio0 committed Nov 12, 2019
1 parent 79171d6 commit 2c0b605
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ typings/
.vscode

venv/
.venv
config/settings/dev.py
db.sqlite3
1 change: 1 addition & 0 deletions .venv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
safe-services
9 changes: 9 additions & 0 deletions safe_relay_service/relay/services/erc20_events_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ class Erc20EventsService(TransactionScanService):
"""
Indexes ERC20 and ERC721 `Transfer` Event (as ERC721 has the same topic)
"""

def __init__(self, ethereum_client: EthereumClient, block_process_limit: int = 10000,
updated_blocks_behind: int = 300, query_chunk_size: int = 500, **kwargs):
super().__init__(ethereum_client,
block_process_limit=block_process_limit,
updated_blocks_behind=updated_blocks_behind,
query_chunk_size=query_chunk_size,
**kwargs)

@property
def database_field(self):
return 'erc_20_block_number'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TransactionScanService(ABC):
def __init__(self, ethereum_client: EthereumClient, confirmations: int = 10,
block_process_limit: int = 10000, updated_blocks_behind: int = 100,
block_process_limit: int = 10000, updated_blocks_behind: int = 300,
query_chunk_size: int = 100, safe_creation_threshold: int = 150000):
"""
:param ethereum_client:
Expand Down
2 changes: 1 addition & 1 deletion safe_relay_service/relay/services/transaction_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ def _send_multisig_tx(self,

if safe_tx.signers != safe_tx.sorted_signers:
raise SignaturesNotSorted('Safe-tx-hash=%s - Signatures are not sorted by owner: %s' %
(safe_tx.safe_tx_hash, safe_tx.signers))
(safe_tx.safe_tx_hash.hex(), safe_tx.signers))

safe_tx.call(tx_sender_address=tx_sender_address, block_identifier=block_identifier)

Expand Down

0 comments on commit 2c0b605

Please sign in to comment.