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

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

The Solidity development team has officially announced the release of Solidity v0.8.37, a comprehensive update that primarily focuses on addressing important compiler bugs, introducing initial support for upcoming Ethereum Virtual Machine versions, and refining experimental code generation features. While the release includes several bugfixes across different compilation pipelines—ranging from low-to-medium severity vulnerabilities to smaller miscompilation issues—it also marks another significant step forward in aligning Solidity with upcoming protocol upgrades like the Amsterdam EVM.

As developers continue to deploy complex decentralized applications across various networks, maintaining compiler reliability remains a paramount concern for the Ethereum ecosystem. The latest version introduces targeted patches for issues discovered both through internal testing and external security research, including contributions via the Ethereum Foundation’s bug bounty program. Furthermore, the release continues the gradual deprecation of legacy language features, outdated EVM versions, and older toolchain components to streamline the codebase and improve long-term maintainability.

Important Bugfixes

The core focus of Solidity v0.8.37 centers on resolving three notable bugfixes, alongside two smaller miscompilation issues that do not directly pose security threats. These fixes address edge cases in memory management, optimization pipelines, and error handling.

Memory Byte Array Element Delete Clears 32 Bytes

One of the most critical security-related issues addressed in this release involves memory byte array element deletion within the legacy evmasm pipeline. When the delete operator was applied to a specific element of a bytes array stored in memory, the compiler incorrectly wrote 32 zero bytes starting at that target element, instead of clearing only the single byte belonging to the designated element.

This unexpected behavior caused the extra zero bytes to overwrite up to 31 bytes immediately following the affected element. Depending on the memory layout, these overwritten bytes could belong to subsequent elements within the same array or, if the target element was situated near the end of the array, to whatever data happened to be allocated next in memory. This vulnerability extended equally to string values that were converted into bytes.

It is worth noting that the newer IR (Intermediate Representation) pipeline remains completely unaffected by this bug. Additionally, the analogous direct assignment operation—such as writing b[i] = 0—correctly cleared precisely one byte across both compilation pipelines. Contracts compiled with any version up to and including v0.8.36 are susceptible if they utilize the legacy pipeline for memory byte array deletions.

The issue was responsibly disclosed by researcher shaheenfazim through the Ethereum Foundation’s bug bounty program, prompting a detailed security write-up by the Solidity team to help developers audit their codebases.

Spill Slot Collision Across Mutual Recursion

The second major bugfix addresses a subtle and potentially dangerous interaction within the IR pipeline’s stack-to-memory mover. To work around the EVM’s strict stack depth limit of 16 items, the compiler occasionally relocates local variables to fixed memory offsets known as spill slots.

In specific 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 during execution phases where both variables were simultaneously live. This resulted in one variable being silently overwritten by the other during runtime execution.

This bug shares similarities with a previous vulnerability—the unsound spill in mutual recursion bug patched in version 0.8.36—but represents a distinct failure mode. Versions ranging from 0.7.2 through 0.8.36 are affected when contracts are compiled using the --via-ir optimization 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 bugfix relates to the IR pipeline’s handling of custom errors constructed with named parameters and subsequently passed to a require statement, such as require(condition, MyError(b: 2, a: 1)).

Under affected compiler versions, the arguments supplied to the custom error were placed onto the stack in the exact call-site order rather than their proper declaration order. During the subsequent ABI encoding process, these values could be matched against the wrong parameters, causing them to be misinterpreted as completely different types.

While the encoder still produced a structurally valid payload matching the intended error signature, the resulting data did not accurately reflect the actual values used to instantiate the error. Plain revert MyError(...) statements and other language constructs utilizing named parameters were unaffected. Because this misbehavior only impacted the revert data of transactions that were already failing, it had no direct impact on valid contract state transitions.

This issue was identified and reported by security researcher Carl from Cantina Security, also participating through the Ethereum Foundation bug bounty program.

Other Miscompilations

In addition to the primary bugfixes, Solidity v0.8.37 resolves two minor miscompilation scenarios that do not present direct security vulnerabilities but could produce unexpected runtime behavior under specific conditions.

The first issue involved uninitialized internal function pointers within packed storage slots using the legacy evmasm pipeline. Reading an uninitialized pointer under these conditions occasionally returned incorrect values if a separate variable stored subsequently in the same storage slot held a non-zero value. This could lead to equality comparisons between such an uninitialized pointer and a default-initialized local function pointer evaluating incorrectly to false. The Solidity team noted that relying on internal function pointer equality is inherently fragile because their values depend on exact bytecode generation and are unstable across contract upgrades. The compiler already emits warnings for such comparisons, and plans are underway to disallow them entirely in future breaking releases.

The second issue occurred within the IR pipeline when compile-time constants were evaluated across both checked and unchecked arithmetic contexts. The code responsible for computing a constant’s value was previously generated only once per contract—inheriting either checked or unchecked semantics based on whichever use site was encountered first—and shared across all subsequent references. For constants whose initializers overflowed their designated types, this sharing meant that reads occurring within a checked context could fail to trigger the required overflow panic, or alternatively, reads inside an unchecked block could spuriously revert. Because the operands involved were strictly compile-time constants, the resulting behavior was entirely deterministic and independent of transaction inputs, making it easily discoverable through standard unit testing.

Notable Features and Changes

Solidity v0.8.37 also introduces several upgrades to experimental tools, adds compatibility for upcoming blockchain specifications, and continues the ongoing cleanup of legacy code.

On the experimental front, the SSA CFG (Single Static Assignment Control Flow Graph) code generator receives a new stack shuffler. Previously, the shuffler operated via a greedy algorithm, applying local steps iteratively until reaching the target layout. The new release replaces this with a planning shuffler that computes an explicit map of current stack items to their target positions and executes the plan bottom-up. Initial benchmarks indicate that this structured approach is computationally more efficient while generating bytecode of comparable size. The feature remains experimental and can be invoked using the command-line flags --experimental --via-ssa-cfg.

In preparation for future network upgrades, the compiler now adds support for the SLOTNUM opcode introduced in the Amsterdam EVM version via EIP-7843. This opcode returns the beacon chain slot number of the current block. Solidity developers can access this property via block.slotnum (typed as uint64), while Yul and inline assembly users can utilize the slotnum() built-in function. The SMTChecker has also been updated to support this new property. These additions require compiling with --evm-version amsterdam, continuing the experimental rollout of Amsterdam features that began in v0.8.36.

The release also implements several permanent removals and deprecations. Features previously restricted to experimental mode in version 0.8.35—specifically Language Server Protocol mode (--lsp) and the Generic Solidity prototype (pragma experimental solidity)—have been completely removed from the codebase. The LSP integration was unmaintained, and the team intends to support standalone language servers rather than tightly coupling them to the compiler. Similarly, the Generic Solidity prototype has been superseded by solcore, a standalone repository designed for ongoing language experimentation.

Additionally, the experimental ABIEncoderV2 pragma now triggers a deprecation warning. Because ABI coder v2 has been enabled by default since version 0.8.0, this legacy pragma is redundant, though many older projects still reference it through legacy framework dependencies. Finally, deprecation warnings have been extended to older EVM versions including constantinople, petersburg, istanbul, and berlin, alongside the SMTChecker’s BMC engine.

Developers wishing to upgrade to Solidity v0.8.37 can access installation instructions and pre-compiled binaries via the official documentation and the GitHub release repository. Those building from source are advised to use the official source tarball rather than automatically generated GitHub archives to ensure build integrity.

Tagged: