From 2df8ad6307d741d0a6d2f746d53f97c7b27ad796 Mon Sep 17 00:00:00 2001 From: obscuren Date: Tue, 2 Dec 2014 00:03:53 +0100 Subject: Added state tests --- vm/address.go | 8 ++++++-- vm/execution.go | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'vm') diff --git a/vm/address.go b/vm/address.go index 235143b34..86ae705bc 100644 --- a/vm/address.go +++ b/vm/address.go @@ -31,12 +31,16 @@ func sha256Func(in []byte) []byte { } func ripemd160Func(in []byte) []byte { - return ethutil.RightPadBytes(crypto.Ripemd160(in), 32) + return ethutil.LeftPadBytes(crypto.Ripemd160(in), 32) } func ecrecoverFunc(in []byte) []byte { // In case of an invalid sig. Defaults to return nil defer func() { recover() }() - return crypto.Ecrecover(in) + hash := in[:32] + v := ethutil.BigD(in[32:64]).Bytes()[0] - 27 + sig := append(in[64:], v) + + return crypto.Sha3(crypto.Ecrecover(append(hash, sig...))[1:]) } diff --git a/vm/execution.go b/vm/execution.go index c23164f82..8c04cf536 100644 --- a/vm/execution.go +++ b/vm/execution.go @@ -69,6 +69,7 @@ func (self *Execution) exec(code, caddr []byte, caller ClosureRef) (ret []byte, if self.Gas.Cmp(p.Gas) >= 0 { ret = p.Call(self.input) self.vm.Printf("NATIVE_FUNC(%x) => %x", naddr, ret) + self.vm.Endl() } } else { // Create a new callable closure -- cgit