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

algod: Minor improvements to simulation support #749

Merged
merged 3 commits into from
Mar 21, 2023

Conversation

jasonpaulos
Copy link
Contributor

This PR makes some minor, but important changes to the simulate support introduced in #743. They are:

  1. SimulateRawTransactions was returning a raw object instead of an instance of SimulateResponse. Based on the code I think we wanted a SimulateResponse
  2. An operation which can error was moved outside of a try-catch block in AtomicTransactionComposer.execute. I made a new try-catch block to include it again. This is especially important because it can be dangerous if a client thinks a transaction was rejected due to an error observing its result, but in reality the transaction succeeded.

txHeaders
txHeaders,
this.query,
false
Copy link
Contributor

Choose a reason for hiding this comment

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

this parseBody parameter seems to parse to JSON by default:

https://github.com/algorand/js-algorand-sdk/blob/develop/src/client/client.ts#L261

Copy link
Contributor Author

@jasonpaulos jasonpaulos Mar 21, 2023

Choose a reason for hiding this comment

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

I think the underlying problem is that post and delete assume the response is always application/json. Probably they should use getAcceptFormat(query) like get does to figure out the actual response format.

But I'm ok with leaving this as-is for now, since passing parseBody as false is sufficient for the time being. We can address that problem with a separate issue/PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opened #751

Copy link
Contributor

@algochoi algochoi left a comment

Choose a reason for hiding this comment

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

🚀

@jasonpaulos jasonpaulos merged commit 663dfa5 into develop Mar 21, 2023
@jasonpaulos jasonpaulos deleted the simulate-support-tweaks branch March 21, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants