Skip to content

Commit f22e79a

Browse files
authored
feat: Referenda&Runtime upgrade commands restored (#70)
* feat: Referenda commands restored * feat: Chain after refactor * fix: Preimage hash fix * chore: Metadata refresh + new runtime version * fix: Collective members decoder * feat: Refresh with chain 0.5.3 * fix: FMT * fix: binary generation
1 parent 123895d commit f22e79a

14 files changed

Lines changed: 2199 additions & 963 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
*.hex
44

55
# Circuit binaries are generated at build time by build.rs
6-
/generated-bins/
6+
/generated-bins/
7+
/generated-bins

build.rs

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,40 @@ fn main() {
5353
// verification (manifest_dir is inside target/package/ in that case).
5454
let project_bins = Path::new(&manifest_dir).join("generated-bins");
5555
if !manifest_dir.contains("target/package/") {
56-
let _ = std::fs::create_dir_all(&project_bins);
57-
if let Ok(entries) = std::fs::read_dir(&build_output_dir) {
58-
for entry in entries.flatten() {
59-
let dest = project_bins.join(entry.file_name());
60-
let _ = std::fs::copy(entry.path(), dest);
56+
// Prefer a symlink to avoid copying large prover binaries on every build.
57+
// If symlink creation fails (e.g. on filesystems without symlink support),
58+
// fall back to copying and surface errors.
59+
#[cfg(unix)]
60+
{
61+
use std::os::unix::fs::symlink;
62+
// Remove any existing dir/file/symlink at destination.
63+
if let Ok(meta) = std::fs::symlink_metadata(&project_bins) {
64+
if meta.is_dir() {
65+
std::fs::remove_dir_all(&project_bins)
66+
.expect("Failed to remove existing generated-bins directory");
67+
} else {
68+
std::fs::remove_file(&project_bins)
69+
.expect("Failed to remove existing generated-bins file/symlink");
70+
}
6171
}
72+
if let Err(e) = symlink(&build_output_dir, &project_bins) {
73+
println!(
74+
"cargo:warning=[quantus-cli] Failed to symlink generated-bins ({}). Falling back to copy...",
75+
e
76+
);
77+
} else {
78+
// Symlink created successfully; we're done.
79+
return;
80+
}
81+
}
82+
83+
std::fs::create_dir_all(&project_bins).expect("Failed to create generated-bins directory");
84+
let entries = std::fs::read_dir(&build_output_dir)
85+
.expect("Failed to read generated-bins directory in OUT_DIR");
86+
for entry in entries {
87+
let entry = entry.expect("Failed to read generated-bins entry");
88+
let dest = project_bins.join(entry.file_name());
89+
std::fs::copy(entry.path(), dest).expect("Failed to copy generated-bins file");
6290
}
6391
}
6492
}

0 commit comments

Comments
 (0)