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

feat: Sync from aztec-packages #4715

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion .aztec-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bb719200034e3bc6db09fb56538dadca4203abf4
745d5229db86b2188f52ab7ccc8f568aef8f5797
3 changes: 1 addition & 2 deletions .github/Cross.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
passthrough = [
"HOME",
"RUST_BACKTRACE",
"BARRETENBERG_BIN_DIR",
"BLNS_JSON_PATH"
"BARRETENBERG_BIN_DIR"
]
volumes = [
"HOME",
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ jobs:
- name: Install Yarn dependencies
uses: ./.github/actions/setup

- name: Install wasm-bindgen-cli
uses: taiki-e/install-action@v2
with:
tool: wasm-bindgen-cli@0.2.86

- name: Install wasm-opt
run: |
npm i wasm-opt -g

- name: Query new noir version
id: noir-version
run: |
Expand Down Expand Up @@ -116,20 +107,17 @@ jobs:
if: ${{ always() }}

needs:
- release-please
- update-acvm-workspace-package-versions
- update-docs

env:
# We treat any skipped or failing jobs as a failure for the workflow as a whole.
FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is reverting a lot of the same things last time we did an aztec-packages sync. Would this be solved with a Noir sync into aztec?

Copy link
Member

Choose a reason for hiding this comment

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

I think so. I opened a PR at AztecProtocol/aztec-packages#5572 but there's a bunch of updates which need to be made on the aztec-packages side.

FAIL: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }

steps:
- name: Add warning to sticky comment
uses: marocchino/sticky-pull-request-comment@v2
with:
# We need to specify the PR on which to make the comment as workflow is triggered by push.
number: ${{ fromJSON(needs.release-please.outputs.release-pr).number }}
# delete the comment in case failures have been fixed
delete: ${{ !env.FAIL }}
message: "The release workflow has not completed successfully. Releasing now will result in a broken release"
Expand Down
46 changes: 22 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions aztec_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ use transforms::{

use noirc_frontend::{
hir::def_collector::dc_crate::{UnresolvedFunctions, UnresolvedTraitImpl},
macros_api::{
CrateId, FileId, HirContext, MacroError, MacroProcessor, SecondaryAttribute, SortedModule,
Span,
},
macros_api::{CrateId, FileId, HirContext, MacroError, MacroProcessor, SortedModule, Span},
};

use utils::{
Expand Down Expand Up @@ -90,15 +87,18 @@ fn transform_module(module: &mut SortedModule) -> Result<bool, AztecMacroError>
let mut has_transformed_module = false;

// Check for a user defined storage struct
let storage_defined = check_for_storage_definition(module);
let storage_implemented = check_for_storage_implementation(module);

if storage_defined && !storage_implemented {
generate_storage_implementation(module)?;
let maybe_storage_struct_name = check_for_storage_definition(module)?;
let storage_defined = maybe_storage_struct_name.is_some();

if let Some(storage_struct_name) = maybe_storage_struct_name {
if !check_for_storage_implementation(module, &storage_struct_name) {
generate_storage_implementation(module, &storage_struct_name)?;
}
}

for structure in module.types.iter() {
if structure.attributes.iter().any(|attr| matches!(attr, SecondaryAttribute::Event)) {
for structure in module.types.iter_mut() {
if structure.attributes.iter().any(|attr| is_custom_attribute(attr, "aztec(event)")) {
module.impls.push(generate_selector_impl(structure));
has_transformed_module = true;
}
Expand Down
8 changes: 5 additions & 3 deletions aztec_macros/src/transforms/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use crate::{
chained_dep,
utils::{
ast_utils::{
call, expression, ident, ident_path, make_statement, make_type, path, variable_path,
call, expression, ident, ident_path, is_custom_attribute, make_statement, make_type,
path, variable_path,
},
constants::SIGNATURE_PLACEHOLDER,
errors::AztecMacroError,
Expand All @@ -38,7 +39,8 @@ use crate::{
/// This allows developers to emit events without having to write the signature of the event every time they emit it.
/// The signature cannot be known at this point since types are not resolved yet, so we use a signature placeholder.
/// It'll get resolved after by transforming the HIR.
pub fn generate_selector_impl(structure: &NoirStruct) -> TypeImpl {
pub fn generate_selector_impl(structure: &mut NoirStruct) -> TypeImpl {
structure.attributes.push(SecondaryAttribute::Abi("events".to_string()));
let struct_type =
make_type(UnresolvedTypeData::Named(path(structure.name.clone()), vec![], true));

Expand Down Expand Up @@ -174,7 +176,7 @@ pub fn transform_events(
) -> Result<(), (AztecMacroError, FileId)> {
for struct_id in collect_crate_structs(crate_id, context) {
let attributes = context.def_interner.struct_attributes(&struct_id);
if attributes.iter().any(|attr| matches!(attr, SecondaryAttribute::Event)) {
if attributes.iter().any(|attr| is_custom_attribute(attr, "aztec(event)")) {
transform_event(struct_id, &mut context.def_interner)?;
}
}
Expand Down
Loading