Skip to content

Commit

Permalink
fix: noir-protocol circuits (#3734)
Browse files Browse the repository at this point in the history
this PR restores the relative path to noir-protocol-circuits in
`aztec-nr/aztec/Nargo.toml` and makes the path remapping more generic
and robust 🤞
  • Loading branch information
alexghr committed Dec 19, 2023
1 parent 1a1285a commit 34e2505
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/mirror_repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,30 @@ jobs:
# list all aztec-packages tags, take the "highest" version
monorepo_tag="$(git tag --list aztec-packages-v* | sort --version-sort | tail -1)"
monorepo_protocol_circuits_path="yarn-project/noir-protocol-circuits"
nargo_file="$SUBREPO_PATH/aztec/Nargo.toml"
# take all Nargo.toml files that reference noir-protocol-circuits
nargo_files="$(find $SUBREPO_PATH -name 'Nargo.toml' | xargs grep --files-with-matches 'noir-protocol-circuits')"
# match lines like this:
# protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" }
# and replace with
# protocol_types = { git="https://github.com/aztecprotocol/aztec-packages", tag="aztec-packages-v0.16.9", directory="yarn-project/noir-protocol-circuits/src/crates/types" }
sed --regexp-extended --in-place \
"s;path\s*=\s*\".*noir-protocol-circuits(.*)\";git=\"$monorepo_url\", tag=\"$monorepo_tag\", directory=\"$monorepo_protocol_circuits_path\1\";" \
$nargo_file
for nargo_file in $nargo_files; do
sed --regexp-extended --in-place \
"s;path\s*=\s*\".*noir-protocol-circuits(.*)\";git=\"$monorepo_url\", tag=\"$monorepo_tag\", directory=\"$monorepo_protocol_circuits_path\1\";" \
$nargo_file
done
git commit --all --message "chore: replace relative paths to noir-protocol-circuits"
if ./scripts/git_subrepo.sh push $SUBREPO_PATH --branch=master; then
git fetch # in case a commit came after this
git rebase origin/master
# restore old Nargo.toml
# We have to go back two generations. History looks like this:
# HEAD <--- the commit generated by git_subrepo
# HEAD~1 <--- the chore commit created above
# HEAD~2 <--- the original commit we were supposed to mirror or the tip of master after rebase
git restore --source=HEAD~2 -- $nargo_file
# restore old files
for nargo_file in $nargo_files; do
git restore --source=origin/master -- $nargo_file
done
git commit --all --amend -m "$(git log -1 --pretty=%B) [skip ci]"
git push
Expand Down
2 changes: 1 addition & 1 deletion yarn-project/aztec-nr/aztec/Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ compiler_version = ">=0.18.0"
type = "lib"

[dependencies]
protocol_types = { git="https://github.com/AztecProtocol/aztec-packages", tag="aztec-packages-v0.16.9", directory="yarn-project/noir-protocol-circuits/src/crates/types" }
protocol_types = { path = "../../noir-protocol-circuits/src/crates/types" }

0 comments on commit 34e2505

Please sign in to comment.