Usage of the crate includes defined there events#1842
Merged
ascjones merged 2 commits intoaj/shared-events-reduxfrom Jul 14, 2023
Merged
Usage of the crate includes defined there events#1842ascjones merged 2 commits intoaj/shared-events-reduxfrom
ascjones merged 2 commits intoaj/shared-events-reduxfrom
Conversation
Merged
ascjones
reviewed
Jul 13, 2023
Collaborator
There was a problem hiding this comment.
See comment #1827 (comment).
If you agree, could you change this PR to demonstrate that an event defined in a dependency, which is not explicitly used, but other code in the crate is used, is expected to be included in the metadata?
This way the test is proving what our expected behaviour is.
75dc7f5 to
d0aa0b1
Compare
ascjones
approved these changes
Jul 14, 2023
ascjones
added a commit
that referenced
this pull request
Jul 24, 2023
* WIP derive Event * Move tests to top level * Add failing Event derive test * Test compiles, now fails * Passing test, now impl * Passing test with no fields * Add events integration-tests example * Expose Event derive macro at the top level ::ink::Event * Remove println! * Remove ContractEventBase * WIP rewiring event codegen for use with derive. * Direct impl of emit_event * Use bound_impl * WIP impl derive EventMetadata * WIP add event metadata derive * Add some metadata derive todos * WIP Collect metadata from linked events * Refactor event metadata collection * Add metadata test * Check for external and Inline events * Add todo for inline events * WIP adding compile time topics check to emit_event. * fmt * Refactor EventRespectsTopicsLimit to use const assertion * Fmt * Remove unused code from legacy events generation * test and generate SIGNATURE topic * use built in ink macro for generating signature topic * Remove all warnings * Implement anonymous event * Remove PrefixedValue * Implement field topics * Use TOPICS_LEN for topics remaining * WIP don't push Option::None topics * Fix only publishing if not `Option::None` * Fix only publishing if not `Option::None` * Only publish value of `Some` topic, not none. * Fix event derive codegen tests * Add test for None topic * Rename Topics trait to Event * Fmt * Remove println * Remove EmitEvent imports * WIP adding E2E test for topics * Clippy * Unnused imports * E2E test contract events emitted * WIP e2e testing topics * Add e2e test which checks topics * Add signature topic to event spec metadata * Use Result in EventMetadata derive * Tests for generating events metadata * Remove max topics len compile time check * Add failing test for topics len validation at metadata generation time * Check for max topics limit breach in metadata generation * Add extra event with no signature topic * Remove checks for generics and pub visibility * Fix anonymous attr * Move topics attr validation to derive macro * Fmt and remove remaining MAX_TOPICS check * Remove event spec field type name * Clippy * WIP add `#[ink::event]` which expands to derives * Check for signature topics collisions when building metadata * Commentl * Remove EventRespectsTopicLimits * Remove cfg attr test * Remove unused topics attr test * Fmt * Fix trait erc20 tests * Fix erc20 tests and fmt * Fix duplicate inline attrs. Remove offchain duplicate topics check. * Fmt * Clippy * clippy * events clippy * Push 0 topic if `None` * Expose signature_topic * Change SignatureTopic to expose as_bytes * Add test for None topic value * Fix erc20 topic tests * Add module_path * Fix max topics in tests * Fix event docs test * Clippy * Use path dependency for ink_env * Remove ink_env dependency * RUSTFLAGS for test to fix linking issue * RUSTFLAGS for test to fix linking issue * Fix custom environment, remove extra topic * Use ink::event syntax * Add ui test for cfg attributes * Add success ui tests for ink::event * UI test for `enum` should fail * Refactor topic attribute fn to accept BindingInfo * Fmt * Remove commented out code * Event docs * Add event field docs * Fix event param spec doc tests * Fix metadata codegen tests * Implement docs for `Event` derive macro * Spellcheck * Check for multiple ink attributes * Spellcheck * Ink attribute validation * Remove Topic * Oops * Oops again * Test for events in different crates being used in the metadata. * Test for unused event not included in metadata * Add test for inline event definition metadata. * Add test for emitting inline event * Fmt * Remove todo, duplicate attributes are checked in the derive impls * Add docs * Fix examples-test * Add docs for `#[ink::event]` * Add docs for `EventMetadata` trait * Update Event trait comments * Docs * SIGNATURE_TOPIC docs * Fix docs * fmt * Try setting lto = "thin" for metadata crate to fix met * Add lto to test profile of unit test * Add test to check disallow generics for Event derive * Fmt * Change to `#[ink::event(anonymous = true)]` syntax * Fix test * Annotate derived event struct with anon * UI test * Document limitation of signature topic derive * Fix doctest * Fix up errors after merge * Usage of the crate includes defined there events (#1842) * Usage of the crate includes defined there events * Inclusion of the event from `event_def_unused` is expected * Update anonymous syntax * Anonymous comment * Move haashing macro inline signature topic gen fn * Fix signature_topic return type --------- Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
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.
The PR shows that including any code from the crate also imports all defined there events. We discussed about the potential solution during previous PR=)