open-autonomy
open-autonomy copied to clipboard
synchronized_data_class attribute
L.S.
for the uninitiated: synchronized_data_class is a class attribute present on specific rounds (references below).
Why does this even exist? It is a very confusing feature without any documentation as far as i can tell. My instinct tells me that it should not exist in the first place.
Why is it passed as an argument in .update or .create methods, but not used during __init__?
Why, if it is a class attribute in the first place, does it need to be passed at all, is there good reason to sometimes pass it and sometimes not? Otherwise it can be referenced and does not need to be passed. One may create a reference from BaseSynchronizedData back to round to access it there, such that all related logic resides at DB).
Can we not simply always reference type(self.synchronized_data)?
Why are there only certain base classes that have this attribute set, and is it not set on the AbstractRound base class?
BaseSynchronizedData
https://github.com/valory-xyz/open-autonomy/blob/6e1dcb58702961a700d1b9c0b711aa773d3ae5be/packages/valory/skills/abstract_round_abci/base.py#L755-L759 https://github.com/valory-xyz/open-autonomy/blob/6e1dcb58702961a700d1b9c0b711aa773d3ae5be/packages/valory/skills/abstract_round_abci/base.py#L768-L772
Rounds
https://github.com/valory-xyz/open-autonomy/blob/6e1dcb58702961a700d1b9c0b711aa773d3ae5be/packages/valory/skills/abstract_round_abci/base.py#L1316 https://github.com/valory-xyz/open-autonomy/blob/6e1dcb58702961a700d1b9c0b711aa773d3ae5be/packages/valory/skills/abstract_round_abci/base.py#L1368 https://github.com/valory-xyz/open-autonomy/blob/6e1dcb58702961a700d1b9c0b711aa773d3ae5be/packages/valory/skills/abstract_round_abci/base.py#L1455 https://github.com/valory-xyz/open-autonomy/blob/6e1dcb58702961a700d1b9c0b711aa773d3ae5be/packages/valory/skills/abstract_round_abci/base.py#L1510
I would also note that some concrete skills only set it as a class attribute (oracle_deployment_abci, price_estimation, safe_deployment), whereas others the developer has implemented functionality that passes this to .create/ .update method of the SynchronizedData (hello_world_abci, apy_estimation_abci, reset_and_pause_abci, simple_abci, transaction_settlement_abci).
Not only does this violate the zen of python, it also violates mine.
My proposal is to abstract this away entirely; no developer should be concerned with implementation details like these.