{"id":29193915,"url":"https://github.com/intersectmbo/plutus-script-evaluation","last_synced_at":"2026-03-05T15:32:41.915Z","repository":{"id":264607946,"uuid":"826216329","full_name":"IntersectMBO/plutus-script-evaluation","owner":"IntersectMBO","description":"Functionality for working with Plutus script evaluation events from Mainnet","archived":false,"fork":false,"pushed_at":"2025-05-21T16:03:57.000Z","size":3348,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-07-02T03:48:30.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IntersectMBO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-09T09:35:11.000Z","updated_at":"2025-05-21T16:03:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"38f8eca6-6027-4b1c-8a41-e35df16574fd","html_url":"https://github.com/IntersectMBO/plutus-script-evaluation","commit_stats":null,"previous_names":["intersectmbo/plutus-script-evaluation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/IntersectMBO/plutus-script-evaluation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntersectMBO%2Fplutus-script-evaluation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntersectMBO%2Fplutus-script-evaluation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntersectMBO%2Fplutus-script-evaluation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntersectMBO%2Fplutus-script-evaluation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IntersectMBO","download_url":"https://codeload.github.com/IntersectMBO/plutus-script-evaluation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IntersectMBO%2Fplutus-script-evaluation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269794097,"owners_count":24476742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-02T03:37:09.304Z","updated_at":"2026-03-05T15:32:41.900Z","avatar_url":"https://github.com/IntersectMBO.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plutus Scripts Evaluation\n\nTools used to:\n\n1. Accumulate Plutus script evaluation events by replaying blockchain folding over the Ledger state and extracting `PlutusScriptEvaluationEvent`s.\n2. Record accumulated events:\n   1. On the file system as \"dump\" files.\n   2. In the PostgreSQL database.\n\n## How to use\n\n0. Initialise the PostgreSQL database and connection using files in the `database` folder:\n   - There is a [pgModeler](https://pgmodeler.io/) (Open-source tool) project for it\n   - As well as the DDL statements\n1. Create `.envrc.local` with the following content (adjust the paths as needed):\n\n   ```sh\n   export CARDANO_NODE_SOCKET_PATH=\"/home/projects/cardano/node/node-state/mainnet/node.sock\"\n   export CARDANO_NODE_CONFIG_PATH=\"/home/projects/cardano/playground/docs/environments/mainnet/config.json\"\n   export DB_CONN_STRING=\"dbname=mainnet_plutus_events\"\n   ```\n2. Enter the `nix` shell using either `nix develop` command or `direnv` hooked to your shell.\n3. See available commands by entering `info` in the shell.\n4. Run the script dump job using the `dump` command or script upload job with the `load` command.\n\n## How to re-evaluate recorded Plutus Script evaluations locally\n\nThe database contains plutus script evaluation events from Mainnet which can be replayed locally to re-evaluate the scripts.\n\nThere is less value in re-evaluating scripts without any changes, as one would\nsimply re-obtain results that are already known. However, this can be useful\nwhen the script evaluation logic has changed, and one wants to compare results\nproduced by the new logic with the old results.\n\nThe repository contains a program that can be used to re-evaluate the scripts\nlocally. You can use this program as a basis for your own re-evaluation, where\nyou can modify various parameters to suit your needs:\n\n- The [Main module](run-script-evaluations/src/Main.hs) of the `run-script-evaluations` executable.\n- The main workhorse, function `evaluateScripts` in the [Evaluation module](run-script-evaluations/src/Evaluate.hs) does the boring parts (aggregating relevant script evaluation inputs, streaming the data from DB to a local computer, decoding CBOR, forking worker threads) so that you can do the interesting part: traverse script evaluations from the Mainnet accessing all of the original evaluation inputs to re-interpret them accordingly to your task.\n\n## Github Actions Workflow\n\nRe-evaluates the Plutus script events from Mainnet periodically (once a week) to test compatibility with the latest Plutus development.\n\nThe workflow is defined in the `.github/workflows/evaluate.yml` file.\n\n### Workflow Overview\n\nThe workflow runs:\n\n- **Scheduled**: Every Saturday at midnight (UTC)\n- **Manual**: Via workflow dispatch with optional `startFrom` parameter\n- **Environment**: Self-hosted runner on `plutus-node` server with database access\n\n### Workflow Steps\n\n1. **Checkout Repository**: Uses the latest code from this repository\n2. **Update Plutus Dependency**: Executes `run-script-evaluations/add_srp.sh` to:\n   - Fetch the latest commit from `IntersectMBO/plutus` master branch\n   - Generate a `source-repository-package` entry with the latest commit hash and nix SHA\n   - Update `cabal.project` with the new dependency (removing any existing entries for idempotency)\n3. **Run Evaluations**: Builds and executes the `run-script-evaluations` program:\n   - Uses `nix develop` environment for reproducible builds\n   - Connects to the local PostgreSQL database containing Mainnet script events\n   - Processes scripts starting from the specified record (default: 0)\n   - Outputs evaluation results to `evaluation.log`\n\n### Script Management Tool\n\nThe `add_srp.sh` script provides robust dependency management with:\n\n- **Command-line options**: `--branch \u003cbranch\u003e` (default: master), `--quiet` for CI\n- **Error handling**: Validates dependencies (`jq`, `nix-prefetch-git`) and fetched data\n- **Idempotent operation**: Safely removes existing entries before adding new ones\n- **Atomic updates**: Uses backup/restore mechanism to prevent file corruption\n- **Exit codes**: Returns specific codes for different error conditions (0-5)\n\n### Usage Examples\n\n```bash\n# Default behavior (master branch)\n./run-script-evaluations/add_srp.sh\n\n# Use specific branch\n./run-script-evaluations/add_srp.sh --branch develop\n\n# Quiet mode for CI\n./run-script-evaluations/add_srp.sh --quiet\n\n# Combined options\n./run-script-evaluations/add_srp.sh --branch main --quiet\n```\n\nThis automated testing ensures that script evaluations remain compatible as Plutus evolves, providing early detection of breaking changes or performance regressions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintersectmbo%2Fplutus-script-evaluation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintersectmbo%2Fplutus-script-evaluation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintersectmbo%2Fplutus-script-evaluation/lists"}