Closed ureeves closed 4 months ago
A single contract's compiled bytecode will contain a header, encoding within it information about the cost per WebAssembly instruction
Is this part of the PR? I haven't found any change for this
A single contract's compiled bytecode will contain a header, encoding within it information about the cost per WebAssembly instruction
Is this part of the PR? I haven't found any change for this
No, it was a part of this one, and the reason why we had an upgrade of the dusk-wasmtime version during this PR.
Each byte stored in the WebAssembly linear memory of a contract is made to cost 4 units of fuel - in the units that wasmtime uses. This makes storing a single byte as expensive as, for example, multiplying or subtracting two numbers.
The
MemoryGrow
instruction is purposefully left with the default price - just like any other instruction, due the fact that expanding the size of the linear memory doesn't actually cost a lot of resources, owing to the fact that a page that is never written to is never written to disk.A single contract's compiled bytecode will contain a header, encoding within it information about the cost per WebAssembly instruction. If these don't match the costs configured for the current
VM
instantiation, the contract will be recompiled, just as what happens if the native instruction set doesn't match.See-also: https://github.com/dusk-network/piecrust/issues/359