Skip to content

Commit 173d471

Browse files
authored
Merge pull request #110 from os-checker/data-hash-split-json
Feat: Generate `hash.json` and `split` json folder; bump toolchain to nightly-2025-08-19
2 parents 3a3b779 + d016af2 commit 173d471

Some content is hidden

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

41 files changed

+10235
-10166
lines changed

.github/gen_core.json.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -o pipefail
44

55
export WORKSPACE="${WORKSPACE:-$(pwd)}"
66

7-
export RUST_LOG=off
7+
export DV_LOG=off
88
export OUTPUT_DIR=$WORKSPACE/assets
99
export KANI_DIR=$WORKSPACE/kani/target/kani
1010
export VERIFY_RUST_STD_LIBRARY=$WORKSPACE/verify-rust-std/library
@@ -13,7 +13,7 @@ export VERIFY_RUST_STD_LIBRARY=$WORKSPACE/verify-rust-std/library
1313
# * update runid after verify-rust-std submodule syncs
1414
# * update snapshots after runid changes
1515
rm tmp -rf
16-
gh run download -D tmp -R model-checking/verify-rust-std 16777123952
16+
gh run download -D tmp -R model-checking/verify-rust-std 17086909032
1717

1818
ls -alh $VERIFY_RUST_STD_LIBRARY
1919

.github/install-kani.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1-
set -ex
1+
#!/usr/bin/bash
2+
set -exo pipefail
23

34
# NOTE: verify-rust-std pins its kani commit, and
45
# distributed-verification pins another.
56
# So this means for verify-rust-std jobs,
67
# distributed-verification may be broken to compile.
78
git submodule update --init kani
89

10+
# Temporary patch to https://github.com/model-checking/kani/pull/4312
11+
cp .github/kani_contract_mode.patch kani
12+
913
# Install kani
1014
pushd kani
1115
git submodule update --init charon
1216

17+
# Apply the patch
18+
git apply kani_contract_mode.patch
19+
1320
./scripts/setup/ubuntu/install_deps.sh
1421
cargo build-dev -- --release
1522

1623
export PATH=$(pwd)/scripts:$PATH
17-
echo PATH=$PATH >>$GITHUB_ENV
24+
echo PATH="$PATH" >>"$GITHUB_ENV"
1825
kani --version
1926

2027
popd

.github/kani_contract_mode.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/library/kani_macros/src/sysroot/contracts/bootstrap.rs b/library/kani_macros/src/sysroot/contracts/bootstrap.rs
2+
index ed8bde7f8..d8f2eae87 100644
3+
--- a/library/kani_macros/src/sysroot/contracts/bootstrap.rs
4+
+++ b/library/kani_macros/src/sysroot/contracts/bootstrap.rs
5+
@@ -71,7 +71,7 @@ const fn kani_register_contract<T, F: FnOnce() -> T>(f: F) -> T {
6+
}
7+
// Dummy function that we replace to pick the contract mode.
8+
// By default, return ORIGINAL
9+
- #[inline(never)]
10+
+ #[inline]
11+
#[kanitool::fn_marker = "kani_contract_mode"]
12+
const fn kani_contract_mode() -> kani::internal::Mode {
13+
kani::internal::ORIGINAL

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
autoharness: ["", "-autoharness"]
5555
if: true
5656
env:
57-
UNSTABLE_ARGS: -Z function-contracts -Z mem-predicates -Z float-lib -Z c-ffi -Z loop-contracts
57+
UNSTABLE_ARGS: -Z function-contracts -Z mem-predicates -Z float-lib -Z c-ffi -Z loop-contracts -Z stubbing
5858
AUTO: ${{ matrix.autoharness }}
5959
steps:
6060
- name: Remove unnecessary software to free up disk space

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ core.json
1313
*.sqlite3
1414
*.db
1515
*.diff
16+
*.log
1617

1718
tmp/

Cargo.lock

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ eyre = "0.6"
1717
color-eyre = "0.6"
1818

1919
# logger
20+
log = "0.4.27"
2021
tracing = "0.1"
2122
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
2223
tracing-error = "0.2"
2324

2425
# db
2526
rusqlite = { version = "0.36.0", features = ["bundled", "jiff"] }
26-
serde_rusqlite = "0.39.1"
2727
jiff = { version = "0.2", features = ["serde"] }
2828

2929
[dev-dependencies]

assets/hash.sql

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- sqlite3 ../artifacts/artifact-libcore/core.sqlite3 <hash.sql | jq -s '.' >../ui/verify-rust-std_data/hash.json
2+
WITH
3+
df AS (
4+
SELECT
5+
file,
6+
name,
7+
proof_kind,
8+
hash
9+
FROM
10+
db
11+
ORDER BY
12+
file,
13+
name
14+
)
15+
SELECT
16+
JSON_PATCH (
17+
'{}',
18+
JSON_OBJECT (
19+
'file',
20+
file,
21+
'name',
22+
name,
23+
'proof_kind',
24+
proof_kind,
25+
'hash',
26+
hash
27+
)
28+
)
29+
FROM
30+
df;

assets/split.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/bash
2+
3+
set -eou pipefail
4+
5+
# Usage: sqlite.sh db-path sql-path
6+
# e.g. ./split.sh ../artifacts/artifact-libcore/core.sqlite3 split.sql ../tmp/json
7+
db=$1
8+
sql=$2
9+
base=$3
10+
11+
echo "db=$db, sql=$sql, base=$base"
12+
13+
# Let parallel use bash.
14+
export PARALLEL_SHELL=$(type -p bash)
15+
16+
run() {
17+
PREFIX=/home/runner/work/verify-rust-std/verify-rust-std/library/
18+
19+
# Read all arguments and JSON from stdin through parallel pipe.
20+
while IFS=$'\t' read -r filename hash json; do
21+
# $base is unavaible in parallel run, so pass it as env var.
22+
json_folder="$BASE/${filename#"$PREFIX"}"
23+
json_file="$json_folder/$hash.json"
24+
echo "$json_file"
25+
mkdir -p "$json_folder"
26+
jq 'del(.[] | select(. == []))' <<<"$json" >"$json_file"
27+
done
28+
}
29+
30+
# Let parallel call the function.
31+
export -f run
32+
33+
sqlite3 -batch "$db" -separator $'\t' <"$sql" |
34+
parallel --colsep '\t' --pipe --progress --tagstring '[Job {#}]' \
35+
"BASE=$base run"

assets/split.sql

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
SELECT
2+
file,
3+
hash,
4+
JSON_PATCH (
5+
'{}',
6+
JSON_OBJECT (
7+
'file',
8+
file,
9+
'name',
10+
name,
11+
'hash',
12+
hash,
13+
'hash_direct',
14+
hash_direct,
15+
'inst_kind',
16+
inst_kind,
17+
'proof_kind',
18+
proof_kind,
19+
'attrs',
20+
JSON (attrs),
21+
'src',
22+
src,
23+
'macro_backtrace',
24+
JSON (macro_backtrace),
25+
'callees',
26+
JSON (callees)
27+
)
28+
) AS data
29+
FROM
30+
db
31+
ORDER BY
32+
file,
33+
hash;

0 commit comments

Comments
 (0)