Open ccrvlh opened 1 year ago
Quickly looking through the code, it seems the only place this is relevant is the recoverHash
function from web3. It seems this was deprecated a while ago https://github.com/ethereum/eth-account/pull/195/files and recover_message
is the method that replaced it.
This method looks fairly straight forward: https://github.com/ethereum/eth-account/blob/8249380b085e6e09dd895c4d6239612eee4a781c/eth_account/account.py#L462-L463
Where keccak
seems to be SHA3, and I think hashlib
has this native, so I wonder if the dependency would even be necessary (given that web3 and eth_account have had some API stability issues in the past).
That all being said, I think it could probably make sense to isolate the web3
interaction to a new file something like:
class Web3:
@classmethod
def recover_address(cls, claim, proof):
pass
And and that a class attribute to ResourceComponent
. That would isolate the interaction with web3 like defunct_hash_message
and recover_message
and others, also a lot easier to mock (vs mocking the whole library now).
The last thing I can think of, would be to add a conftest
with some fixtures with autouse=True
so to avoid the fairly complex fixture chaining in the TestTokenValidate
like:
hey @ccrvlh. Or anyone that needs this still. I've been having the same issues so I have uploaded a revisited version of this package on pypi that supports python 3.9,3.10, 3.11. https://github.com/luisgj/magic-admin-python-v2.
You can install it with the name pip install cool-magic-admin
I've opened PR #92 with the fixes but the team hasn't been maintaining the package for a while 🤷🏻
✅ Prerequisites
magic-admin-python
)?🐛 Description
Currently magic-admin depends on web3 < 6, which has issues with Python 3.11 (because of
getargspec
frominspect
). It seems this issue was fixed with web3 6.10. So in practice we can't use magic with Python 3.11 and are restricted to 3.10. This means that the docs are imprecise (only works 3.7 - 3.10) and with 3.12 being release next week and 3.11 being stable, it would make sense to handle the different web3 versions.