rocklabs-io / ic-py

Python Agent Library for the DFINITY Internet Computer
MIT License
127 stars 26 forks source link

"field id collision or not sorted" error #28

Closed jbroudou closed 2 years ago

jbroudou commented 2 years ago

Attempting to get the details of a proposal

iden = Identity()
client = Client()
agent = Agent(iden, client)
params = [
    {'type': Types.Nat64, 'value': 43117}
]
name = agent.query_raw("rrkah-fqaaa-aaaaa-aaaaq-cai", "get_proposal_info", encode(params))

results in the error

candid.py", line 977, in readTypeTable
    raise "field id collision or not sorted"
TypeError: exceptions must derive from BaseException

I see that from debugging the IC has returned a response to my request, but the error occurs in decoding.

Myse1f commented 2 years ago

I ran the code above and get the following result:

[{'type': 3871088705, 'value': [{'_23515': [{'_23515': 43117}], '_100394802': 1, '_338645423': 4, '_568110681': [], '_718522127': [], '_1120297033': 1644013994, '_1138543385': 0, '_1380048431': [1644419677], '_1453869204': 0, '_1659864270': 100000000, '_2084260468': [{'_24641': 1142447551073097, '_6039847': 3570800010389126, '_338842564': 40538514298239389, '_4174818006': 1644284604}], '_2139208002': 1, '_2756235859': 0, '_3000310834': [{'_5843823': '', '_272307608': ['Where to Learn About IC Governance'], '_373701558': [{'_4294048342': {'_1294802582': ''}}], '_2162756390': 'The first two proposals in this series were intended to explain how participants in governance are incentivized to participate and why some of those incentives will be changing.  This proposal provides a list of references that are useful for learning about and engaging in discussions about IC governance.\n\nA new Internet Computer Wiki has been started in recent weeks and already has great content that is easy to reference in community conversations.  This wiki also contains links to numerous medium.com articles that are published by Dfinity, which include tokenomics and governance information.  https://wiki.internetcomputer.org/wiki/Internet_Computer_wiki\n\nThe Dfinity developer Forum is the go to place for active and highly engaged discussion on current and past governance topics. Select the Governance or Roadmap categories to see deliberation topics on current and upcoming proposals.  https://forum.dfinity.org/\n\nThe Dashboard is where you can see all current and past proposal details and voting results.  Select the Governance section and filter by Topic if you want to see governance proposals only.  https://dashboard.internetcomputer.org/\n\nGovernance topics are commonly discussed in various social media circles such as:\nICP Maximalist Network on Telegram (https://t.me/icpmaximalistnetwork)\nInternet Computer Weekly podcast with Arthur Falls from cycledao.xyz\nTwitter Spaces with @ICDevs_org, @weedpatchtwo, @BobBodily, @lastmjs, @icpjesse\n\n\nSpecial thanks to well known IC community member @EasyStevie_e for this Twitter thread on 2/2/22 expressing his opinion about this series of educational governance proposals:\nMy take on an interesting proposal:  You may believe this proposal doesn’t effectively do anything, and you would be correct.  You could also say this proposal does in fact do something, and you would be correct. The purpose is to raise awareness about voting incentives and the power of liquid democracy to drive future participation. No matter the result there will be no change to NNS governance. However, there will be a change within NNS governance. Voter turnout is already incredible with over 9.58% on day 1. If a set of proposals that effectively do nothing spark conversation and increase voter turnout by a statistically significant amount then you could factually say they do change NNS Governance. I view this proposal to be asking if you are in favor of increased participation in our liquid democracy. Voting yes or no serves as a Yes vote, to abstain serves as a No vote. I voted yes as I believe the positive psychological impact to be greater than no. If you disagree with the NNS being used in this way I understand. You could argue that this is a misuse of governance proposals and have a leg to stand on. Fortunately this is a liquid democracy, you can submit a proposal to prevent this type of behavior from happening.  Whether a counter proposal would pass or not, the original proposal has achieved its purpose. It made us discuss, change, vote, and adapt.  This community is so insane and brilliant. Not a day goes by where I don’t count myself thankful for being a part of it. '}], '_3000311732': [{'_23515': 12008772471346176261}], '_4133454822': 0}]}]

Perhaps you are using ic-py installed by pip. Some bugs were fixed in recent commits. This repo is under development. Maybe you should clone the main branch of ic-py and install it.

jbroudou commented 2 years ago

Thanks. Using the version of the repo fixed that problem.