feat: emit EmergencyPauseTriggered alert on circuit-breaker activatio… - #668
Merged
Sadeequ merged 3 commits intoJul 27, 2026
Conversation
|
@AbuJulaybeeb 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! 🚀 |
… from merge corruption - Add ethnum-patched local directory (v1.5.0 with transmute fix) committed to repo so CI can resolve it without network git access - Update [patch.crates-io] in Cargo.toml to point to local ethnum-patched path - Remove duplicate ContractError variants (StaleSequence, InvalidVarianceConfig, StaleTelemetryPayload, InsufficientLiquidityDepth) caused by failed merge - Remove duplicate function stubs in lib.rs (get_last_update_timestamp, is_data_fresh, add_corridor_fees, _resolve_feed_metrics, get_feed_stake, get_corridor_fee_pool, get_stake, vote_revocation) - Remove duplicate imports and function definitions in admin.rs, consensus.rs, and storage.rs from the same merge corruption - Fix unclosed delimiters in lib.rs, admin.rs, consensus.rs Closes StellarFlow-Network#613 (partial: build fix)
AbuJulaybeeb
force-pushed
the
feat/613-emergency-pause-triggered-broadcast
branch
from
July 26, 2026 01:15
088418f to
adf2dd5
Compare
Closed
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.
What was done
src/events/alerts.rs (new)
Centralised emit_emergency_pause_triggered function that publishes a structured Soroban event with:
Topics: ("emrg_alrt", "paus_trig") — two-level hierarchy for flexible backend filtering
Data payload: (caller: Address, reason_code: u32, timestamp: u64) — full identity, reason, and tamper-proof ledger timestamp
src/events/mod.rs (new)
Module root declaring the alerts sub-module, following the established pattern in contracts/price-oracle/src/event_topics.rs.
src/admin.rs (modified)
Added PAUSED_KEY — dedicated Instance-storage constant for the circuit-breaker flag
Added is_paused() — pure read helper (already consumed by lib.rs:assert_contract_is_active)
Added set_paused() — atomic write to the pause flag
Exposed consume_admin_action_nonce as a pub(crate) alias for descriptive call-site naming
src/lib.rs (modified)
Declared pub mod events;
Added set_paused(caller, paused, reason_code, nonce) — the contract entry point that (1) verifies admin identity, (2) consumes a replay-proof per-action nonce, (3) emits the alert before mutating state, and (4) flips the circuit-breaker storage flag
Why
The two-level topic layout (emrg_alrt / paus_trig) satisfies the "immediately discoverable" acceptance criterion: backend alert monitoring services can subscribe to the broad severity class or the precise event type without scanning all transaction logs.
Emitting the event before storage mutation guarantees the signal is always published, matching the security-first pattern used across the codebase.
Verification
Event structure manually inspected against contracts/price-oracle/src/event_topics.rs pattern
set_paused(paused=true) flow traced: auth → nonce → event emit → storage write
set_paused(paused=false) skips the alert emission (lift events are not high-priority alerts per spec)
Closes #613