Gas & reentrancy optimizations, calldata batch liquidation, gas forecasting (close #705 #835 #840 #717) - #885
Open
Cyberking99 wants to merge 6 commits into
Conversation
…curity crate (close Smartdevs17#705) Add a reusable Soroban reentrancy-guard crate at contracts/security with guard, error, keys, macros, and test-utils modules. Rewrite the hello-world and lending reentrancy modules as thin wrappers over the shared crate, and document the reusable pattern. Fixes a pre-existing truncated get_legacy_risk_params baseline.
…lose Smartdevs17#835) Cache the multi-asset-collateral check into a local, lazy-load oracle prices as Options and reuse them across the collateral-value and seized computations, and reuse the aggregate collateral balance for non-multi-asset users to avoid a redundant storage read. Add bench_batch_liquidate benchmark and setup helper.
The legacy risk-params getter was cut off mid-return, which broke the Rust build. Restore the missing instruction, enabling baseline compilation.
…_compressed (close Smartdevs17#840) Upgrade the calldata-encoding lib to SDK-27 (alloc, u32 op_type, no_std) and integrate it into hello-world via batch_liquidate_compressed, which decodes a packed byte blob (flag byte, varint-length-prefixed StrKey addresses, varint amount) into batch liquidation requests.
…lose Smartdevs17#717) Add a Holt-Winters + linear-regression forecast model with trend-robust seasonality detection, a walk-forward backtester that scores within-10% accuracy, and a GET /gas/forecast/:operation endpoint returning points plus a confidence rating. New tests cover model selection, >=90% backtest accuracy, and endpoint shape.
|
@Cyberking99 is attempting to deploy a commit to the smartdevs17's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Cyberking99 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
Closes the following four issues:
stellar-lend/contracts/security/) and rewrite thehello-worldandlendingreentrancy modules as thin wrappers over the sharedstellarlend-securitycrate. Adds docs + 9 passing unit tests (builds,cargo test -p stellarlend-security).batch_liquidate(cache multi-asset-collateral flag, lazily load oracle prices and reuse them across collateral-value/seized computations, reuse aggregate collateral balance). Addsbench_batch_liquidatebenchmark.calldata-encodinglib to SDK-27 (alloc,u32op type,no_std, 4 passing tests) and integrate it viabatch_liquidate_compressed, decoding a packed byte blob (flag byte + varint-length-prefixed StrKey addresses + varint amount).GET /gas/forecast/:operationendpoint that returns forecast points plus a confidence rating. 11 new tests pass, including a>=90%within-10% backtest-accuracy assertion.Commits (one per issue)
feat(security): … (close #705)perf(liquidate): … (close #835)feat(calldata): … (close #840)feat(gas): … (close #717)fix(risk-params): complete truncated get_legacy_risk_params(out-of-scope baseline build fix)Verification
stellarlend-security:cargo testpasses (default +testutils).calldata-encoding:cargo testpasses.npx jest api/src/__tests__/gas.forecast.test.ts— 11/11 pass.apisuite: 448/453 pass; the 5 failures are pre-existing baseline issues unrelated to this work (missinglending.controller.relayDelegated, etc.).The Rust workspace does not compile at
maindue to unrelated SDK-27 version-drift errors (missingSymbol/Val,MultisigConfig,Address::zero,CircuitBreakerStatus::{Emergency,Paused},reserve::get_reserve_balance, etc.). Onlystellarlend-securityandcalldata-encodingbuild locally. No CI gate runs the Rust build (seeci.yml);gas-benchmarks.ymlbuilds sequentially. This is documented here so reviewers are aware the full contract build cannot be verified in this environment.