Skip to content

Commit

Permalink
Merge pull request #241 from valory-xyz/fix/timeout
Browse files Browse the repository at this point in the history
Fix/timeout
  • Loading branch information
dvilelaf authored Dec 3, 2024
2 parents 7f2d3eb + 220620e commit 1fdb608
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ In order to run a local demo service based on the IEKit:
2. Fetch the IEKit.

```bash
autonomy fetch valory/impact_evaluator:0.1.0:bafybeidw7kxgdzltrkrfrfvplsmw6xkpx2mzbgapdq6nxe7fd57gu22zku --service
autonomy fetch valory/impact_evaluator:0.1.0:bafybeibagmo33sm6mcetjplelsfyflxj74flwsl4kglsg4oolxvvctx47u --service
```

3. Build the Docker image of the service agents
Expand Down
8 changes: 4 additions & 4 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"skill/valory/twitter_scoring_abci/0.1.0": "bafybeidwoqhgrppbmi25vxgy54gd2ord4ojmcr6b4k7dh4gqju3zy4oeuq",
"skill/valory/ceramic_read_abci/0.1.0": "bafybeibph35jhtvn6kgytj6mqdz4lpjkvtfqd75qorrt4onv6i2trxfttu",
"skill/valory/ceramic_write_abci/0.1.0": "bafybeihez2zrvvt6cyi5vu3fpomjlbo3v4fzyf4buv7ysxzj4dntr2wy3q",
"skill/valory/impact_evaluator_abci/0.1.0": "bafybeifcxcemrjt3trmwwfu3a36wbg7tbofgwuxedwqmrypf7jxmqo4u54",
"skill/valory/impact_evaluator_abci/0.1.0": "bafybeidtmy2dcqj2qaacqngzlblxrur4mk5nbl6qslgsa5mibiljxzweha",
"skill/valory/generic_scoring_abci/0.1.0": "bafybeiej5iwzfvoan4kp4erfxva3h5vrrmon6ahbyupa2jdfypy5i25t5y",
"skill/valory/twitter_write_abci/0.1.0": "bafybeig4dc4cereyshk535pfpparvxiuaimdu4lsm3hnl5li7pxafho6lu",
"skill/valory/llm_abci/0.1.0": "bafybeihpfesi2sjqdcb2j2mqybhz7av7jlvf27ozk32wbwmklkdugycxyq",
Expand All @@ -29,10 +29,10 @@
"skill/valory/farcaster_write_abci/0.1.0": "bafybeibbbfui3g2s63cg5vsvxqpzzdg2uxhd7a4ikwfo6dy7b2klqthvu4",
"skill/valory/farcaster_test_abci/0.1.0": "bafybeiblauv376hvy7dzi232fxf6iq5nxxnhvk2gy6g7kcsj7a4r2bilqa",
"skill/valory/staking_abci/0.1.0": "bafybeie3wypei4kt35trwpa26ocn3zvxb6a45ch2wzbsaev3fxg6lj7yqm",
"agent/valory/impact_evaluator/0.1.0": "bafybeifqhhy7fgxommu45e7yuigixavzifzelvirkadcj72llgzp3bpswe",
"agent/valory/impact_evaluator/0.1.0": "bafybeigrcdnosmbyw4sqzs64vx5w3esfixi2nddyz4qhp4rleuc5ld26qm",
"agent/valory/farcaster_test/0.1.0": "bafybeig6yilme5s7fvru2b44dtr5xxqz3gf7p56swr7c5hip775l5wally",
"service/valory/impact_evaluator/0.1.0": "bafybeidw7kxgdzltrkrfrfvplsmw6xkpx2mzbgapdq6nxe7fd57gu22zku",
"service/valory/impact_evaluator_local/0.1.0": "bafybeibay3ctdmrrfoxymxcdraruekh4qslmk7dogatjpkvuz5jmmabsue"
"service/valory/impact_evaluator/0.1.0": "bafybeibagmo33sm6mcetjplelsfyflxj74flwsl4kglsg4oolxvvctx47u",
"service/valory/impact_evaluator_local/0.1.0": "bafybeihdj5thh5l2a5eho45ivygvrtsbs7ydqwh7svyyzqap4nld2gsmii"
},
"third_party": {
"protocol/open_aea/signing/1.0.0": "bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi",
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/agents/impact_evaluator/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protocols:
skills:
- valory/abstract_abci:0.1.0:bafybeif2naoydlrqkdpnig34uejedwgurjwyvmbpcz53tif7pyukfdophq
- valory/abstract_round_abci:0.1.0:bafybeigjddhk7epta7xpnfvv426xedff5abh4xlkwi6cqgp4vkutgkvydm
- valory/impact_evaluator_abci:0.1.0:bafybeifcxcemrjt3trmwwfu3a36wbg7tbofgwuxedwqmrypf7jxmqo4u54
- valory/impact_evaluator_abci:0.1.0:bafybeidtmy2dcqj2qaacqngzlblxrur4mk5nbl6qslgsa5mibiljxzweha
- valory/generic_scoring_abci:0.1.0:bafybeiej5iwzfvoan4kp4erfxva3h5vrrmon6ahbyupa2jdfypy5i25t5y
- valory/twitter_scoring_abci:0.1.0:bafybeidwoqhgrppbmi25vxgy54gd2ord4ojmcr6b4k7dh4gqju3zy4oeuq
- valory/ceramic_read_abci:0.1.0:bafybeibph35jhtvn6kgytj6mqdz4lpjkvtfqd75qorrt4onv6i2trxfttu
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/impact_evaluator/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeign56hilwuoa6bgos3uqabss4gew4vadkik7vhj3ucpqw6nxtqtpe
fingerprint_ignore_patterns: []
agent: valory/impact_evaluator:0.1.0:bafybeifqhhy7fgxommu45e7yuigixavzifzelvirkadcj72llgzp3bpswe
agent: valory/impact_evaluator:0.1.0:bafybeigrcdnosmbyw4sqzs64vx5w3esfixi2nddyz4qhp4rleuc5ld26qm
number_of_agents: 4
deployment:
agent:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeign56hilwuoa6bgos3uqabss4gew4vadkik7vhj3ucpqw6nxtqtpe
fingerprint_ignore_patterns: []
agent: valory/impact_evaluator:0.1.0:bafybeifqhhy7fgxommu45e7yuigixavzifzelvirkadcj72llgzp3bpswe
agent: valory/impact_evaluator:0.1.0:bafybeigrcdnosmbyw4sqzs64vx5w3esfixi2nddyz4qhp4rleuc5ld26qm
number_of_agents: 1
deployment:
agent:
Expand Down
5 changes: 3 additions & 2 deletions packages/valory/skills/impact_evaluator_abci/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@

MARGIN = 5
MULTIPLIER = 5
CERAMIC_TIMEOUT_MULTIPLIER = 10


class RandomnessApi(ApiSpecs):
Expand All @@ -112,11 +113,11 @@ def setup(self) -> None:
"""Set up."""
super().setup()
ImpactEvaluatorSkillAbciApp.event_to_timeout[CeramicReadEvent.ROUND_TIMEOUT] = (
self.context.params.round_timeout_seconds * MULTIPLIER
self.context.params.round_timeout_seconds * CERAMIC_TIMEOUT_MULTIPLIER
)
ImpactEvaluatorSkillAbciApp.event_to_timeout[
CeramicWriteEvent.ROUND_TIMEOUT
] = (self.context.params.round_timeout_seconds * MULTIPLIER)
] = (self.context.params.round_timeout_seconds * CERAMIC_TIMEOUT_MULTIPLIER)
ImpactEvaluatorSkillAbciApp.event_to_timeout[
TwitterScoringEvent.ROUND_TIMEOUT
] = self.context.params.round_timeout_seconds
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/skills/impact_evaluator_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fingerprint:
dialogues.py: bafybeigybns7lilv57day366bo6kri5ehu3nbrfjk6x7a7pz3xq4wc5r6e
fsm_specification.yaml: bafybeies2gqemrvigszvpg7l733gyyyck3ieeidc5jfdnwqwwvgyumhiha
handlers.py: bafybeihnfjtuusm65o76lr4q6rdawq6xjc7d7hywmcdabop7vgvuxdry3e
models.py: bafybeif7unc573kd5bpot3vjfmoktbkeervsms72cqobd52y74txcwq55y
models.py: bafybeicqkdvwyekxx6qx26dv3guf36r2wwqf74lfmna5comlr5jjbzlhmm
tests/__init__.py: bafybeievwzwojvq4aofk5kjpf4jzygfes7ew6s6svc6b6frktjnt3sicce
tests/test_behaviours.py: bafybeifkazsevd6vsfaapulouxepez3rl24y3rxgja5zhmj7s323zdjlmq
tests/test_dialogues.py: bafybeieaos2byphju6i6xvytppqqcuqqvnpilnflsy73l3wqazzjttbg7m
Expand Down
12 changes: 9 additions & 3 deletions scripts/check_rewards.py → scripts/check_staking.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@


EPOCH = "latest"
BASE_LEDGER_RPC = os.getenv("BASE_LEDGER_RPC")
BASE_LEDGER_RPC = os.getenv("BASE_LEDGER_RPC_ALCHEMY")
GREEN = "bold green"
RED = "bold red"
YELLOW = "bold yellow"
POINTS_PER_UPDATE = 200
web3 = Web3(Web3.HTTPProvider(BASE_LEDGER_RPC))
UNSTAKED = "unstaked"
UNSTAKED = "UNSTAKED"
EVICTED = "EVICTED"


STAKING_CONTRACTS = {
Expand Down Expand Up @@ -166,6 +167,8 @@ def get_user_info(user_data: Dict, contract_info: Dict, contributors_contract: C
)
staking_contract_name = get_contract_by_address(staking_contract_address)

is_evicted = staking_token_contract.functions.getStakingState(service_id).call() == 2

accrued_rewards = staking_token_contract.functions.calculateStakingReward(service_id).call()
# this_epoch_rewards = staking_token_contract.functions.calculateStakingLastReward(service_id).call() # needs fixing
this_epoch = contract_info[staking_contract_name]["epoch"]
Expand All @@ -175,9 +178,12 @@ def get_user_info(user_data: Dict, contract_info: Dict, contributors_contract: C

required_points = POINTS_PER_UPDATE * contract_info[staking_contract_name]['required_updates']
color = GREEN if this_epoch_points >= required_points else YELLOW
if is_evicted:
color = RED

user_info = {
"staked": True,
"evicted": is_evicted,
"staking_contract_name": staking_contract_name,
"epoch": str(this_epoch),
"this_epoch_tweets": str(len(this_epoch_tweets)),
Expand Down Expand Up @@ -227,7 +233,7 @@ def print_table():
"@" + user_data["twitter_handle"],
shorten_address(user_data["service_multisig"]),
user_info["staking_contract_name"],
user_info["epoch"] + f" [{user_info['next_epoch_start']}]",
user_info["epoch"] + f" [{user_info['next_epoch_start']}]" if not user_info["evicted"] else EVICTED,
user_info["this_epoch_tweets"],
user_info["this_epoch_points"] + " / " + user_info["required_points"],
# user_info["this_epoch_rewards"],
Expand Down

0 comments on commit 1fdb608

Please sign in to comment.