COZ recently updated Boa to v0.12.0. The new version brings a number of bug fixes and support for the new features introduced in Neo v3.5, including the ability to run dynamic code in smart contracts.

Dynamic scripts

The loadScript system call is a recent addition to N3 designed to enable new use cases for contract developers. The syscall makes it possible for contracts to run code that was not declared within the contract itself at compile-time. For example, a contract could allow users to submit logic to its storage for later use, or fetch a trusted script to run from the Oracle.

In the interest of security, this ability to run dynamic code is restricted to read-only operations. Loaded scripts have access to all the usual tools within the NeoVM execution environment, but these executions may not persist any state changes. This prevents uses such as transfers, which would require balance states to be changed.

Other improvements

Neo v3.5 also introduced the hasMethod to the ContractManagement native contract. As the name implies, this provides a more convenient way to check if a smart contract has a named method than manually parsing its ABI.

Boa’s latest update featured some reorganization to its built-ins. The to_script_hash method was moved to the contract package, while a number of manifest-related decorators and the NeoMetadata class were moved to the compile-time package. Other notable changes include the addition of the hash property to smart contract interfaces, the str constructor, and reintroduction of the Opcode enum to the list of available built-in types.

Bug fixes

Boa v0.12.0 delivered several bug fixes alongside other changes. Issues with invalid script generation for contracts using classes, various compiler errors, and unexpected behaviors such as the inability to share names between events and methods were all resolved.

The original announcement may be read at the following link: