Handle circular type dependencies in AbiSerializer
You can crash eosd submitting a json abi with
...
"types": [{}]
...
I debugged this issue and found the following stack trace when it crashes:
eos::types::AbiSerializer::isArray(fc::fixed_string<fc::array<unsigned long, 4ul> > const&) const () eos::types::AbiSerializer::arrayType(fc::fixed_string<fc::array<unsigned long, 4ul> > const&) const () eos::types::AbiSerializer::isType(fc::fixed_string<fc::array<unsigned long, 4ul> > const&) const ()
Apparently AbiSerializer::isArray(...) needs to check for null Types I believe.
Fixed and raised a pull request. It now displays following error instead of crashing node:
ubuntu@ip-172-31-23-80:~/eos/build/programs/eosc$ ./eosc --wallet-port 7777 set contract currency ../../contracts/currency/currency.wast ../../contracts/currency/currency.abi Reading WAST... Assembling WASM... Publishing contract... 2016284ms thread-0 main.cpp:768 main ] Failed with error: 10 assert_exception: Assert Exception status_code == 200: Error : 10 assert_exception: Assert Exception isType(td.type): invalid type {"type":""} thread-0 AbiSerializer.cpp:104 setAbi
The described issue seems fixed. However, the subject suggests a feature improvement for ABI serializer about circular dependencies. @elmato if that is the case, please open a new issue with a full description of the enhancement you want to add to AbiSerializer
closed by #380
@wanderingbort @pavybez The above PR finish this issue preventing circular references in types and structs and also enforcing structs to inherit only from struct