Skip to content

Commit

Permalink
Removed mutan. Closes ethereum#183
Browse files Browse the repository at this point in the history
  • Loading branch information
obscuren committed Dec 4, 2014
1 parent 085f604 commit 3db9c80
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 69 deletions.
42 changes: 6 additions & 36 deletions ethutil/script_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,17 @@

package ethutil

import (
"fmt"
"strings"

"github.com/ethereum/serpent-go"
"github.com/obscuren/mutan"
"github.com/obscuren/mutan/backends"
)
import "github.com/ethereum/serpent-go"

// General compile function
func Compile(script string, silent bool) (ret []byte, err error) {
if len(script) > 2 {
line := strings.Split(script, "\n")[0]

if len(line) > 1 && line[0:2] == "#!" {
switch line {
case "#!serpent":
byteCode, err := serpent.Compile(script)
if err != nil {
return nil, err
}

return byteCode, nil
}
} else {

compiler := mutan.NewCompiler(backend.NewEthereumBackend())
compiler.Silent = silent
byteCode, errors := compiler.Compile(strings.NewReader(script))
if len(errors) > 0 {
var errs string
for _, er := range errors {
if er != nil {
errs += er.Error()
}
}
return nil, fmt.Errorf("%v", errs)
}

return byteCode, nil
byteCode, err := serpent.Compile(script)
if err != nil {
return nil, err
}

return byteCode, nil
}

return nil, nil
Expand Down
23 changes: 1 addition & 22 deletions ethutil/script_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,10 @@

package ethutil

import (
"fmt"
"strings"

"github.com/obscuren/mutan"
"github.com/obscuren/mutan/backends"
)

// General compile function
func Compile(script string, silent bool) (ret []byte, err error) {
if len(script) > 2 {
compiler := mutan.NewCompiler(backend.NewEthereumBackend())
compiler.Silent = silent
byteCode, errors := compiler.Compile(strings.NewReader(script))
if len(errors) > 0 {
var errs string
for _, er := range errors {
if er != nil {
errs += er.Error()
}
}
return nil, fmt.Errorf("%v", errs)
}

return byteCode, nil
return nil, nil
}

return nil, nil
Expand Down
15 changes: 4 additions & 11 deletions vm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/trie"
checker "gopkg.in/check.v1"
// "github.com/obscuren/mutan"
)

type VmSuite struct{}
Expand Down Expand Up @@ -68,24 +67,18 @@ func setup(level logger.LogLevel, typ Type) (*Closure, VirtualMachine) {
}

func (s *VmSuite) TestDebugVm(c *checker.C) {
// if mutan.Version < "0.6" {
// t.Skip("skipping for mutan version", mutan.Version, " < 0.6")
// }
closure, vm := setup(logger.DebugLevel, DebugVmTy)
ret, _, e := closure.Call(vm, nil)
c.Assert(e, checker.NotNil)
c.Skip("Depends on mutan")
c.Skip("Depends on mutan. Requires serpent implementation")
c.Assert(ret, checker.DeepEquals, big9)
}

func (s *VmSuite) TestVm(c *checker.C) {
// if mutan.Version < "0.6" {
// t.Skip("skipping for mutan version", mutan.Version, " < 0.6")
// }
closure, vm := setup(logger.DebugLevel, StandardVmTy)
ret, _, e := closure.Call(vm, nil)
c.Assert(e, checker.NotNil)
c.Skip("Depends on mutan")
c.Skip("Depends on mutan. Requires serpent implementation")
c.Assert(ret, checker.DeepEquals, big9)
}

Expand Down Expand Up @@ -142,7 +135,7 @@ func (s *VmSuite) TestBuildInSha256(c *checker.C) {
`, DebugVmTy)

exp := crypto.Sha256(ethutil.LeftPadBytes([]byte{42}, 32))
c.Skip("Depends on mutan")
c.Skip("Depends on mutan. Requires serpent implementation")
c.Assert(ret, checker.DeepEquals, exp)
}

Expand All @@ -157,7 +150,7 @@ func (s *VmSuite) TestBuildInRipemd(c *checker.C) {
`, DebugVmTy)

exp := ethutil.RightPadBytes(crypto.Ripemd160(ethutil.LeftPadBytes([]byte{42}, 32)), 32)
c.Skip("Depends on mutan")
c.Skip("Depends on mutan. Requires serpent implementation")
c.Assert(ret, checker.DeepEquals, exp)
}

Expand Down

0 comments on commit 3db9c80

Please sign in to comment.