NewsCryptoNeoVM v3.11.2 Prepares Neo N3 for Huyao's Dynamic Opcode Pricing

NeoVM v3.11.2 Prepares Neo N3 for Huyao's Dynamic Opcode Pricing

Author: CryptoNewsNet·

Key Takeaways

  • •Neo published neo-vm v3.11.2 on Nov. 17, its first release since v3.10.1 shipped in July, with all functional changes contained in v3.11.0 tagged hours earlier the same day.
  • •The new RunStats structure logs each instruction's operational details, enabling the dynamic pricing model that will replace fixed opcode prices once the Huyao hard fork activates.
  • •The update brings the C# VM's reference counting in line with NeoGo, removing redundant count adjustments in opcodes such as INITSLOT, PACKMAP, UNPACK, and SETITEM, and porting NeoGo's remaining reference-counter tests.
  • •The Neo Council postponed a planned 100x execution fee reduction in April until dynamic pricing is in place, with the model intended to make standard transactions cheaper and malicious ones more expensive.
  • •The release includes breaking changes for projects extending the VM and has no effect on MainNet or TestNet until the Neo core library adopts v3.11.2 and Huyao receives an activation height.
NeoVM v3.11.2 Prepares Neo N3 for Huyao's Dynamic Opcode Pricing

Neo's C# virtual machine implementation can now record the amount of work each instruction performs — data that the dynamic pricing model planned for the upcoming Huyao hard fork will use to calculate GAS costs. NeoVM is the virtual machine responsible for executing Neo N3 smart contracts.

The update, published as neo-vm v3.11.2 on Nov. 17, also brings the VM's reference counting into line with NeoGo, the Go-based node implementation maintained by Neo SPCC. Jimmy Liao, a Neo core developer and founder of R3E Network, announced the release on Nov. 18. It marks the first neo-vm release since v3.10.1 shipped in July.

Notably, all functional code changes were contained in v3.11.0, which was tagged a few hours earlier on the same day; v3.11.1 and v3.11.2 adjust only the version number.

A delayed fee reduction awaits dynamic pricing

The groundwork matters because of a decision taken in April, when the Neo Council postponed a planned 100x reduction in execution fees until dynamic pricing was in place. The model was originally tied to the Gorgon hard fork. After Gorgon's scheduled Aug. 1 MainNet activation, Neo core developers merged the C# pricing code on Sept. 17, and it will now take effect only with Huyao. Execution fees on Neo N3 are paid in GAS, and hard forks such as Huyao take effect only once a predetermined activation height is reached on each network.

What RunStats records

Central to the release is RunStats, a new structure that logs what an instruction does as it executes (PR #571). Only opcodes whose prices depend on their inputs, such as PACKMAP, populate it.

RunStats captures four values: the type of item the opcode operated on, the number of elements, bytes, or slots involved, the net change in the VM's reference count, and the number of items cloned.

Under the current system, every opcode carries a fixed price. The new model ties an instruction's cost to the work it performs, meaning packing a large map would incur a higher fee than packing a small one. Neo SPCC has stated the model is intended to make standard transactions cheaper while making malicious ones more expensive.

The VM itself only gathers these figures and passes them to the node after each instruction. The actual pricing formulas sit in the Neo core library (PR #4536) and will replace the fixed price table once Huyao is enabled. Until that point, existing prices remain in force.

Tural Devrishev of Neo SPCC authored the RunStats change, which the pull request describes as a partial port of NeoGo's implementation. NeoGo merged its own dynamic opcode pricing on Sept. 25 (PR #4087) but has yet to include it in a tagged release.

Reference counting brought in line with NeoGo

NeoVM tracks how many items are alive on its stacks and uses that count to enforce its maximum stack size. Because every Neo node implementation must produce identical results, any divergence between the C# VM and NeoGo's VM could cause the two clients to disagree. Running independent implementations of the same protocol is common across major blockchain networks, an approach that reduces the risk of a defect in any single codebase disrupting the network.

Previously, several opcodes — including INITSLOT, PACKMAP, UNPACK, and SETITEM — removed items from the count and immediately added them back when moving values between the stack and slots, arrays, or maps. They now skip that step (PR #575). Storing an item into a slot likewise follows NeoGo's approach (PR #598).

The release also ports NeoGo's remaining reference-counter tests, completing work begun with neo-vm v3.10.0. That version moved the C# VM to NeoGo's lighter counter model, which followed NeoGo's own reference counting optimizations in March.

During review of PR #598, Roman Khimov of Neo SPCC noted that the change does not require a hard fork, since it affects only transactions that fail anyway.

SETITEM correction and determinism fixes

SETITEM now correctly stores negative values between -128 and -1 into a Buffer (PR #606). Those values previously passed the opcode's range check, but a faulty conversion caused the transaction to fail. The C# node will retain the old behavior until Huyao activates (PR #4800).

The update also standardizes how every node formats error messages that contracts can catch, regardless of locale settings (PR #612). Previously, .NET rendered negative numbers with a different minus character on nodes configured for Swedish or Norwegian locales, meaning the same script could produce different bytes on different machines. Shargon, a Neo core developer, identified the fix as one of the final security patches ahead of the next Neo core release.

Additional fixes address a memory leak caused by Buffers borrowing memory from a shared pool and almost never returning it (PR #603), and tighten checks on jump targets during script validation (PR #605).

Breaking changes for developers

Projects that extend the VM will need to update their code: opcode handlers and the PostExecuteInstruction method now accept a RunStats parameter, custom JumpTable entries and ExecutionEngine subclasses must be adjusted, and the Buffer constructor no longer accepts a zeroInitialize argument.

What comes next

On its own, the update has no effect on Neo's MainNet or TestNet. The most recent Neo core release, v3.10.2, still depends on neo-vm v3.10.1, and the core library's development branch has not yet adopted v3.11.2.

According to the Neo core v3.11.0 release checklist, that version will focus on finalizing the Huyao hard fork, including dynamic VM instruction prices and a new TemporaryStorage native contract. No release date has been announced, and Huyao currently has no activation height on either MainNet or TestNet. For now, the markers to watch are the core development branch's adoption of v3.11.2, the eventual v3.11.0 release, and any activation heights announced for Huyao on MainNet or TestNet.

The release is available at: https://github.com/neo-project/neo-vm/releases/tag/v3.11.2