mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-06-29 19:49:26 +00:00
Add the first end-to-end coverage of the oracle's RecordTick path, which previously existed only as native unit tests: - amm_twap_observations_accumulate_across_swaps_and_yield_time_weighted_average: drives swaps + RecordTick across simulated time, then checks the cumulative accumulator and the consulted time-weighted average. - amm_twap_record_tick_sampling_guard_skips_calls_below_min_interval: exercises the min-interval sampling guard through the real instruction path. Running RecordTick through the zkVM surfaced that committing the oracle-owned ~100 KiB observations account costs ~50.9M cycles — over the 2^25 (~33.5M) public-execution limit — so the instruction aborted on chain. Reduce OBSERVATIONS_CAPACITY 6396 -> 2048 (~16.8M cycles, ~half the limit); window coverage is unchanged, only sampling resolution. Add programs/benchmark, a standalone crate (excluded from the workspace so CI and the Makefile skip it) that runs the guest ELF through the RISC Zero executor and reports the per-instruction cycle split, reproducing the on-chain pass/fail at the limit. Its cost-vs-capacity sweep still spans to 6396, guarding against bumping capacity back into the over-budget range.
20 lines
1009 B
TOML
20 lines
1009 B
TOML
[package]
|
|
name = "benchmark"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
# Its own workspace root: this crate is EXCLUDED from the repo workspace (see the root Cargo.toml
|
|
# `exclude` list) so that `cargo {test,clippy,build} --workspace`, the Makefile targets, and CI
|
|
# never compile it. It pulls the heavy `risc0-zkvm` `prove` feature and only exists to produce the
|
|
# cycle benchmarks in `tests/`. Run it explicitly:
|
|
# cargo test --manifest-path programs/benchmark/Cargo.toml -- --ignored --nocapture
|
|
[workspace]
|
|
|
|
[dependencies]
|
|
nssa = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3" }
|
|
nssa_core = { git = "https://github.com/logos-blockchain/logos-execution-zone.git", tag = "v0.2.0-rc3", features = ["host"] }
|
|
twap_oracle_core = { path = "../twap_oracle/core" }
|
|
twap-oracle-methods = { path = "../twap_oracle/methods" }
|
|
# `prove` exposes `ExecutorImpl`/`Session` (the cycle split); we only execute, never prove.
|
|
risc0-zkvm = { version = "=3.0.5", features = ["prove"] }
|