Skip to content

Commit

Permalink
fix: event macro (#3784)
Browse files Browse the repository at this point in the history
Fixes #3655
  • Loading branch information
benesjan authored and sirasistant committed Jan 4, 2024
1 parent 20f1652 commit ce02b01
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions aztec_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ const SIGNATURE_PLACEHOLDER: &str = "SIGNATURE_PLACEHOLDER";
/// Inserts the following code:
/// ```noir
/// impl SomeStruct {
/// fn selector() -> Field {
/// aztec::oracle::compute_selector::compute_selector("SIGNATURE_PLACEHOLDER")
/// fn selector() -> FunctionSelector {
/// aztec::selector::compute_selector("SIGNATURE_PLACEHOLDER")
/// }
/// }
/// ```
Expand All @@ -503,13 +503,18 @@ fn generate_selector_impl(structure: &NoirStruct) -> TypeImpl {
vec![expression(ExpressionKind::Literal(Literal::Str(SIGNATURE_PLACEHOLDER.to_string())))],
)))]);

// Define `FunctionSelector` return type
// TODO(https://github.com/AztecProtocol/aztec-packages/issues/3590): Make this point to aztec-nr once the issue is fixed.
let return_type_path = chained_path!("protocol_types", "abis", "function_selector", "FunctionSelector");
let return_type = FunctionReturnType::Ty(make_type(UnresolvedTypeData::Named(return_type_path, vec![])));

let mut selector_fn_def = FunctionDefinition::normal(
&ident("selector"),
&vec![],
&[],
&selector_fun_body,
&[],
&FunctionReturnType::Ty(make_type(UnresolvedTypeData::FieldElement)),
&return_type,
);

selector_fn_def.visibility = FunctionVisibility::Public;
Expand Down

0 comments on commit ce02b01

Please sign in to comment.