aboutsummaryrefslogtreecommitdiffstats
path: root/vm/common.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-17 04:46:47 +0800
committerobscuren <geffobscura@gmail.com>2015-03-17 04:46:47 +0800
commit4e181c5764b78193705f91d3220710bb63b8962f (patch)
treef07b42336b6099b20585e24cef147dc4280e9555 /vm/common.go
parent6aa390abfb8553c3cbbd5fa658f7f3788d3c262c (diff)
downloaddexon-4e181c5764b78193705f91d3220710bb63b8962f.tar.gz
dexon-4e181c5764b78193705f91d3220710bb63b8962f.tar.zst
dexon-4e181c5764b78193705f91d3220710bb63b8962f.zip
Moved gas
Diffstat (limited to 'vm/common.go')
-rw-r--r--vm/common.go78
1 files changed, 16 insertions, 62 deletions
diff --git a/vm/common.go b/vm/common.go
index 1f07ec8a2..cedc0f309 100644
--- a/vm/common.go
+++ b/vm/common.go
@@ -18,8 +18,23 @@ type Type byte
const (
StdVmTy Type = iota
JitVmTy
-
MaxVmTy
+
+ MaxCallDepth = 1025
+
+ LogTyPretty byte = 0x1
+ LogTyDiff byte = 0x2
+)
+
+var (
+ Pow256 = common.BigPow(2, 256)
+
+ U256 = common.U256
+ S256 = common.S256
+
+ Zero = common.Big0
+
+ max = big.NewInt(math.MaxInt64)
)
func NewVm(env Environment) VirtualMachine {
@@ -34,67 +49,6 @@ func NewVm(env Environment) VirtualMachine {
}
}
-var (
- GasQuickStep = big.NewInt(2)
- GasFastestStep = big.NewInt(3)
- GasFastStep = big.NewInt(5)
- GasMidStep = big.NewInt(8)
- GasSlowStep = big.NewInt(10)
- GasExtStep = big.NewInt(20)
-
- GasStorageGet = big.NewInt(50)
- GasStorageAdd = big.NewInt(20000)
- GasStorageMod = big.NewInt(5000)
- GasLogBase = big.NewInt(375)
- GasLogTopic = big.NewInt(375)
- GasLogByte = big.NewInt(8)
- GasCreate = big.NewInt(32000)
- GasCreateByte = big.NewInt(200)
- GasCall = big.NewInt(40)
- GasCallValueTransfer = big.NewInt(9000)
- GasStipend = big.NewInt(2300)
- GasCallNewAccount = big.NewInt(25000)
- GasReturn = big.NewInt(0)
- GasStop = big.NewInt(0)
- GasJumpDest = big.NewInt(1)
-
- RefundStorage = big.NewInt(15000)
- RefundSuicide = big.NewInt(24000)
-
- GasMemWord = big.NewInt(3)
- GasQuadCoeffDenom = big.NewInt(512)
- GasContractByte = big.NewInt(200)
- GasTransaction = big.NewInt(21000)
- GasTxDataNonzeroByte = big.NewInt(68)
- GasTxDataZeroByte = big.NewInt(4)
- GasTx = big.NewInt(21000)
- GasExp = big.NewInt(10)
- GasExpByte = big.NewInt(10)
-
- GasSha3Base = big.NewInt(30)
- GasSha3Word = big.NewInt(6)
- GasSha256Base = big.NewInt(60)
- GasSha256Word = big.NewInt(12)
- GasRipemdBase = big.NewInt(600)
- GasRipemdWord = big.NewInt(12)
- GasEcrecover = big.NewInt(3000)
- GasIdentityBase = big.NewInt(15)
- GasIdentityWord = big.NewInt(3)
- GasCopyWord = big.NewInt(3)
-
- Pow256 = common.BigPow(2, 256)
-
- LogTyPretty byte = 0x1
- LogTyDiff byte = 0x2
-
- U256 = common.U256
- S256 = common.S256
-
- Zero = common.Big0
-)
-
-const MaxCallDepth = 1025
-
func calcMemSize(off, l *big.Int) *big.Int {
if l.Cmp(common.Big0) == 0 {
return common.Big0