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

Fix cross-device-link error when compiling contract #1092

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

JulianGCalderon
Copy link
Contributor

When compiling contracts in our server, we encountered the following error: IoError(Os { code: 18, kind: CrossesDevices, message: "Invalid cross-device link" }).

This seems to happen when the temporary file used to compile contract is not in the same file system as the requested output path.

To fix this, instead of using a temporary file, the lockfile is used as a tmp file, and then renamed to the output path.

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.

Copy link

Benchmark results Main vs HEAD.

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_insert.cairo (JIT) 4.020 ± 0.057 3.963 4.145 1.07 ± 0.02
base dict_insert.cairo (AOT) 3.763 ± 0.027 3.717 3.805 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_insert.cairo (JIT) 3.868 ± 0.019 3.846 3.910 1.02 ± 0.01
head dict_insert.cairo (AOT) 3.788 ± 0.022 3.757 3.822 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_snapshot.cairo (JIT) 3.704 ± 0.019 3.676 3.737 1.03 ± 0.01
base dict_snapshot.cairo (AOT) 3.610 ± 0.021 3.570 3.639 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_snapshot.cairo (JIT) 3.793 ± 0.043 3.739 3.854 1.03 ± 0.01
head dict_snapshot.cairo (AOT) 3.690 ± 0.029 3.641 3.730 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 4.043 ± 0.015 4.019 4.072 1.01 ± 0.01
base factorial_2M.cairo (AOT) 4.013 ± 0.032 3.976 4.069 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 4.145 ± 0.032 4.100 4.185 1.01 ± 0.01
head factorial_2M.cairo (AOT) 4.085 ± 0.029 4.040 4.118 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 3.651 ± 0.037 3.585 3.702 1.02 ± 0.01
base fib_2M.cairo (AOT) 3.577 ± 0.038 3.533 3.643 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 3.696 ± 0.031 3.669 3.766 1.02 ± 0.01
head fib_2M.cairo (AOT) 3.624 ± 0.022 3.581 3.660 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 3.855 ± 0.033 3.821 3.906 1.04 ± 0.02
base linear_search.cairo (AOT) 3.694 ± 0.044 3.601 3.768 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head linear_search.cairo (JIT) 3.823 ± 0.027 3.797 3.879 1.02 ± 0.02
head linear_search.cairo (AOT) 3.748 ± 0.067 3.666 3.870 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 3.915 ± 0.037 3.859 3.965 1.04 ± 0.01
base logistic_map.cairo (AOT) 3.770 ± 0.021 3.726 3.795 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 3.938 ± 0.015 3.918 3.964 1.04 ± 0.01
head logistic_map.cairo (AOT) 3.779 ± 0.025 3.737 3.813 1.00

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.04%. Comparing base (4d4849a) to head (4281ad2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1092      +/-   ##
==========================================
- Coverage   81.05%   81.04%   -0.01%     
==========================================
  Files         108      108              
  Lines       29722    29723       +1     
==========================================
- Hits        24091    24089       -2     
- Misses       5631     5634       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Benchmarking results

Benchmark for program dict_insert

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 20.917 ± 0.052 20.827 21.001 5.58 ± 0.03
cairo-native (embedded AOT) 3.746 ± 0.018 3.720 3.780 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 3.821 ± 0.025 3.772 3.850 1.02 ± 0.01

Benchmark for program dict_snapshot

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 5.835 ± 0.023 5.795 5.874 1.61 ± 0.01
cairo-native (embedded AOT) 3.626 ± 0.022 3.596 3.669 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 3.725 ± 0.034 3.680 3.806 1.03 ± 0.01

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 14.516 ± 0.186 14.415 15.038 3.62 ± 0.06
cairo-native (embedded AOT) 4.005 ± 0.033 3.969 4.091 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 4.046 ± 0.025 3.998 4.086 1.01 ± 0.01

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 14.311 ± 0.067 14.179 14.404 4.02 ± 0.03
cairo-native (embedded AOT) 3.556 ± 0.017 3.531 3.583 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 3.592 ± 0.022 3.572 3.646 1.01 ± 0.01

Benchmark for program linear_search

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 5.838 ± 0.035 5.771 5.881 1.60 ± 0.01
cairo-native (embedded AOT) 3.660 ± 0.023 3.627 3.688 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 3.789 ± 0.038 3.739 3.867 1.04 ± 0.01

Benchmark for program logistic_map

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 5.740 ± 0.036 5.684 5.796 1.55 ± 0.01
cairo-native (embedded AOT) 3.705 ± 0.021 3.668 3.734 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 3.889 ± 0.022 3.868 3.940 1.05 ± 0.01

@edg-l edg-l added this pull request to the merge queue Feb 10, 2025
Merged via the queue into main with commit e59efe9 Feb 10, 2025
28 checks passed
@edg-l edg-l deleted the fix-cross-device-link branch February 10, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants