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: Add experimental endpoint for simulating transactions against a real block evaluator #4436

Merged
merged 85 commits into from
Dec 19, 2022

Conversation

jdtzmn
Copy link
Contributor

@jdtzmn jdtzmn commented Aug 19, 2022

Summary

This PR adds an initial implementation of the simulate endpoint.

This early implementation should be mostly functional, but its results are intentionally narrow for the time being. Following PRs will expand on the work here to add more useful information to the results.

The new endpoint can be used by sending a POST request to /v2/transactions/simulate. This endpoint is tagged as experimental, which means it will not be enabled by unless the EnableExperimentalAPI node config flag is set to true.

Test Plan

New tests added.

Follow up PRs

  • Algod: Extend debugger hooks interface (#4438)
  • Algod: Additional simulation result information (#4439)

jdtzmn added 30 commits July 20, 2022 17:18
Dynamic budget checks in the evaluator complicate the gatekeeping. This functionality will be easier to add in the future after the `DebuggerHook` interface has been extended.
This test confirms an error spotted by @jannotti where `errors.As(…)` was always true.

#4322 (comment)
@jasonpaulos jasonpaulos marked this pull request as ready for review December 14, 2022 23:11
@jasonpaulos jasonpaulos requested a review from jannotti December 14, 2022 23:11
Comment on lines +4206 to +4213
"failure-message": {
"description": "\\[fm\\] Failure message, if the transaction would have failed during a live broadcast.",
"type": "string"
},
"missing-signatures": {
"description": "\\[ms\\] Whether any transactions would have failed during a live broadcast because they were missing signatures.",
"type": "boolean"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just a placeholder for the actual information that will eventually be returned. It's intentionally minimal for the time being, and unless there's a serious concern, I'd rather leave this as is and focus on enriching this response in later PRs

jannotti
jannotti previously approved these changes Dec 19, 2022
Copy link
Contributor

@jannotti jannotti left a comment

Choose a reason for hiding this comment

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

Seems mergable to me.

daemon/algod/api/README.md Outdated Show resolved Hide resolved
daemon/algod/api/algod.oas2.json Show resolved Hide resolved
],
"summary": "Simulates a raw transaction as it would be evaluated on the network.",
"operationId": "SimulateTransaction",
"parameters": [
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, we need some sort of "envelope" to contain the transaction(s) and metadata. I find myself wanting this in the protocol itself often as well.

@jasonpaulos jasonpaulos changed the title Algod: Evaluation simulator and endpoint for simulating transactions against a real block evaluator Algod: Add experimental endpoint for simulating transactions against a real block evaluator Dec 19, 2022
@jasonpaulos jasonpaulos requested a review from jannotti December 19, 2022 21:19
@jannotti jannotti merged commit f06c481 into master Dec 19, 2022
@jasonpaulos jasonpaulos deleted the feature/simulate-endpoint branch December 19, 2022 21:25
@jasonpaulos jasonpaulos restored the feature/simulate-endpoint branch December 19, 2022 21:27
@jasonpaulos jasonpaulos deleted the feature/simulate-endpoint branch January 19, 2023 01:06
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.

4 participants