Repository navigation
Conversation
…dge routing - vault: use DataKeyExt::LastOraclePrice as the single last-price key, migrate legacy Risk(LastPx) on first read, clear both on oracle change (Junirezz#1525) - vault: read strategy/token/oracle config once per total_assets and ledger timestamp once in set_strategy; single price write (Junirezz#1538) - vault: reject zero-share deposits with MinDepositNotMet and emit dep_dust in deposit, gasless_deposit and batch entries (Junirezz#1536) - bridge-compat: queue/cancel/execute provider removal behind a 24h timelock, invoke provider endpoint in transfer_out and fall back to the next eligible provider on failure (Junirezz#1540) - fix pre-existing compile errors in rounding.rs, bridge-compat tests and vault lib tests so the new tests can run Closes Junirezz#1525 Closes Junirezz#1536 Closes Junirezz#1538 Closes Junirezz#1540
|
@godamongstmen897 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.
🚀 Overview
This Pull Request resolves four core smart contract reliability, optimization, security, and integration issues for Junirezz/YieldVault-RWA:
Risk(LastPx)andLastOraclePrice) intoDataKeyExt::LastOraclePricewith backward-compatible lazy migration and proper cache invalidation on oracle updates.MinDepositNotMet(Error Code 6) and emits diagnosticdep_dustevents, preventing locked user funds acrossdeposit,gasless_deposit, and batch entrypoints.total_assetsandset_strategyby eliminating redundant storage reads and double-writes, verified via gas/footprint benchmark assertions.queue,unregister,cancel), active contract invocation viaBridgeEndpoint::send, and fallback routing over enabled secondary providers.🔑 Linked Issues
🛠️ Summary of Changes
🔑 1. Price Storage Key Consolidation (
contracts/vault/src/lib.rs) (#1525)DataKeyExt::LastOraclePriceas the single canonical storage location for oracle price feeds.Risk(LastPx)exists, its value is automatically migrated toLastOraclePriceand the legacy key is purged.🛡️ 2. Zero-Share Dust Deposit Rejection (
contracts/vault/src/lib.rs,contracts/share-price-math/src/rounding.rs) (#1536)MinDepositNotMet(Code 6) to remain strictly within Soroban's 50-variantVaultErrorenum ceiling without breaking existing error mappings.dep_dustdiagnostic event detailing input amount and vault totals. In batch entries where execution does not revert, events persist for off-chain indexing.⚡ 3. Storage Read/Write Optimization (
contracts/vault/src/lib.rs) (#1538)total_assetsto read token configuration once and cached intermediate storage reads across single calls.set_strategynow caches ledger timestamps.🌉 4. Bridge Provider Removal & Fallback Routing (
contracts/bridge-compat/src/lib.rs) (#1540)queue_unregister_provider, a 24-hour timelock delay, andunregister_provider. Supported cancellation viacancel_unregister_provider. Automatically clears default provider assignments if the default provider is removed.transfer_outto invokeBridgeEndpoint::sendon the target provider contract.transfer_outiterates through remaining enabled providers supporting the destination chain in ID order. Reverts withNoFallbackAvailableif all providers fail, ensuring sender tokens are preserved.📁 Files Touched
contracts/vault/src/lib.rscontracts/share-price-math/src/rounding.rscontracts/bridge-compat/src/lib.rscontracts/vault/src/fuzz_math.rs&tests/timelock.rs,whitelist.rs, andstrategy_registration.rsto allow test compilation.🧪 Verification Logs
bridge-compat: 16 / 16 tests passed.share-price-math: 13 / 13 tests passed.vault: All 23 new and modified tests passed cleanly (including gas footprint comparison, migration, dust rejection, and single-key invariant tests).vaulthelper modules. Pre-existing test failures onmain(auth mocking and strategy setup failures) remain unchanged.