diff options
author | obscuren <geffobscura@gmail.com> | 2014-12-10 03:27:57 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-12-10 03:27:57 +0800 |
commit | acf4b5753fd473f048176a12c42e1b8209035b57 (patch) | |
tree | ed9b73ea5a69684e40cfdb546cf729cd29f88db5 /vm/vm_debug.go | |
parent | 76842b0df8b5605682362bd57fbd6eb315bcaf1f (diff) | |
download | go-tangerine-acf4b5753fd473f048176a12c42e1b8209035b57.tar.gz go-tangerine-acf4b5753fd473f048176a12c42e1b8209035b57.tar.zst go-tangerine-acf4b5753fd473f048176a12c42e1b8209035b57.zip |
Core changes
* Code = '' if gas < len(D) * 5
* Sha3 gas 10 + 10 * len(D), rounding up 32 bytes
* Sha256 gas 50 + 50 * len(D), rounding up 32 bytes
* Ripmed gas 50 + 50 * len(D), rounding up 32 bytes
* Accounts and value transfers no longer reverted
Diffstat (limited to 'vm/vm_debug.go')
-rw-r--r-- | vm/vm_debug.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/vm/vm_debug.go b/vm/vm_debug.go index be1c59339..c0a2d6d98 100644 --- a/vm/vm_debug.go +++ b/vm/vm_debug.go @@ -254,9 +254,12 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * newMemSize.Mul(newMemSize, u256(32)) switch op { - // Additional gas usage on *CODPY case CALLDATACOPY, CODECOPY, EXTCODECOPY: addStepGasUsage(new(big.Int).Div(newMemSize, u256(32))) + case SHA3: + g := new(big.Int).Div(newMemSize, u256(32)) + g.Mul(g, GasSha3Byte) + addStepGasUsage(g) } if newMemSize.Cmp(u256(int64(mem.Len()))) > 0 { @@ -833,8 +836,13 @@ func (self *DebugVm) Run(me, caller ClosureRef, code []byte, value, gas, price * self.Printf("CREATE err %v", err) } else { - ref.SetCode(ret) - msg.Output = ret + // gas < len(ret) * CreateDataGas == NO_CODE + dataGas := big.NewInt(int64(len(ret))) + dataGas.Mul(dataGas, GasCreateByte) + if closure.UseGas(dataGas) { + ref.SetCode(ret) + msg.Output = ret + } stack.Push(ethutil.BigD(addr)) } |