Skip to content

Change ExecutionContext.Clone to public#318

Merged
shargon merged 5 commits intoneo-project:masterfrom
shargon:create-callback
May 15, 2020
Merged

Change ExecutionContext.Clone to public#318
shargon merged 5 commits intoneo-project:masterfrom
shargon:create-callback

Conversation

@shargon
Copy link
Copy Markdown
Member

@shargon shargon commented May 7, 2020

It will be required for neo-project/neo#1629

@shargon shargon requested a review from erikzhang May 7, 2020 09:16
@shargon shargon changed the title Modify LoadClonedContext Required changes for Callbacks May 7, 2020
@ProDog
Copy link
Copy Markdown

ProDog commented May 13, 2020

Is this ready for testing? @shargon

@shargon
Copy link
Copy Markdown
Member Author

shargon commented May 13, 2020

Is this ready for testing? @shargon

Yes please

@ProDog
Copy link
Copy Markdown

ProDog commented May 14, 2020

Can you give me an example? what it is used for, or how to use it 🤔 @shargon

@erikzhang
Copy link
Copy Markdown
Member

I think it is not necessary. See neo-project/neo#1629 (comment).

We need to load a new context for the callbacks.

@shargon
Copy link
Copy Markdown
Member Author

shargon commented May 14, 2020

We need to load a new context for the callbacks.

But then we wont have the shared variables

@erikzhang
Copy link
Copy Markdown
Member

Callback methods should be stateless.

@ProDog
Copy link
Copy Markdown

ProDog commented May 15, 2020

I have tested it whit neo-project/neo-devpack-dotnet#262.

  • The callback function runs normally without arguments.
  • An error occurred while compiling the contract, when the callback function has arguments:

image

In addition, an exception is thrown when deploy contract if CreateFuncPointer() is public:

image

@shargon
Copy link
Copy Markdown
Member Author

shargon commented May 15, 2020

Callback methods should be stateless.

But how can we prevent the use of static variables?

@shargon
Copy link
Copy Markdown
Member Author

shargon commented May 15, 2020

@ProDog could you create this test in dev-pack repository?

@ProDog
Copy link
Copy Markdown

ProDog commented May 15, 2020

@ProDog could you create this test in dev-pack repository?

OK

Comment thread src/neo-vm/ExecutionEngine.cs Outdated
erikzhang
erikzhang previously approved these changes May 15, 2020
@shargon shargon changed the title Required changes for Callbacks Change ExecutionContext.Clone to public May 15, 2020
@shargon shargon merged commit f76b1a3 into neo-project:master May 15, 2020
@shargon shargon deleted the create-callback branch May 15, 2020 16:22
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.

3 participants