As explained in #168, due the ordering of opcodes, passing the full remaining gas to a CALL is a little more complicated, we can't just call GAS and have the correct value on the stack, we must subtract the cost of the instruction in-between GAS and CALL.
This pull request attempts to subtract the exact amount. Because we are working directly with WASM here we can control that. I've noted in the comments a logical formulation for the subtraction required, although I don't believe that complies with any standard, this may just be a property of pwasm (which I don't believe claims to be fully compliant in that way).
I've noted in #168 that we can apply this technique elsewhere by linking in more lower-level custom WASM.
As explained in #168, due the ordering of opcodes, passing the full remaining gas to a CALL is a little more complicated, we can't just call GAS and have the correct value on the stack, we must subtract the cost of the instruction in-between GAS and CALL.
This pull request attempts to subtract the exact amount. Because we are working directly with WASM here we can control that. I've noted in the comments a logical formulation for the subtraction required, although I don't believe that complies with any standard, this may just be a property of pwasm (which I don't believe claims to be fully compliant in that way).
I've noted in #168 that we can apply this technique elsewhere by linking in more lower-level custom WASM.
This is on top of cap9-core.