-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[#1172] Mutation testing support for Solidity #1335
Conversation
- replaced string literals with string constants.
- added 'mutate' option to compiler.
- added mutate option into combined json.
- preliminary implementation of 'mutate' option.
- added Mutation class to keep object code of a contract and its mutants.
- renamed Mutation class into LinkerMutation; - moved LinkerMutation into libenvasm.
- added AssemblyMutation class to pass assembly for a contract and its mutations; - replaced Assembly with AssemblyMutation keeping the code compilable and running as before for original compiler options. - implemented trivial handling of mutate option.
- passed mutate option down to code generation classes; - implementation is not finished: if a mutant had been created, it would be same as the ordinary contract.
- implemented mutation of compare operations.
- implemented mutation of arithmetic operations.
- added default branch to switch.
Thanks for the pull request! Unfortunately, this is a quite invasive change and I'm not sure how to best integrate it into the compiler. |
@chriseth, yes, the change looks big, but the options other than "mutate" work as before, and it is possible to review per commit. Each commit should compile and keep compiler functional. |
@chriseth, no chance for mutations being intergrated? |
@ameten I wonder how possible would it be doing this based on the JSON AST output? |
@axis, do you mean to create another utility totally separated from solc? |
Yes, I think this is what he means. It would be great if this could be done in a more "plugin-ish" way. |
@ameten trying to understand if the outputs generated by Solidity (the JSON AST for example) would enable writing this tool outside of the compiler |
@axic, yes, JSON AST can be used for mutation assuming that "src" defines the location of an operator. It is a possible approach but it has its drawbacks, though. |
I'm sorry, I know this was quite some work, but I have to close this now. If you want to talk about how te integrate these changes in another way, please don't hesitate to schedule a meeting. |
Update eip-1081 to add tags to the schema
What is the status of the mutation project for solidity?
I am asking because I have written a mutation tool and would like to share ideas and results. --pieter |
We plan to add ast-import to the compiler, i.e. compile bytecode starting from an AST instead of starting from source code. That's all we have and plan. Please share your ideas and results! Maybe you could open a new issue to discuss? Maybe the discussion would also be better suited with some external testing tool. |
I'm not sure how to open a new issue, but I'm happy to share some issues (below). All of these apply to the LegacyAST. I have found work-arounds for all of the issues, but the resulting code is not very pretty.
|
Sorry for the late reply, let me answer on your individual points.
|
I am working on the importAST feaure in this PR. re: legacyAST vs compactASTIf you haven't yet, I'd recommend that you have a look at that format. It is a lot more readable, and also complete for all kinds of programs. Also, the '''importAST''' function will only be available for the new version of the AST.
re: comment stripperin the compact AST, comments are in their own "documentation" field, so a stripper should be easy to do. |
@chriseth @djudjuu Thanks for your efforts on compact AST import. May I suggest to make a clear difference between a minimal set of properties that the compiler requires on AST input and a maximal set of properties that the compiler produces as AST output? A program transformation tool would then be able to use the rich output to generate new code, without actually having to do any analysis on the generated code, because the compiler can do this better. It would be convenient if the rich output could easily be stripped. I will let you know when the paper on our mutation tool is finished. Our current tool works only on the legacy AST, so we will have to rewrite it for the compact AST. |
Yep, that is the idea, export happens after analysis, but import re-starts the compiler just after parsing, i.e. before analysis, and it ignores any analysis data present in the import. |
No description provided.