Skip to content

Commit

Permalink
propagte errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzSchueler committed Nov 27, 2024
1 parent 5273f12 commit 3a48143
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 24 deletions.
10 changes: 4 additions & 6 deletions go/interpreter/evmone/evmone.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ package evmone
import "C"

import (
"fmt"

"github.com/Fantom-foundation/Tosca/go/interpreter/evmc"
"github.com/Fantom-foundation/Tosca/go/tosca"
)
Expand All @@ -32,14 +30,14 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmone", func(any) (tosca.Interpreter, error) {
evmone, err := evmc.LoadEvmcInterpreter("libevmone.so")
if err != nil {
panic(fmt.Errorf("failed to load evmone library: %s", err))
return nil, err
}
return &evmoneInstance{evmone}, nil
})
tosca.MustRegisterInterpreterFactory("evmone-basic", func(any) (tosca.Interpreter, error) {
evmone, err := evmc.LoadEvmcInterpreter("libevmone.so")
if err != nil {
panic(fmt.Errorf("failed to load evmone library: %s", err))
return nil, err
}
return &evmoneInstance{evmone}, nil
})
Expand All @@ -48,10 +46,10 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmone-advanced", func(any) (tosca.Interpreter, error) {
evmone, err := evmc.LoadEvmcInterpreter("libevmone.so")
if err != nil {
panic(fmt.Errorf("failed to load evmone library: %s", err))
return nil, err
}
if err := evmone.SetOption("advanced", "on"); err != nil {
panic(fmt.Errorf("failed to configure evmone advanced mode: %v", err))
return nil, err
}
return &evmoneInstance{evmone}, nil
})
Expand Down
8 changes: 3 additions & 5 deletions go/interpreter/evmrs/evmrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ package evmrs
import "C"

import (
"fmt"

"github.com/Fantom-foundation/Tosca/go/interpreter/evmc"
"github.com/Fantom-foundation/Tosca/go/tosca"
)
Expand All @@ -32,7 +30,7 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmrs", func(any) (tosca.Interpreter, error) {
evm, err := evmc.LoadEvmcInterpreter("libevmrs.so")
if err != nil {
panic(fmt.Errorf("failed to load evmrs library: %s", err))
return nil, err
}
return &evmrsInstance{evm}, nil
})
Expand All @@ -42,10 +40,10 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmrs-logging", func(any) (tosca.Interpreter, error) {
evm, err := evmc.LoadEvmcInterpreter("libevmrs.so")
if err != nil {
panic(fmt.Errorf("failed to load evmrs library: %s", err))
return nil, err
}
if err = evm.SetOption("logging", "true"); err != nil {
panic(fmt.Errorf("failed to configure EVM instance: %s", err))
return nil, err
}
return &evmrsInstance{evm}, nil
})
Expand Down
24 changes: 11 additions & 13 deletions go/interpreter/evmzero/evmzero.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ void evmzero_reset_profiler(void* vm);
import "C"

import (
"fmt"

"github.com/Fantom-foundation/Tosca/go/interpreter/evmc"
"github.com/Fantom-foundation/Tosca/go/tosca"
)
Expand All @@ -35,7 +33,7 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmzero", func(any) (tosca.Interpreter, error) {
evm, err := evmc.LoadEvmcInterpreter("libevmzero.so")
if err != nil {
panic(fmt.Errorf("failed to load evmzero library: %s", err))
return nil, err
}
return &evmzeroInstance{evm}, nil
})
Expand All @@ -46,10 +44,10 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmzero-logging", func(any) (tosca.Interpreter, error) {
evm, err := evmc.LoadEvmcInterpreter("libevmzero.so")
if err != nil {
panic(fmt.Errorf("failed to load evmzero library: %s", err))
return nil, err
}
if err = evm.SetOption("logging", "true"); err != nil {
panic(fmt.Errorf("failed to configure EVM instance: %s", err))
return nil, err
}
return &evmzeroInstance{evm}, nil
})
Expand All @@ -60,10 +58,10 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmzero-no-analysis-cache", func(any) (tosca.Interpreter, error) {
evm, err := evmc.LoadEvmcInterpreter("libevmzero.so")
if err != nil {
panic(fmt.Errorf("failed to load evmzero library: %s", err))
return nil, err
}
if err = evm.SetOption("analysis_cache", "false"); err != nil {
panic(fmt.Errorf("failed to configure EVM instance: %s", err))
return nil, err
}
return &evmzeroInstance{evm}, nil
})
Expand All @@ -74,10 +72,10 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmzero-no-sha3-cache", func(any) (tosca.Interpreter, error) {
evm, err := evmc.LoadEvmcInterpreter("libevmzero.so")
if err != nil {
panic(fmt.Errorf("failed to load evmzero library: %s", err))
return nil, err
}
if err = evm.SetOption("sha3_cache", "false"); err != nil {
panic(fmt.Errorf("failed to configure EVM instance: %s", err))
return nil, err
}
return &evmzeroInstance{evm}, nil
})
Expand All @@ -88,10 +86,10 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmzero-profiling", func(any) (tosca.Interpreter, error) {
evm, err := evmc.LoadEvmcInterpreter("libevmzero.so")
if err != nil {
panic(fmt.Errorf("failed to load evmzero library: %s", err))
return nil, err
}
if err = evm.SetOption("profiling", "true"); err != nil {
panic(fmt.Errorf("failed to configure EVM instance: %s", err))
return nil, err
}
return &evmzeroInstanceWithProfiler{&evmzeroInstance{evm}}, nil
})
Expand All @@ -102,10 +100,10 @@ func init() {
tosca.MustRegisterInterpreterFactory("evmzero-profiling-external", func(any) (tosca.Interpreter, error) {
evm, err := evmc.LoadEvmcInterpreter("libevmzero.so")
if err != nil {
panic(fmt.Errorf("failed to load evmzero library: %s", err))
return nil, err
}
if err = evm.SetOption("profiling_external", "true"); err != nil {
panic(fmt.Errorf("failed to configure EVM instance: %s", err))
return nil, err
}
return &evmzeroInstanceWithProfiler{&evmzeroInstance{evm}}, nil
})
Expand Down

0 comments on commit 3a48143

Please sign in to comment.