From 58f5bc901939072337371ad2f834a45e3ba1048a Mon Sep 17 00:00:00 2001 From: Ardian Date: Thu, 24 Oct 2024 23:05:03 +0200 Subject: [PATCH] fix: misc issues with mech during marketplace --- packages/packages.json | 16 +++++------ packages/valory/agents/mech/aea-config.yaml | 12 ++++----- .../valory/contracts/agent_mech/contract.py | 8 ++++-- .../valory/contracts/agent_mech/contract.yaml | 2 +- .../contracts/mech_marketplace/contract.py | 27 ++++++++++++------- .../contracts/mech_marketplace/contract.yaml | 2 +- packages/valory/services/mech/service.yaml | 10 ++++++- packages/valory/skills/mech_abci/skill.yaml | 4 +-- .../skills/subscription_abci/skill.yaml | 2 +- .../valory/skills/task_execution/skill.yaml | 4 +-- .../skills/task_submission_abci/behaviours.py | 9 +++++-- .../skills/task_submission_abci/rounds.py | 7 +++-- .../skills/task_submission_abci/skill.yaml | 6 ++--- 13 files changed, 68 insertions(+), 41 deletions(-) diff --git a/packages/packages.json b/packages/packages.json index 80a28942..dc1f9516 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -36,19 +36,19 @@ "custom/dvilela/gemini_prediction/0.1.0": "bafybeigvwflupxzbjgmaxcxml5vkez3obl4fjo6bxzhquq56urnviq32u4", "protocol/valory/acn_data_share/0.1.0": "bafybeih5ydonnvrwvy2ygfqgfabkr47s4yw3uqxztmwyfprulwfsoe7ipq", "protocol/valory/websocket_client/0.1.0": "bafybeifjk254sy65rna2k32kynzenutujwqndap2r222afvr3zezi27mx4", - "contract/valory/agent_mech/0.1.0": "bafybeifj253ojkdr75ckrzb55su3j2v2hyb3v2ppqjwvvqyzbxanptebne", + "contract/valory/agent_mech/0.1.0": "bafybeibvupi37fvzxlwpdokrd6eyxuo64j45icsti3atoprk6pvx6cpiye", "contract/valory/agent_registry/0.1.0": "bafybeiarzhzs2wm2sl47qg37tqoc3qok54enxlcj6vx3hldozg537uslnq", "contract/valory/hash_checkpoint/0.1.0": "bafybeicbycr6rxods7sg3f2qlhgkjqrbh7kymmy2yw7bewxdwjyp7ibtg4", - "contract/valory/mech_marketplace/0.1.0": "bafybeich3a3oh5w4u533w6y7ideojudqp2m5gxta7pqmsfiaohdhuw7yz4", + "contract/valory/mech_marketplace/0.1.0": "bafybeib2cuv2tdrjp44y57drllpyh34t66y67zibefxmzyvmoupcb476uu", "connection/valory/websocket_client/0.1.0": "bafybeic4ag3gqc7kd3k2o3pucddj2odck5yrfbgmwh5veqny7zao5qayli", "skill/valory/contract_subscription/0.1.0": "bafybeiefuemlp75obgpxrp6iuleb3hn6vcviwh5oetk5djbuprf4xsmgjy", - "skill/valory/mech_abci/0.1.0": "bafybeiajz42vtyvmm3bjmft7d6y3dodped2kh7h75zgqocym76twvpyejq", - "skill/valory/task_submission_abci/0.1.0": "bafybeigoda6koeghcboflmz5e6r7yluk7fanpjso64b4am3w2szo2a65w4", - "skill/valory/task_execution/0.1.0": "bafybeif7jsxbue6l7fhn5ahf7jbks5td6me55b42dy7k6s3j72zvu2p7ie", + "skill/valory/mech_abci/0.1.0": "bafybeicbmmiw5wx26i3vs5nlh66d7oi74ezsyl7wshwrosxvibkyu6a6ze", + "skill/valory/task_submission_abci/0.1.0": "bafybeigb3synomrwmducrnli6b6goykqxcp5dt6mdhcx7iemd6xtslf7um", + "skill/valory/task_execution/0.1.0": "bafybeieyikx3pvdjhya2qppbzywa2o2hgobn47enkygcf24ns3r7phdm7i", "skill/valory/websocket_client/0.1.0": "bafybeif7rrvsu6z4evqkhblxj3u6wwv2eqou576hgkyoehxuj7cntw7o2m", - "skill/valory/subscription_abci/0.1.0": "bafybeicnum426c4te77enoalhmthqirrhvswvyunvanjbljlhs2cob6zsa", - "agent/valory/mech/0.1.0": "bafybeib4wzpyfopo7curjyp5jvt35clri7mmpzyzbtmv5246bjxrkieelu", - "service/valory/mech/0.1.0": "bafybeic7uew3lt2kiely3a5jvizir5pcbnuuwzr6rmj75yydseiz744wqu" + "skill/valory/subscription_abci/0.1.0": "bafybeihmwomgbieeuo6ee3bnpmlmukvk46a6h6jyhjbloj3qqxjvbqsjsy", + "agent/valory/mech/0.1.0": "bafybeidhb465sfku4wozcrgq6ylsyek5vwgpwaeuiwujluh537f2j6vzgq", + "service/valory/mech/0.1.0": "bafybeia44aom4gr2oixulfbubs5thnaj4dcqsm2mysjepp5clcmg5rn3im" }, "third_party": { "protocol/valory/default/1.0.0": "bafybeifqcqy5hfbnd7fjv4mqdjrtujh2vx3p2xhe33y67zoxa6ph7wdpaq", diff --git a/packages/valory/agents/mech/aea-config.yaml b/packages/valory/agents/mech/aea-config.yaml index 7d5f2b24..682bf474 100644 --- a/packages/valory/agents/mech/aea-config.yaml +++ b/packages/valory/agents/mech/aea-config.yaml @@ -15,14 +15,14 @@ connections: - valory/p2p_libp2p_client:0.1.0:bafybeid3xg5k2ol5adflqloy75ibgljmol6xsvzvezebsg7oudxeeolz7e - valory/websocket_client:0.1.0:bafybeic4ag3gqc7kd3k2o3pucddj2odck5yrfbgmwh5veqny7zao5qayli contracts: -- valory/agent_mech:0.1.0:bafybeifj253ojkdr75ckrzb55su3j2v2hyb3v2ppqjwvvqyzbxanptebne +- valory/agent_mech:0.1.0:bafybeibvupi37fvzxlwpdokrd6eyxuo64j45icsti3atoprk6pvx6cpiye - valory/agent_registry:0.1.0:bafybeiarzhzs2wm2sl47qg37tqoc3qok54enxlcj6vx3hldozg537uslnq - valory/gnosis_safe:0.1.0:bafybeibq77mgzhyb23blf2eqmia3kc6io5karedfzhntvpcebeqdzrgyqa - valory/gnosis_safe_proxy_factory:0.1.0:bafybeib6podeifufgmawvicm3xyz3uaplbcrsptjzz4unpseh7qtcpar74 - valory/hash_checkpoint:0.1.0:bafybeicbycr6rxods7sg3f2qlhgkjqrbh7kymmy2yw7bewxdwjyp7ibtg4 - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y - valory/service_registry:0.1.0:bafybeicbxmbzt757lbmyh6762lrkcrp3oeum6dk3z7pvosixasifsk6xlm -- valory/mech_marketplace:0.1.0:bafybeich3a3oh5w4u533w6y7ideojudqp2m5gxta7pqmsfiaohdhuw7yz4 +- valory/mech_marketplace:0.1.0:bafybeib2cuv2tdrjp44y57drllpyh34t66y67zibefxmzyvmoupcb476uu protocols: - open_aea/signing:1.0.0:bafybeihv62fim3wl2bayavfcg3u5e5cxu3b7brtu4cn5xoxd6lqwachasi - valory/abci:0.1.0:bafybeiaqmp7kocbfdboksayeqhkbrynvlfzsx4uy4x6nohywnmaig4an7u @@ -39,12 +39,12 @@ skills: - valory/abstract_abci:0.1.0:bafybeihat4giyc4bz6zopvahcj4iw53356pbtwfn7p4d5yflwly2qhahum - valory/abstract_round_abci:0.1.0:bafybeih3enhagoql7kzpeyzzu2scpkif6y3ubakpralfnwxcvxexdyvy5i - valory/contract_subscription:0.1.0:bafybeiefuemlp75obgpxrp6iuleb3hn6vcviwh5oetk5djbuprf4xsmgjy -- valory/mech_abci:0.1.0:bafybeiajz42vtyvmm3bjmft7d6y3dodped2kh7h75zgqocym76twvpyejq +- valory/mech_abci:0.1.0:bafybeicbmmiw5wx26i3vs5nlh66d7oi74ezsyl7wshwrosxvibkyu6a6ze - valory/registration_abci:0.1.0:bafybeiek7zcsxbucjwzgqfftafhfrocvc7q4yxllh2q44jeemsjxg3rcfm - valory/reset_pause_abci:0.1.0:bafybeidw4mbx3os3hmv7ley7b3g3gja7ydpitr7mxbjpwzxin2mzyt5yam -- valory/subscription_abci:0.1.0:bafybeicnum426c4te77enoalhmthqirrhvswvyunvanjbljlhs2cob6zsa -- valory/task_execution:0.1.0:bafybeif7jsxbue6l7fhn5ahf7jbks5td6me55b42dy7k6s3j72zvu2p7ie -- valory/task_submission_abci:0.1.0:bafybeigoda6koeghcboflmz5e6r7yluk7fanpjso64b4am3w2szo2a65w4 +- valory/subscription_abci:0.1.0:bafybeihmwomgbieeuo6ee3bnpmlmukvk46a6h6jyhjbloj3qqxjvbqsjsy +- valory/task_execution:0.1.0:bafybeieyikx3pvdjhya2qppbzywa2o2hgobn47enkygcf24ns3r7phdm7i +- valory/task_submission_abci:0.1.0:bafybeigb3synomrwmducrnli6b6goykqxcp5dt6mdhcx7iemd6xtslf7um - valory/termination_abci:0.1.0:bafybeihq6qtbwt6i53ayqym63vhjexkcppy26gguzhhjqywfmiuqghvv44 - valory/transaction_settlement_abci:0.1.0:bafybeigtzlk4uakmd54rxnznorcrstsr52kta474lgrnvx5ovr546vj7sq - valory/websocket_client:0.1.0:bafybeif7rrvsu6z4evqkhblxj3u6wwv2eqou576hgkyoehxuj7cntw7o2m diff --git a/packages/valory/contracts/agent_mech/contract.py b/packages/valory/contracts/agent_mech/contract.py index 19001c07..2a6562c1 100644 --- a/packages/valory/contracts/agent_mech/contract.py +++ b/packages/valory/contracts/agent_mech/contract.py @@ -484,6 +484,7 @@ def get_deliver_to_market_tx( cls, ledger_api: LedgerApi, contract_address: str, + sender_address: str, request_id: int, data: str, mech_staking_instance: str, @@ -500,9 +501,12 @@ def get_deliver_to_market_tx( fn_name="deliverToMarketplace", args=[ request_id, - data, + bytes.fromhex(data), Web3.to_checksum_address(mech_staking_instance), mech_service_id, ], ) - return {"data": bytes.fromhex(tx_data[2:])} # type: ignore + simulation_ok = cls.simulate_tx( + ledger_api, contract_address, sender_address, tx_data + ).pop("data") + return {"data": bytes.fromhex(tx_data[2:]), "simulation_ok": simulation_ok} # type: ignore diff --git a/packages/valory/contracts/agent_mech/contract.yaml b/packages/valory/contracts/agent_mech/contract.yaml index d95c7644..e133c302 100644 --- a/packages/valory/contracts/agent_mech/contract.yaml +++ b/packages/valory/contracts/agent_mech/contract.yaml @@ -8,7 +8,7 @@ aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeigpq5lxfj2aza6ok3fjuywtdafelkbvoqwaits7regfbgu4oynmku build/AgentMech.json: bafybeifbx2dovjm7ufoufvxwb5n3tyfcwysecaggpcds4caanqlpfg5dqm - contract.py: bafybeib2wss3fjozfnocvt4yqpwso5ufdaln56q4ug7hwriqfx6u4e7fdu + contract.py: bafybeig5pnbegw4qw3vltgfaay5edf55bkeoewy5dqz6q7dsdclu2doxji fingerprint_ignore_patterns: [] class_name: AgentMechContract contract_interface_paths: diff --git a/packages/valory/contracts/mech_marketplace/contract.py b/packages/valory/contracts/mech_marketplace/contract.py index 9b952c65..7e41a9b2 100644 --- a/packages/valory/contracts/mech_marketplace/contract.py +++ b/packages/valory/contracts/mech_marketplace/contract.py @@ -47,6 +47,11 @@ "name": "_marketplace", "type": "address" }, + { + "internalType": "address", + "name": "me", + "type": "address" + }, { "internalType": "uint256[]", "name": "_requestIds", @@ -57,7 +62,7 @@ "type": "constructor" } ], - "bytecode": "0x608060405234801561001057600080fd5b5060405161078c38038061078c8339818101604052810190610032919061046d565b60008151905060008167ffffffffffffffff811115610054576100536102f4565b5b6040519080825280602002602001820160405280156100825781602001602082028036833780820191505090505b5090506000805b8381101561018d5760008673ffffffffffffffffffffffffffffffffffffffff1663cb261bec8784815181106100c2576100c16104c9565b5b60200260200101516040518263ffffffff1660e01b81526004016100e69190610507565b608060405180830381865afa158015610103573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101279190610607565b9050806060015163ffffffff1642106101815785828151811061014d5761014c6104c9565b5b6020026020010151848481518110610168576101676104c9565b5b6020026020010181815250508261017e90610663565b92505b81600101915050610089565b5060008167ffffffffffffffff8111156101aa576101a96102f4565b5b6040519080825280602002602001820160405280156101d85781602001602082028036833780820191505090505b50905060005b8281101561022b578381815181106101f9576101f86104c9565b5b6020026020010151828281518110610214576102136104c9565b5b6020026020010181815250508060010190506101de565b5060008160405160200161023f9190610769565b60405160208183030381529060405290506020810180590381f35b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102998261026e565b9050919050565b60006102ab8261028e565b9050919050565b6102bb816102a0565b81146102c657600080fd5b50565b6000815190506102d8816102b2565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61032c826102e3565b810181811067ffffffffffffffff8211171561034b5761034a6102f4565b5b80604052505050565b600061035e61025a565b905061036a8282610323565b919050565b600067ffffffffffffffff82111561038a576103896102f4565b5b602082029050602081019050919050565b600080fd5b6000819050919050565b6103b3816103a0565b81146103be57600080fd5b50565b6000815190506103d0816103aa565b92915050565b60006103e96103e48461036f565b610354565b9050808382526020820190506020840283018581111561040c5761040b61039b565b5b835b81811015610435578061042188826103c1565b84526020840193505060208101905061040e565b5050509392505050565b600082601f830112610454576104536102de565b5b81516104648482602086016103d6565b91505092915050565b6000806040838503121561048457610483610264565b5b6000610492858286016102c9565b925050602083015167ffffffffffffffff8111156104b3576104b2610269565b5b6104bf8582860161043f565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b610501816103a0565b82525050565b600060208201905061051c60008301846104f8565b92915050565b600080fd5b6105308161028e565b811461053b57600080fd5b50565b60008151905061054d81610527565b92915050565b600063ffffffff82169050919050565b61056c81610553565b811461057757600080fd5b50565b60008151905061058981610563565b92915050565b6000608082840312156105a5576105a4610522565b5b6105af6080610354565b905060006105bf8482850161053e565b60008301525060206105d38482850161053e565b60208301525060406105e78482850161053e565b60408301525060606105fb8482850161057a565b60608301525092915050565b60006080828403121561061d5761061c610264565b5b600061062b8482850161058f565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061066e826103a0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036106a05761069f610634565b5b600182019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6106e0816103a0565b82525050565b60006106f283836106d7565b60208301905092915050565b6000602082019050919050565b6000610716826106ab565b61072081856106b6565b935061072b836106c7565b8060005b8381101561075c57815161074388826106e6565b975061074e836106fe565b92505060018101905061072f565b5085935050505092915050565b60006020820190508181036000830152610783818461070b565b90509291505056fe", + "bytecode": "0x608060405234801561001057600080fd5b5060405161081738038061081783398181016040528101906100329190610511565b60008151905060008167ffffffffffffffff81111561005457610053610398565b5b6040519080825280602002602001820160405280156100825781602001602082028036833780820191505090505b5090506000805b838110156102055760008773ffffffffffffffffffffffffffffffffffffffff1663cb261bec8784815181106100c2576100c1610580565b5b60200260200101516040518263ffffffff1660e01b81526004016100e691906105be565b608060405180830381865afa158015610103573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101279190610692565b90508673ffffffffffffffffffffffffffffffffffffffff16816000015173ffffffffffffffffffffffffffffffffffffffff1614806101715750806060015163ffffffff164210155b80156101ad5750600073ffffffffffffffffffffffffffffffffffffffff16816020015173ffffffffffffffffffffffffffffffffffffffff16145b156101f9578582815181106101c5576101c4610580565b5b60200260200101518484815181106101e0576101df610580565b5b602002602001018181525050826101f6906106ee565b92505b81600101915050610089565b5060008167ffffffffffffffff81111561022257610221610398565b5b6040519080825280602002602001820160405280156102505781602001602082028036833780820191505090505b50905060005b828110156102a35783818151811061027157610270610580565b5b602002602001015182828151811061028c5761028b610580565b5b602002602001018181525050806001019050610256565b506000816040516020016102b791906107f4565b60405160208183030381529060405290506020810180590381f35b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610311826102e6565b9050919050565b600061032382610306565b9050919050565b61033381610318565b811461033e57600080fd5b50565b6000815190506103508161032a565b92915050565b61035f81610306565b811461036a57600080fd5b50565b60008151905061037c81610356565b92915050565b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6103d082610387565b810181811067ffffffffffffffff821117156103ef576103ee610398565b5b80604052505050565b60006104026102d2565b905061040e82826103c7565b919050565b600067ffffffffffffffff82111561042e5761042d610398565b5b602082029050602081019050919050565b600080fd5b6000819050919050565b61045781610444565b811461046257600080fd5b50565b6000815190506104748161044e565b92915050565b600061048d61048884610413565b6103f8565b905080838252602082019050602084028301858111156104b0576104af61043f565b5b835b818110156104d957806104c58882610465565b8452602084019350506020810190506104b2565b5050509392505050565b600082601f8301126104f8576104f7610382565b5b815161050884826020860161047a565b91505092915050565b60008060006060848603121561052a576105296102dc565b5b600061053886828701610341565b93505060206105498682870161036d565b925050604084015167ffffffffffffffff81111561056a576105696102e1565b5b610576868287016104e3565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6105b881610444565b82525050565b60006020820190506105d360008301846105af565b92915050565b600080fd5b600063ffffffff82169050919050565b6105f7816105de565b811461060257600080fd5b50565b600081519050610614816105ee565b92915050565b6000608082840312156106305761062f6105d9565b5b61063a60806103f8565b9050600061064a8482850161036d565b600083015250602061065e8482850161036d565b60208301525060406106728482850161036d565b604083015250606061068684828501610605565b60608301525092915050565b6000608082840312156106a8576106a76102dc565b5b60006106b68482850161061a565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006106f982610444565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361072b5761072a6106bf565b5b600182019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61076b81610444565b82525050565b600061077d8383610762565b60208301905092915050565b6000602082019050919050565b60006107a182610736565b6107ab8185610741565b93506107b683610752565b8060005b838110156107e75781516107ce8882610771565b97506107d983610789565b9250506001810190506107ba565b5085935050505092915050565b6000602082019050818103600083015261080e8184610796565b90509291505056fe", } @@ -153,7 +158,7 @@ def get_deliver_data( fn_name="deliverMarketplace", args=[ request_id, - data, + bytes.fromhex(data), delivery_mech_staking_instance, delivery_mech_service_id, ], @@ -186,7 +191,7 @@ def get_request_events( "tx_hash": entry.transactionHash.hex(), "block_number": entry.blockNumber, **entry["args"], - "contract_address": contract_address, + "sender": entry["args"]["requester"], } for entry in entries ) @@ -239,9 +244,10 @@ def has_priority_passed( cls, ledger_api: LedgerApi, contract_address: str, + my_mech: str, request_ids: List[int], ) -> Dict[str, Any]: - """Check the priority of the requests.""" + """Check if requests are ready to be delivered.""" # BatchPriorityData contract is a special contract used specifically for checking if the requests have passed # the priority timeout. It is not deployed anywhere, nor it needs to be deployed batch_workable_contract = ledger_api.api.eth.contract( @@ -249,8 +255,8 @@ def has_priority_passed( ) # Encode the input data (constructor params) - encoded_input_data = ledger_api.api.codec.encode_abi( - ["address", "address[]"], [contract_address, request_ids] + encoded_input_data = ledger_api.api.codec.encode( + ["address", "address", "uint256[]"], [contract_address, my_mech, request_ids] ) # Concatenate the bytecode with the encoded input data to create the contract creation code @@ -259,12 +265,12 @@ def has_priority_passed( # Call the function with the contract creation code # Note that we are not sending any transaction, we are just calling the function # This is a special contract creation code that will return some result - encoded_strategies = ledger_api.api.eth.call({"data": contract_creation_code}) + encoded_req_ids = ledger_api.api.eth.call({"data": contract_creation_code}) # Decode the raw response # the decoding returns a Tuple with a single element so we need to access the first element of the tuple, - request_ids = ledger_api.api.codec.decode_abi( - ["uint256[]"], encoded_strategies + request_ids = ledger_api.api.codec.decode( + ["uint256[]"], encoded_req_ids )[0] return dict(request_ids=request_ids) @@ -274,6 +280,7 @@ def get_undelivered_reqs( cls, ledger_api: LedgerApi, contract_address: str, + my_mech: str, from_block: BlockIdentifier = "earliest", to_block: BlockIdentifier = "latest", max_block_window: int = 1000, @@ -306,7 +313,7 @@ def get_undelivered_reqs( pending_tasks.append(request) request_ids = [req["requestId"] for req in pending_tasks] - eligible_request_ids = cls.has_priority_passed(ledger_api, contract_address, request_ids).pop("request_ids") + eligible_request_ids = cls.has_priority_passed(ledger_api, contract_address, my_mech, request_ids).pop("request_ids") pending_tasks = [req for req in pending_tasks if req["requestId"] in eligible_request_ids] return {"data": pending_tasks} diff --git a/packages/valory/contracts/mech_marketplace/contract.yaml b/packages/valory/contracts/mech_marketplace/contract.yaml index 8c7895dc..98fd067b 100644 --- a/packages/valory/contracts/mech_marketplace/contract.yaml +++ b/packages/valory/contracts/mech_marketplace/contract.yaml @@ -9,7 +9,7 @@ fingerprint: BatchPriorityPassedCheck.sol: bafybeie3hfpyss43sggqh5rjzwsqe7o37td4v4k6f3hlweiosnayyseo4i __init__.py: bafybeigqedpnruwcvjarngql7yfnpqwozvvgzcei2xcrp7mjf4ccspa62y build/MechMarketplace.json: bafybeiavaelxgltfzquszveskzn732c47tbkyoqd6gwbk3by6ky2n73rcm - contract.py: bafybeibuyclvqogginsusuf5h77iuhwsyustys2thptwcdilu6lk5oo7iq + contract.py: bafybeidwynzoz23yulmxdpe5ae6dx75ozbxm6v3zghzs7pyr6zfhkfkm4q fingerprint_ignore_patterns: [] class_name: MechMarketplaceContract contract_interface_paths: diff --git a/packages/valory/services/mech/service.yaml b/packages/valory/services/mech/service.yaml index 7ae966e7..4a04963b 100644 --- a/packages/valory/services/mech/service.yaml +++ b/packages/valory/services/mech/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeif7ia4jdlazy6745ke2k2x5yoqlwsgwr6sbztbgqtwvs3ndm2p7ba fingerprint_ignore_patterns: [] -agent: valory/mech:0.1.0:bafybeib4wzpyfopo7curjyp5jvt35clri7mmpzyzbtmv5246bjxrkieelu +agent: valory/mech:0.1.0:bafybeidhb465sfku4wozcrgq6ylsyek5vwgpwaeuiwujluh537f2j6vzgq number_of_agents: 4 deployment: agent: @@ -66,6 +66,8 @@ type: skill mech_to_subscription: ${MECH_TO_SUBSCRIPTION:list:[["0x77af31De935740567Cf4fF1986D04B2c964A786a",["0x0000000000000000000000000000000000000000","1"]]]} agent_funding_amount: ${AGENT_FUNDING_AMOUNT:int:200000000000000000} minimum_agent_balance: ${MINIMUM_AGENT_BALANCE:int:100000000000000000} + mech_staking_instance_address: ${MECH_STAKING_INSTANCE_ADDRESS:str:0x0000000000000000000000000000000000000000} + service_owner_share: ${SERVICE_SHARE:float:0} 1: models: params: @@ -103,6 +105,8 @@ type: skill agent_funding_amount: ${AGENT_FUNDING_AMOUNT:int:200000000000000000} mech_marketplace_address: ${MECH_MARKETPLACE_ADDRESS:str:0x0000000000000000000000000000000000000000} minimum_agent_balance: ${MINIMUM_AGENT_BALANCE:int:100000000000000000} + mech_staking_instance_address: ${MECH_STAKING_INSTANCE_ADDRESS:str:0x0000000000000000000000000000000000000000} + service_owner_share: ${SERVICE_SHARE:float:0} 2: models: params: @@ -140,6 +144,8 @@ type: skill mech_to_subscription: ${MECH_TO_SUBSCRIPTION:list:[["0x77af31De935740567Cf4fF1986D04B2c964A786a",["0x0000000000000000000000000000000000000000","1"]]]} agent_funding_amount: ${AGENT_FUNDING_AMOUNT:int:200000000000000000} minimum_agent_balance: ${MINIMUM_AGENT_BALANCE:int:100000000000000000} + mech_staking_instance_address: ${MECH_STAKING_INSTANCE_ADDRESS:str:0x0000000000000000000000000000000000000000} + service_owner_share: ${SERVICE_SHARE:float:0} 3: models: params: @@ -177,6 +183,8 @@ type: skill mech_to_subscription: ${MECH_TO_SUBSCRIPTION:list:[["0x77af31De935740567Cf4fF1986D04B2c964A786a",["0x0000000000000000000000000000000000000000","1"]]]} agent_funding_amount: ${AGENT_FUNDING_AMOUNT:int:200000000000000000} minimum_agent_balance: ${MINIMUM_AGENT_BALANCE:int:100000000000000000} + mech_staking_instance_address: ${MECH_STAKING_INSTANCE_ADDRESS:str:0x0000000000000000000000000000000000000000} + service_owner_share: ${SERVICE_SHARE:float:0} --- public_id: valory/task_execution:0.1.0 type: skill diff --git a/packages/valory/skills/mech_abci/skill.yaml b/packages/valory/skills/mech_abci/skill.yaml index f4c2dca4..62d7fdd3 100644 --- a/packages/valory/skills/mech_abci/skill.yaml +++ b/packages/valory/skills/mech_abci/skill.yaml @@ -23,10 +23,10 @@ skills: - valory/abstract_round_abci:0.1.0:bafybeih3enhagoql7kzpeyzzu2scpkif6y3ubakpralfnwxcvxexdyvy5i - valory/registration_abci:0.1.0:bafybeiek7zcsxbucjwzgqfftafhfrocvc7q4yxllh2q44jeemsjxg3rcfm - valory/reset_pause_abci:0.1.0:bafybeidw4mbx3os3hmv7ley7b3g3gja7ydpitr7mxbjpwzxin2mzyt5yam -- valory/task_submission_abci:0.1.0:bafybeigoda6koeghcboflmz5e6r7yluk7fanpjso64b4am3w2szo2a65w4 +- valory/task_submission_abci:0.1.0:bafybeigb3synomrwmducrnli6b6goykqxcp5dt6mdhcx7iemd6xtslf7um - valory/termination_abci:0.1.0:bafybeihq6qtbwt6i53ayqym63vhjexkcppy26gguzhhjqywfmiuqghvv44 - valory/transaction_settlement_abci:0.1.0:bafybeigtzlk4uakmd54rxnznorcrstsr52kta474lgrnvx5ovr546vj7sq -- valory/subscription_abci:0.1.0:bafybeicnum426c4te77enoalhmthqirrhvswvyunvanjbljlhs2cob6zsa +- valory/subscription_abci:0.1.0:bafybeihmwomgbieeuo6ee3bnpmlmukvk46a6h6jyhjbloj3qqxjvbqsjsy behaviours: main: args: {} diff --git a/packages/valory/skills/subscription_abci/skill.yaml b/packages/valory/skills/subscription_abci/skill.yaml index e0a9f435..8c38f1d9 100644 --- a/packages/valory/skills/subscription_abci/skill.yaml +++ b/packages/valory/skills/subscription_abci/skill.yaml @@ -18,7 +18,7 @@ fingerprint: fingerprint_ignore_patterns: [] connections: [] contracts: -- valory/agent_mech:0.1.0:bafybeifj253ojkdr75ckrzb55su3j2v2hyb3v2ppqjwvvqyzbxanptebne +- valory/agent_mech:0.1.0:bafybeibvupi37fvzxlwpdokrd6eyxuo64j45icsti3atoprk6pvx6cpiye - valory/gnosis_safe:0.1.0:bafybeibq77mgzhyb23blf2eqmia3kc6io5karedfzhntvpcebeqdzrgyqa - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y protocols: diff --git a/packages/valory/skills/task_execution/skill.yaml b/packages/valory/skills/task_execution/skill.yaml index 956b6fd4..a5ceeb0e 100644 --- a/packages/valory/skills/task_execution/skill.yaml +++ b/packages/valory/skills/task_execution/skill.yaml @@ -23,8 +23,8 @@ connections: - valory/ipfs:0.1.0:bafybeihndk6hohj3yncgrye5pw7b7w2kztj3avby5u5mfk2fpjh7hqphii - valory/p2p_libp2p_client:0.1.0:bafybeid3xg5k2ol5adflqloy75ibgljmol6xsvzvezebsg7oudxeeolz7e contracts: -- valory/agent_mech:0.1.0:bafybeifj253ojkdr75ckrzb55su3j2v2hyb3v2ppqjwvvqyzbxanptebne -- valory/mech_marketplace:0.1.0:bafybeich3a3oh5w4u533w6y7ideojudqp2m5gxta7pqmsfiaohdhuw7yz4 +- valory/agent_mech:0.1.0:bafybeibvupi37fvzxlwpdokrd6eyxuo64j45icsti3atoprk6pvx6cpiye +- valory/mech_marketplace:0.1.0:bafybeib2cuv2tdrjp44y57drllpyh34t66y67zibefxmzyvmoupcb476uu protocols: - valory/acn_data_share:0.1.0:bafybeih5ydonnvrwvy2ygfqgfabkr47s4yw3uqxztmwyfprulwfsoe7ipq - valory/contract_api:1.0.0:bafybeidgu7o5llh26xp3u3ebq3yluull5lupiyeu6iooi2xyymdrgnzq5i diff --git a/packages/valory/skills/task_submission_abci/behaviours.py b/packages/valory/skills/task_submission_abci/behaviours.py index 60f4e765..5f071705 100644 --- a/packages/valory/skills/task_submission_abci/behaviours.py +++ b/packages/valory/skills/task_submission_abci/behaviours.py @@ -375,6 +375,8 @@ def get_split_profit_txs( f"Split {profits} profits from mech {mech_address} into {split_funds}" ) for receiver_address, amount in split_funds.items(): + if amount == 0: + continue tx = yield from self._get_transfer_tx( mech_address, receiver_address, amount ) @@ -386,6 +388,9 @@ def get_split_profit_txs( return None txs.append(tx) + if len(txs) == 0: + self.context.logger.info("No profits to split, all transfer amounts are 0.") + return None return txs def _get_balance(self, address: str) -> Generator[None, None, Optional[int]]: @@ -950,10 +955,11 @@ def _get_deliver_marketplace_tx( """Get the deliver tx for the marketplace delivery.""" contract_api_msg = yield from self.get_contract_api_response( performative=ContractApiMessage.Performative.GET_STATE, # type: ignore - contract_address=self.params.mech_marketplace_address, + contract_address=task_data["mech_address"], contract_id=str(AgentMechContract.contract_id), contract_callable="get_deliver_to_market_tx", request_id=task_data["request_id"], + sender_address=self.synchronized_data.safe_contract_address, data=task_data["task_result"], mech_staking_instance=self.params.mech_staking_instance_address, mech_service_id=self.params.on_chain_service_id, @@ -969,7 +975,6 @@ def _get_deliver_marketplace_tx( data = cast(bytes, contract_api_msg.state.body["data"]) simulation_ok = cast(bool, contract_api_msg.state.body["simulation_ok"]) - data = cast(bytes, contract_api_msg.state.body["data"]) return { "to": task_data["mech_address"], "value": ZERO_ETHER_VALUE, diff --git a/packages/valory/skills/task_submission_abci/rounds.py b/packages/valory/skills/task_submission_abci/rounds.py index 123cd763..5074f207 100644 --- a/packages/valory/skills/task_submission_abci/rounds.py +++ b/packages/valory/skills/task_submission_abci/rounds.py @@ -241,13 +241,16 @@ class TaskSubmissionAbciApp(AbciApp[Event]): Event.ROUND_TIMEOUT: 60.0, } cross_period_persisted_keys: FrozenSet[str] = frozenset( - [get_name(SynchronizedData.done_tasks)] + [ + get_name(SynchronizedData.done_tasks), + get_name(SynchronizedData.final_tx_hash) + ] ) db_pre_conditions: Dict[AppState, Set[str]] = { TaskPoolingRound: set(), } db_post_conditions: Dict[AppState, Set[str]] = { - FinishedTaskPoolingRound: {"most_voted_tx_hash"}, + FinishedTaskPoolingRound: {"most_voted_tx_hash", "final_tx_hash"}, FinishedTaskExecutionWithErrorRound: set(), FinishedWithoutTasksRound: set(), } diff --git a/packages/valory/skills/task_submission_abci/skill.yaml b/packages/valory/skills/task_submission_abci/skill.yaml index 29a01716..cc7ab7b3 100644 --- a/packages/valory/skills/task_submission_abci/skill.yaml +++ b/packages/valory/skills/task_submission_abci/skill.yaml @@ -8,18 +8,18 @@ license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeiholqak7ltw6bbmn2c5tn3j7xgzkdlfzp3kcskiqsvmxoih6m4muq - behaviours.py: bafybeigdv2gcesycwjwoy62igcbhsr3cgszfzleb5fhl4lwmq7g57skntm + behaviours.py: bafybeidydtcw2cicb3dyrkgk53munaqvs6okc3vwn2txey47eifutayoku dialogues.py: bafybeibmac3m5u5h6ucoyjr4dazay72dyga656wvjl6z6saapluvjo54ne fsm_specification.yaml: bafybeidtmsmpunr3t77pshd3k2s6dd6hlvhze6inu3gj7xyvlg4wi3tnuu handlers.py: bafybeibe5n7my2vd2wlwo73sbma65epjqc7kxgtittewlylcmvnmoxtxzq models.py: bafybeifkca4krpykazv4tar4nfgaefwplpcia34zrdlvkiijf5anrxzcmu payloads.py: bafybeia2yorri2u5rwh6vukb6iwdrbn53ygsuuhthns2txptvjipyb6f4e - rounds.py: bafybeicqimk23sc7itxwcu372lyerwnqly4v7tv2pcl4krd53gdizdv6ae + rounds.py: bafybeidsu5b2aa6zr2lu4tcp2bibah2inw7bibdt6pia5d2bv5uojz726a tasks.py: bafybeicu5t5cvfhbndgpxbbtmp4vbmtyb6fba6vsnlewftvuderxp5lwcy fingerprint_ignore_patterns: [] connections: [] contracts: -- valory/agent_mech:0.1.0:bafybeifj253ojkdr75ckrzb55su3j2v2hyb3v2ppqjwvvqyzbxanptebne +- valory/agent_mech:0.1.0:bafybeibvupi37fvzxlwpdokrd6eyxuo64j45icsti3atoprk6pvx6cpiye - valory/agent_registry:0.1.0:bafybeiarzhzs2wm2sl47qg37tqoc3qok54enxlcj6vx3hldozg537uslnq - valory/gnosis_safe:0.1.0:bafybeibq77mgzhyb23blf2eqmia3kc6io5karedfzhntvpcebeqdzrgyqa - valory/multisend:0.1.0:bafybeig5byt5urg2d2bsecufxe5ql7f4mezg3mekfleeh32nmuusx66p4y