valory-xyz / trader-quickstart

A quickstart for the trader agent for AI prediction markets on Gnosis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wait until RPC write is reflected on the read

jmoreira-valory opened this issue · comments

Sometimes the following issue occurs with RPC:

  1. Script sends a write operation to the contract (using autonomy CLI). Service state changes from A->B. This transaction is acknowledged by RPC.
  2. Script reads the state of the contract, and still gets Service in state A.

To mitigate this, sleep after contract calls have been introduced. However, the following improvement is suggested:
Create a method which waits until the state is the expected one (or times out after a generous time margin ~5min.). This would be similar to what is done in the method to ensure that addressess are funded.

Addressed in #227