feat: add Soroban cost estimation and economic analysis engine - #68
Merged
Nanle-code merged 3 commits intoAug 21, 2026
Merged
Conversation
Adds a cost command family (estimate, compare, budget, export, check-regression) built on a deterministic fee/resource model for deploy, invoke, storage, archival, event, and batch operations. A simulation adapter normalizes raw Soroban RPC simulateTransaction responses into a stable resource-usage structure, and an optional narrative layer explains cost drivers using a configured language-model provider, falling back to a deterministic summary when unavailable. Estimates persist as versioned, permission-restricted JSON snapshots per label, enabling trend export and CI-style regression threshold checks.
Awosdot
force-pushed
the
feat/50-soroban-cost-estimation
branch
from
August 20, 2026 20:33
b24e8ed to
9c135e9
Compare
Updates h2, crossbeam-epoch, and anyhow to their patched versions where a safe upgrade exists. For unmaintained transitive dependencies with no safe upgrade path (instant, paste, rustls-pemfile, backoff, and one remaining h2 0.3.x instance locked by reqwest's hyper-0.14 line), adds justified ignores to deny.toml following the file's existing convention.
Three fixes surfaced by review: - The archival restore penalty was scaled by batch_size like a per-item resource fee, wildly overstating cost for archived-entry batches; it is now charged once per estimate, matching the base transaction fee's batching model. The per-item fee split now rounds instead of truncating so it reconciles closely with the total. - History labels that collide after path sanitization (e.g. "svc:v1" and "svc/v1") no longer merge into the same on-disk directory; a short fingerprint of the raw label disambiguates them. - Two saves for the same label landing in the same millisecond no longer silently overwrite each other; snapshot filenames now carry a zero-padded sequence suffix. - The CLI now rejects --batch-size 0 with a clear error instead of silently clamping it to 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Brief description of what this PR does and why.
Adds a
costcommand family (estimate, compare, budget, export, check-regression) built on a deterministic fee/resource model for deploy, invoke, storage, archival, event, and batch operations. A simulation adapter normalizes raw Soroban RPC simulateTransaction responses into a stable resource-usage structure, and an AI narrative layer augments the deterministic explanation when an API key is configured, falling back cleanly otherwise. Estimates persist as versioned, permission-restricted JSON snapshots per label, enabling trend export and CI-style regression threshold checks.Closes #50
Type of Change
Changes Made
Testing
How has this been tested?
Describe the tests you ran and how to reproduce them.
Test Coverage
Describe what scenarios have been tested:
Code Quality Checklist
cargo fmt)cargo clippy -- -D warnings)Breaking Changes
If checked, describe the breaking changes and migration path:
Documentation
Screenshots (if applicable)
Add screenshots or GIFs for UI changes.
Additional Context
Add any other context about the PR here.
Note: Make sure all tests pass locally before submitting:
cargo test cargo fmt --all cargo clippy -- -D warnings