Skip to content

Commit e49404c

Browse files
author
Carolyn Zech
authored
Merge branch 'main' into vecchallenge
2 parents 7497759 + 0840b22 commit e49404c

File tree

541 files changed

+24417
-14605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

541 files changed

+24417
-14605
lines changed

.github/workflows/goto-transcoder.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
uses: actions/checkout@v4
2828
with:
2929
submodules: true
30+
- name: Apply stdarch patch
31+
run: cd library/stdarch && patch -p1 < ../../stdarch.patch
3032

3133
# Step 2: Generate contracts programs
3234
- name: Generate contracts

.github/workflows/kani-metrics.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,30 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17+
- name: Remove unnecessary software to free up disk space
18+
run: |
19+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
20+
df -h
21+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
22+
df -h
23+
1724
- name: Checkout Repository
1825
uses: actions/checkout@v4
1926
with:
2027
submodules: true
21-
28+
- name: Apply stdarch patch
29+
run: cd library/stdarch && patch -p1 < ../../stdarch.patch
30+
2231
# The Kani metrics collection uses a Python script (kani_std_analysis.py), so make sure Python is installed
2332
- name: Set up Python
2433
uses: actions/setup-python@v4
2534
with:
2635
python-version: '3.x'
2736

2837
- name: Compute Kani Metrics
29-
run: ./scripts/run-kani.sh --run metrics --path ${{github.workspace}}
38+
run: |
39+
./scripts/run-kani.sh --run metrics --with-autoharness --path ${{github.workspace}}
40+
rm kani-list.json
3041
3142
- name: Create Pull Request
3243
uses: peter-evans/create-pull-request@v7

.github/workflows/kani.yml

Lines changed: 267 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,23 @@ jobs:
3737
WORKER_TOTAL: 4
3838

3939
steps:
40+
- name: Remove unnecessary software to free up disk space
41+
if: matrix.os == 'ubuntu-latest'
42+
run: |
43+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
44+
df -h
45+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
46+
df -h
47+
4048
# Step 1: Check out the repository
4149
- name: Checkout Repository
4250
uses: actions/checkout@v4
4351
with:
4452
path: head
4553
submodules: true
46-
54+
- name: Apply stdarch patch
55+
run: cd head/library/stdarch && patch -p1 < ../../stdarch.patch
56+
4757
# Step 2: Install jq
4858
- name: Install jq
4959
if: matrix.os == 'ubuntu-latest'
@@ -53,6 +63,221 @@ jobs:
5363
- name: Run Kani Verification
5464
run: head/scripts/run-kani.sh --path ${{github.workspace}}/head
5565

66+
kani_autoharness:
67+
name: Verify std library using autoharness
68+
runs-on: ${{ matrix.os }}
69+
strategy:
70+
matrix:
71+
os: [ubuntu-latest, macos-latest]
72+
include:
73+
- os: ubuntu-latest
74+
base: ubuntu
75+
- os: macos-latest
76+
base: macos
77+
fail-fast: false
78+
79+
steps:
80+
- name: Remove unnecessary software to free up disk space
81+
if: matrix.os == 'ubuntu-latest'
82+
run: |
83+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
84+
df -h
85+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
86+
df -h
87+
88+
# Step 1: Check out the repository
89+
- name: Checkout Repository
90+
uses: actions/checkout@v4
91+
with:
92+
submodules: true
93+
- name: Apply stdarch patch
94+
run: cd library/stdarch && patch -p1 < ../../stdarch.patch
95+
96+
# Step 2: Run Kani autoharness on the std library for selected functions.
97+
# Uses "--include-pattern" to make sure we do not try to run across all
98+
# possible functions as that may take a lot longer than expected. Instead,
99+
# explicitly list all functions (or prefixes thereof) the proofs of which
100+
# are known to pass.
101+
# Notes:
102+
# - We use >::disjoint_bitor (and >::unchecked_disjoint_bitor) as pattern
103+
# as whitespace is not supported, cf.
104+
# https://github.com/model-checking/kani/issues/4046
105+
# - core_arch::x86::__m128d::as_f64x2 is just one example of hundreds of
106+
# core_arch::x86:: functions that are known to verify successfully.
107+
- name: Run Kani Verification
108+
run: |
109+
scripts/run-kani.sh --run autoharness --kani-args \
110+
--include-pattern ">::disjoint_bitor" \
111+
--include-pattern ">::unchecked_disjoint_bitor" \
112+
--include-pattern alloc::__default_lib_allocator:: \
113+
--include-pattern alloc::layout::Layout::from_size_align \
114+
--include-pattern ascii::ascii_char::AsciiChar::from_u8 \
115+
--include-pattern char::convert::from_u32_unchecked \
116+
--include-pattern core_arch::x86::__m128d::as_f64x2 \
117+
--include-pattern "num::nonzero::NonZero::<i8>::count_ones" \
118+
--include-pattern "num::nonzero::NonZero::<i16>::count_ones" \
119+
--include-pattern "num::nonzero::NonZero::<i32>::count_ones" \
120+
--include-pattern "num::nonzero::NonZero::<i64>::count_ones" \
121+
--include-pattern "num::nonzero::NonZero::<i128>::count_ones" \
122+
--include-pattern "num::nonzero::NonZero::<isize>::count_ones" \
123+
--include-pattern "num::nonzero::NonZero::<u8>::count_ones" \
124+
--include-pattern "num::nonzero::NonZero::<u16>::count_ones" \
125+
--include-pattern "num::nonzero::NonZero::<u32>::count_ones" \
126+
--include-pattern "num::nonzero::NonZero::<u64>::count_ones" \
127+
--include-pattern "num::nonzero::NonZero::<u128>::count_ones" \
128+
--include-pattern "num::nonzero::NonZero::<usize>::count_ones" \
129+
--include-pattern "num::nonzero::NonZero::<i8>::rotate_" \
130+
--include-pattern "num::nonzero::NonZero::<i16>::rotate_" \
131+
--include-pattern "num::nonzero::NonZero::<i32>::rotate_" \
132+
--include-pattern "num::nonzero::NonZero::<i64>::rotate_" \
133+
--include-pattern "num::nonzero::NonZero::<i128>::rotate_" \
134+
--include-pattern "num::nonzero::NonZero::<isize>::rotate_" \
135+
--include-pattern "num::nonzero::NonZero::<u8>::rotate_" \
136+
--include-pattern "num::nonzero::NonZero::<u16>::rotate_" \
137+
--include-pattern "num::nonzero::NonZero::<u32>::rotate_" \
138+
--include-pattern "num::nonzero::NonZero::<u64>::rotate_" \
139+
--include-pattern "num::nonzero::NonZero::<u128>::rotate_" \
140+
--include-pattern "num::nonzero::NonZero::<usize>::rotate_" \
141+
--include-pattern ptr::align_offset::mod_inv \
142+
--include-pattern ptr::alignment::Alignment::as_nonzero \
143+
--include-pattern ptr::alignment::Alignment::as_usize \
144+
--include-pattern ptr::alignment::Alignment::log2 \
145+
--include-pattern ptr::alignment::Alignment::mask \
146+
--include-pattern ptr::alignment::Alignment::new \
147+
--include-pattern ptr::alignment::Alignment::new_unchecked \
148+
--include-pattern time::Duration::from_micros \
149+
--include-pattern time::Duration::from_millis \
150+
--include-pattern time::Duration::from_nanos \
151+
--include-pattern time::Duration::from_secs \
152+
--exclude-pattern time::Duration::from_secs_f \
153+
--include-pattern unicode::unicode_data::conversions::to_ \
154+
--exclude-pattern ::precondition_check \
155+
--harness-timeout 10m \
156+
--default-unwind 1000 \
157+
--jobs=3 --output-format=terse | tee autoharness-verification.log
158+
gzip autoharness-verification.log
159+
160+
- name: Upload Autoharness Verification Log
161+
uses: actions/upload-artifact@v4
162+
with:
163+
name: ${{ matrix.os }}-autoharness-verification.log.gz
164+
path: autoharness-verification.log.gz
165+
if-no-files-found: error
166+
# Aggressively short retention: we don't really need these
167+
retention-days: 3
168+
169+
run_kani_metrics:
170+
name: Kani Metrics
171+
runs-on: ${{ matrix.os }}
172+
strategy:
173+
matrix:
174+
os: [ubuntu-latest, macos-latest]
175+
include:
176+
- os: ubuntu-latest
177+
base: ubuntu
178+
- os: macos-latest
179+
base: macos
180+
fail-fast: true
181+
182+
steps:
183+
- name: Remove unnecessary software to free up disk space
184+
if: matrix.os == 'ubuntu-latest'
185+
run: |
186+
# inspired by https://github.com/easimon/maximize-build-space/blob/master/action.yml
187+
df -h
188+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /usr/local/.ghcup
189+
df -h
190+
191+
# Step 1: Check out the repository
192+
- name: Checkout Repository
193+
uses: actions/checkout@v4
194+
with:
195+
submodules: true
196+
197+
# The Kani metrics collection uses a Python script (kani_std_analysis.py), so make sure Python is installed
198+
- name: Set up Python
199+
uses: actions/setup-python@v4
200+
with:
201+
python-version: '3.x'
202+
203+
# Step 2: Run list on the std library
204+
- name: Run Kani Metrics
205+
run: |
206+
scripts/run-kani.sh --run metrics --with-autoharness
207+
pushd /tmp/std_lib_analysis
208+
tar czf results.tar.gz results
209+
popd
210+
211+
- name: Upload kani-list.json
212+
uses: actions/upload-artifact@v4
213+
with:
214+
name: ${{ matrix.os }}-kani-list.json
215+
path: kani-list.json
216+
if-no-files-found: error
217+
# Aggressively short retention: we don't really need these
218+
retention-days: 3
219+
220+
- name: Upload scanner results
221+
uses: actions/upload-artifact@v4
222+
with:
223+
name: ${{ matrix.os }}-results.tar.gz
224+
path: /tmp/std_lib_analysis/results.tar.gz
225+
if-no-files-found: error
226+
# Aggressively short retention: we don't really need these
227+
retention-days: 3
228+
229+
run-log-analysis:
230+
name: Build JSON from logs
231+
needs: [run_kani_metrics, kani_autoharness]
232+
runs-on: ${{ matrix.os }}
233+
strategy:
234+
matrix:
235+
os: [ubuntu-latest, macos-latest]
236+
include:
237+
- os: ubuntu-latest
238+
base: ubuntu
239+
- os: macos-latest
240+
base: macos
241+
fail-fast: false
242+
243+
steps:
244+
- name: Checkout Repository
245+
uses: actions/checkout@v4
246+
with:
247+
submodules: false
248+
249+
- name: Download log
250+
uses: actions/download-artifact@v4
251+
with:
252+
name: ${{ matrix.os }}-autoharness-verification.log.gz
253+
254+
- name: Download kani-list.json
255+
uses: actions/download-artifact@v4
256+
with:
257+
name: ${{ matrix.os }}-kani-list.json
258+
259+
- name: Download scanner results
260+
uses: actions/download-artifact@v4
261+
with:
262+
name: ${{ matrix.os }}-results.tar.gz
263+
264+
- name: Run log parser
265+
run: |
266+
gunzip autoharness-verification.log.gz
267+
tar xzf results.tar.gz
268+
python3 scripts/kani-std-analysis/log_parser.py \
269+
--kani-list-file kani-list.json \
270+
--analysis-results-dir results/ \
271+
autoharness-verification.log \
272+
-o results.json
273+
274+
- name: Upload JSON
275+
uses: actions/upload-artifact@v4
276+
with:
277+
name: ${{ matrix.os }}-results.json
278+
path: results.json
279+
if-no-files-found: error
280+
56281
run-kani-list:
57282
name: Kani List
58283
runs-on: ubuntu-latest
@@ -63,11 +288,19 @@ jobs:
63288
with:
64289
path: head
65290
submodules: true
291+
- name: Apply stdarch patch
292+
run: cd head/library/stdarch && patch -p1 < ../../stdarch.patch
66293

67294
# Step 2: Run list on the std library
68295
- name: Run Kani List
69-
run: head/scripts/run-kani.sh --run list --path ${{github.workspace}}/head
70-
296+
run: |
297+
head/scripts/run-kani.sh --run list --with-autoharness --path ${{github.workspace}}/head
298+
# remove duplicate white space to reduce file size (GitHub permits at
299+
# most one 1MB)
300+
ls -l ${{github.workspace}}/head/kani-list.md
301+
perl -p -i -e 's/ +/ /g' ${{github.workspace}}/head/kani-list.md
302+
ls -l ${{github.workspace}}/head/kani-list.md
303+
71304
# Step 3: Add output to job summary
72305
- name: Add Kani List output to job summary
73306
uses: actions/github-script@v6
@@ -79,3 +312,34 @@ jobs:
79312
.addHeading('Kani List Output', 2)
80313
.addRaw(kaniOutput, false)
81314
.write();
315+
316+
run-autoharness-analyzer:
317+
name: Kani Autoharness Analyzer
318+
runs-on: ubuntu-latest
319+
steps:
320+
# Step 1: Check out the repository
321+
- name: Checkout Repository
322+
uses: actions/checkout@v4
323+
with:
324+
submodules: true
325+
- name: Apply stdarch patch
326+
run: cd library/stdarch && patch -p1 < ../../stdarch.patch
327+
328+
# Step 2: Run autoharness analyzer on the std library
329+
- name: Run Autoharness Analyzer
330+
run: scripts/run-kani.sh --run autoharness-analyzer
331+
332+
# Step 3: Add output to job summary
333+
- name: Add Autoharness Analyzer output to job summary
334+
run: |
335+
pushd scripts/autoharness_analyzer
336+
echo "# Autoharness Failure Summary" >> "$GITHUB_STEP_SUMMARY"
337+
echo "## Crate core, all functions" >> "$GITHUB_STEP_SUMMARY"
338+
cat core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
339+
echo "## Crate core, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
340+
cat core_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
341+
echo "## Crate std, all functions" >> "$GITHUB_STEP_SUMMARY"
342+
cat std_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
343+
echo "## Crate std, unsafe functions" >> "$GITHUB_STEP_SUMMARY"
344+
cat std_unsafe_autoharness_data.md >> "$GITHUB_STEP_SUMMARY"
345+
popd

.github/workflows/pr_approval.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ jobs:
7373
return;
7474
}
7575
76+
// Get the list of changed files
77+
const { data: changedFiles } = await github.rest.pulls.listFiles({
78+
owner,
79+
repo,
80+
pull_number,
81+
});
82+
83+
// Check if any files in doc/, library/ or verifast-proofs/ are modified
84+
const affectsDocs = changedFiles.some(file => file.filename.startsWith('doc/'));
85+
const affectsLibrary = changedFiles.some(file => file.filename.startsWith('library/'));
86+
const affectsVerifast = changedFiles.some(file => file.filename.startsWith('verifast-proofs/'));
87+
// Require two approvals iff one of the above folders are modified; otherwise, one is sufficient.
88+
const requiresTwoApprovals = affectsDocs || affectsLibrary || affectsVerifast;
89+
const requiredApprovals = requiresTwoApprovals ? 2 : 1;
90+
7691
// Get all reviews with pagination
7792
async function getAllReviews() {
7893
let allReviews = [];
@@ -113,23 +128,27 @@ jobs:
113128
.map(review => review.user.login)
114129
);
115130
116-
const requiredApprovals = 2;
117131
const committeeApprovers = Array.from(approvers)
118132
.filter(approver => requiredApprovers.includes(approver));
119133
const currentCountfromCommittee = committeeApprovers.length;
120134
121-
// Core logic that checks if the approvers are in the committee
122-
const conclusion = (currentCountfromCommittee >= 2) ? 'success' : 'failure';
135+
// Check if we have enough approvals
136+
const conclusion = (currentCountfromCommittee >= requiredApprovals) ? 'success' : 'failure';
123137
124138
console.log('PR Approval Status');
139+
console.log('Modified folders:');
140+
console.log(`- doc/: ${affectsDocs ? 'yes' : 'no'}`);
141+
console.log(`- library/: ${affectsLibrary ? 'yes' : 'no'}`);
142+
console.log(`- verifast-proofs/: ${affectsVerifast ? 'yes' : 'no'}`);
143+
console.log(`Required approvals from committee: ${requiredApprovals}`);
125144
console.log(`PR has ${approvers.size} total approvals and ${currentCountfromCommittee} required approvals from the committee.`);
126145
127146
console.log(`Committee Members: [${requiredApprovers.join(', ')}]`);
128147
console.log(`Committee Approvers: ${committeeApprovers.length === 0 ? 'NONE' : `[${committeeApprovers.join(', ')}]`}`);
129148
console.log(`All Approvers: ${approvers.size === 0 ? 'NONE' : `[${Array.from(approvers).join(', ')}]`}`);
130149
131150
if (conclusion === 'failure') {
132-
core.setFailed(`PR needs 2 approvals from committee members, but it has ${currentCountfromCommittee}`);
151+
core.setFailed(`PR needs ${requiredApprovals} approval${requiredApprovals > 1 ? 's' : ''} from committee members, but it has ${currentCountfromCommittee}`);
133152
} else {
134153
core.info('PR approval check passed successfully.');
135154
}

0 commit comments

Comments
 (0)