Skip to content

Commit

Permalink
revert: "fix: rpc timeout issue"
Browse files Browse the repository at this point in the history
This reverts commit 26a1405
  • Loading branch information
Adamantios committed Oct 30, 2023
1 parent bbc359b commit 4e3eb1b
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 51 deletions.
1 change: 0 additions & 1 deletion packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ models:
realitio_address: ${str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57}
redeeming_batch_size: ${int:5}
slippage: ${float:0.01}
redeem_margin_days: ${int:15}
policy_epsilon: ${float:0.1}
policy_store_path: ${str:/data/}
irrelevant_tools: ${list:["openai-text-davinci-002", "openai-text-davinci-003",
Expand Down
2 changes: 0 additions & 2 deletions packages/valory/contracts/conditional_tokens/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ def check_redeemed(
f"Did the creation happen too long in the past?\n"
f"The market with condition id {earliest_condition_id!r} "
f"is the oldest one and the block filtering was set based on it."
"If the issue persists, try to decrease the value of `redeem_margin_days` "
f"in the agent's configuration, based on the date corresponding to the block number {earliest_block}."
)
return dict(error=msg)

Expand Down
4 changes: 0 additions & 4 deletions packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ type: skill
realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57}
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15}
policy_epsilon: ${POLICY_EPSILON:float:0.1}
policy_store_path: ${POLICY_STORE_PATH:str:/data/}
irrelevant_tools: ${IRRELEVANT_TOOLS:list:["openai-text-davinci-002", "openai-text-davinci-003",
Expand Down Expand Up @@ -173,7 +172,6 @@ type: skill
realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57}
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15}
policy_epsilon: ${POLICY_EPSILON:float:0.1}
policy_store_path: ${POLICY_STORE_PATH:str:/data/}
irrelevant_tools: ${IRRELEVANT_TOOLS:list:["openai-text-davinci-002", "openai-text-davinci-003",
Expand Down Expand Up @@ -241,7 +239,6 @@ type: skill
realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57}
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15}
policy_epsilon: ${POLICY_EPSILON:float:0.1}
policy_store_path: ${POLICY_STORE_PATH:str:/data/}
irrelevant_tools: ${IRRELEVANT_TOOLS:list:["openai-text-davinci-002", "openai-text-davinci-003",
Expand Down Expand Up @@ -309,7 +306,6 @@ type: skill
realitio_address: ${REALITIO_ADDRESS:str:0x79e32aE03fb27B07C89c0c568F80287C01ca2E57}
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15}
policy_epsilon: ${POLICY_EPSILON:float:0.1}
policy_store_path: ${POLICY_STORE_PATH:str:/data/}
irrelevant_tools: ${IRRELEVANT_TOOLS:list:["openai-text-davinci-002", "openai-text-davinci-003",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
creator: "${creator}",
fpmm_: {
answerFinalizedTimestamp_not: null,
creationTimestamp_gt: "${from_timestamp}",
isPendingArbitration: false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
from packages.valory.skills.market_manager_abci.rounds import SynchronizedData


DAY_UNIX = 24 * 60 * 60


def to_content(query: str) -> bytes:
"""Convert the given query string to payload content, i.e., add it under a `queries` key and convert it to bytes."""
finalized_query = {"query": query}
Expand Down Expand Up @@ -187,9 +184,7 @@ def _fetch_redeem_info(self) -> Generator[None, None, Optional[list]]:
self._fetch_status = FetchStatus.IN_PROGRESS

safe = self.synchronized_data.safe_contract_address
redeem_margin = self.params.redeem_margin_days * DAY_UNIX
from_timestamp = self.synced_time - redeem_margin
query = trades.substitute(creator=safe.lower(), from_timestamp=from_timestamp)
query = trades.substitute(creator=safe.lower())

# workaround because we cannot have multiple response keys for a single `ApiSpec`
res_key_backup = self.current_subgraph.response_info.response_key
Expand Down
35 changes: 0 additions & 35 deletions packages/valory/skills/market_manager_abci/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
BenchmarkTool = BaseBenchmarkTool


GNOSIS_RPC_TIMEOUT_DAYS = 25


class SharedState(BaseSharedState):
"""Keep the current shared state of the skill."""

Expand Down Expand Up @@ -75,40 +72,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.languages: List[str] = self._ensure("languages", kwargs, List[str])
self.average_block_time: int = self._ensure("average_block_time", kwargs, int)
self.abt_error_mult: int = self._ensure("abt_error_mult", kwargs, int)
self._redeem_margin_days: int = 0
self.redeem_margin_days = self._ensure("redeem_margin_days", kwargs, int)
super().__init__(*args, **kwargs)

@property
def redeem_margin_days(self) -> int:
"""Get the margin in days of the redeeming information."""
return self._redeem_margin_days

@redeem_margin_days.setter
def redeem_margin_days(self, redeem_margin_days: int) -> None:
"""Get the margin in days of the redeeming information."""
value_enforcement = (
f"The value needs to be in the exclusive range (0, {GNOSIS_RPC_TIMEOUT_DAYS}) "
f"and manual redeeming has to be performed for markets older than {GNOSIS_RPC_TIMEOUT_DAYS - 1} days."
)

if redeem_margin_days <= 0:
raise ValueError(
"The margin in days for the redeeming information (`redeem_margin_days`) "
f"cannot be set to {redeem_margin_days} <= 0. {value_enforcement}"
)
if redeem_margin_days >= GNOSIS_RPC_TIMEOUT_DAYS:
raise ValueError(
"Due to a constraint of the Gnosis RPCs, it is not possible to configure the redeeming "
f"information's time window to exceed {GNOSIS_RPC_TIMEOUT_DAYS - 1} days "
f"(currently {redeem_margin_days=}). To clarify, these RPCs experience timeouts "
"when attempting to filter for historical on-chain events. "
"Practical testing of the service has revealed that timeouts consistently occur for blocks "
f"approximately {GNOSIS_RPC_TIMEOUT_DAYS} days old. {value_enforcement}"
)

self._redeem_margin_days = redeem_margin_days

@property
def creators_iterator(self) -> Iterator[Tuple[str, List[str]]]:
"""Return an iterator of market per creators."""
Expand Down
1 change: 0 additions & 1 deletion packages/valory/skills/market_manager_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ models:
- en_US
average_block_time: 5
abt_error_mult: 5
redeem_margin_days: 15
class_name: MarketManagerParams
network_subgraph:
args:
Expand Down
1 change: 0 additions & 1 deletion packages/valory/skills/trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ models:
realitio_address: '0x79e32aE03fb27B07C89c0c568F80287C01ca2E57'
redeeming_batch_size: 5
slippage: 0.01
redeem_margin_days: 15
policy_epsilon: 0.1
policy_store_path: /data/
irrelevant_tools:
Expand Down

0 comments on commit 4e3eb1b

Please sign in to comment.