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
[BUG] The CairoSerializer cannot handle names starting with a underscore #260
Comments
Drecord doesn't have equality implemented which is quite a complex feature. We have a couple of ideas we want to try - @war-in will handle this one. |
Or me if he's too busy ;) |
If you are going to decode any Cairo data you could try using CairoSerializer. It can decode all cairo structures if their types are known :) There is a section in our documentation about it: https://starknetpy.readthedocs.io/en/latest/guide.html#using-cairoserializer |
I am using it :) The problem here, is that such a Cairo function will break the serializer: func foo(_arg : felt):
return ()
end
https://docs.python.org/3/library/collections.html#collections.namedtuple states:
|
And reading again the namedtuple limitation, it means arguments names like "class, for, return, global, pass, raise" will be problematic too. There are quite specific though. |
Yeah, I know that my comment doesn't close the issue, but you mentioned FunctionCallSerializer and I thought that you didn't know about CairoSerializer because it is the relatively new one. |
Oh OK :) |
I've a Cairo contract using names starting with a underscore. And using the
FunctionCallSerializer
for get back data from Cairo to Python (to decode transactions return data) will raise:It's a namedtuple limitation, from here:
starknet.py/starknet_py/utils/data_transformer/data_transformer.py
Lines 207 to 209 in 36acd9f
Python version
All.
Expected Behavior
Names starting with a underscore should not be a problem.
Current Behavior
Possible Solution
rename
kwargs from the namedtuple, but will would loose the real name then.Steps to Reproduce
FunctionCallSerializer.to_python()
.Context (Environment)
The issue is quite big, because we're using the
FunctionCallSerializer
in the Ape StarkNet plugin to decode transactions return data. The goal is to leverage all the fantastic work you've already done to decode all kind of data types (like arrays, and custom complex structs).Detailed Description
Possible Implementation
I like the 3rd idea. If you think it's something you would like to implement, I could give a try.
The text was updated successfully, but these errors were encountered: