Skip to content

fix(events): emit PendingManagerCancelled event when replacing pending proposal - #157

Open
rushikeshgarad2024-dev wants to merge 2 commits into
boundlessfi:testnetfrom
rushikeshgarad2024-dev:fix/propose-manager-cancellation-event-137
Open

rushikeshgarad2024-dev wants to merge 2 commits into
boundlessfi:testnetfrom
rushikeshgarad2024-dev:fix/propose-manager-cancellation-event-137

Conversation

@rushikeshgarad2024-dev

Copy link
Copy Markdown

Summary of Changes

Closes #137
Reference: docs/threat-model.md v1.0, Spoof.7 (planned hardening).

Problem

Previously, calling propose_manager when a PendingManager was already active would overwrite the storage record without emitting PendingManagerCancelled. An observer watching contract events would see two consecutive ManagerProposed events without an explicit cancellation for the superseded proposal, leading to timeline ambiguity.

Solution

  • Updated propose_manager in contracts/events/src/event_ops.rs to check if a pending manager is already set for event_id via storage::get_pending_manager(env, event_id).is_some().
  • If an existing proposal is present, emit evt::PendingManagerCancelled { event_id }.publish(env) immediately prior to writing the replacement PendingManager and publishing ManagerProposed.
  • Added unit test propose_manager_emits_cancellation_when_replacing_pending_proposal to contracts/events/src/tests/cross_contract.rs to verify replacement semantics and successful subsequent acceptance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

propose_manager: emit a cancellation event when replacing a pending proposal

1 participant