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

lang: Remove EventIndex #3244

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- ts: Upgrade `typescript` to `5.5.4` and remove the generic parameters of `SimulateResponse` ([#3221](https://github.com/coral-xyz/anchor/pull/3221)).
- ts: Remove `StateCoder`([#3224](https://github.com/coral-xyz/anchor/pull/3224)).
- cli: Accept integers for `warp_slot` ([#3235](https://github.com/coral-xyz/anchor/pull/3235)).
- lang: Remove `EventIndex` ([#3244](https://github.com/coral-xyz/anchor/pull/3244)).

## [0.30.1] - 2024-06-20

Expand Down
10 changes: 1 addition & 9 deletions lang/attribute/event/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn event(
.unwrap_or_else(|| gen_discriminator("event", event_name));

let ret = quote! {
#[derive(anchor_lang::__private::EventIndex, AnchorSerialize, AnchorDeserialize)]
#[derive(AnchorSerialize, AnchorDeserialize)]
#event_strct

impl anchor_lang::Event for #event_name {
Expand Down Expand Up @@ -72,14 +72,6 @@ pub fn event(
proc_macro::TokenStream::from(ret)
}

// EventIndex is a marker macro. It functionally does nothing other than
// allow one to mark fields with the `#[index]` inert attribute, which is
// used to add metadata to IDLs.
#[proc_macro_derive(EventIndex, attributes(index))]
pub fn derive_event(_item: proc_macro::TokenStream) -> proc_macro::TokenStream {
proc_macro::TokenStream::from(quote! {})
}

/// Logs an event that can be subscribed to by clients.
/// Uses the [`sol_log_data`](https://docs.rs/solana-program/latest/solana_program/log/fn.sol_log_data.html)
/// syscall which results in the following log:
Expand Down
1 change: 0 additions & 1 deletion lang/attribute/program/src/declare_program/mods/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ pub fn gen_events_mod(idl: &Idl) -> proc_macro2::TokenStream {
.expect("Type must exist");

quote! {
#[derive(anchor_lang::__private::EventIndex)]
#ty_def

impl anchor_lang::Event for #name {
Expand Down
1 change: 0 additions & 1 deletion lang/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ pub mod prelude {
#[doc(hidden)]
pub mod __private {
pub use anchor_attribute_account::ZeroCopyAccessor;
pub use anchor_attribute_event::EventIndex;
pub use base64;
pub use bytemuck;

Expand Down
2 changes: 0 additions & 2 deletions tests/events/programs/events/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ pub struct TestEventCpi {}
#[event]
pub struct MyEvent {
pub data: u64,
#[index]
pub label: String,
}

#[event]
pub struct MyOtherEvent {
pub data: u64,
#[index]
pub label: String,
}
Loading