Skip to content
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

Add oracle Request/Response event #2036

Merged
merged 14 commits into from
Nov 5, 2020
Merged

Conversation

Tommo-L
Copy link
Contributor

@Tommo-L Tommo-L commented Oct 29, 2020

User need some way to query the oracle response tx.

@Tommo-L Tommo-L changed the title Add oracle Response event Add oracle Request/Response event Oct 29, 2020
@erikzhang
Copy link
Member

erikzhang commented Oct 29, 2020

I think you can get the responses from transactions. No notification is needed.

https://github.com/neo-project/neo/blob/master/src/neo/Network/P2P/Payloads/OracleResponse.cs

@Tommo-L
Copy link
Contributor Author

Tommo-L commented Oct 29, 2020

I think notification will be easy for users to record it, just extend the ApplicationLog plugin, since we have unified transaction types.

@Tommo-L Tommo-L closed this Nov 3, 2020
@Tommo-L Tommo-L reopened this Nov 3, 2020
@Tommo-L
Copy link
Contributor Author

Tommo-L commented Nov 3, 2020

I think you can get the responses from transactions. No notification is needed.

https://github.com/neo-project/neo/blob/master/src/neo/Network/P2P/Payloads/OracleResponse.cs

After OracleRespnose exeucted, the OracleRequest will be deleted, then user can't get the relationship between response and request. I think we need this event.

Tommo-L and others added 2 commits November 3, 2020 20:51
Co-authored-by: Erik Zhang <erik@neo.org>
Co-authored-by: Erik Zhang <erik@neo.org>
@@ -161,6 +208,8 @@ private void Request(ApplicationEngine engine, string url, string filter, string
if (list.Count >= 256)
throw new InvalidOperationException("There are too many pending responses for this url");
list.Add(id);

engine.SendNotification(Hash, "Request", new VM.Types.Array { id, url, filter });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this event's can be done by the project.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Co-authored-by: Erik Zhang <erik@neo.org>
@shargon shargon merged commit fc721d5 into neo-project:master Nov 5, 2020
roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request Nov 5, 2020
roman-khimov added a commit to nspcc-dev/neo-go that referenced this pull request Nov 6, 2020
ShawnYun pushed a commit to ShawnYun/neo that referenced this pull request Jan 8, 2021
* add event

* add Request event

* move Reponse into Finish method

* format

* optimize

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-authored-by: Erik Zhang <erik@neo.org>

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-authored-by: Erik Zhang <erik@neo.org>

* fix

* apply erik's feedback

* add RequestContract

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-authored-by: Erik Zhang <erik@neo.org>

Co-authored-by: Tommo-L <luchuan@neo.org>
Co-authored-by: Erik Zhang <erik@neo.org>
Co-authored-by: Shargon <shargon@gmail.com>
cloud8little pushed a commit to cloud8little/neo that referenced this pull request Jan 24, 2021
* add event

* add Request event

* move Reponse into Finish method

* format

* optimize

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-authored-by: Erik Zhang <erik@neo.org>

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-authored-by: Erik Zhang <erik@neo.org>

* fix

* apply erik's feedback

* add RequestContract

* Update src/neo/SmartContract/Native/Oracle/OracleContract.cs

Co-authored-by: Erik Zhang <erik@neo.org>

Co-authored-by: Tommo-L <luchuan@neo.org>
Co-authored-by: Erik Zhang <erik@neo.org>
Co-authored-by: Shargon <shargon@gmail.com>
ixje added a commit to CityOfZion/neo-mamba that referenced this pull request Feb 2, 2021
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.

None yet

3 participants