Skip to content

Algod: Add experimental endpoint for simulating transactions against a real block evaluator#4436

Merged
jannotti merged 85 commits intomasterfrom
feature/simulate-endpoint
Dec 19, 2022
Merged

Algod: Add experimental endpoint for simulating transactions against a real block evaluator#4436
jannotti merged 85 commits intomasterfrom
feature/simulate-endpoint

Conversation

@jdtzmn
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread daemon/algod/api/README.md Outdated
Comment thread daemon/algod/api/algod.oas2.json
],
"summary": "Simulates a raw transaction as it would be evaluated on the network.",
"operationId": "SimulateTransaction",
"parameters": [
Copy link
Copy Markdown
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.

Comment thread daemon/algod/api/server/v2/handlers.go
@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
tmc pushed a commit to tmc/go-algorand that referenced this pull request Mar 7, 2025
…a real block evaluator (algorand#4436)

Co-authored-by: Michael Diamant <michaeldiamant@users.noreply.github.com>
Co-authored-by: Jason Paulos <jasonpaulos@users.noreply.github.com>
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