alexdovzhanyn / AlchemyVM

WebAssembly Virtual Machine Built In Elixir
MIT License
188 stars 5 forks source link

Calculate Gas #19

Open alexdovzhanyn opened 5 years ago

alexdovzhanyn commented 5 years ago

We need a way of calculating the 'relative price' of each instruction, and accumulating the total execution cost as a given program runs. We also need an option to specify a 'gas limit', which is the maximum execution cost we're allowed to expend on a given program before we stop. If the 'gas limit' is reached (or exceeded) the vm should stop function execution immediately.