Use VMInstruction.ToString for parse script listings - #1097
Open
cschuchardt88 wants to merge 5 commits into
Open
Use VMInstruction.ToString for parse script listings#1097cschuchardt88 wants to merge 5 commits into
cschuchardt88 wants to merge 5 commits into
Conversation
ScriptsToOpCode printed opcodes with a separate format from VMInstruction.ToString. Share one layout: position, opcode, and operand only when present. Keep the Lxxxx line prefix in parse output.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master-n3 #1097 +/- ##
=============================================
+ Coverage 50.88% 51.61% +0.73%
=============================================
Files 284 284
Lines 16660 16747 +87
Branches 2137 2155 +18
=============================================
+ Hits 8477 8644 +167
+ Misses 7619 7523 -96
- Partials 564 580 +16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Readable ASCII (including punctuation) is shown after the hex. Otherwise 20/32/33/65-byte payloads use UInt160, UInt256, or ECPoint ToString. Unix seconds or milliseconds in 2000-2100 are annotated on PUSHINT and 4/8-byte PUSHDATA.
Require Utf8.IsValid and reject control runes. Allow any printable Unicode, not only ASCII letters and digits.
Control characters in UTF-8 text comments are written as \n \r \t \0 or \xNN so they do not break the listing. Untyped payloads get // blob N bytes.
D04 is the minimum. Larger scripts use more decimal digits for Lxxxx and more hex digits for the instruction position.
17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
parse/ScriptsToOpCodenow uses a singleVMInstruction.ToString()layout, andDecodeOperandannotates operands instead of dumping raw hex.Changes
ToString()is{position} {opcode}plus operand only whenOperandSize > 0. Hex position width is at least 4 and grows with script length.ScriptsToOpCodeprefixes that withL{n}:. Decimal width is at least 4 (D04) and grows with the script size / instruction count (so listings longer than 9999 lines still line up).PUSHDATA*text (Utf8.IsValid) is shown ashex // text. Control runes are escaped (\n,\r,\t,\0,\xNN) so they do not create real newlines in the listing.ECPoint→hex // {point}UInt160/ 32-byteUInt256→hex // {hash}PUSHINT32/PUSHINT64and 4/8-bytePUSHDATAhex // blob N bytes.Example
parselisting of this Base64System.Contract.Call(updateFeeds, …)script: