-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: funds splitting logic #213
Conversation
@@ -529,7 +541,7 @@ def _accumulate_reqs_by_operator( | |||
agent_instances = list(reqs_by_agent.keys()) | |||
contract_api_msg = yield from self.get_contract_api_response( | |||
performative=ContractApiMessage.Performative.GET_STATE, # type: ignore | |||
contract_address=self.params.agent_registry_address, | |||
contract_address=self.params.service_registry_address, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure how this was ever working with this issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to set the env var when deploying, because the default is zero address:
service_registry_address: ${SERVICE_REGISTRY_ADDRESS:str:0x0000000000000000000000000000000000000000} |
# in case an agent maps to an operator that is the zero address | ||
# we need to remove it from the list of addresses that will receive funds | ||
# this can happen in case of changing agent instances in the service registry | ||
# old agent instances will map to the zero address, because they are still part of | ||
# usage history | ||
invalid_operator_reqs = accumulated_reqs_by_operator.pop(ZERO_ADDRESS, 0) | ||
|
||
# remove the invalid operator reqs from the total reqs, | ||
# so that we share 100% of the funds among the valid operators | ||
total_reqs -= invalid_operator_reqs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is critical, otherwise funds would be transferred to zero address
This PR fixes the funds splitting logic.