Open JakeOShannessy opened 5 years ago
I have a solution for this. We can use the same mechanism as cap9_syscall_low
and introduce cap9_maxgas_call_code
and the like. In the same way we can control the exact instructions deployed and make sure that exactly all the remaining gas is used.
I have a solution for this. We can use the same mechanism as
cap9_syscall_low
and introducecap9_maxgas_call_code
and the like. In the same way we can control the exact instructions deployed and make sure that exactly all the remaining gas is used.
Would this still be feasible for validation?
In that particular case it's only for the kernel, so we don't have to run it through the validation code.
For procedures we have defined syscalls in such a way that handles this already, we just have to make sure the values are correct, which I failed to do in #178 it seems.
As part of a syscall (or any call) we usually pass the value of the
GAS
call, which is equivalent to allowing the called contract to use as much of the remaining gas as it needs. When performing aCALL
in EVM this was quite easy, as theGAS
call was the last instruction executed before performing the call. When comping to WASM this isn't quite as simple, as we can't guarantee that it is the final instruction called.Currently, there are a few instances of
GAS - SomeValue
to allow some leftover gas to complete other instructions. This is not a robust way to do this and we should find alternatives.