The C# implementation of NeoVM now records how much work its instructions perform. The dynamic pricing model planned for the Huyao hard fork will use that data to set GAS costs.
NeoVM is the virtual machine that runs Neo N3 smart contracts. Neo released the update as neo-vm v3.11.2 on Nov. 17, and it also aligns the VM’s reference counting with NeoGo, the Go node implementation maintained by Neo SPCC.
Jimmy Liao, Neo core developer and R3E Network founder, announced the release on Nov. 18. It is the first neo-vm release since v3.10.1 in July. All of its code changes landed in v3.11.0, tagged a few hours earlier on Nov. 17, and v3.11.1 and v3.11.2 only update the version number.
In April, the Neo Council deferred a 100x execution fee reduction until dynamic pricing was in place.
The model was originally tied to the Gorgon hard fork. Neo core developers merged the C# pricing code on Sept. 17, after Gorgon’s scheduled Aug. 1 MainNet activation, and it now takes effect only with Huyao.
Inputs for dynamic pricing
The release adds RunStats, a structure that records what an instruction did as it executes (PR #571). Only opcodes with input-dependent prices, such as PACKMAP, fill it in.
RunStats holds 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.
Today, each opcode has a fixed price. Under the new model, an instruction’s price would depend on the work it did, so packing a large map would cost more than packing a small one. Neo SPCC has said the model is meant to make standard transactions cheaper and malicious ones more expensive.
The VM only collects these figures and passes them to the node after each instruction. The pricing formulas sit in the Neo core library (PR #4536) and will replace the fixed price table once Huyao is enabled. Until then, the existing prices apply.
Neo SPCC’s Tural Devrishev wrote the RunStats change, and the pull request describes it as a partial port of NeoGo’s implementation. NeoGo merged its own dynamic opcode pricing on Sept. 25 (PR #4087) but has not yet included it in a tagged release.
Reference counting aligned with NeoGo
The VM counts how many items are alive on its stacks and uses that count to enforce its maximum stack size. Every Neo node implementation must reach identical results, so any difference between the C# VM and NeoGo’s VM can cause the two clients to disagree.
Several opcodes, including INITSLOT, PACKMAP, UNPACK, and SETITEM, used to take items off the count and add them straight back when moving them between the stack and slots, arrays, or maps. They now skip that step (PR #575). Storing an item into a slot also follows NeoGo’s approach now (PR #598).
The update also ports NeoGo’s remaining reference-counter tests, completing work begun in neo-vm v3.10.0. That release switched the C# VM to NeoGo’s lighter counter model, following NeoGo’s own reference counting optimizations in March.
During review of PR #598, Neo SPCC’s Roman Khimov said the change does not need a hard fork because it only affects transactions that fail anyway.
SETITEM fix and determinism improvements
SETITEM now correctly stores negative values between -128 and -1 into a Buffer (PR #606). These values already passed the opcode’s range check, but a faulty conversion made the transaction fail. The C# node will keep the old behavior until Huyao activates (PR #4800).
Every node now formats error messages that contracts can catch in the same way, whatever its locale settings (PR #612). Previously, .NET wrote negative numbers with a different minus character on nodes set to Swedish or Norwegian locales, so the same script could produce different bytes on different nodes.
Shargon, Neo core developer, listed the fix among the last security patches ahead of the next Neo core release.
The VM release also fixes a memory leak caused by Buffers borrowing memory from a shared pool and almost never returning it (PR #603). It tightens checks on jump targets during script validation as well (PR #605).
Changes for developers
Projects that extend the VM will need to update their code, because opcode handlers and the PostExecuteInstruction method now take a RunStats parameter. Custom JumpTable entries and ExecutionEngine subclasses must change, and the Buffer constructor no longer accepts a zeroInitialize argument.
Next steps
The update has no effect on MainNet or TestNet by itself. The latest Neo core release, v3.10.2, still uses 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, the version focuses on finalizing the Huyao hard fork, including dynamic VM instruction prices and a new TemporaryStorage native contract. No release date has been set, and Huyao has no activation height on MainNet or TestNet.
The release can be found at the link below:
https://github.com/neo-project/neo-vm/releases/tag/v3.11.2





About The Author: Dean Jeffs
Dean is a digital project manager who has worked extensively with start ups and agencies in the marketing space. Fascinated by the potential applications of blockchain technology, Dean has a passion for realising the new smart economy.
More posts by Dean Jeffs