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: Ignore frozen files check by using a PR label #14247

Merged
merged 13 commits into from
Feb 11, 2025
16 changes: 15 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,21 @@ jobs:
# If the target branch is not develop, do not run this check
if [ "$TARGET_BRANCH" != "develop" ]; then
echo "Target branch is not develop, skipping frozen files check"
exit 0
circleci-agent step halt
fi
- run:
name: Check if PR has exempt label
command: |
# Get PR number from CIRCLE_PULL_REQUEST
PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | rev | cut -d/ -f1 | rev)

# Use GitHub API to get labels
LABELS=$(curl -s "https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/pulls/${PR_NUMBER}" | jq -r .labels)

# If the PR has the "S-exempt-frozen-files" label, do not run this check
if echo $LABELS | jq -e 'any(.[]; .name == "S-exempt-frozen-files")' > /dev/null; then
echo "Skipping frozen files check, PR has exempt label"
circleci-agent step halt
fi
- run:
name: Check frozen files
Expand Down
22 changes: 22 additions & 0 deletions packages/contracts-bedrock/meta/CODE_FREEZES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Smart Contract Code Freeze Process

The Smart Contract Freeze Process is used to protect specific files from accidental changes during sensitive periods.

## Code Freeze

Code freezes are implemented by comparison of the bytecode and source code hashes of the local file against the upstream files.

To enable a code freeze, follow these steps:

1. Create a PR.
2. The `semver-lock.json` file should already be up to date, but run anyway `just semver-lock` to be sure.
3. Comment out the path and filename of the file/s you want to freeze in check-frozen-files.sh.

To disable a code freeze, comment out the path and filename of the file/s you want to unfreeze in check-frozen-files.sh.
1. Create a PR.
2. Uncomment the path and filename of all files in check-frozen-files.sh.

## Exceptions

To bypass the freeze you can apply the "S-exempt-frozen-files" label on affected PRs. This should be done upon agreement with the code owner. Expected uses of this exception are to fix issues found on audits or to add comments to frozen files.

4 changes: 4 additions & 0 deletions packages/contracts-bedrock/meta/POLICY.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ For any policies on contributing, please see [CONTRIBUTING](./CONTRIBUTING.md)

For our versioning policy, please see our policy on [VERSIONING](./VERSIONING.md)

## Code Freeze Policy

For our code freeze policy, please see our doc on [CODE FREEZES](./CODE_FREEZES.md)

## Upgrade Policy

For the solidity upgrade policy, please see our doc on [SOLIDITY UPGRADES](./SOLIDITY_UPGRADES.md)
Expand Down