aboutsummaryrefslogtreecommitdiffstats
path: root/vm/common.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-10 08:22:38 +0800
committerobscuren <geffobscura@gmail.com>2015-03-10 08:22:38 +0800
commit0db4a0e898d09ffa7b6b1289e9a334edc0001cfa (patch)
treea0b5c8381ab482550ef4800a06d4db086d76a983 /vm/common.go
parent94e543bc398efbb5c712b6e4cb48d8a57eb3400d (diff)
parent0d64163fea3a266ceb71cb4c4ee5682052c9ca6c (diff)
downloaddexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar
dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.gz
dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.bz2
dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.lz
dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.xz
dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.tar.zst
dexon-0db4a0e898d09ffa7b6b1289e9a334edc0001cfa.zip
Merge branch 'poc-9' into develop
Diffstat (limited to 'vm/common.go')
-rw-r--r--vm/common.go71
1 files changed, 51 insertions, 20 deletions
diff --git a/vm/common.go b/vm/common.go
index 45a7187a9..b391bb8c2 100644
--- a/vm/common.go
+++ b/vm/common.go
@@ -9,6 +9,9 @@ import (
var vmlogger = logger.NewLogger("VM")
+// Global Debug flag indicating Debug VM (full logging)
+var Debug bool
+
type Type byte
const (
@@ -31,26 +34,52 @@ func NewVm(env Environment) VirtualMachine {
}
var (
- GasStep = big.NewInt(1)
- GasSha = big.NewInt(10)
- GasSLoad = big.NewInt(20)
- GasSStore = big.NewInt(100)
- GasSStoreRefund = big.NewInt(100)
- GasBalance = big.NewInt(20)
- GasCreate = big.NewInt(100)
- GasCall = big.NewInt(20)
- GasCreateByte = big.NewInt(5)
- GasSha3Byte = big.NewInt(10)
- GasSha256Byte = big.NewInt(50)
- GasRipemdByte = big.NewInt(50)
- GasMemory = big.NewInt(1)
- GasData = big.NewInt(5)
- GasTx = big.NewInt(500)
- GasLog = big.NewInt(32)
- GasSha256 = big.NewInt(50)
- GasRipemd = big.NewInt(50)
- GasEcrecover = big.NewInt(500)
- GasMemCpy = big.NewInt(1)
+ 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 = ethutil.BigPow(2, 256)
@@ -59,6 +88,8 @@ var (
U256 = ethutil.U256
S256 = ethutil.S256
+
+ Zero = ethutil.Big0
)
const MaxCallDepth = 1025