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

Asynchronous Oracle #1738

Merged
merged 90 commits into from
Sep 3, 2020
Merged

Asynchronous Oracle #1738

merged 90 commits into from
Sep 3, 2020

Conversation

erikzhang
Copy link
Member

No description provided.

@erikzhang erikzhang added this to the NEO 3.0 milestone Jun 30, 2020
@erikzhang
Copy link
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
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
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
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
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
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
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
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.

None yet

5 participants