Skip to content

Use arrays for event expectations - #2721

Merged
leighmcculloch merged 3 commits into
mainfrom
fix-events-testing-contract-events
Aug 4, 2026
Merged

Use arrays for event expectations#2721
leighmcculloch merged 3 commits into
mainfrom
fix-events-testing-contract-events

Conversation

@leighmcculloch

@leighmcculloch leighmcculloch commented Aug 3, 2026

Copy link
Copy Markdown
Member

What

Use fixed-size arrays for single expected events in the events documentation.

Why

ContractEvents supports direct array comparison, so allocating std::vec! is unnecessary.

Note

Companion example update: stellar/soroban-examples#411

Origin: #2687 (comment)

### What
Update the test's event assertions to use the SDK's current event-testing APIs (XDR comparison via `to_xdr`, `filter_by_contract`), and point the example link at the current version.

### Why
The old tuple-vec comparison no longer type-checks against the current SDK, so the example as shown would fail to compile.
@stellar-jenkins-ci

Copy link
Copy Markdown

@leighmcculloch
leighmcculloch marked this pull request as ready for review August 4, 2026 00:50
Copilot AI review requested due to automatic review settings August 4, 2026 00:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates event assertions to use fixed-size arrays supported by ContractEvents, avoiding unnecessary vector allocations.

Changes:

  • Replaces four std::vec! expectations with arrays.
  • Requires companion soroban-examples#411 to land first.

Recommendation: NEEDS-CHANGES — coordinate merging the companion PR first.

Comment thread docs/build/smart-contracts/example-contracts/events.mdx

@ElliotFriend ElliotFriend left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! thanks for fixing that up!

should we wait for the soroban-examples PR to merge before this one? or is it worth having the fix in the docs sooner?

@leighmcculloch

Copy link
Copy Markdown
Member Author

should we wait for the soroban-examples PR to merge before this one?

The soroban-examples pr is merged!

@leighmcculloch
leighmcculloch merged commit 66a6806 into main Aug 4, 2026
10 checks passed
@leighmcculloch
leighmcculloch deleted the fix-events-testing-contract-events branch August 4, 2026 20:48
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.

3 participants