dumpnef intakes manifest to find method starts#1293
dumpnef intakes manifest to find method starts#1293shargon merged 5 commits intoneo-project:masterfrom
Conversation
| /// <param name="debugInfo">The debug information. If available, provides source code comments in the dumped assembly.</param> | ||
| /// <param name="manifest">The contract manifest. Provides method start comments. Not necessary if debugInfo is available</param> | ||
| /// <returns></returns> | ||
| public static string GenerateDumpNef(NefFile nef, JToken? debugInfo, ContractManifest? manifest = null) |
There was a problem hiding this comment.
We should have a unit test for this method, I don't know well the final output, because maybe we need to makes different between if the method comes from manifest or from debugInfo
There was a problem hiding this comment.
We should have a unit test for this method, I don't know well the final output, because maybe we need to makes different between if the method comes from manifest or from debugInfo
nccs YourContract.csproj --assembly or nccs YourContract.nef --assembly generates the dumpnef text file. The content is just assembly instructions with comments. The method name from debugInfo is much longer and more accurate, because it contains the namespace and class names from the source code. For example, # Method Start Neo.Compiler.CSharp.TestContracts.Contract_WriteInTry.Write(). Method names from manifest is much more concise, like # Method Start totalSupply
There was a problem hiding this comment.
Maybe we add a new entry for the manifest?
# Public Method: xxxx
There was a problem hiding this comment.
Maybe we add a new entry for the manifest? # Public Method: xxxx
I am still thinking about this. Do we need to include both # Method Start and # Public Method, or only one of them?
I think my original codes are the most reliable😂😭. People dumpnef because they need an assembly document commented well by source codes, and the debugInfo has to be correct for this. If the debugInfo is wrong, a user can try again without the debugInfo.
Also there exists a compilation pattern moving the public method entry point in the manifest to somewhere else (without moving the address in the debugInfo), in order to initialize the non-static variables in the contract class. With this pattern the manifest is even less reliable than the debugInfo, because the user has more difficulty finding the actual method implementation in the dumpnef document.
There was a problem hiding this comment.
Maybe we add a new entry for the manifest? # Public Method: xxxx
I think it is good if we write entry address keys from manifest, if it is not written by the debugInfo.
There was a problem hiding this comment.
@Hecate2 make the changes and I will approve it, but it would be nice to have the expected result somewhere
There was a problem hiding this comment.
Will try to have some nice tests.
Co-authored-by: Hecate2 <2474101468@qq.com>
|
Still struggling to balance the restriction and correctness of tests |
|
Tests ready. Difficult to include more strict tests. |
* dumpnef intakes manifest to find method starts * Update src/Neo.Compiler.CSharp/Optimizer/DumpNef.cs * Update src/Neo.Compiler.CSharp/Optimizer/DumpNef.cs Co-authored-by: Hecate2 <2474101468@qq.com> * DumpNef test --------- Co-authored-by: Shargon <shargon@gmail.com>
* dumpnef intakes manifest to find method starts * Update src/Neo.Compiler.CSharp/Optimizer/DumpNef.cs * Update src/Neo.Compiler.CSharp/Optimizer/DumpNef.cs Co-authored-by: Hecate2 <2474101468@qq.com> * DumpNef test --------- Co-authored-by: Shargon <shargon@gmail.com>
Useful for deployed contracts without debugInfo