mirror of
https://github.com/SHOGGOTH-SECTOR/sica-fondt.git
synced 2026-08-01 16:40:24 +00:00
Resolve economy organ toolchains: ECLiPSe 7.2 + COIN-OR, M3g to Fortran, BoundedPrediction fields
Hook: - ECLiPSe upgraded 7.1_13 → 7.2_13, adds ic + eplex (if_osiclpcbc) with COIN-OR system dep, sha256 pinned, ECLIPSEDIR exported, correct paths (lib/x86_64_linux/eclipse.exe not bin/) - fpm switched from GitHub binary download to pip (0.12.0) — proxy blocks GitHub release downloads in this environment - Alire download gets sha256 verification on both install and presence check - Fortran comment updated M3d,M3e → M3d,M3e,M3g - Foundry section comment clarified as hosted separately Specs: - M3g §3: Zig → Fortran 2018 (gfortran/fpm/OpenBLAS, hand-rolled Riccati) - M3 hub §3: sub-process list Zig(M3g) → Fortran(M3g) - M3 hub §5: BoundedPrediction adds token_ticker and recent_shift (ground truth from M2, same source as correctness scoring and calibration) - M3b §3: ECLiPSe 7.2 + ic + eplex (COIN-OR CLP/CBC) - M3f §3: ECLiPSe 7.2 + ic + eplex (COIN-OR CLP/CBC) - M3c §3: Solidity + Foundry confirmed, hosted separately, same Hub path
This commit is contained in:
parent
700a1825bf
commit
e408409b77
@ -40,17 +40,21 @@ fi
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Alire (alr) 2.1.1
|
# Alire (alr) 2.1.1
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
ALR_SHA256="2e2b8de009b793ad2aed10096e162649bbcc5b0711e3c21785ebe8a1261c5d64"
|
||||||
if command -v alr >/dev/null 2>&1; then
|
if command -v alr >/dev/null 2>&1; then
|
||||||
log "alr already present; skipping Alire install."
|
log "alr present; verifying integrity."
|
||||||
|
echo "$ALR_SHA256 $(command -v alr)" | sha256sum -c - || die "Installed alr sha256 mismatch — binary may be corrupt."
|
||||||
else
|
else
|
||||||
log "Installing Alire (alr) 2.1.1 ..."
|
log "Installing Alire (alr) 2.1.1 ..."
|
||||||
curl -sSL -o /tmp/alr.zip https://github.com/alire-project/alire/releases/download/v2.1.1/alr-2.1.1-bin-x86_64-linux.zip || die "Alire download failed."
|
curl -sSL -o /tmp/alr.zip https://github.com/alire-project/alire/releases/download/v2.1.1/alr-2.1.1-bin-x86_64-linux.zip || die "Alire download failed."
|
||||||
( cd /tmp && unzip -o -q alr.zip && sudo cp bin/alr /usr/local/bin/alr && chmod +x /usr/local/bin/alr ) || die "Alire unzip/copy failed."
|
( cd /tmp && unzip -o -q alr.zip ) || die "Alire unzip failed."
|
||||||
|
echo "$ALR_SHA256 /tmp/bin/alr" | sha256sum -c - || die "Downloaded alr sha256 mismatch."
|
||||||
|
sudo cp /tmp/bin/alr /usr/local/bin/alr && chmod +x /usr/local/bin/alr || die "Alire copy failed."
|
||||||
log "alr installed to /usr/local/bin/alr"
|
log "alr installed to /usr/local/bin/alr"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Fortran 2018 (gfortran) + OpenBLAS (economy organ: M3d, M3e)
|
# Fortran 2018 (gfortran) + OpenBLAS (economy organ: M3d, M3e, M3g)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
if command -v gfortran >/dev/null 2>&1; then
|
if command -v gfortran >/dev/null 2>&1; then
|
||||||
log "gfortran already present; skipping."
|
log "gfortran already present; skipping."
|
||||||
@ -60,16 +64,14 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# fpm — Fortran Package Manager (economy organ: M3d, M3e)
|
# fpm — Fortran Package Manager (economy organ: M3d, M3e, M3g)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
if command -v fpm >/dev/null 2>&1; then
|
if command -v fpm >/dev/null 2>&1 && fpm --version >/dev/null 2>&1; then
|
||||||
log "fpm already present; skipping."
|
log "fpm already present; skipping."
|
||||||
else
|
else
|
||||||
log "Installing fpm ..."
|
log "Installing fpm via pip ..."
|
||||||
FPM_URL="https://github.com/fortran-lang/fpm/releases/download/v0.10.1/fpm-0.10.1-linux-x86_64"
|
pip install --quiet fpm==0.12.0 || die "pip install fpm failed."
|
||||||
curl -sSL -o /tmp/fpm "$FPM_URL" || die "fpm download failed."
|
log "fpm $(fpm --version 2>&1 | head -1)"
|
||||||
sudo cp /tmp/fpm /usr/local/bin/fpm && sudo chmod +x /usr/local/bin/fpm || die "fpm install failed."
|
|
||||||
log "fpm installed to /usr/local/bin/fpm"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@ -83,21 +85,38 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# ECLiPSe Prolog (economy organ: M3b, M3f)
|
# ECLiPSe Prolog 7.2_13 (economy organ: M3b, M3f)
|
||||||
|
# Bundles: basic (includes ic), if_osiclpcbc (COIN-OR backend for eplex LP/MIP)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
if command -v eclipse >/dev/null 2>&1 || [ -x /opt/eclipseclp/bin/x86_64_linux/eclipse ]; then
|
ECL_MIRROR="https://www.mirrorservice.org/sites/eclipseclp.org/Distribution/CurrentRelease"
|
||||||
log "ECLiPSe Prolog already present; skipping."
|
ECL_PLATFORM="7.2_13%20x86_64_linux%20Intel-64bit-Linux"
|
||||||
|
ECL_BASIC_SHA256="df12d7ab694331f54cd87e5861ceec2ddd41028d1cccf6496ec56ea6755600a3"
|
||||||
|
ECL_OSICLPCBC_SHA256="a90d34a19606c916a684b8a8927dda441b743a11d07dbfe0de007c38f9844df6"
|
||||||
|
if [ -x /opt/eclipseclp/lib/x86_64_linux/eclipse.exe ]; then
|
||||||
|
log "ECLiPSe Prolog present; verifying."
|
||||||
|
[ -f /opt/eclipseclp/lib/x86_64_linux/ic.so ] || die "ECLiPSe ic library missing."
|
||||||
|
[ -f /opt/eclipseclp/lib/x86_64_linux/seosiclpcbc.so ] || die "ECLiPSe eplex COIN-OR backend missing."
|
||||||
else
|
else
|
||||||
log "Installing ECLiPSe Prolog ..."
|
log "Installing ECLiPSe Prolog 7.2_13 ..."
|
||||||
ECLIPSE_URL="https://eclipseclp.org/Distribution/Current/7.1_13/x86_64_linux/eclipse_basic.tgz"
|
sudo apt-get install -y coinor-libcbc3.1 || die "COIN-OR CBC system library install failed."
|
||||||
curl -sSL -o /tmp/eclipse_basic.tgz "$ECLIPSE_URL" || die "ECLiPSe download failed."
|
|
||||||
sudo mkdir -p /opt/eclipseclp || die "Could not create /opt/eclipseclp."
|
sudo mkdir -p /opt/eclipseclp || die "Could not create /opt/eclipseclp."
|
||||||
sudo tar -xzf /tmp/eclipse_basic.tgz -C /opt/eclipseclp || die "ECLiPSe extraction failed."
|
curl -sSL -o /tmp/eclipse_basic.tgz "$ECL_MIRROR/$ECL_PLATFORM/eclipse_basic.tgz" \
|
||||||
log "ECLiPSe installed to /opt/eclipseclp"
|
|| die "ECLiPSe basic download failed."
|
||||||
|
echo "$ECL_BASIC_SHA256 /tmp/eclipse_basic.tgz" | sha256sum -c - \
|
||||||
|
|| die "ECLiPSe basic sha256 mismatch."
|
||||||
|
sudo tar -xzf /tmp/eclipse_basic.tgz -C /opt/eclipseclp \
|
||||||
|
|| die "ECLiPSe basic extraction failed."
|
||||||
|
curl -sSL -o /tmp/if_osiclpcbc.tgz "$ECL_MIRROR/$ECL_PLATFORM/if_osiclpcbc.tgz" \
|
||||||
|
|| die "ECLiPSe COIN-OR download failed."
|
||||||
|
echo "$ECL_OSICLPCBC_SHA256 /tmp/if_osiclpcbc.tgz" | sha256sum -c - \
|
||||||
|
|| die "ECLiPSe COIN-OR sha256 mismatch."
|
||||||
|
sudo tar -xzf /tmp/if_osiclpcbc.tgz -C /opt/eclipseclp \
|
||||||
|
|| die "ECLiPSe COIN-OR extraction failed."
|
||||||
|
log "ECLiPSe 7.2_13 installed to /opt/eclipseclp (basic + ic + eplex/COIN-OR)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --------------------------------------------------------------------------- ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Solidity / Foundry (economy organ: M3c)
|
# Solidity / Foundry (economy organ: M3c — hosted separately)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# if command -v forge >/dev/null 2>&1; then
|
# if command -v forge >/dev/null 2>&1; then
|
||||||
# log "forge (Foundry) already present; skipping."
|
# log "forge (Foundry) already present; skipping."
|
||||||
@ -111,14 +130,16 @@ fi
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# PATH for tools not in standard locations.
|
# PATH for tools not in standard locations.
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
EXTRA_PATHS='/root/.local/share/ponyup/bin:/opt/eclipseclp/bin/x86_64_linux'
|
EXTRA_PATHS='/root/.local/share/ponyup/bin:/opt/eclipseclp/lib/x86_64_linux'
|
||||||
FOUNDRY_PATH="$HOME/.foundry/bin"
|
FOUNDRY_PATH="$HOME/.foundry/bin"
|
||||||
FULL_PATH_LINE="export PATH=$EXTRA_PATHS:$FOUNDRY_PATH:\$PATH"
|
FULL_PATH_LINE="export PATH=$EXTRA_PATHS:$FOUNDRY_PATH:\$PATH"
|
||||||
if [ -f "$HOME/.bashrc" ] && grep -qF "eclipseclp" "$HOME/.bashrc"; then
|
ECLIPSEDIR_LINE="export ECLIPSEDIR=/opt/eclipseclp"
|
||||||
log "Toolchain PATH lines already in ~/.bashrc; skipping."
|
if [ -f "$HOME/.bashrc" ] && grep -qF "ECLIPSEDIR" "$HOME/.bashrc"; then
|
||||||
|
log "Toolchain PATH/env lines already in ~/.bashrc; skipping."
|
||||||
else
|
else
|
||||||
log "Appending toolchain PATH lines to ~/.bashrc"
|
log "Appending toolchain PATH/env lines to ~/.bashrc"
|
||||||
echo "$FULL_PATH_LINE" >> "$HOME/.bashrc" || die "Could not append to ~/.bashrc."
|
{ echo "$FULL_PATH_LINE"; echo "$ECLIPSEDIR_LINE"; } >> "$HOME/.bashrc" \
|
||||||
|
|| die "Could not append to ~/.bashrc."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log "Done."
|
log "Done."
|
||||||
|
|||||||
@ -18,8 +18,8 @@ established); specific model parameters C1.
|
|||||||
## 3. Language & location
|
## 3. Language & location
|
||||||
**Tcl** · `src/economy/sims/`. The hub is a syntax-agnostic coordinator: Tcl manages
|
**Tcl** · `src/economy/sims/`. The hub is a syntax-agnostic coordinator: Tcl manages
|
||||||
lifecycle, tick-advancement, and query routing for sub-sims in their native runtimes via
|
lifecycle, tick-advancement, and query routing for sub-sims in their native runtimes via
|
||||||
stdin/stdout JSON — **Fortran** (M3d, M3e), **Prolog** (M3b, M3f), **R** (M3a),
|
stdin/stdout JSON — **Fortran** (M3d, M3e, M3g), **Prolog** (M3b, M3f), **R** (M3a),
|
||||||
**Solidity** (M3c), **Zig** (M3g). Tcl imposes no type system or paradigm on the
|
**Solidity** (M3c). Tcl imposes no type system or paradigm on the
|
||||||
sub-processes it orchestrates.
|
sub-processes it orchestrates.
|
||||||
|
|
||||||
## 4. Does / does-not
|
## 4. Does / does-not
|
||||||
@ -50,17 +50,22 @@ sub-processes it orchestrates.
|
|||||||
`SimType` ∈ { `statistical`, `sociological`, `amm_liquidity`, `mev_adversarial`,
|
`SimType` ∈ { `statistical`, `sociological`, `amm_liquidity`, `mev_adversarial`,
|
||||||
`tokenomics_macro`, `consensus_staking`, `market_microstructure` } (M3a–M3g).
|
`tokenomics_macro`, `consensus_staking`, `market_microstructure` } (M3a–M3g).
|
||||||
- `BoundedPrediction { value, lower_bound, upper_bound, confidence, correctness, certainty,
|
- `BoundedPrediction { value, lower_bound, upper_bound, confidence, correctness, certainty,
|
||||||
time_horizon, sim_type, timestamp }`.
|
time_horizon, sim_type, timestamp, token_ticker, recent_shift }`.
|
||||||
Every output is bounded — no point estimates without uncertainty ranges.
|
Every output is bounded — no point estimates without uncertainty ranges.
|
||||||
Three quality metrics, each ∈ [0.00, 10.00]:
|
Three quality metrics, each ∈ [0.00, 10.00]:
|
||||||
**confidence** — how sure the model is of this prediction;
|
**confidence** — how sure the model is of this prediction;
|
||||||
**correctness** — how accurate the model has been historically;
|
**correctness** — how accurate the model has been historically (scored against literal
|
||||||
|
market values from M2);
|
||||||
**certainty** — how stable the estimate is across perturbations.
|
**certainty** — how stable the estimate is across perturbations.
|
||||||
|
**token_ticker** — which asset this prediction concerns (e.g. `"ETH"`, `"BTC"`).
|
||||||
|
**recent_shift** — literal observed market movement (ground truth from M2, not sim output).
|
||||||
|
Same M2 source feeds calibration and `correctness` scoring.
|
||||||
Gain rates print as `lower - value - upper / 10.00`
|
Gain rates print as `lower - value - upper / 10.00`
|
||||||
(e.g. `2.31 - 4.44 - 7.11 / 10.00 gain over next 30 days`);
|
(e.g. `2.31 - 4.44 - 7.11 / 10.00 gain over next 30 days`);
|
||||||
the denominator aids legibility — gain is not capped at 10.00.
|
the denominator aids legibility — gain is not capped at 10.00.
|
||||||
Example: `{ value: 7.2, lower_bound: 5.8, upper_bound: 8.9, confidence: 7.30,
|
Example: `{ value: 7.2, lower_bound: 5.8, upper_bound: 8.9, confidence: 7.30,
|
||||||
correctness: 8.10, certainty: 6.50, time_horizon: "4h", sim_type: "amm_liquidity" }`.
|
correctness: 8.10, certainty: 6.50, time_horizon: "4h", sim_type: "amm_liquidity",
|
||||||
|
token_ticker: "ETH", recent_shift: -0.023 }`.
|
||||||
- `status(sim_type?) -> { running, pop_count, last_calibration, data_freshness }` — health check.
|
- `status(sim_type?) -> { running, pop_count, last_calibration, data_freshness }` — health check.
|
||||||
- `calibrate(sim_type, feed_data: [NormalizedDatum])` — Data Feeds (M2) pushes live data for
|
- `calibrate(sim_type, feed_data: [NormalizedDatum])` — Data Feeds (M2) pushes live data for
|
||||||
model recalibration.
|
model recalibration.
|
||||||
|
|||||||
@ -17,11 +17,12 @@ solvers C3). Crypto pump-and-dump ABM C3 (3-agent protocol validated on historic
|
|||||||
Pop behavioral models C1.
|
Pop behavioral models C1.
|
||||||
|
|
||||||
## 3. Language & location
|
## 3. Language & location
|
||||||
ECLiPSe Prolog · `src/economy/sims/sociological/`. **Prolog** — game-theoretic equilibria, replicator
|
**ECLiPSe Prolog 7.2** · `src/economy/sims/sociological/`. Libraries: **ic** (interval
|
||||||
dynamics, and strategy evolution are naturally expressed as logical relations over population
|
constraints — bounds propagation for BoundedPrediction ranges), **eplex** (LP/MIP via COIN-OR
|
||||||
states; Nash equilibrium search is constraint satisfaction. Needs efficient population iteration,
|
CLP/CBC — Nash equilibrium computation). Game-theoretic equilibria, replicator dynamics, and
|
||||||
strategy mutation, PDE solvers for MFG (HJB + Fokker-Planck), and bandit algorithms
|
strategy evolution are naturally expressed as logical relations over population states; Nash
|
||||||
(UCB/Thompson).
|
equilibrium search is constraint satisfaction. Needs efficient population iteration, strategy
|
||||||
|
mutation, PDE solvers for MFG (HJB + Fokker-Planck), and bandit algorithms (UCB/Thompson).
|
||||||
|
|
||||||
## 4. Does / does-not
|
## 4. Does / does-not
|
||||||
- **Does:** simulate populations of behavioral archetypes competing in a market; apply
|
- **Does:** simulate populations of behavioral archetypes competing in a market; apply
|
||||||
|
|||||||
@ -12,9 +12,11 @@ impermanent loss formula C5 (closed-form: $\text{IL}(r) = \frac{2\sqrt{r}}{1+r}
|
|||||||
simulation parameterization C1.
|
simulation parameterization C1.
|
||||||
|
|
||||||
## 3. Language & location
|
## 3. Language & location
|
||||||
TBD · `src/economy/sims/amm/`. **Solidity** — on-chain-equivalent fixed-point arithmetic
|
**Solidity** + **Foundry** (forge, anvil) · `src/economy/sims/amm/`. Foundry is hosted
|
||||||
reproduces the exact invariant calculations DEXs execute, eliminating precision-mismatch bugs
|
separately from the session container — not a session-start install. M3c's output enters the
|
||||||
between sim and production contracts.
|
system through Hub like every other sim, same `BoundedPrediction` schema, same M2 path.
|
||||||
|
On-chain-equivalent fixed-point arithmetic reproduces the exact invariant calculations DEXs
|
||||||
|
execute, eliminating precision-mismatch bugs between sim and production contracts.
|
||||||
|
|
||||||
## 4. Does / does-not
|
## 4. Does / does-not
|
||||||
- **Does:** simulate constant-product pools with fee parameter $\gamma$:
|
- **Does:** simulate constant-product pools with fee parameter $\gamma$:
|
||||||
|
|||||||
@ -14,10 +14,11 @@ validator populations C4 (Lasry & Lions 2007; validator-specific application C3)
|
|||||||
simulation parameterization C1.
|
simulation parameterization C1.
|
||||||
|
|
||||||
## 3. Language & location
|
## 3. Language & location
|
||||||
TBD · `src/economy/sims/consensus/`. **Prolog** — Markov chain transition rules, Nash
|
**ECLiPSe Prolog 7.2** · `src/economy/sims/consensus/`. Libraries: **ic** (interval
|
||||||
equilibrium search, and replicator dynamics are constraint-satisfaction problems over validator
|
constraints), **eplex** (LP/MIP via COIN-OR CLP/CBC — Nash equilibrium via linear programming).
|
||||||
populations; Prolog's backtracking search finds equilibria declaratively rather than
|
Markov chain transition rules, Nash equilibrium search, and replicator dynamics are
|
||||||
imperatively iterating toward them.
|
constraint-satisfaction problems over validator populations; Prolog's backtracking search finds
|
||||||
|
equilibria declaratively rather than imperatively iterating toward them.
|
||||||
|
|
||||||
## 4. Does / does-not
|
## 4. Does / does-not
|
||||||
- **Does:** simulate validator populations where honesty evolves via **evolutionary game theory**
|
- **Does:** simulate validator populations where honesty evolves via **evolutionary game theory**
|
||||||
|
|||||||
@ -15,9 +15,11 @@ optimal execution C5 (industry standard since 2001; crypto adaptations validated
|
|||||||
Kurz CMC thesis). DEX-specific microstructure C2 (emerging). Implementation C1.
|
Kurz CMC thesis). DEX-specific microstructure C2 (emerging). Implementation C1.
|
||||||
|
|
||||||
## 3. Language & location
|
## 3. Language & location
|
||||||
TBD · `src/economy/sims/microstructure/`. **Zig** — tick-level event-driven simulation with
|
**Fortran 2018** (gfortran) · `src/economy/sims/microstructure/`. Build: **fpm**. Dependencies:
|
||||||
deterministic memory layout, no GC pauses, and sub-microsecond latency for Riccati solvers and
|
**OpenBLAS** (LAPACK/BLAS via native Fortran interfaces). Hand-rolled: Riccati ODE solver,
|
||||||
order-book state updates; comptime generics eliminate runtime dispatch on hot paths.
|
order-book state arrays, JSON I/O against fixed schemas. Almgren-Chriss optimal execution is a
|
||||||
|
dense ODE (Riccati equations) — Fortran's home turf; LAPACK is native, array intrinsics map
|
||||||
|
directly to order-book depth vectors, and zero new toolchain is needed (same as M3d/M3e).
|
||||||
|
|
||||||
## 4. Does / does-not
|
## 4. Does / does-not
|
||||||
- **Does:** simulate order flow across venues (DEXs and CEXs); model bid-ask spread dynamics as a
|
- **Does:** simulate order flow across venues (DEXs and CEXs); model bid-ask spread dynamics as a
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user