Closed trentmc closed 1 year ago
Marked as high priority (at least to do part 1), because it's blocking users of a current Data Challenge.
I will fix it in ocean.py
@trentmc after merging the last part of the interface simplification in #1220, we can resume this.
Summary
Steps to solve this issue, while keeping ocean.py code clean & maintainable:
Background & motivation
Traceback shared by Alex:
@alexcos20 's Q: does ocean.py 2.0.0a4 knows how to handle different templates ?
Here's the code inside ocean_assets.py::download_file():
Trent notes:
download_file()
We need to do three things to fix this:
download_file()
, enable download of assets that are {"free", "enterprise template", allowed_swapper != ZERO}. See "summary" at the top of this issue, and belowDetails For (1): tactical fix for the user, now
Here's the fix for the user: whoever is the owner of that asset, needs to set allowedSwapper to 0x000...000, via a call to
Dispenser.sol::setAllowedSwapper()
. It could be via etherscan, ocean.js, or ocean.py. Here's the key line for ocean.pyExample in python
Details for (2): definitive fix in market
Goal: so that when assets are published as "free" in Ocean Market, anyone can dispense() them
Like mentioned, we had this issue before - see market#1725 - opened on Oct 4, closed Nov 15.
But it seems like it's not fixed, given the behavior above.
Here's the PR that aimed to fix it.
To recap: the issue in Ocean Market is: when publishing a free asset, in Ocean Market, people think that assume that anyone can actually download it. Yet dispense() doesn't work -- not only in ocean.py, but also anywhere else that people would try, like etherscan or web3.js.
Did the PR actually fix it? Investigating, the answer is no. https://github.com/oceanprotocol/market/blob/0ccd375738d3f51d23a66f9e0576a0f3b412a6fd/app.config.js#L21
Towards solving, market#1725 has been re-opened.
Details for (3): definitive fix in ocean.py
Note: the "summary" at the top of this issue is for (3).
Goal: enable download of assets that are {"free", "enterprise template", allowed_swapper != ZERO}
Note that ocean_assets::download_file() did work for both templates, exactly as expected.
So how does it relate to the issue at hand? ocean_assets::download_file() already works for {"free", "enterprise template", allowed_swapper == ZERO} but because "enterprise template" weirdly set allowed_swapper != ZERO, even for "free", and that default is not changeable, we want to find a workaround, so ocean.py can the asset anyway. That is: download in the case of {"free", "enterprise template", allowed_swapper != ZERO}
A tool:
Datatoken.sol::dt.buy_from_dispenser_and_order()
But we can use this quirk as a workaround: