Skip to content

Commit

Permalink
fix: minor issues from chainid PR (#871)
Browse files Browse the repository at this point in the history
* fix: attribute error

* fix: coroutine never awaited
  • Loading branch information
BobTheBuidler authored Dec 22, 2024
1 parent 82ad965 commit 6f6e888
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions y/_db/utils/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,18 @@ async def bulk_insert(
(CHAINID, block, "BlockExtended")
for block in {log.blockNumber for log in logs}
)
blocks_fut = submit(_bulk_insert, Block, _BLOCK_COLS_EXTENDED, blocks)
blocks_fut = submit(_bulk_insert, Block, _BLOCK_COLS_EXTENDED, blocks, sync=True)
else:
blocks = tuple((CHAINID, block) for block in {log.blockNumber for log in logs})
blocks_fut = submit(_bulk_insert, Block, _BLOCK_COLS, blocks)
blocks_fut = submit(_bulk_insert, Block, _BLOCK_COLS, blocks, sync=True)
del blocks

txhashes = (txhash.hex() for txhash in {log.transactionHash for log in logs})
addresses = {log.address for log in logs}
hashes = tuple(
(_remove_0x_prefix(hash),) for hash in itertools.chain(txhashes, addresses)
)
hashes_fut = submit(_bulk_insert, Hashes, ["hash"], hashes)
hashes_fut = submit(_bulk_insert, Hashes, ("hash",), hashes, sync=True)
del txhashes, addresses, hashes

topics = set(itertools.chain(*(log.topics for log in logs)))
Expand All @@ -133,6 +133,7 @@ async def bulk_insert(
LogTopic,
("topic",),
tuple((_remove_0x_prefix(topic.strip()),) for topic in topics),
sync=True,
)
del topics

Expand Down
2 changes: 1 addition & 1 deletion y/_db/utils/price.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ def known_prices_at_block(number: int) -> Dict[Address, Decimal]:
select(
(p.token.address, p.price)
for p in Price
if p.block.CHAINID == CHAINID and p.block.number == number
if p.block.chain.id == CHAINID and p.block.number == number
)
)

0 comments on commit 6f6e888

Please sign in to comment.