-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathbudget.toml
More file actions
67 lines (61 loc) · 3.35 KB
/
Copy pathbudget.toml
File metadata and controls
67 lines (61 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
network = "testnet"
source = "alice"
# -- Tier A limit derivation (issue: derive-tier-a-limits-from-tier-b) ---------
# Per-metric margin multipliers fed to `cargo budget-report --derive-limits`.
# Every field is required; an incomplete `[margin]` block (e.g. only
# `cpu_margin`) is rejected at use-time to avoid a half-configured file
# silently degrading to a hand-picked global value. Issue #45 calls this out
# explicitly: a single global margin is wrong across operation types, so the
# per-metric split is the minimum granularity until per-operation margin
# computation lands.
[margin]
cpu_margin = 1.50 # 50% headroom over Tier B CPU ceiling
memory_margin = 1.25 # 25% headroom over Tier B memory ceiling
read_margin = 2.00 # 100% headroom over Tier B read-bytes ceiling
write_margin = 3.00 # 200% headroom over Tier B write-bytes ceiling
# -- Scenarios --------------------------------------------------------------
# Components whose Tier B values are summed into a single Tier A limit for
# tests that exercise a multi-step workflow in one assertion. Keys must
# match a `<package>::<scenario_name>` namespace otherwise the derived
# env-var key will not line up with the test annotation.
[scenarios.full_workflow]
package = "amm-pool-contract"
functions = ["deposit", "swap", "withdraw"]
# The `do_expensive_work` function is retained as a synthetic CPU-bound baseline.
# It exercises loops and instance storage without cross-contract calls, making it
# the only function that can be invoked via `cargo budget-report` on testnet without
# additional token contract deployments.
#
# Per-function limits below are enforced by `cargo budget-report --check` in CI.
# A missing `*_limit` field means that metric is reported but not enforced.
# On a regression, the offending metric is printed as `FAIL` and the process
# exits non-zero.
# Numbers are chosen as generous upper bounds for n=10000 on testnet; tighten
# them once a clean baseline is recorded from a passing run.
[functions.do_expensive_work]
args = ["--n", "10000"]
cpu_limit = 5000000
read_limit = 5000
write_limit = 1000
# The `require_auth_only` function isolates the cost of a single `require_auth()`
# host call, providing a minimal baseline for authorization overhead measurement.
[functions.require_auth_only]
args = ["--addr", "alice"]
# The `allocate_vec` function is the fixture for the local-vs-network gap
# measurement of memory-bytes (issue #122). It pushes `n` elements into a
# host-resident Vec with no auth/storage side-effects so the simulation's
# reported `result.cost.memBytes` is dominated by the allocation itself.
# A 5 MB memory ceiling is generous for n = 10_000; tighten once a
# network baseline is recorded with `cargo budget-report`.
[functions.allocate_vec]
args = ["--n", "10000"]
mem_limit = 5000000
# The `do_event_heavy_work` function isolates event-emission cost by publishing
# events in a loop with no storage or compute work mixed in. It can be invoked
# via `cargo budget-report` on testnet without additional setup.
[functions.do_event_heavy_work]
args = ["--n", "5"]
# The AMM pool functions (initialize, deposit, swap, withdraw) are designed for
# local test-harness measurement and exercise multiple storage keys, authorization,
# events, and simulated token flows. They require pre-deployed token contracts and
# are not intended for `cargo budget-report` invocation without additional setup.