Skip to content

Commit 42ec572

Browse files
committed
Document Script Evaluation pipeline.
1 parent 1fdd0bc commit 42ec572

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

README.md

+22-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
Plutus Scripts Evaluation
2-
===
1+
# Plutus Scripts Evaluation
32

43
Tools used to:
4+
55
1. Accumulate Plutus script evaluation events by replaying blockchain folding over the Ledger state and extracting `PlutusScriptEvaluationEvent`s.
66
2. Record accumulated events:
7-
1. On the file system as "dump" files.
8-
2. In the PostgreSQL database.
7+
1. On the file system as "dump" files.
8+
2. In the PostgreSQL database.
99

1010
## How to use
1111

1212
0. Initialise the PostgreSQL database and connection using files in the `database` folder:
13-
* There is a [pgModeler](https://pgmodeler.io/) (Open-source tool) project for it,
14-
* As well as the DDL statements.
13+
- There is a [pgModeler](https://pgmodeler.io/) (Open-source tool) project for it,
14+
- As well as the DDL statements.
1515
1. Create `.envrc.local` with the following content (adjust the paths as needed):
1616
```sh
1717
export CARDANO_NODE_SOCKET_PATH="/home/projects/cardano/node/node-state/mainnet/node.sock"
@@ -21,3 +21,19 @@ Tools used to:
2121
2. Enter the `nix` shell using either `nix develop` command or `direnv` hooked to your shell.
2222
3. See available commands by entering `info` in the shell.
2323
4. Run the script dump job using the `dump` command or script upload job with the `load` command.
24+
25+
## How to re-evaluate recorded Plutus Script evaluations locally
26+
27+
The database contains plutus script evaluation events from Mainnet which can be replayed locally to re-evaluate the scripts.
28+
29+
There is less value in re-evaluating scripts without any changes, as one would
30+
simply re-obtain results that are already known. However, this can be useful
31+
when the script evaluation logic has changed, and one wants to compare results
32+
produced by the new logic with the old results.
33+
34+
The repository contains a program that can be used to re-evaluate the scripts
35+
locally. You can use this program as a basis for your own re-evaluation, where
36+
you can modify various parameters to suit your needs:
37+
38+
- The [Main module](plutus-script-evaluation/evaluate-scripts/Main.hs) of the `evaluate-scripts` executable.
39+
- The main workhorse, function `evaluateScripts` in the [Evaluation module](plutus-script-evaluation/evaluate-scripts/Evaluation.hs) does the boring parts (aggregating relevant script evaluation inputs, streaming the data from DB to a local computer, decoding CBOR) so that you can do the interesting part: fold over the script evaluations from the Mainnet accessing all of the original evaluation inputs, to re-interpret them accordingly to your task, maintaining local state (accumulator) if needed.

0 commit comments

Comments
 (0)