From e1d8f981c0c16cc131006075981910a3953ec549 Mon Sep 17 00:00:00 2001 From: logicalmechanism Date: Sun, 31 Dec 2023 15:16:36 -0800 Subject: [PATCH] updated the readme --- README.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 81ef6ca..72d2695 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ The `tx_simulation` tool facilitates transaction simulation using `aiken tx simulate` in conjunction with Koios. -The simulation script assumes the contracts are implemented using PlutusV2, relies on reference script UTxOs, and operates under the assumption that within a transaction, only the scripts themselves contain datums. It's important to note that specific edge cases may need to be considered when transitioning to a production environment. Additionally, the simulation script currently supports both the mainnet and pre-production environments but does not provide support for preview environments at this time. +The simulation script assumes the contracts are implemented using PlutusV2, relies on reference script UTxOs, and operates under the assumption that within a transaction, only the script UTxOs have datums. `tx_simulation` currently supports the mainnet and pre-production environments. Support for the preview environment is not implemented at this time. The tx simulation script was tested with `Python 3.10.12`, `Aiken v1.0.21`, and `Ubuntu 22.04.2 LTS`. @@ -12,6 +12,12 @@ It is highly suggested that Aiken is installed and on path. [Install Aiken](https://aiken-lang.org/installation-instructions) +If Aiken is already installed then upgrade to the newest version with `aikup`. + +```bash +aikup +``` + A precompile version of Aiken may be used with the `from_file` or `from_cbor` functions. ## Development @@ -34,21 +40,22 @@ pip install -r requirements.txt ## Use -The `tx_simulation` script can simulate a transaction from a draft file or from pure cbor. +The `tx_simulation` script can simulate a transaction from a transaction file or from pure cbor. ```bash import tx_simulation # can be used on a tx.draft file -required_units = tx_simulation.from_file('tx.draft') +execution_units = tx_simulation.from_file('path/to/tx.draft') # can be used directory on the tx cbor -required_units = tx_simulation.from_cbor(tx_cbor) +execution_units = tx_simulation.from_cbor(tx_cbor) ``` -It will either return a list of dictionaries of the units or a list with an empty dict if it fails. An output example is shown below. +It will either return a list of dictionaries of the execution units or a list with an empty dict if it fails. An output example is shown below. + +Success example: -Success example ```json [{ "mem": 443656, @@ -56,19 +63,16 @@ Success example }] ``` -Failure example +Failure example: + ```json [{}] ``` ## Testing -Inside the `tests` folder are pytest tests for `tx_simulation.py`. The tests can be ran with the command below. +Inside the `tests` folder are pytest tests for `tx_simulation`. The tests can be ran with the command below. ```bash pytest ``` - -## Known Issues - -Any scripts involving fee logic always error resulting in an empty dictionary being returned. \ No newline at end of file