The NEAR development team pulled off perhaps one of the most impressive engineering operations of the year: right in the middle of mainnet operation, under real load, they replaced the smart contract execution engine. And they did it almost imperceptibly for users. This is not just an update — it's a change of foundation that remained behind the scenes.

Why was this necessary?

For years, NEAR relied on its own implementation of the NearVM virtual machine, built on a fork of the Wasmer engine. This "private" compiler, according to a former core network developer, was a real "tax" on the project. Every update to the Rust language, every new security feature fell on the shoulders of a small team. This once even led to the project accidentally avoiding a critical vulnerability in the original Wasmer, simply by ceasing to sync with it the day before the bug was discovered. This couldn't continue for long.

Wasmtime: Industry standard for security

The choice fell on Wasmtime — the reference implementation of WebAssembly, supported by the Bytecode Alliance. This is not just replacing a "nut" — it's a transition to a standard developed by the entire community. The security proof was conducted with surgical precision: network nodes simultaneously ran real traffic through both virtual machines and cross-checked every result. The discrepancy in fees was less than 0.002%, and execution speed increased approximately fourfold.

The forbidden solution and the "slowdown bomb"

The main engineering puzzle lay not in execution, but in compilation. In the NEAR network, contract deployment is compiled directly within a block lasting only 600 milliseconds. The problem is that the optimizing compiler has no upper time limit. The team created a test contract of 128 KB, whose compilation took about 7 seconds — enough to "miss" the block and slow down the entire network.

A seemingly simple solution — setting a time limit on compilation — turned out to be forbidden. As the developers explained, different validators spend different amounts of time on compilation. A borderline contract would be accepted by some nodes and rejected by others. The result — a network split due to a single compiler setting. Consensus requires complete predictability, even from build time.

Elegant solution: Winch and offloading compilation

Instead of brute force, the team applied engineering elegance. They introduced Winch — a single-pass backend for Wasmtime — and added missing features to it. As a result, the "worst-case compilation" was reduced from 7.6 seconds to 36 milliseconds. Moreover, compilation was offloaded to a separate type of handler, not tied to execution nodes. As Vadim noted, working outside the blockchain provides "a luxury unavailable to the protocol."

Analyst's verdict: This upgrade is a brilliant example of what mature infrastructure should look like. NEAR didn't just change the engine; it solved a fundamental security and performance problem without attracting attention or creating hype. For me, this is a signal of the high quality of the project's engineering culture, which in the long term is far more important than loud marketing claims.