-
Notifications
You must be signed in to change notification settings - Fork 355
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
Add presets page update on release workflow #883
Merged
ericnordelo
merged 23 commits into
OpenZeppelin:main
from
ericnordelo:feat/class-hash-action
Feb 23, 2024
Merged
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
aa248b2
feat: add update class hashes workflow
ericnordelo ea7f92e
fix: input name
ericnordelo 03e2cee
test
ericnordelo 1b40cb2
test
ericnordelo a0e89bc
feat: test with main
ericnordelo 744a140
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo a18309a
feat: add update class hashes local action
ericnordelo 8d20bd5
test
ericnordelo 4f74499
feat: finish main logic
ericnordelo 1460f69
test
ericnordelo 61d2b74
fix: version
ericnordelo f3aa10e
refactor: update wording
ericnordelo 3034b12
Merge branch 'main' into feat/class-hash-action
ericnordelo 3c0f9b3
feat: remove javascript action and update preset page on release
ericnordelo b9c669d
refactor: scarb version input
ericnordelo 856b512
feat: normalize hashes len
ericnordelo 699ecbd
feat: update workflow name
ericnordelo 9a93e71
feat: apply review updates
ericnordelo 90f0d58
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo d5d8fe5
Merge branch 'main' of github.com:OpenZeppelin/cairo-contracts into f…
ericnordelo b1b724c
feat: rename file to match action
ericnordelo f82f18c
feat: get scarb version from Scarb.toml
ericnordelo 17b5f62
Update .github/workflows/prepare-release.yml
ericnordelo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import sys | ||
import json | ||
|
||
|
||
def main(): | ||
ericnordelo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# Required compiler version argument | ||
cmp_version = sys.argv[1] | ||
|
||
# Read class hashes from stdin | ||
contracts = json.load(sys.stdin) | ||
|
||
print(generate_doc_file(cmp_version, contracts)) | ||
|
||
|
||
def generate_doc_file(cmp_version, contracts): | ||
header = f"""// Version | ||
:class-hash-cairo-version: \ | ||
https://crates.io/crates/cairo-lang-compiler/{cmp_version}[cairo {cmp_version}] | ||
""" | ||
hashes = "// Class Hashes\n" | ||
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" | ||
|
||
footer = """// Presets page | ||
:presets-page: xref:presets.adoc[Sierra class hash]""" | ||
|
||
return f"{header}\n{hashes}\n{footer}\n" | ||
|
||
|
||
def normalize_len(sierra_hash): | ||
return "0x" + "0" * (66 - len(sierra_hash)) + sierra_hash[2:] | ||
|
||
|
||
if __name__ == '__main__': | ||
ericnordelo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's our strategy to maintain this up to date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My idea is to continue using the same we've been using: update this version at the same time we update the Scarb.toml. We had to do this already for the
lint_and_test
action.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see. does it make sense to automate it in some way? is there something preventing us from mistakenly not updating it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm under the impression it might be easy to forget about this bump and mistakenly publish the wrong hashes. what about reading it from
Scarb.toml
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!