-
Notifications
You must be signed in to change notification settings - Fork 77
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
vm: pretty-print remaining opcodes #1231
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1231 +/- ##
==========================================
- Coverage 68.07% 68.05% -0.02%
==========================================
Files 215 216 +1
Lines 18508 18524 +16
==========================================
+ Hits 12599 12607 +8
- Misses 5227 5235 +8
Partials 682 682
Continue to review full report at Codecov.
|
Looks nice (from the test contract):
|
I haven't implemented maps from id-to-name and reverse, because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg/core/interop/names/names.go
Outdated
@@ -0,0 +1,66 @@ | |||
package names | |||
|
|||
var names = []string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I wanted to avoid --- yet another name registry duplicating declarations made by interops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a perfect case for some code-generation tool, but Go isn't very friendly to those, so as a compromise I think we can make the following:
- add
interopnames
(notnames
, please) package that would just contain string constants for all interop functions. - use its constants for interop registrations
- use its constants for id-to-name in vm/cli
At least that would remove string duplication that is very easy to make error in. It still leaves some potential for constant usage to get out of sync, but that's unavoidable given the constraints we have.
Allow to convert interop id to it's name.
There are a few opcodes which have parameter but are not yet pretty-printed. Fix this.