Skip to content

test: cover admin update event contract address #253 - #626

Open
gitGolf wants to merge 1 commit into
zintarh:mainfrom
gitGolf:fix/253-admin-update-event-contract-address
Open

test: cover admin update event contract address #253#626
gitGolf wants to merge 1 commit into
zintarh:mainfrom
gitGolf:fix/253-admin-update-event-contract-address

Conversation

@gitGolf

@gitGolf gitGolf commented Aug 4, 2026

Copy link
Copy Markdown

Overview

Adds a unit test for the admin update event emitted by update_admin that asserts the emitting contract address, in addition to the existing topic and data assertions. Previously the test destructured the event as (_, topics, data), so an event emitted by a different contract would have gone unnoticed.

Related Issue

Closes #253

Changes

[ADD] src/test.rs

  • Added test_update_admin_emits_event which asserts:
    • Emitting contract IDenv.events().all().filter_by_contract(&contract_id) and the expected event tuple contains the registered contract_id
    • Topicsv1, admin, updated (matching the publish in src/admin.rs)
    • Data(old_admin, new_admin)
    • Diagnostic events are filtered out — SDK Events::all() only returns contract events (diagnostics excluded), and filter_by_contract keeps only events from this contract, so a wrong emitter fails the assertion

[FIX] src/signature.rs, src/storage_types.rs

  • Removed committed merge-conflict artifacts (>>>>>>> main marker and a stray }) that prevented the crate from compiling

Verification Results

Test: admin update event contract-address assertion
✅ Passed (positive case) — event contract ID, topics, and data all match
✅ Passed (negative case) — a wrong emitter is correctly rejected by the assertion

Note: cargo test cannot run in this repository because main does not compile (missing mod burn;, duplicate #[contractimpl]/#[contracttype] blocks, stale Cargo.lock pinning soroban-sdk 21.7.1 while Cargo.toml requires =27.0.3, and test modules written for the SDK 21 API). The test logic above was therefore verified against the pinned soroban-sdk 27.0.3 host in an isolated harness.

Acceptance Criteria Status
Update the test to assert event contract ID
Keep existing topic and data assertions
Ensure the test filters out diagnostic events if needed

@drips-wave

drips-wave Bot commented Aug 4, 2026

Copy link
Copy Markdown

@gitGolf 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

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.

test: Cover admin update event contract address

1 participant