-
Notifications
You must be signed in to change notification settings - Fork 118
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
[x/programs] Add simulator feature to RustSDK #567
Conversation
Signed-off-by: Sam Batschelet <[email protected]>
Signed-off-by: Sam Batschelet <[email protected]>
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.
Fine as is, but I think my suggestions would improve things
Signed-off-by: Sam Batschelet <[email protected]>
Signed-off-by: Sam Batschelet <[email protected]>
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.
🚀
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.
Just a few questions
/// # Errors | ||
/// | ||
/// Returns an error if the if serialization or plan fails. | ||
pub fn execute<T>(&self, data: Step, key: &str) -> Result<T, Box<dyn Error>> |
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.
what is the point of explicitly noting execute
vs read_only
?
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.
the expectation is that one returns a tx ID the other returns the result of a function.
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 think we will want the SDK to be able to better describe this. Some functions are read_only thus can be run against a local nodes as a read only call. But something that explicitly could change state would be part of a transaction. That's my thinking at least.
This PR adds the types to describe VM simulation
Plans
in Rust. This is the API that the Simulator will use, I adding this first will allow us to come to consensus on the API and unblock writing tests for program examples.The idea behind this feature is to provide a simple API to communicate with the simulator using Rust types that serialize to
JSON
instead ofJSON/YAML
directly. This will allow for Rust developers to write tests for their programs completely in Rust or directly withYAML/JSON
.