Closed pyglot closed 2 years ago
I am thinking I might see if I can decorate some of the smartpy functions, such as sp.verify() rather than 'collecting' the errors with the ERR() helper function. If it is possible to do that update to smartpy from outside of the smartpy module, I think it's a better way of collecting the error messages.
There is an issue that became obvious in more complex scenarios with multiple contracts. So this is not in a useable state yet.
This is working for me now. Time for a quick review, @jagracar.
I am not sure if this should be taken in, or if it will cause a bit of clutter. I am fine with it being put on hold or directed elsewhere.
The end product is a way to track most smart contract errors (providing the error-generating methods get triggered during test execution). It will then check what metadata is pre-recorded and see if it matches up to execution and if it looks 'compliant'. I have no deep understanding of TZIP-16, so don't trust my code on what it says is compliant!
There are no requirements and I tested with Python 3.8.
My own thoughts include:
teia_sc
or if it should even belong inside the same repository.Looks good! Let me know if you want to merge it.
The main problem i see is that one cannot copy paste the contracts to the smartpy gui and compile them. One will need to remove the import and the couple of lines involved, but it's not a big issue.
There's still an issue with reading/setting up metadata when the contract is initialized with the metadata from ipfs function. Basically the input doesn't make too much sense. I think it will be an easier fix to accept it, but I didn't have time to look at it in any detail, yet.
Merged!
This commit adds a
teia_sc.error_collection
module which allows an option to collect error metadata. The main use is to encapsulate tests and methods related to producing consistent and compliant TZIP-16 error metadata.The first commit implements an example in daoToken only:
Results in
output/tests/daoToken/Lint_FAILWITH_messages/log.html
, and in contract metadata under "errors", e.g. see Metdata tab inoutput/tests/daoToken/Test_set_metadata/log.html
The code has not been linted yet, but might be ok to take a look at now, at a high level.