Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix moonstream provider #125

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions moonworm/crawler/function_call_crawler.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,7 @@ def crawl(self, from_block: int, to_block: int, flush_state: bool = False):
method_id = transaction.get("input")[:10]
if method_id in self.whitelisted_methods:
self.process_transaction(transaction)
else:
print(
f"Function not in ABI, MethodID: {method_id} tx: {transaction['hash'].hex()}. Ignored."
)

self.state.state
if flush_state:
self.state.flush()
10 changes: 5 additions & 5 deletions moonworm/crawler/moonstream_ethereum_state_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,9 @@ def get_last_block_number(self) -> int:
return last_block.block_number

@staticmethod
def _transform_to_w3_tx(
tx_raw: tx_raw_types,
) -> Dict[str, Any]:
def _transform_to_w3_tx(tx_raw: tx_raw_types, raw_block) -> Dict[str, Any]:
tx = {
"blockHash": tx_raw.block_hash,
"blockHash": raw_block.hash,
"blockNumber": tx_raw.block_number,
"from": tx_raw.from_address,
"gas": tx_raw.gas,
Expand Down Expand Up @@ -134,7 +132,9 @@ def _get_block_from_db(self, block_number: int) -> Optional[Dict[str, Any]]:
for block, txs in block_transactions.items():
self.blocks_cache[block] = {
"timestamp": blocks[block].timestamp,
"transactions": [self._transform_to_w3_tx(tx) for tx in txs],
"transactions": [
self._transform_to_w3_tx(tx, blocks[block]) for tx in txs
],
}

return self.blocks_cache[block_number]
Expand Down
2 changes: 1 addition & 1 deletion moonworm/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MOONWORM_VERSION = "0.9.1"
MOONWORM_VERSION = "0.9.2"
Loading