fix(test): correct cross-call event-count assumption in ownership-transfer test - #315
Open
thlpkee20-wq wants to merge 1 commit into
Open
Conversation
…nsfer test test_transfer_service_ownership_genuine_transfer_emits_event compared env.events().all().len() before and after transfer_service_ownership, assuming the event log accumulates across separate top-level client calls. In this soroban-sdk version, env.events().all() is scoped to the current invocation, so the delta assertion always failed even though the contract correctly emits owner_chg on every genuine transfer. Fixed to match the established, working pattern used elsewhere in this file (e.g. test_settle_emits_settled_event_with_payload): assert the event log is non-empty and check the most recent publish's topic/payload.
This was referenced Jul 28, 2026
Contributor
|
thanks @thlpkee20-wq! please add a |
3 tasks
Contributor
|
thanks @thlpkee20-wq! please add a |
1 similar comment
Contributor
|
thanks @thlpkee20-wq! please add a |
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.
Summary
test_transfer_service_ownership_genuine_transfer_emits_eventfails oncurrent
main(confirmed against a clean checkout, unrelated to any ofmy other in-flight PRs on this repo). It compares
env.events().all().len()before and aftertransfer_service_ownership,assuming the event log accumulates across separate top-level client
calls (
set_service_metadatathentransfer_service_ownership). Inthis
soroban-sdkversion,env.events().all()is scoped to thecurrent invocation, so the delta assertion always fails even though the
contract correctly emits
owner_chgon every genuine transfer (theevent is there — the test's own subsequent assertions on
events_after.last()already prove that).Fix
Matched the established, working pattern used elsewhere in this file
(e.g.
test_settle_emits_settled_event_with_payload): assert the eventlog is non-empty and check the most recent publish's topic/payload,
instead of a before/after delta.
Test plan
cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test— 336/336 passing (was 335 passed, 1 failed beforethis fix)
This is a test-only fix, not tied to a specific GrantFox issue — it
unblocks a clean
cargo testrun for every other PR touching this repo.