feat(events): add #[event] macro and IDL event support#84
Open
bristinWild wants to merge 2 commits into
Open
Conversation
- 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
9bbc692 to
f9b235a
Compare
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. |
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.
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