nucypher
nucypher copied to clipboard
NotFound is not being caught and converted into a 404; Bob is also not properly catching it.
During my investigation of #833, I thought it odd that, once a Policy has been revoked, we expect that Bob will encounter NotEnoughUrsulas:
https://github.com/nucypher/nucypher/blob/6bdde8d7c46f1dd7470f3d8c67349a004645f701/tests/characters/test_bob_joins_policy_and_retrieves.py#L116
Now... maybe, at a high-level, this is true - we expect that Bob will treat any 404 as insufficient, and ultimately conclude that there are Not Enough Ursulas to complete the retrieval.
The problem is that this is not at all why this is happening. Instead, it "works" for a terrible reason - and it's the same reason that #833 is broken in the first place: that Bob doesn't generate new work orders once he has retrieved. So if he generates zero work orders, he reaches out to zero Ursulas. And of course zero is not enough!
Why would Bob even want to try to retrieve if he has the response already (and cached)?
Hey buddy, take yer cached cfrags right over to #833.
Yup. Do we even want Bob to know whether he was revoked, btw? (Can probably safely assume so if number of Ursulas is 0?)
Well... let's see.
If even a single Ursula in the TreasureMap gives Bob a 404 for a valid Arrangement ID, then Bob knows either that his Policy has been revoked or that Ursula is not responding correctly.
We can probably right like that in the error message then? Like, "Not enough Ursulas (1 < 7), or the policy has been revoked"
Or, when found 0 Ursulas, we can say "likely" instead of "or"