feat: Resolve contract issues 578, 579, 542, 543 - #699
Merged
Conversation
…rkets#579) Admin-gated setter to repoint stored oracle address, mirroring deposit_handler/order_handler/withdrawal_handler. Rejects no-op and copy-paste mistakes (current contract or other instance addresses) and emits orcl_set event for audit trail.
Remove PriceTooHigh and UnauthorizedPositionManager from order_handler, NoKeepers from oracle, and Unauthorized from reader. Variants were declared but never raised, polluting ABI; either wire or remove per suggested fix.
Require caller auth and CONTROLLER role for deposit_vault and withdrawal_vault record_transfer_in, mirroring transfer_out. Update deposit_handler call sites to pass handler address as caller. Prevents front-running that strands deposits by zeroing delta before create_deposit.
Apply lazy TTL renewal (extend_ttl with MIN_BUMP_THRESHOLD / PERSISTENT_BUMP_TARGET) on every read/write for u128/i128/address/ bool/bytes32 accessors and their delta/increment variants. Prevents archival of market config keys written once at create_market and silently consumed on every operation.
|
@infimum90 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.
Closes #579 contracts/liquidation_handler/src/lib.rs:28 / contracts/adl_handler/src/lib.rs:42 — added update_oracle(env, caller, new_oracle) admin-gated, rejecting current_contract_address and any other stored instance address (Admin/RoleStore/DataStore/OrderHandler), emitting orcl_set with old/new, mirroring deposit_handler/src/lib.rs:189, order_handler/src/lib.rs:387, withdrawal_handler/src/lib.rs:183. Added Error::InvalidOracle (liquidation 8, adl 10, fixed duplicate InvalidMarket/MarketPaused discriminant in liquidation).
Closes #578 — removed dead variants: order_handler/src/lib.rs:89 PriceTooHigh=7, order_handler/src/lib.rs:96 UnauthorizedPositionManager=11, oracle/src/lib.rs:48 NoKeepers=8, reader/src/lib.rs:63 Unauthorized=3 (explicit repr preserved).
Closes #542 contracts/deposit_vault/src/lib.rs:73 / contracts/withdrawal_vault/src/lib.rs:59 — record_transfer_in now fn(env, caller, token) with caller.require_auth() + require_controller, mirroring transfer_out. Updated deposit_handler/src/lib.rs:129 client trait and deposit_handler/src/lib.rs:319,327,337 call sites to pass handler as caller.
Closes #543 contracts/data_store/src/lib.rs:177 — added lazy TTL renewal (extend_ttl(&dk, MIN_BUMP_THRESHOLD, PERSISTENT_BUMP_TARGET)) to all scalar accessors: get_u128/get_u128_batch/set_u128/set_u128_config/get_u128_cached/apply_delta_to_u128/increment_u128/decrement_u128/get_i128/set_i128/apply_delta_to_i128/get_address/set_address/get_bool/set_bool/get_bytes32/set_bytes32, closing archival gap for market definition keys.