-
Notifications
You must be signed in to change notification settings - Fork 493
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
Changes from 69 commits
8f840dc
62f4b59
505bc50
58846a3
e242bc4
63805af
5d93ceb
2c8c912
b9f96ee
e52d1bf
a9f4d1a
8a54d2e
301a366
06d0063
0631333
7f0b564
6e5c9ce
64567aa
fc76cb2
760bbfb
cc6e605
c51926f
deb330f
19cdb73
462a9dd
b2c4f51
6ec12f1
b5473ae
307709d
7995700
02d0947
a3e0f59
dad0197
ac72228
50304a3
33dda59
f1c0b05
f90c19a
394f7e7
be38467
970d9f4
595ca6b
5f45dfe
7897a2e
051cbef
65cba5c
b78e899
cb381d8
2d92ad4
2f189d2
5bf32e7
c7996d3
08f8e5e
6e448a8
139672a
6ad7387
47e83dc
ba5d43e
82f31c8
d3e4253
bf3907b
1e518be
e7ce7fc
042704a
ca59421
a0a0550
b99b80b
ad5f515
533c239
807b384
3f4e74e
4a74a24
2f083e8
3c5bc99
70ddd43
6de00a4
f153f4a
d1f0d0e
845425b
075e288
84c5dff
446d158
aa3565a
069a0a0
6ad3ffc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1150,6 +1150,65 @@ | |
} | ||
} | ||
}, | ||
"/v2/transactions/simulate": { | ||
"post": { | ||
"consumes": [ | ||
"application/x-binary" | ||
], | ||
"produces": [ | ||
"application/msgpack" | ||
], | ||
"schemes": [ | ||
"http" | ||
], | ||
"summary": "Simulates a raw transaction as it would be evaluated on the network.", | ||
jasonpaulos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"operationId": "SimulateTransaction", | ||
"parameters": [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shall we add a SimulationOptions struct now, even if it's nearly empty? We'll eventually need a place for parameters like "run me in 'access any resource mode`" or "Run me against the latest block OR run me against the end of the current pending queue". We'll also need a place for incoming state, so this becomes a suitable replacement for dry-run, but I suspect that ought to be a third parameter, to keep "options" separate from "state". I am also ok with not doing this now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a problem if we want to have additional arguments in the request body (and if the goal is to specify initial state, that seems like it would need to be in the body, not on the URL). Right now we mimic the raw transaction submission endpoint and treat the entire body as sign transaction bytes. There's no place for other arguments to be encoded. We probably need to think of a way to also accept other arguments without differentiating too much from the raw transaction endpoint. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be clear I don't think a change is necessary at the moment, but we should think about this and try to address it before we make the endpoint generally available There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
{ | ||
"description": "The byte encoded transaction to simulate", | ||
"name": "rawtxn", | ||
"in": "body", | ||
"required": true, | ||
"schema": { | ||
"type": "string", | ||
"format": "binary" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"$ref": "#/responses/SimulationResponse" | ||
}, | ||
"400": { | ||
"description": "Bad Request - Malformed Algorand transaction", | ||
"schema": { | ||
"$ref": "#/definitions/ErrorResponse" | ||
} | ||
}, | ||
"401": { | ||
"description": "Invalid API Token", | ||
"schema": { | ||
"$ref": "#/definitions/ErrorResponse" | ||
} | ||
}, | ||
"500": { | ||
"description": "Internal Error", | ||
"schema": { | ||
"$ref": "#/definitions/ErrorResponse" | ||
} | ||
}, | ||
"503": { | ||
"description": "Service Temporarily Unavailable", | ||
"schema": { | ||
"$ref": "#/definitions/ErrorResponse" | ||
} | ||
}, | ||
"default": { | ||
"description": "Unknown Error" | ||
} | ||
} | ||
} | ||
}, | ||
"/v2/transactions/params": { | ||
"get": { | ||
"produces": [ | ||
|
@@ -3499,6 +3558,26 @@ | |
} | ||
} | ||
}, | ||
"SimulationResponse": { | ||
"description": "Result of a transaction group simulation.", | ||
"schema": { | ||
"type": "object", | ||
"required": [ | ||
"failure-message", | ||
"missing-signatures" | ||
], | ||
"properties": { | ||
"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" | ||
} | ||
Comment on lines
+4206
to
+4213
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
} | ||
} | ||
}, | ||
"SupplyResponse": { | ||
"description": "Supply represents the current supply of MicroAlgos in the system.", | ||
"schema": { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forget if we've already discussed this (I think we only discussed whether to combine this with dev mode configuration.)
I worry we're going to need fairly detailed configuration here - things like "sure, let their simulations run over their opcode budget, but not TOO much", or access many resources, but not TOO many.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's definitely a good point. I won't attempt to add support for this now, but I'll leave this open as a reminder.