-
Notifications
You must be signed in to change notification settings - Fork 81
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
Replace NEP-5 with NEP-17 #1558
Conversation
And take a look at RPC client also, |
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.
There's also a binary file added (cli/testdata/verify.nef
), do we need it?
@@ -402,6 +409,10 @@ func (o *Oracle) verify(ic *interop.Context, _ []stackitem.Item) stackitem.Item | |||
return stackitem.NewBool(ic.Tx.HasAttribute(transaction.OracleResponseT)) | |||
} | |||
|
|||
func (o *Oracle) onPayment(_ *interop.Context, _ []stackitem.Item) stackitem.Item { | |||
return stackitem.Null{} |
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.
Just a question, don't we need to check that calling script hash is GAS and panic if not? Otherwise, Oracle contract will accept any other token.
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.
I think this needs to be discussed with core devs. I mean, it's correct and expected behavior, but at the same time we need to be compatible.
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.
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.
Fixed, allow GAS only.
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.
There is a problem with this: when invoking native methods directly, calling script hash is not updated. And when invoking them via contract.Call
, GAS is spent.
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.
Same problem in neo-project/neo#2094.
Codecov Report
@@ Coverage Diff @@
## master #1558 +/- ##
==========================================
+ Coverage 77.54% 77.58% +0.04%
==========================================
Files 233 233
Lines 18413 18438 +25
==========================================
+ Hits 14278 14306 +28
+ Misses 3120 3116 -4
- Partials 1015 1016 +1
Continue to review full report at Codecov.
|
pkg/vm/context.go
Outdated
// InvocationState contains return convention and callback to be executed on context unload. | ||
type InvocationState struct { | ||
// Callback is executed on context unload. | ||
Callback func(ctx *Context) |
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.
Do we really need it?
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 don't need it now, though it exists in C# code.
If we remove it, some tests for native contract will also be removed. I am ok with both variants, as we have it covered with tests.
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.
I think we better not introduce things not need for the protocol to work. I'd say it's an internal C# thingie (that's not really used even there), so we can not complicate our code with it.
@@ -402,6 +409,10 @@ func (o *Oracle) verify(ic *interop.Context, _ []stackitem.Item) stackitem.Item | |||
return stackitem.NewBool(ic.Tx.HasAttribute(transaction.OracleResponseT)) | |||
} | |||
|
|||
func (o *Oracle) onPayment(_ *interop.Context, _ []stackitem.Item) stackitem.Item { | |||
return stackitem.Null{} |
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.
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.
supportedstandards in YAML files were not updated to nep-17.
When native method calls other contract result should be put on the stack of current context. With oracles this problem wasn't noticed because of void return type.
Sometimes amount of GAS consumed depends on block height.
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.
@AnnaShaleva: take a look and you can use data
in onPayment
now.
Name
field to manifest.TODO