mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-04 09:02:28 +00:00
vm: set GAS limit
Make it possible to set maximum amount of GAS which can be spent during execution.
This commit is contained in:
parent
0662a7e3c2
commit
c22d09adad
2 changed files with 25 additions and 1 deletions
|
@ -92,7 +92,21 @@ func TestVM_SetPriceGetter(t *testing.T) {
|
|||
v.Load(prog)
|
||||
runVM(t, v)
|
||||
|
||||
require.EqualValues(t, 9, v.gasConsumed)
|
||||
require.EqualValues(t, 9, v.GasConsumed())
|
||||
})
|
||||
|
||||
t.Run("with sufficient gas limit", func(t *testing.T) {
|
||||
v.Load(prog)
|
||||
v.SetGasLimit(9)
|
||||
runVM(t, v)
|
||||
|
||||
require.EqualValues(t, 9, v.GasConsumed())
|
||||
})
|
||||
|
||||
t.Run("with small gas limit", func(t *testing.T) {
|
||||
v.Load(prog)
|
||||
v.SetGasLimit(8)
|
||||
checkVMFailed(t, v)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue