Fix redeem stage when interacting with ConditionalTokens Graph
jmoreira-valory opened this issue · comments
jmoreira-valory commented
On the redeem behaviour, the agent is not properly addressing the case when the user has not made any bet:
[2024-04-24 03:54:02,117] [INFO] [agent] Fetched redeeming information: set()
[2024-04-24 03:54:02,301] [INFO] [agent] Retrieved trades: [].
[2024-04-24 03:54:02,502] [ERROR] [agent] Could not access response using the given key(s) (data:user:userPositions) and index (None)!
[2024-04-24 03:54:02,502] [ERROR] [agent] Response: "{\"data\":{\"user\":null}}"
[2024-04-24 03:54:02,502] [ERROR] [agent] Could not get positions from conditional_tokens
[2024-04-24 04:54:02,543] [WARNING] [agent] expired deadline 2024-04-24 04:54:00.892132 with event Event.REDEEM_ROUND_TIMEOUT at AbciApp time 2024-04-24 04:54:01.529532
[2024-04-24 04:54:02,543] [WARNING] [agent] current AbciApp time after expired deadline: 2024-04-24 04:54:01.529532
[2024-04-24 04:54:02,543] [INFO] [agent] 'redeem_round' round is done with event: Event.REDEEM_ROUND_TIMEOUT
[2024-04-24 04:54:02,543] [INFO] [agent] Entered in the 'call_checkpoint_round' round for period 16
[2024-04-24 04:54:02,544] [INFO] [agent] Entered in the 'call_checkpoint_behaviour' behaviour
When the service hasn't placed any bet yet, the Conditional Tokens query outputs "{"data":{"user":null}}" and this seems to cause the agent to get stuck (in the example above, for 1 hour). This will typically happen for new services which are run and don't place a bet on their first iteration.
jmoreira-valory commented
For exmple, try making a query for a non-existent user:
https://api.thegraph.com/subgraphs/name/gnosis/conditional-tokens-gc/graphql
{
user(id: "0xabcde00000000000000000000000000000") {
userPositions(
first: 1000
orderBy: id
) {
balance
id
position {
id
conditionIds
lifetimeValue
}
totalBalance
wrappedBalance
}
}
}
jmoreira-valory commented
Additionally, investigate why the timeout in this round is 1h long.