aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelig <viktor.tron@gmail.com>2015-05-20 09:04:52 +0800
committerzelig <viktor.tron@gmail.com>2015-05-20 09:47:13 +0800
commit22b694ee1e1044e68c906fbd864797ac2f8a4ab0 (patch)
tree498477c69b6715c41a0c5e8c6ddfe20f06ca5e93
parentf9abcee0f9185d41c71cc24af1303133497ebeb0 (diff)
downloadgo-tangerine-22b694ee1e1044e68c906fbd864797ac2f8a4ab0.tar
go-tangerine-22b694ee1e1044e68c906fbd864797ac2f8a4ab0.tar.gz
go-tangerine-22b694ee1e1044e68c906fbd864797ac2f8a4ab0.tar.bz2
go-tangerine-22b694ee1e1044e68c906fbd864797ac2f8a4ab0.tar.lz
go-tangerine-22b694ee1e1044e68c906fbd864797ac2f8a4ab0.tar.xz
go-tangerine-22b694ee1e1044e68c906fbd864797ac2f8a4ab0.tar.zst
go-tangerine-22b694ee1e1044e68c906fbd864797ac2f8a4ab0.zip
solc now in ethereum, fixes solc path setting; setSolc() didnt work
-rw-r--r--cmd/geth/js.go3
-rw-r--r--cmd/geth/js_test.go3
-rw-r--r--cmd/geth/main.go2
-rw-r--r--cmd/utils/flags.go1
-rw-r--r--eth/backend.go20
-rw-r--r--xeth/xeth.go12
6 files changed, 26 insertions, 15 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 4ddb3bd9c..f99051a1e 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -71,7 +71,7 @@ type jsre struct {
prompter
}
-func newJSRE(ethereum *eth.Ethereum, libPath, solcPath, corsDomain string, interactive bool, f xeth.Frontend) *jsre {
+func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, interactive bool, f xeth.Frontend) *jsre {
js := &jsre{ethereum: ethereum, ps1: "> "}
// set default cors domain used by startRpc from CLI flag
js.corsDomain = corsDomain
@@ -81,7 +81,6 @@ func newJSRE(ethereum *eth.Ethereum, libPath, solcPath, corsDomain string, inter
js.xeth = xeth.New(ethereum, f)
js.wait = js.xeth.UpdateState()
// update state in separare forever blocks
- js.xeth.SetSolc(solcPath)
js.re = re.New(libPath)
js.apiBindings(f)
js.adminBindings()
diff --git a/cmd/geth/js_test.go b/cmd/geth/js_test.go
index 2f29612d3..8ffef4970 100644
--- a/cmd/geth/js_test.go
+++ b/cmd/geth/js_test.go
@@ -76,6 +76,7 @@ func testJEthRE(t *testing.T) (string, *testjethre, *eth.Ethereum) {
AccountManager: am,
MaxPeers: 0,
Name: "test",
+ SolcPath: testSolcPath,
})
if err != nil {
t.Fatal("%v", err)
@@ -102,7 +103,7 @@ func testJEthRE(t *testing.T) (string, *testjethre, *eth.Ethereum) {
t.Errorf("Error creating DocServer: %v", err)
}
tf := &testjethre{ds: ds, stateDb: ethereum.ChainManager().State().Copy()}
- repl := newJSRE(ethereum, assetPath, testSolcPath, "", false, tf)
+ repl := newJSRE(ethereum, assetPath, "", false, tf)
tf.jsre = repl
return tmp, tf, ethereum
}
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 2afc92f10..d102e3158 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -326,7 +326,6 @@ func console(ctx *cli.Context) {
repl := newJSRE(
ethereum,
ctx.String(utils.JSpathFlag.Name),
- ctx.String(utils.SolcPathFlag.Name),
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
true,
nil,
@@ -348,7 +347,6 @@ func execJSFiles(ctx *cli.Context) {
repl := newJSRE(
ethereum,
ctx.String(utils.JSpathFlag.Name),
- ctx.String(utils.SolcPathFlag.Name),
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
false,
nil,
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index f646e4fcc..2766e7517 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -313,6 +313,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
Dial: true,
BootNodes: ctx.GlobalString(BootnodesFlag.Name),
GasPrice: common.String2Big(ctx.GlobalString(GasPriceFlag.Name)),
+ SolcPath: ctx.GlobalString(SolcPathFlag.Name),
}
}
diff --git a/eth/backend.go b/eth/backend.go
index 519a4c410..44ceb89e8 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -14,6 +14,7 @@ import (
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/common/compiler"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
@@ -79,6 +80,7 @@ type Config struct {
GasPrice *big.Int
MinerThreads int
AccountManager *accounts.Manager
+ SolcPath string
// NewDB is used to create databases.
// If nil, the default is to create leveldb databases on disk.
@@ -181,6 +183,8 @@ type Ethereum struct {
pow *ethash.Ethash
protocolManager *ProtocolManager
downloader *downloader.Downloader
+ SolcPath string
+ solc *compiler.Solidity
net *p2p.Server
eventMux *event.TypeMux
@@ -264,6 +268,7 @@ func New(config *Config) (*Ethereum, error) {
netVersionId: config.NetworkId,
NatSpec: config.NatSpec,
MinerThreads: config.MinerThreads,
+ SolcPath: config.SolcPath,
}
eth.pow = ethash.New()
@@ -571,3 +576,18 @@ func saveBlockchainVersion(db common.Database, bcVersion int) {
db.Put([]byte("BlockchainVersion"), common.NewValue(bcVersion).Bytes())
}
}
+
+func (self *Ethereum) Solc() (*compiler.Solidity, error) {
+ var err error
+ if self.solc == nil {
+ self.solc, err = compiler.New(self.SolcPath)
+ }
+ return self.solc, err
+}
+
+// set in js console via admin interface or wrapper from cli flags
+func (self *Ethereum) SetSolc(solcPath string) (*compiler.Solidity, error) {
+ self.SolcPath = solcPath
+ self.solc = nil
+ return self.Solc()
+}
diff --git a/xeth/xeth.go b/xeth/xeth.go
index 7de3e31be..81197d381 100644
--- a/xeth/xeth.go
+++ b/xeth/xeth.go
@@ -66,9 +66,6 @@ type XEth struct {
// regmut sync.Mutex
// register map[string][]*interface{} // TODO improve return type
- solcPath string
- solc *compiler.Solidity
-
agent *miner.RemoteAgent
}
@@ -379,17 +376,12 @@ func (self *XEth) Accounts() []string {
// accessor for solidity compiler.
// memoized if available, retried on-demand if not
func (self *XEth) Solc() (*compiler.Solidity, error) {
- var err error
- if self.solc == nil {
- self.solc, err = compiler.New(self.solcPath)
- }
- return self.solc, err
+ return self.backend.Solc()
}
// set in js console via admin interface or wrapper from cli flags
func (self *XEth) SetSolc(solcPath string) (*compiler.Solidity, error) {
- self.solcPath = solcPath
- self.solc = nil
+ self.backend.SetSolc(solcPath)
return self.Solc()
}