Skip to content

Add event name, callback support and base64 syscalls#302

Merged
shargon merged 23 commits intomasterfrom
update-nuget
Jun 30, 2020
Merged

Add event name, callback support and base64 syscalls#302
shargon merged 23 commits intomasterfrom
update-nuget

Conversation

@shargon
Copy link
Copy Markdown
Member

@shargon shargon commented Jun 22, 2020

Close #301 #299

  • Updated neo nuget
  • Added event name
  • Added callback syscalls
  • Added base64 syscalls

Require neo-project/neo#1723

@shargon shargon changed the title Add event name Add event name and callback support Jun 22, 2020
@shargon shargon marked this pull request as ready for review June 22, 2020 10:37
@shargon shargon requested a review from lightszero June 22, 2020 10:37
@shargon shargon changed the title Add event name and callback support Add event name, callback support and base64 syscalls Jun 23, 2020
@shargon shargon requested a review from erikzhang June 23, 2020 09:13
@ProDog
Copy link
Copy Markdown
Contributor

ProDog commented Jun 24, 2020

I have tested notify, it's OK.

Contract:

        public delegate void mydelegate(params object[] arg);

        [DisplayName("event")]
        public static event mydelegate Notify;

        [DisplayName("TestEvent")]
        public static event Action<byte[], BigInteger> OnEvent;

        public static bool NotifyTest()
        {
            OnEvent(new byte[] { 0x89, 0x77, 0x20, 0xd8}, 1);

            Notify("str", 11, 12);

            Runtime.Log("test");

            return true;
        }

events in abi:

"events":
    [
        {
            "name":"event",
            "parameters":
            [
                {
                    "name":"arg",
                    "type":"Array"
                }
            ]
        },
        {
            "name":"TestEvent",
            "parameters":
            [
                {
                    "name":"arg1",
                    "type":"ByteArray"
                },
                {
                    "name":"arg2",
                    "type":"Integer"
                }
            ]
        }
    ]

Notify:

 "notifications": [
            {
                "contract": "0x90ca09ef53cb3753a3770119b31bf211d410dad5",
                "event_name": "TestEvent",
                "state": {
                    "type": "Array",
                    "value": [
                        {
                            "type": "Buffer",
                            "value": "iXcg2A=="
                        },
                        {
                            "type": "Integer",
                            "value": "1"
                        }
                    ]
                }
            },
            {
                "contract": "0x90ca09ef53cb3753a3770119b31bf211d410dad5",
                "event_name": "event",
                "state": {
                    "type": "Array",
                    "value": [
                        {
                            "type": "Array",
                            "value": [
                                {
                                    "type": "ByteString",
                                    "value": "c3Ry"
                                },
                                {
                                    "type": "Integer",
                                    "value": "11"
                                },
                                {
                                    "type": "Integer",
                                    "value": "12"
                                }
                            ]
                        }
                    ]
                }
            }

Tommo-L
Tommo-L previously approved these changes Jun 24, 2020
ShawnYun
ShawnYun previously approved these changes Jun 28, 2020
@shargon shargon dismissed stale reviews from ShawnYun and Tommo-L via d6d12e8 June 28, 2020 09:09
@ProDog
Copy link
Copy Markdown
Contributor

ProDog commented Jun 28, 2020

I found contract execute FAULT when the contract uses static variables and delegate event in this PR.
The #309 is same problem.

My contract:

        public delegate void mydelegate(params object[] arg);

        [DisplayName("event")]
        public static event mydelegate Notify;

        private static byte[] myAddr = "NNB8GKS7mdMXXGsAwvXYyEGonkEjDbqNkG".ToScriptHash();

        public static byte[] test()
        {
            return myAddr;
        }

Invoke result:

neo> invoke 0xe7a5322430588a0eb7969100c52a5d8d7bf9642c test
Invoking script with: '10c00c04746573740c142c64f97b8d5d2ac5009196b70e8a58302432a5e741627d5b52'
VM State: FAULT
Gas Consumed: 0.0100889
Result Stack: []
Engine faulted.
Error: insufficient balance.

Please take a look @shargon .

@shargon
Copy link
Copy Markdown
Member Author

shargon commented Jun 28, 2020

Could you take a look @lightszero ?

@ShawnYun
Copy link
Copy Markdown
Contributor

We'd better merge it as soon as possible, so we can solve other problems which wait for it.

@shargon shargon merged commit 3ce1adf into master Jun 30, 2020
@shargon shargon deleted the update-nuget branch June 30, 2020 07:46
Jim8y pushed a commit that referenced this pull request Aug 3, 2025
* Update nugets
* Fix event
* Fix one UT
* Change state to array
* Fix event UT
* Add callbacks
* Update
* Clean code
* some fixes
* Fix Create
* Update Neo.Compiler.MSIL.csproj
* Update Neo.Compiler.MSIL.csproj
* Add BinaryEncode
* Add Base64 test
* Remove Notify
* remove delegate
* Change to enum
* Action callback
* Add test for ensure SyscallCallbacks
* Remove action
* Remove action
* Add more overloads
Co-authored-by: erikzhang <erik@neo.org>
Jim8y pushed a commit that referenced this pull request Aug 18, 2025
* Update nugets

* Fix event

* Fix one UT

* Change state to array

* Fix event UT

* Add callbacks

* Update

* Clean code

* some fixes

* Fix Create

* Update Neo.Compiler.MSIL.csproj

* Update Neo.Compiler.MSIL.csproj

* Add BinaryEncode

* Add Base64 test

* Remove Notify

* remove delegate

* Change to enum

* Action callback

* Add test for ensure SyscallCallbacks

* Remove action

* Remove action

* Add more overloads

Co-authored-by: erikzhang <erik@neo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add event name to System.Runtime.Notify

5 participants