-
Notifications
You must be signed in to change notification settings - Fork 465
Can't call into contract method taking an array of structs #1574
Comments
This is a big problem for market-making and making a python DEX using 0x (e.g. pydex). If it is not fixed, we will have to abandon our python market maker... I would like to lobby for this to be fixed as soon as possible. |
@officialcryptomaster I want to signal my support here, so that we can grow the python ecosystem. apparently this relates to web3.py and hopefully can be fixed there |
I agree with everyone here. Can't execute anything on-chain with an array of SignedOrders in python right now. |
To be clear, the place to implement this support is in the Ethereum foundation's web3.py library. We can implement it in our fork, to get things working sooner rather than later, but ultimately, in order to make life easy, we need full tuple support (including support for arrays of them) in the mainline web3.py library. See ethereum/web3.py#829 |
@feuGeneA Any workaround you can suggest would be great because honestly this is a pretty major roadblock for the python eco-system and we are very motivated to have some sort of workaround as python web3 moves too slow... |
@officialcryptomaster @michaelhly @benjyZ I've released a new version of the The PR does contain one additional useful change, adding to order utils a dependency on |
@feuGeneA This is great news! thank you! |
Expected Behavior
Be able to call
Exchange.marketBuyOrders()
without raising an exception.Current Behavior
Making this call results in an exception:
ValueError: No matching entries for 'tuple' in encoder registry
. (Interestingly, this is the same exception given when there is no tuple support.)Solution
The problem is that our fork of web3.py isn't supporting arrays of tuples. We need to modify
web3._utils.abi.get_abi_inputs()
to be able to detect arrays of tuples in addition to single tuples.Steps to Reproduce
Add the following line to
zero_ex.contract_demo.test.test_exchange.test_get_order_info()
:Context
Discord user frak, working for CoinAlpha, contacted me about this problem. They are getting signedOrders from RadarRelay and trying to fill them using
marketBuyOrders
. They have a workaround, callingfillOrder
multiple times.But this problem is more general than just supporting
marketBuyOrders
. The problem affects all methods that take or return arrays of structs. Skimming our contract docs, that's about 10 methods on theExchange
contract.The text was updated successfully, but these errors were encountered: