-
Notifications
You must be signed in to change notification settings - Fork 1k
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
GetInvocationCounter #813
GetInvocationCounter #813
Conversation
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.
@shargon, this is an interesting thing, is there any use that you have already discussed?
} | ||
else | ||
{ | ||
engine.InvocationCounter[contract.ScriptHash] = 1; |
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.
Shargon, could this Dictionary be already initialized in 1 and avoid this if?
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.
we need to increment the value, so you need to query the previous value
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.
Yes, but I mean, for the first time initialize already with 1 and then just increment.
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 would simplify the if.
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.
It's initialized to 1 when it is not found
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.
Shargon I'll review, but we also have a related interesting and complementary solution to this.
Is not related, is according to this issue #307 |
@erikzhang could you compute the gas cost? |
Codecov Report
@@ Coverage Diff @@
## master #813 +/- ##
=========================================
+ Coverage 38% 38.41% +0.4%
=========================================
Files 176 176
Lines 12443 12459 +16
=========================================
+ Hits 4729 4786 +57
+ Misses 7714 7673 -41
Continue to review full report at Codecov.
|
Co-Authored-By: Erik Zhang <[email protected]>
Co-Authored-By: Erik Zhang <[email protected]>
* GetInvocationCounter * UT as sample * Fix travis * Update neo/SmartContract/InteropService.cs * Update neo/SmartContract/ApplicationEngine.cs Co-Authored-By: Erik Zhang <[email protected]> * Update neo/SmartContract/InteropService.cs Co-Authored-By: Erik Zhang <[email protected]> * We need Writable dictionary * internal
Close #307