Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use name-only syntax for anonymous ink! event item configuration argument #2140

Merged

Conversation

davidsemakula
Copy link
Contributor

@davidsemakula davidsemakula commented Mar 7, 2024

Summary

Closes #_

  • [n] y/n | Does it introduce breaking changes?
  • [n] y/n | Is it dependant on the specific version of cargo-contract or pallet-contracts?

Description

  • Use name-only syntax for anonymous ink! event item configuration argument (i.e. #[ink::event(anonymous)] instead of #[ink::event(anonymous = true|false)])
  • Required updating ink_ir::ast::AttributeArgs to support name-only meta items e.g. #[ink::event(anonymous)]
  • Fixes error message for signature_topic argument which previously referenced anonymous instead

Checklist before requesting a review

  • My code follows the style guidelines of this project
  • I have added an entry to CHANGELOG.md
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@davidsemakula davidsemakula force-pushed the ink-event-anonymous-as-name-only branch 2 times, most recently from f87f014 to aa17fec Compare March 7, 2024 19:48
@codecov-commenter
Copy link

codecov-commenter commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 85.93750% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 53.74%. Comparing base (a124e60) to head (30d30bc).
Report is 1 commits behind head on master.

Files Patch % Lines
crates/ink/ir/src/ir/event/signature_topic.rs 0.00% 3 Missing ⚠️
crates/ink/ir/src/ast/meta.rs 91.66% 2 Missing ⚠️
crates/ink/ir/src/ir/event/config.rs 80.00% 2 Missing ⚠️
crates/ink/ir/src/ir/trait_def/config.rs 88.88% 1 Missing ⚠️
...es/ink/tests/ui/event/pass/anonymous_flag_works.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2140      +/-   ##
==========================================
+ Coverage   53.64%   53.74%   +0.09%     
==========================================
  Files         224      224              
  Lines        7050     7084      +34     
  Branches     3115     3129      +14     
==========================================
+ Hits         3782     3807      +25     
- Misses       3268     3277       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Mar 7, 2024

🦑 📈 ink! Example Contracts ‒ Changes Report 📉 🦑

These are the results when building the integration-tests/* contracts from this branch with cargo-contract and comparing them to ink! master:

Contract Upstream Size (kB) PR Size (kB) Diff (kB) Diff (%) Change
call-builder-return-value 9.249 9.249 0 0
call-runtime 2.071 2.071 0 0
combined-extension 2.149 2.132 -0.017 -0.791066 📉
conditional-compilation 1.502 1.502 0 0
contract-storage 7.58 7.58 0 0
contract-terminate 1.369 1.369 0 0
contract-transfer 1.731 1.731 0 0
cross-contract-calls 7.732 7.732 0 0
cross-contract-calls/other-contract 1.595 1.595 0 0
custom-allocator 7.787 7.787 0 0
custom-environment 2.158 2.158 0 0
dns 7.355 7.355 0 0
e2e-call-runtime 1.32 1.32 0 0
e2e-runtime-only-backend 1.901 1.901 0 0
erc1155 14.345 14.345 0 0
erc20 6.955 6.955 0 0
erc721 10.044 10.044 0 0
events 5.27 5.27 0 0
flipper 1.651 1.651 0 0
incrementer 1.516 1.516 0 0
lang-err-integration-tests/call-builder-delegate 2.65 2.65 0 0
lang-err-integration-tests/call-builder 5.571 5.571 0 0
lang-err-integration-tests/constructors-return-value 1.997 1.997 0 0
lang-err-integration-tests/contract-ref 5.062 5.062 0 0
lang-err-integration-tests/integration-flipper 1.827 1.827 0 0
lazyvec-integration-test 4.66 4.66 0 0
mapping-integration-tests 8.036 8.036 0 0
mother 12.753 12.753 0 0
multi-contract-caller 6.654 6.654 0 0
multi-contract-caller/accumulator 1.388 1.388 0 0
multi-contract-caller/adder 1.922 1.922 0 0
multi-contract-caller/subber 1.942 1.942 0 0
multisig 21.871 21.871 0 0
payment-channel 5.742 5.742 0 0
psp22-extension 7.083 7.083 0 0
rand-extension 2.977 2.977 0 0
sr25519-verification 1.154 1.154 0 0
static-buffer 2.578 2.578 0 0
trait-dyn-cross-contract-calls 2.899 2.899 0 0
trait-dyn-cross-contract-calls/contracts/incrementer 1.557 1.557 0 0
trait-erc20 7.331 7.331 0 0
trait-flipper 1.502 1.502 0 0
trait-incrementer 1.626 1.626 0 0
upgradeable-contracts/delegator 3.96 3.96 0 0
upgradeable-contracts/delegator/delegatee 1.641 1.641 0 0
upgradeable-contracts/delegator/delegatee2 1.641 1.641 0 0
upgradeable-contracts/set-code-hash-migration 1.755 1.755 0 0
upgradeable-contracts/set-code-hash-migration/migration 1.462 1.462 0 0
upgradeable-contracts/set-code-hash-migration/updated-incrementer 1.909 1.909 0 0
upgradeable-contracts/set-code-hash 1.755 1.755 0 0
upgradeable-contracts/set-code-hash/updated-incrementer 1.733 1.733 0 0
wildcard-selector 2.858 2.858 0 0

Link to the run | Last update: Fri Mar 8 12:37:56 CET 2024

…gument

Required updating `ink_ir::ast::AttributeArgs` to support name-only meta items e.g. `#[ink::event(anonymous)]`
@davidsemakula davidsemakula force-pushed the ink-event-anonymous-as-name-only branch from aa17fec to 9cabcc4 Compare March 8, 2024 09:40
Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ascjones ascjones enabled auto-merge (squash) March 8, 2024 10:18
@davidsemakula
Copy link
Contributor Author

Looks like I'm gonna have to rebase to fix the changelog conflict 🙂

@ascjones
Copy link
Collaborator

ascjones commented Mar 8, 2024

Looks like I'm gonna have to rebase to fix the changelog conflict 🙂

Already done

@ascjones ascjones merged commit 0f2b2c6 into use-ink:master Mar 8, 2024
23 checks passed
@davidsemakula davidsemakula deleted the ink-event-anonymous-as-name-only branch March 8, 2024 11:12
@SkymanOne SkymanOne mentioned this pull request Mar 11, 2024
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.

3 participants