Skip to content

feat(events): add #[event] macro and IDL event support#84

Open
bristinWild wants to merge 2 commits into
logos-co:mainfrom
bristinWild:feat/event-idl-extension
Open

feat(events): add #[event] macro and IDL event support#84
bristinWild wants to merge 2 commits into
logos-co:mainfrom
bristinWild:feat/event-idl-extension

Conversation

@bristinWild
Copy link
Copy Markdown

Adds #[event] macro and IDL event schema support, enabling spel tx decode to do full typed event decoding from transaction receipts.
Changes:

IdlEvent struct added to SpelIdl (name, discriminant, fields: Vec)
events: Vec field in SpelIdl — backward-compatible, skipped if empty
#[event(discriminant = N)] proc macro to annotate event payload structs
SpelOutput::with_events() builder that auto-drains the lez-events buffer
generate_idl_json and generate_idl_fn pick up #[event] structs alongside #[instruction] functions
All 90 existing tests passing

Usage:
rust#[event(discriminant = 1)]
pub struct InsufficientFunds {
pub requested: u128,
pub available: u128,
}
Relates to: logos-blockchain/logos-execution-zone LP-0012 event system

- Add IdlEvent struct to SpelIdl with name, discriminant, fields
- Add events: Vec<IdlEvent> field to SpelIdl (backward-compatible)
- Add #[event(discriminant = N)] proc macro attribute
- Add with_events() builder to SpelOutput
- Wire event parsing into generate_idl_json and generate_idl_fn
- Add lez-events dependency to spel-framework-core
- Update spel-client-gen tests for new SpelIdl field
- All 90 tests passing

This enables programs to annotate event payload structs with
enabling spel tx decode to do full typed event decoding.

Related: logos-blockchain/logos-execution-zone LP-0012
@bristinWild bristinWild force-pushed the feat/event-idl-extension branch from 9bbc692 to f9b235a Compare May 25, 2026 21:54
@bristinWild
Copy link
Copy Markdown
Author

Rebased onto upstream/main (d24dbaa, v0.4.0). Conflicts resolved , removed the lez-events crate dependency, keeping IdlEvent and #[event] as self-contained additions to spel-framework-core and spel-framework-macros. All 225 unit tests passing, 0 failures.

@bristinWild bristinWild marked this pull request as ready for review June 8, 2026 10:38
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.

1 participant