Skip to content

Commit

Permalink
Decouple indexing from evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
Unisay committed Feb 19, 2025
1 parent 43dda5f commit e59f594
Show file tree
Hide file tree
Showing 44 changed files with 1,378 additions and 156 deletions.
File renamed without changes.
24 changes: 24 additions & 0 deletions index-script-evaluations/cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repository cardano-haskell-packages
url: https://chap.intersectmbo.org/
secure: True
root-keys:
3e0cce471cf09815f930210f7827266fd09045445d65923e6d0238a6cd15126f
443abb7fb497a134c343faf52f0b659bd7999bc06b7f63fa76dc99d631f9bea1
a86a1f6ce86c449c46666bda44268677abf29b5b2d2eb5ec7af903ec2f117a82
bcec67e8e99cabfa7764d75ad9b158d72bfacf70ca1d0ec8bc6b4406d1bf8413
c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

index-state:
, hackage.haskell.org 2025-02-14T10:33:49Z
, cardano-haskell-packages 2025-02-11T21:18:23Z

write-ghc-environment-files: never
tests: true
benchmarks: true
test-show-details: direct

packages: .

package postgresql-libpq
flags: +use-pkg-config
30 changes: 15 additions & 15 deletions flake.lock → index-script-evaluations/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cabal-version: 3.0
name: plutus-script-evaluation
name: index-script-evaluations
version: 0.1.0.0

common lang
Expand Down Expand Up @@ -47,6 +47,10 @@ library
import: lang
hs-source-dirs: lib
exposed-modules:
Database
Database.Orphans
Database.Query
Database.Schema
Dump
FileStorage
LedgerEvents.FileWriter
Expand All @@ -56,47 +60,32 @@ library
Types

build-depends:
, base >=4.9 && <5
, aeson
, base >=4.9 && <5
, base16-bytestring
, bytestring
, cardano-api ^>=10.4
, cardano-ledger-alonzo
, cardano-ledger-core
, cardano-slotting ^>=0.2.0.0
, deepseq
, dlist
, int-cast
, murmur-hash ^>=0.1.0.10
, opaleye
, ouroboros-consensus
, ouroboros-consensus-cardano
, path
, path-io
, plutus-core
, plutus-ledger-api
, plutus-ledger-api:plutus-ledger-api-testlib
, postgresql-simple
, product-profunctors
, serialise
, string-interpolate ^>=0.3
, text
, transformers

-- Internal library for database access
library lib-database
import: lang
hs-source-dirs: database
exposed-modules:
Database
Database.Orphans
Database.Query
Database.Schema

build-depends:
, aeson
, base >=4.9 && <5
, bytestring
, cardano-slotting
, int-cast
, murmur-hash ^>=0.1.0.10
, opaleye
, plutus-core
, plutus-ledger-api
, postgresql-simple
, product-profunctors
, unliftio-core

-- Executable for dumping script events to file system
Expand All @@ -110,9 +99,9 @@ executable dump-script-events
, base >=4.9 && <5
, bytestring
, cardano-api ^>=10.4
, index-script-evaluations
, optparse-applicative
, path
, plutus-script-evaluation
, postgresql-simple
, with-utf8

Expand All @@ -133,7 +122,7 @@ executable load-script-events
, cardano-api ^>=10.4
, cardano-ledger-binary
, cardano-ledger-core
, lib-database
, index-script-evaluations
, lib-deserialise-scripts
, lib-materialise-views
, murmur-hash
Expand All @@ -142,7 +131,6 @@ executable load-script-events
, path-io
, plutus-core
, plutus-ledger-api
, plutus-script-evaluation
, postgresql-simple
, pretty-show
, serialise
Expand All @@ -157,11 +145,11 @@ library lib-deserialise-scripts
exposed-modules: Deserialise
build-depends:
, aeson
, base >=4.9 && <5
, base >=4.9 && <5
, base64
, bytestring
, cborg
, lib-database
, index-script-evaluations
, mtl
, plutus-core
, plutus-ledger-api
Expand All @@ -184,7 +172,6 @@ executable deserialise-scripts
, base64
, bytestring
, cborg
, lib-database
, lib-deserialise-scripts
, mtl
, optparse-applicative
Expand Down Expand Up @@ -216,37 +203,7 @@ executable materialise-views
build-depends:
, base >=4.9 && <5
, bytestring
, lib-database
, lib-materialise-views
, optparse-applicative
, postgresql-simple
, with-utf8

-- Executabe for evaluating scripts
executable evaluate-scripts
import: lang
hs-source-dirs: evaluate-scripts
main-is: Main.hs
ghc-options: -threaded -with-rtsopts=-N
other-modules:
Evaluate
Options

build-depends:
, base >=4.9 && <5
, bytestring
, cardano-slotting
, containers
, lib-database
, murmur-hash
, optparse-applicative
, plutus-ledger-api
, postgresql-simple
, prettyprinter-configurable
, serialise
, text
, time
, transformers
, unliftio
, unliftio-core
, with-utf8
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let
"https://chap.intersectmbo.org/" = inputs.CHaP;
};

name = "plutus-script-evaluation";
name = "index-script-evaluations";

compiler-nix-name = lib.mkDefault "ghc96";

Expand Down
28 changes: 8 additions & 20 deletions nix/shell.nix → index-script-evaluations/nix/shell.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Docs for this file: https://github.com/input-output-hk/iogx/blob/main/doc/api.md#mkhaskellprojectinshellargs
# See `shellArgs` in `mkHaskellProject` in ./project.nix for more details.

{ repoRoot
, inputs
, pkgs
, lib
, system
,
{
repoRoot,
inputs,
pkgs,
lib,
system,
}:

# Each flake variant defined in your project.nix project will yield a separate
# shell. If no flake variants are defined, then cabalProject is the original project.
cabalProject: {
name = "plutus-script-evaluation";
name = "index-script-evaluations";

packages = [
pkgs.figlet
Expand Down Expand Up @@ -61,22 +61,10 @@ cabalProject: {
cabal run materialise-views -- --database-conn-str "$DB_CONN_STRING"
'';
};

evaluate = {
description = "Evaluate Plutus Scripts from mainnet";
group = "general";
exec = ''
cabal run evaluate-scripts -- --start-block=0 --database-conn-str "$DB_CONN_STRING"
'';
};
};

# env = {
# KEY = "VALUE";
# };

shellHook = ''
figlet "Plutus Script Evaluation"
figlet "Plutus Script Evaluations: Indexer"
'';

preCommit = {
Expand Down
2 changes: 2 additions & 0 deletions run-script-evaluations/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake
source_env_if_exists .envrc.local
24 changes: 11 additions & 13 deletions cabal.project → run-script-evaluations/cabal.project
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
-- Custom repository for cardano haskell packages, see CONTRIBUTING for more
repository cardano-haskell-packages
url: https://chap.intersectmbo.org/
secure: True
Expand All @@ -10,27 +9,26 @@ repository cardano-haskell-packages
c00aae8461a256275598500ea0e187588c35a5d5d7454fb57eac18d9edb86a56
d4a35cd3121aa00d18544bb0ac01c3e1691d618f462c46129271bccf39f7e8ee

-- See CONTRIBUTING for some Nix commands you will need to run if you
-- update either of these.
index-state:
-- Bump both the following dates if you need newer packages from Hackage
, hackage.haskell.org 2025-02-14T10:33:49Z
-- Bump this if you need newer packages from CHaP
, cardano-haskell-packages 2025-02-11T21:18:23Z

-- We never, ever, want this.
write-ghc-environment-files: never

-- Always build tests and benchmarks.
tests: true
benchmarks: true

-- The only sensible test display option, since it allows us to have colourized
-- 'tasty' output.
test-show-details: direct

packages:
plutus-script-evaluation
packages: .

package postgresql-libpq
flags: +use-pkg-config

source-repository-package
type: git
location: https://github.com/intersectmbo/plutus
tag: 262adfd2c7fadb6d89a3c1835eb36b7f85bcf09d
--sha256: sha256-fWwRMARDf3KHIDvGKTInFGz/ISvgGLfF8r2MhK969y8=
subdir:
plutus-tx
plutus-core
plutus-ledger-api
Loading

0 comments on commit e59f594

Please sign in to comment.