Skip to content

Commit

Permalink
Filter events the env exposes in test snapshots to contracts to contr…
Browse files Browse the repository at this point in the history
…act events (#1361)

### What
Filter events the env exposes in test snapshots to contracts to contract
events.

### Why
The main thing we need to test in test snapshots is that non-diagnostic
events are consistent and captured.

Diagnostic events are noise here.

### Notes
There's no good time to make this change.

Ideally the change is made at a major version because it's breaking.

But at a major version is the ideal time to avoid the change so that
people see only meaningful diffs on their test snapshots.
  • Loading branch information
leighmcculloch authored Oct 11, 2024
1 parent 1b32566 commit b924717
Show file tree
Hide file tree
Showing 119 changed files with 110 additions and 18,199 deletions.
11 changes: 11 additions & 0 deletions soroban-sdk/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,17 @@ impl Env {
.unwrap()
.0
.into_iter()
.filter(|e| match e.event.type_ {
// Keep only system and contract events, because event
// snapshots are used in test snapshots, and intended to be
// stable over time because the goal is to record meaningful
// observable behaviors. Diagnostic events are observable,
// but events have no stability guarantees and are intended
// to be used by developers when debugging, tracing, and
// observing, not by systems that integrate.
xdr::ContractEventType::System | xdr::ContractEventType::Contract => true,
xdr::ContractEventType::Diagnostic => false,
})
.map(Into::into)
.collect(),
)
Expand Down

This file was deleted.

This file was deleted.

77 changes: 0 additions & 77 deletions soroban-sdk/test_snapshots/bytes/test/test_insert_panic.1.json

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit b924717

Please sign in to comment.