-
Notifications
You must be signed in to change notification settings - Fork 58
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
Stack Output Parser for Transaction Script Results #1161
Comments
Thank you for such a detailed description! I do have a couple of clarifying questions:
Transaction scripts are usually meant to be execute as a part of a transaction to update account state, create notes etc. The above script (as currently written) just reads the account state and puts the data on the stack - so, it won't really have a meaningful effect on a transaction. So, I'm curious if you are planning to execute it as a part of a transaction or as a "stand-alone" program. If the intent is to run it as a stand-alone program, is this mostly for testing/debugging purposes? Or is the result meant to be used for something meaningful? |
The get-entry functionality serves as a "view" function, allowing users to query specific functions within the oracle contract. When called, it performs the necessary computations and outputs the results onto the stack. |
So, if I understood correctly: a user may want to execute an arbitrary script against an account (kind of like transaction script but with the intent to only read the state of the account rather than update it) and get the results. We don't currently have something exactly like this, but I think this could be a very useful functionality to provide. To achieve this, we probably would need to do the following: Add a new method to pub fn execute_program(
&self,
account_id: AccountId,
block_ref: BlockNumber,
tx_script: TransactionScript,
advice_inputs: AdviceInputs,
) -> Result<[Felt; 16], TransactionExecutorError> This would basically run the transaction kernel prologue, then run the transaction script and return the top of the stack after the transaction script completes. (we could probably use this method in the test code quite a bit). Then, to make this more accessible, we'll need to add some functionality to the client/CLI. On the CLI side it could be something like an
This would compile the script and execute it agains the specified account using cc @PhilippGackstatter, @igamigo (we probably should create an issue for this in |
Feature description
We need to implement functionality to parse and load the stack output from transaction script executions into a Rust data structure. This will make stack values accessible and manipulable as Rust entities.
This feature might be already existing.I would appreciate if you can provide any documentation/code, that might help solve this.
Current behavior
Currently, when executing a transaction script like:
The get_median function returns a price value that is pushed onto the stack. The debug.stack output shows a 20-element stack with the price value (98179860000) at index 0, followed by zeros:
Stack state before step 7234:
Why is this feature needed?
Implement functionality to:
The text was updated successfully, but these errors were encountered: