-
Notifications
You must be signed in to change notification settings - Fork 102
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
Added new syscalls - GetInvocationCounter and GetNotifications #95
Conversation
Can you please try to use it @belane? To see if it's responding correctly... like first invocation of kind.. second invocation.. etc. "mint" should be done only once, to simplify implementation. |
Ah, it's breaking by format now... could you run a P.S.: that's the first proof that the travis is working well to keep formats well-done 💪 |
Also, could you add the notifications? |
|
On |
@@ -0,0 +1,8 @@ | |||
namespace Neo.SmartContract.Framework.Services.Neo | |||
{ | |||
public class Notification : IScriptContainer |
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 this works, and it doesn't makes sense to inherit from IScriptContainer, bacause Notification is not a ScriptContainer.
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.
Need to adjust into object[] pair.
@igormcoelho I think we can revert the last commit. I believe that returning |
Erik, I agree it could work, but it's a very unsafe side effect to rely on. If we want Notification to have its own life, we should create an Interop object for it, not treat it as an Array. At best scenario, it would be a Struct, not an Array... if that's intended perhaps we can create a Struct stack item on Notifications push, that's slightly better.... I mean, if it's worth risking, let's do it // as struct
engine.CurrentContext.EvaluationStack.Push(notifications.Select(u => new VM.Types.Struct(new StackItem[] { u.ScriptHash.ToArray(), u.State })).ToArray());
// instead of array
engine.CurrentContext.EvaluationStack.Push(notifications.Select(u => new VM.Types.Array(new StackItem[] { u.ScriptHash.ToArray(), u.State })).ToArray());
For me it's good to revert, I'm just saying, it's not 100% correct in my opinion. |
What risk do you mean? We convert |
I never thought this was official (for |
This reverts commit 9d8b5a8.
We need to deal with the class, because is easier for devs. |
Maybe need to be a struct? |
@belane please confirm that this works for NEP-5 template... as Erik said, if class and array are equivalent for NeoVM, this should be fine. |
I will make some unit test for both syscalls |
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.
@erikzhang, it is quite confusing like this.
We used to consider that struct
is also a class
when programming in C++. How is it in C#?
Perhaps we could remove the struct
and then consider everything as an array
Added unit test, it not works :( but you can play with it xD |
The problem was because property is a method, with variables, works perfect! |
Are tests still broken? I'll take a look. |
Formatted done! |
Still something: Error Message:
CollectionAssert.AreEqual failed. (Different number of elements.)
Stack Trace:
at Neo.SmartContract.Framework.UnitTests.UT_OpcodeTest.TestAllOpcodes() in /home/travis/build/neo-project/neo-devpack-dotnet/tests/Neo.SmartContract.Framework.UnitTests/UT_OpcodeTest.cs:line 17 |
#99 solve the issue, but i think that UTF8 was not cleaned in this project |
* Update neo opcodes * Fix * dotnet format * Update OpCode.cs * Remove SHA
Is fixed (i think) Thanks @vncoelho for the format |
They are quite different in C#. |
Co-Authored-By: Erik Zhang <erik@neo.org>
@belane you will need this for NEP-5