-
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
[Neo Core Fix] Check params at Calling Contract #3438
base: HF_Echidna
Are you sure you want to change the base?
Changes from 7 commits
f26303a
ad33527
c01ac8f
9f394f3
01ed4dc
bb6692b
5aa0d30
df39d45
9ced170
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,7 +319,12 @@ private ExecutionContext CallContractInternal(ContractState contract, ContractMe | |
state.CallingContext = currentContext; | ||
|
||
for (int i = args.Count - 1; i >= 0; i--) | ||
{ | ||
var a = args[i]; | ||
if (!CheckItemType(a, method.Parameters[i].Type)) | ||
Jim8y marked this conversation as resolved.
Show resolved
Hide resolved
|
||
throw new InvalidOperationException($"The type of the argument `{args[i]}` does not match the formal parameter."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be too harsh for mainnet contracts (even if enabled with hardfrok), this change may break some of them and even prevent them from update. What do you think about using the same approach as it was done for SC Events parameters check (#2810 (comment)): in next release we firstly enable a warning log in case of parameters mismatch, and then in the subsequent release we convert the log to an exception. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We have discussed this in the last meeting, check will only happen for newly deployed or updated contracts, this pr will be updated. |
||
context_new.EvaluationStack.Push(args[i]); | ||
} | ||
|
||
return context_new; | ||
} | ||
|
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 don't think it's correct for VM-compatible SC types, because for example, if you require stackitem to be Boolean, then Any just doesn't match this requirement.
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 see what you mean, will update.