Skip to content

Asynchronous Oracle#1738

Merged
erikzhang merged 90 commits intomasterfrom
asynchronous-oracle
Sep 3, 2020
Merged

Asynchronous Oracle#1738
erikzhang merged 90 commits intomasterfrom
asynchronous-oracle

Conversation

@erikzhang
Copy link
Copy Markdown
Member

No description provided.

@erikzhang erikzhang added this to the NEO 3.0 milestone Jun 30, 2020
@erikzhang
Copy link
Copy Markdown
Member Author

Ready for review. @neo-project/core @neo-project/ngd-shanghai

private void Finish(ApplicationEngine engine)
{
Transaction tx = (Transaction)engine.ScriptContainer;
OracleResponse response = tx.GetAttribute<OracleResponse>();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
OracleResponse response = tx.GetAttribute<OracleResponse>();
OracleResponse response = tx.GetAttribute<OracleResponse>();
if (response == null) throw new ArgumentException("Oracle response was not found");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What's the difference? If response is null, it will throw exception in the next line because of response.Id.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, it's not a fix, its for debugging purpose now that we have the fault exception it's good to provide the specific error.

Transaction tx = (Transaction)engine.ScriptContainer;
OracleResponse response = tx.GetAttribute<OracleResponse>();
if (response == null) throw new ArgumentException("Oracle response was not found");
OracleRequest request = GetRequest(engine.Snapshot, response.Id);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
OracleRequest request = GetRequest(engine.Snapshot, response.Id);
OracleRequest request = GetRequest(engine.Snapshot, response.Id);
if (request == null) throw new ArgumentException("Oracle request was not found");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If request is null, it will throw exception in the next line because of request.UserData.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, it's not a fix, its for debugging purpose now that we have the fault exception it's good to provide the specific error.

shargon
shargon previously approved these changes Sep 2, 2020
Copy link
Copy Markdown
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

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

My unique concern it's #1738 (comment) But we can move on !

@erikzhang erikzhang merged commit 56234cc into master Sep 3, 2020
@erikzhang erikzhang deleted the asynchronous-oracle branch September 3, 2020 06:41
@superboyiii superboyiii mentioned this pull request Sep 15, 2020
44 tasks
ShawnYun pushed a commit to ShawnYun/neo that referenced this pull request Jan 8, 2021
ixje added a commit to CityOfZion/neo-mamba that referenced this pull request Jan 15, 2021
cloud8little pushed a commit to cloud8little/neo that referenced this pull request Jan 24, 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.

5 participants