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

Sort class hashes in workflow #938

Merged
merged 1 commit into from
Mar 6, 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
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

- name: Update presets page
run: |
class_hash get --json | sed -e '1,4d' | python3 scripts/get_hashes_page.py v$SCARB_VERSION \
class_hash get --json | sed -e '1,4d' | python3 scripts/get_hashes_page.py $SCARB_VERSION \
> ./docs/modules/ROOT/pages/utils/_class_hashes.adoc

- name: Auto-commit changes
Expand Down
1 change: 1 addition & 0 deletions scripts/get_hashes_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def generate_doc_file(cmp_version, contracts):
https://crates.io/crates/cairo-lang-compiler/{cmp_version}[cairo {cmp_version}]
"""
hashes = "// Class Hashes\n"
contracts['contracts'].sort(key=lambda x: x['name'])
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't this doing lexicographical sort?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor

Choose a reason for hiding this comment

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

but weren't we favoring category grouping over alphabetical order?

Copy link
Member Author

Choose a reason for hiding this comment

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

We did open an issue for that, #934, but we are currently sorting alphabetically.

Copy link
Contributor

@martriay martriay Mar 7, 2024

Choose a reason for hiding this comment

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

i guess find it a bit weird to open a PR with no associated issue that goes in a different direction than the issue we do have. instead i guess i would've addressed the issue directly or just leave it as it is, since i'm not sure alphabetical order is better than just whatever order until we address it. i guess it's not harmful so i wouldn't revert this either, i just wanted to understand the motivation

Copy link
Contributor

Choose a reason for hiding this comment

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

i see now that the PR is also fixing the v in the CI. we should mention that in the issue/commit

for contract in contracts['contracts']:
# The [13:] is to remove the "openzeppelin_" prefix from the contract name
hashes += f":{contract['name'][13:]}-class-hash: {normalize_len(contract['sierra'])}\n"
Expand Down
Loading