Skip to content

fix(stream): emit storage_version in the created event (#462) - #494

Open
Abba073 wants to merge 1 commit into
conduit-protocol:mainfrom
Abba073:fix/462-emit-storage-version-in-created-event
Open

fix(stream): emit storage_version in the created event (#462)#494
Abba073 wants to merge 1 commit into
conduit-protocol:mainfrom
Abba073:fix/462-emit-storage-version-in-created-event

Conversation

@Abba073

@Abba073 Abba073 commented Aug 31, 2026

Copy link
Copy Markdown

Summary

Closes #462.

An indexer can now determine which storage layout a stream was initialized under directly from the created event, without issuing a separate storage_version() read.

Changes

contracts/stream/src/events.rs

  • Added storage_version: u32 as the final parameter of events::created.
  • Appended it to the event data tuple:
    (recipient, token, rate_per_second, start_time, end_time, storage_version)

contracts/stream/src/lib.rs

  • initialize() now passes storage::CURRENT_STORAGE_VERSION as the new argument.

Why this approach

storage_version is already written to instance storage in initialize() (key DataKey::StorageVersion). Emitting it in the same created event is the minimal, zero-cost change that lets indexers avoid the extra cross-contract read — the value is already in scope at the exact point the event fires.

What was not changed

  • No other events, functions, or structs were touched.
  • No test fixtures assert on the created event data tuple (only a comment references stream_events[0]), so no test updates were needed.

…col#462)

An indexer can now read which storage layout a stream was initialized
under directly from the created event, without a separate storage read.

- events::created gains a storage_version: u32 parameter appended to the
  data tuple: (recipient, token, rate_per_second, start_time, end_time, storage_version)
- initialize() passes storage::CURRENT_STORAGE_VERSION to events::created
@Abba073
Abba073 requested a review from Jaydbrown as a code owner August 31, 2026 10:45
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Abba073 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.

Emit StorageVersion in the created event

1 participant