-
Notifications
You must be signed in to change notification settings - Fork 43
/
gas.go
36 lines (30 loc) · 1.28 KB
/
gas.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Copyright (c) 2018-present, MultiVAC Foundation.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package mvvm
import (
"math"
"github.com/perlin-network/life/compiler"
)
var (
// mvvmGasPolicy is the gas policy for MVVM.
//
// In default cases, assume that each single step will consume the unit gas fee.
mvvmGasPolicy = &compiler.SimpleGasPolicy{GasPerInstruction: 1}
// mvvmDefaultGasLimit is the default gas limit for MVVM.
//
// Mostly, it is assumed that the developer will give a user-defined gas limit. But if the limit is not assigned,
// mvvmDefaultGasLimit will be used as the limit value.
// For now the value is set as 65535. Deeper discussion is needed.
// Note that mvvmDefaultGasLimit > 0. 'cause if mvvmDefaultGasLimit <= 0, gas fee will never exceed.
mvvmDefaultGasLimit int64 = 1<<16 - 1
// mvvmMaxGasLimit is the maximum gas limit for MVVM.
//
// The MTV Coin value cost for gas is a big.Int, which is sometimes much bigger than the gas limit for life.
// Hence it is assumed that if the coin value is bigger than mvvmDefaultGasLimit, the gas limit is the maximum limit.
// For now this value is set as the maximum value of int64.
mvvmMaxGasLimit int64 = math.MaxInt64
)