Goal: produce reproducible cost metrics per entrypoint across typical scenarios and catch regressions.
- Stellar CLI (
stellar) with--cost - RPC simulateTransaction (client SDKs)
stellar contract build- Use
stellar contract invoke --cost(ortx simulate) to print execution cost breakdown before submit. - For each function, craft inputs for small/medium/large cases.
Example (pseudocode; replace ids/args):
# Simulate vote cost
stellar contract invoke --id $CONTRACT_ID \
--network futurenet --cost -- \
vote --user $USER --market-id market_1 --outcome Yes --stake 1000Capture output (instructions, ledger read/write counts, bytes) into benchmarks/results/*.csv.
- Use SDKs to build a tx that invokes the function and call
simulateTransaction. - Record
resourceFee,cpuInsns,readBytes,writeBytes,readEntries,writeEntries, and events/return sizes.
- create_market: short vs long question/outcomes
- vote: single voter; 100 voters; 1,000 voters
- claim_winnings: winner vs loser; large market iteration
- resolve_market: with/without oracle result, with disputes
- fetch_oracle_result: Reflector vs Pyth paths
- collect_fees: resolved vs unresolved
stellar contract optimize --wasm target/wasm32v1-none/release/predictify_hybrid.wasmTrack optimized size and ensure below network limits.
- Commit CSVs and a short summary per release under
benchmarks/. - Update
../gas/GAS_COST_ANALYSIS.mdwith highlights (e.g., hot paths, bytes drivers).