Skip to content

refactor: fold remaining extension-flow wrappers through _exec_logged#306

Open
hunnyboy1217 wants to merge 1 commit intoentrius:testfrom
hunnyboy1217:refactor/exec-logged-extension-wrappers
Open

refactor: fold remaining extension-flow wrappers through _exec_logged#306
hunnyboy1217 wants to merge 1 commit intoentrius:testfrom
hunnyboy1217:refactor/exec-logged-extension-wrappers

Conversation

@hunnyboy1217
Copy link
Copy Markdown

Closes #305

Summary

Direct follow-on to #91, which standardized 23 write wrappers through _exec_logged but left the six propose/challenge/finalize wrappers for reservation and swap-timeout extensions out of scope. Those six were skipped because four of them pass wait_for_inclusion=False — a parameter the helper didn't accept.

This PR extends _exec_logged with wait_for_inclusion: bool = True and collapses the six remaining wrappers to single return self._exec_logged(...) delegations. Default True preserves byte-identical behavior for the 23 callers already routed through the helper; the four no-wait sites pass the kwarg explicitly.

Motivation

  • Single source of truth for write-side extrinsic submission — these six were the only write paths that could drift independently from _exec_logged (e.g., if pre-flight balance probing or log wording evolves).
  • Lower-friction extension — future propose/challenge/finalize triples inherit the one-line shape instead of resurrecting the 5-line block.
  • Smaller surface area — duplication eliminated; public signatures, log-message wording, and the wait_for_inclusion=False semantics documented at allways/contract_client.py:529-535 are preserved.

Changes

  • allways/contract_client.py:
    • _exec_logged (L1009-L1027): added wait_for_inclusion: bool = True kwarg, threaded through to exec_contract_raw
    • Collapsed six wrappers (L1067-L1131) to single delegations:
      • Reservation extension: propose_extend_reservation (no-wait), challenge_extend_reservation (no-wait), finalize_extend_reservation (waits)
      • Timeout extension: propose_extend_timeout (no-wait), challenge_extend_timeout (no-wait), finalize_extend_timeout (waits)
    • Net +32 / −37 (−5 LOC plus removal of all duplication)

Type of Change

  • Refactoring (consolidation, no behavior change)

Test plan

  • uv run pytest tests/ — 411 passed
  • uv run pytest tests/test_optimistic_extensions.py — 31 passed (covers all six wrappers)
  • uv run ruff check allways/ neurons/ — all checks passed
  • uv run ruff format --check allways/contract_client.py — already formatted
  • uv run pre-commit run --files allways/contract_client.py — all hooks passed
  • Public signatures, log-message wording, and wait_for_inclusion semantics preserved — verified by diff review

Extends _exec_logged with a wait_for_inclusion kwarg (default True) and
collapses the six propose/challenge/finalize wrappers for reservation
and swap-timeout extensions to single delegations. Default preserves
behavior for the 23 existing callers; the four no-wait sites pass it
explicitly. Closes entrius#305.
@xiao-xiao-mao xiao-xiao-mao Bot added the refactor Restructures code without changing behavior label May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructures code without changing behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(contract_client): fold remaining extension-flow wrappers through _exec_logged

1 participant