Skip to content

chore: use 1.83.0 for dev, 1.80.0 for building contract #155

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

Closed
wants to merge 4 commits into from

Conversation

r-near
Copy link
Contributor

@r-near r-near commented Feb 24, 2025

The Problem

We've been stuck in a Rust versioning trap:

  • Our dev dependencies require Rust ≥1.81.0
  • The existing near-sandbox version is only compatible with contracts built with Rust 1.80.0
  • Using 1.81.0/1.82.0 hit compiler bugs (rust-lang/rust#64490)
  • Using 1.83.0 for everything caused CompilationError(PrepareError(Deserialization)) in tests

The Solution

This PR implements a dual-toolchain approach:

  1. Use Rust 1.83.0 for development environment and running tests
  2. Use Rust 1.80.0 specifically for building contract WASM files

Key changes:

  • Modified CI to install both toolchains without forcing an override
  • Set 1.83.0 as default while allowing rust-toolchain files to control contract building
  • Fixed caching strategy for multi-toolchain setup

This matches what works on our local setups - we develop with newer Rust versions, but contracts are compiled with 1.80.0 via local rust-toolchain files.

Why This Works

NEAR sandbox expects a specific WASM binary format produced by Rust 1.80.0. When using newer Rust versions, subtle changes in serialization format cause deserialization errors.

The local rust-toolchain files in contract directories now correctly take precedence during contract compilation, ensuring compatibility with NEAR sandbox.

All tests now pass in CI with this configuration.

This was referenced Feb 25, 2025
@r-near r-near enabled auto-merge (squash) February 25, 2025 16:32
@karim-en karim-en closed this Feb 26, 2025
auto-merge was automatically disabled February 26, 2025 02:05

Pull request was closed

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.

2 participants