Skip to content

Commit

Permalink
Maybe fix dune in receivemessages (#609)
Browse files Browse the repository at this point in the history
  • Loading branch information
kongzii authored Dec 16, 2024
1 parent 60601b7 commit 718414b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions prediction_market_agent/db/blockchain_transaction_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,17 @@ def fetch_unseen_transactions(
)
)
min_block_number = (
37554163 # Block at the time of starting agents.
37554165 # Block at the time of starting agents.
if not latest_blockchain_message
else latest_blockchain_message.block
)
# We order by block_time because it's used as partition on Dune.
# We use >= for block because we might have lost transactions from the same block.
# Additionally, processed tx_hashes are filtered out anyways.
query = f'select * from gnosis.transactions where "to" = {Web3.to_checksum_address(consumer_address)} AND block_number >= {min_block_number} and value >= {xdai_to_wei(MicrochainAgentKeys().RECEIVER_MINIMUM_AMOUNT)} order by block_time asc'
df = spice.query(query, api_key=keys.dune_api_key.get_secret_value())
df = spice.query(
query, api_key=keys.dune_api_key.get_secret_value(), cache=False
)

existing_hashes = self.blockchain_table_handler.fetch_all_transaction_hashes(
consumer_address=consumer_address
Expand Down
2 changes: 1 addition & 1 deletion tests/agents/microchain/test_messages_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def account2_private_key() -> SecretStr:
) # anvil account 1


def mock_spice_query(query: str, api_key: str) -> pl.DataFrame:
def mock_spice_query(query: str, api_key: str, cache: bool) -> pl.DataFrame:
return pl.DataFrame(
{
"hash": [MOCK_HASH_1, MOCK_HASH_2],
Expand Down

0 comments on commit 718414b

Please sign in to comment.