Home / Smart Contract Auditing / Solidity v0.8.37 Released with Critical Bug Fixes, EVM Amsterdam Support, and Experimental Compiler Enhancements

Solidity v0.8.37 Released with Critical Bug Fixes, EVM Amsterdam Support, and Experimental Compiler Enhancements

The Solidity development team has officially announced the release of Solidity v0.8.37, a maintenance-focused update that introduces essential bug fixes, crucial security patches, and early experimental support for upcoming Ethereum Virtual Machine capabilities. While primarily designed to address vulnerabilities discovered across previous versions of the compiler, this latest iteration also moves forward with infrastructure updates, including a new stack shuffler for the experimental SSA CFG code generator and native exposure for the upcoming Amsterdam EVM upgrade.

The release comes packed with three noteworthy bug fixes—two categorized under low-to-medium severity and one classified as very low severity—alongside patches for two separate non-security-related miscompilation issues. Ethereum smart contract developers are encouraged to review the changelog and upgrade their toolchains to maintain secure and predictable compilation behavior.

Important Bug Fixes

A central focus of the Solidity v0.8.37 release cycle has been resolving critical compiler bugs identified through rigorous internal auditing and the Ethereum Foundation’s bug bounty program. Three specific vulnerability disclosures highlight this release.

Memory Byte Array Element Delete Clears 32 Bytes

The most prominent security-related issue addressed in v0.8.37 involves how the legacy evmasm pipeline handles deletion operations on elements within memory-based byte arrays. When developers applied the delete keyword to a single element of a bytes array in memory, the compilation pipeline incorrectly wrote 32 zero bytes starting at the target element’s location instead of clearing only that specific byte.

This unintended behavior resulted in the extra zero bytes overwriting up to 31 subsequent bytes following the targeted element. Depending on the array’s layout, these overwritten bytes could affect later elements within the same array or, if the element was located near the end of the array, entirely unrelated data allocated immediately afterward in memory. This bug similarly impacted string values that were converted into bytes.

Crucially, the modern IR (Intermediate Representation) pipeline remains unaffected by this flaw, and analogous direct assignment operations, such as setting b[i] = 0, consistently clear exactly one byte across both compilation pipelines. Solidity versions up to and including v0.8.36 are impacted. The vulnerability was responsibly disclosed by researcher shaheenfazim through the Ethereum Foundation bug bounty program.

Spill Slot Collision Across Mutual Recursion

The second critical security fix addresses an issue within the IR pipeline’s stack-to-memory mover, a mechanism designed to bypass the EVM’s strict stack depth limit by relocating overflowing local variables to designated memory offsets known as spill slots.

Under specific, complex call graph configurations involving mutual recursion, the compiler reserved too few spill slots. Consequently, local variables belonging to two entirely different functions could be assigned the exact same memory slot even while both variables remained active and live simultaneously. This caused one variable to silently overwrite the data of the other during execution.

While closely related to a previous issue—the unsound spill in mutual recursion bug patched in version v0.8.36—this distinct manifestation affects versions 0.7.2 through 0.8.36 when contracts are compiled using the --via-ir flag. The issue was brought to light by Ng Sze Hon via the Ethereum Foundation bug bounty program.

Misordered Named Parameters in Require with Custom Errors

The third important bug fix rectifies a parameter-ordering mistake occurring when custom errors initialized with named arguments are passed directly into require statements within the IR pipeline. For example, expressions such as require(condition, MyError(b: 2, a: 1)) caused arguments to be placed onto the stack according to their call-site order rather than their strict declaration order.

During the ABI encoding phase, these misplaced parameters could be matched against incorrect types, leading to structural mismatches where transaction revert data reflected the wrong values entirely. Although the encoder generated a valid payload matching the target error’s signature, the returned data failed to represent the actual instantiation values.

Because this behavior only influences the revert data of transactions that are already failing and terminating, it has zero impact on valid contract state changes. Plain revert MyError(...) statements and other language constructs utilizing named parameters remain entirely unaffected. This vulnerability was discovered and reported by Carl from Cantina Security through the Ethereum Foundation bug bounty program.

Other Miscompilations

In addition to the primary security fixes, Solidity v0.8.37 resolves two smaller miscompilations that do not constitute direct security vulnerabilities but could introduce unexpected run-time behaviors if left unaddressed.

The first issue involves uninitialized internal function pointers located within packed storage slots using the evmasm pipeline. When a variable positioned after an uninitialized function pointer within the same storage slot held a non-zero value, reading the function pointer returned an incorrect value. This could cause equality comparisons between uninitialized function pointers and default-initialized local function pointers to evaluate incorrectly as false, despite neither pointer ever being explicitly assigned.

Because internal function pointer values depend heavily on precise bytecode layouts and are notoriously unstable across contract updates, the Solidity compiler already warns developers against performing such comparisons—a practice slated to be completely disallowed in future breaking releases. Triggering this bug requires very specific usage patterns and can be reliably caught through standard unit testing.

The second non-security miscompilation impacts constants evaluated within both checked and unchecked arithmetic contexts inside the IR pipeline. Previously, the compiler generated code computing a constant’s value only once per contract, inheriting checked or unchecked arithmetic based entirely on whichever use site happened to be compiled first. Consequently, if a constant’s initializer inherently overflowed its type, subsequent reads in checked contexts could mistakenly miss required overflow panics, while reads inside unchecked blocks could unexpectedly revert due to spurious checks.

Because all operands involved in these constant evaluations are established at compile time, the miscompiled outputs are deterministic and completely immune to external transaction manipulation. Exploiting this flaw would require writing code intentionally dependent on constants that reliably revert or behave inconsistently between contexts—scenarios that do not align with standard contract design. The most likely exposure vector involves insufficient test coverage, where an initial function execution encounters an unexpected panic or a wrapped value that is easily identified during routine development.

Notable Features and Changes

Solidity v0.8.37 also delivers notable architectural improvements, experimental updates, and early preparations for upcoming protocol upgrades.

SSA CFG Planning Stack Shuffler (Experimental)

The experimental SSA CFG code generator, which precomputes explicit stack layouts for every instruction point within a program, has received a significant upgrade. Previously, the stack shuffler utilized a greedy algorithm, applying local instruction adjustments step-by-step until reaching the desired target layout.

Version v0.8.37 replaces this greedy approach with a new planning stack shuffler. The updated shuffler constructs an explicit plan mapping current stack items to their target locations before executing the arrangement bottom-up. If it encounters a reachability limitation due to the constraints of SWAP and DUP instructions, it compresses the stack and recalculates from a fresh plan. Preliminary benchmarking demonstrates that this structured methodology is computationally superior to its predecessor while maintaining comparable bytecode output sizes. The feature remains experimental and can be enabled via --experimental --via-ssa-cfg.

Support for the SLOTNUM Opcode

Aligning with the planned Amsterdam EVM version upgrade, Solidity v0.8.37 introduces native support for the SLOTNUM opcode introduced under EIP-7843. This opcode retrieves the beacon chain slot number of the current block.

Developers can now access this value directly in Solidity through block.slotnum (typed as uint64) or within Yul and inline assembly via the built-in slotnum() function. The SMTChecker has also been updated to fully support this new global property. These features require compiling with --evm-version amsterdam. Beginning with the Amsterdam EVM version, slotnum also becomes a reserved identifier within Yul.

Removals and Deprecations

As part of ongoing efforts to streamline the compiler codebase, two experimental features introduced in version v0.8.35 have been entirely removed: Language Server Protocol mode (--lsp) and the Generic Solidity prototype (pragma experimental solidity).

LSP mode was unmaintained and unfinished, aligning with the team’s philosophy that language tooling should exist independently rather than being tightly bound to the compiler. Similarly, Generic Solidity—an early prototype aimed at refactoring the compiler in place—has been superseded by solcore, a standalone modular framework better suited for long-term experimentation and future production implementations.

Additionally, the experimental ABIEncoderV2 pragma now emits a formal deprecation warning. Having been redundant since pragma abicoder v2 debuted in version v0.7.4 and standard coder deployment in v0.8.0, this lingering pragma is being phased out to encourage clean codebases, particularly across legacy dependencies.

Finally, continuing deprecation schedules initiated in version v0.8.31, warning messages have been added for older EVM target versions—specifically constantinople, petersburg, istanbul, and berlin—as well as the SMTChecker’s BMC (Bounded Model Checking) analysis engine.

How to Install and Upgrade

Developers wishing to update to Solidity v0.8.37 can access the official installation documentation via the Solidity portal. Binaries and source files are available directly through the GitHub release page for v0.8.37.

When building from source, developers are advised to avoid automatically generated GitHub source archives, utilizing instead the dedicated solidity_0.8.37.tar.gz source tarball or checking out the explicit v0.8.37 Git tag to ensure build integrity.

Tagged:

Leave a Reply

Your email address will not be published. Required fields are marked *