Skip to content

Fix/issues 1094 1095 1096 1097 - #1145

Merged
Maki-Zeninn merged 4 commits into
Maki-Zeninn:mainfrom
Hexstar-labs:fix/issues-1094-1095-1096-1097
Aug 26, 2026
Merged

Fix/issues 1094 1095 1096 1097#1145
Maki-Zeninn merged 4 commits into
Maki-Zeninn:mainfrom
Hexstar-labs:fix/issues-1094-1095-1096-1097

Conversation

@Hexstar-labs

Copy link
Copy Markdown
Contributor

Summary

Implement fixes and improvements for router-quote and router-timelock contracts:

  • Add comprehensive test coverage for set_route_fee_tiers validation
  • Fix compilation errors in integration tests
  • Fix storage leak in cleanup_expired function
  • Improve documentation for set_route_fee_tiers

Changes

router-quote

  • Add tests for invalid fee tier inputs (negative min_amount and fee_bps > 10000)
  • Add missing Arguments/Returns/Errors documentation to set_route_fee_tiers

router-timelock

  • Remove underlying storage entries in cleanup_expired to prevent unbounded storage growth

integration-tests

  • Remove redundant .expect() calls on already-unwrapped client methods

Closes #1094
Closes #1095
Closes #1096
Closes #1097

…id tiers (Maki-Zeninn#1094)

Add two tests:
- test_set_route_fee_tiers_rejects_negative_min_amount: verifies that a tier with negative min_amount returns InvalidFeeTier error
- test_set_route_fee_tiers_rejects_fee_bps_over_max: verifies that a tier with fee_bps > 10000 returns InvalidFeeBps error

These tests exercise the validation branches that were previously untested.
…lient calls (Maki-Zeninn#1095)

The non-try_ variants of RouterQuote::get_quote and RouterExecution::execute
already unwrap the Result and return the plain value, so calling .expect() on
them causes compilation errors. Remove the redundant .expect() chains:
- Line 201-202: get_quote() call
- Line 269-270: execute() call
- Line 373-374: get_quote() call
- Line 399-400: execute() call

This matches the pattern used elsewhere in this file (e.g., s.core.resolve())
and mirrors how these methods are used in the contracts' own test suites.
…ge entries (Maki-Zeninn#1096)

The cleanup_expired function was only removing operation IDs from the PendingOps
index, but not actually freeing the underlying Op and Deps storage entries. This
caused the contract's instance storage footprint to grow unboundedly even though
cleanup_expired was called regularly.

Now when an operation is confirmed expired/executed/cancelled and is being
dropped from the index, also remove its storage entries via:
- env.storage().instance().remove(&DataKey::Op(op_id.clone()))
- env.storage().instance().remove(&DataKey::Deps(op_id.clone()))

This allows get_op() and get_dependencies() to start returning None for
cleaned-up operations instead of their last known state, but this is the
intended behavior for truly expired/finalized operations.
…set_route_fee_tiers (Maki-Zeninn#1097)

Bring the doc comment for set_route_fee_tiers in line with the existing
documentation style of set_route_fee and other admin-facing methods.

Added sections:
- # Arguments: documents env, caller, route, and tiers parameters
- # Returns: documents Ok(()) on success
- # Errors: documents all three possible error types:
  - Unauthorized: if caller is not the admin
  - InvalidFeeTier: if any tier has negative min_amount
  - InvalidFeeBps: if any tier has fee_bps > 10000
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@Hexstar-labs 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! 🚀

Learn more about application limits

@Maki-Zeninn
Maki-Zeninn merged commit 912b6ed into Maki-Zeninn:main Aug 26, 2026
9 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment