Skip to content

Commit

Permalink
lang: Remove EventIndex (#3244)
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Sep 12, 2024
1 parent 0eb166b commit 340e9c1
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 13 deletions.
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,
}

0 comments on commit 340e9c1

Please sign in to comment.