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 /core/execution.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 'core/execution.go')
-rw-r--r-- | core/execution.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/execution.go b/core/execution.go index 9f9d9a5d9..5176f7351 100644 --- a/core/execution.go +++ b/core/execution.go @@ -34,8 +34,14 @@ func (self *Execution) Call(codeAddr []byte, caller vm.ClosureRef) ([]byte, erro func (self *Execution) exec(code, caddr []byte, caller vm.ClosureRef) (ret []byte, err error) { env := self.vm.Env() - chainlogger.Debugf("pre state %x\n", env.State().Root()) + + from, to := env.State().GetStateObject(caller.Address()), env.State().GetOrNewStateObject(self.address) + // Skipping transfer is used on testing for the initial call + if !self.SkipTransfer { + err = env.Transfer(from, to, self.value) + } + snapshot := env.State().Copy() defer func() { if vm.IsDepthErr(err) || vm.IsOOGErr(err) { @@ -44,12 +50,6 @@ func (self *Execution) exec(code, caddr []byte, caller vm.ClosureRef) (ret []byt chainlogger.Debugf("post state %x\n", env.State().Root()) }() - from, to := env.State().GetStateObject(caller.Address()), env.State().GetOrNewStateObject(self.address) - // Skipping transfer is used on testing for the initial call - if !self.SkipTransfer { - err = env.Transfer(from, to, self.value) - } - if err != nil { caller.ReturnGas(self.Gas, self.price) @@ -59,7 +59,7 @@ func (self *Execution) exec(code, caddr []byte, caller vm.ClosureRef) (ret []byt // Pre-compiled contracts (address.go) 1, 2 & 3. naddr := ethutil.BigD(caddr).Uint64() if p := vm.Precompiled[naddr]; p != nil { - if self.Gas.Cmp(p.Gas) >= 0 { + if self.Gas.Cmp(p.Gas(len(self.input))) >= 0 { ret = p.Call(self.input) self.vm.Printf("NATIVE_FUNC(%x) => %x", naddr, ret) self.vm.Endl() |