solc now in ethereum, fixes solc path setting; setSolc() didnt work
This commit is contained in:
parent
f9abcee0f9
commit
22b694ee1e
@ -71,7 +71,7 @@ type jsre struct {
|
|||||||
prompter
|
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: "> "}
|
js := &jsre{ethereum: ethereum, ps1: "> "}
|
||||||
// set default cors domain used by startRpc from CLI flag
|
// set default cors domain used by startRpc from CLI flag
|
||||||
js.corsDomain = corsDomain
|
js.corsDomain = corsDomain
|
||||||
@ -81,7 +81,6 @@ func newJSRE(ethereum *eth.Ethereum, libPath, solcPath, corsDomain string, inter
|
|||||||
js.xeth = xeth.New(ethereum, f)
|
js.xeth = xeth.New(ethereum, f)
|
||||||
js.wait = js.xeth.UpdateState()
|
js.wait = js.xeth.UpdateState()
|
||||||
// update state in separare forever blocks
|
// update state in separare forever blocks
|
||||||
js.xeth.SetSolc(solcPath)
|
|
||||||
js.re = re.New(libPath)
|
js.re = re.New(libPath)
|
||||||
js.apiBindings(f)
|
js.apiBindings(f)
|
||||||
js.adminBindings()
|
js.adminBindings()
|
||||||
|
@ -76,6 +76,7 @@ func testJEthRE(t *testing.T) (string, *testjethre, *eth.Ethereum) {
|
|||||||
AccountManager: am,
|
AccountManager: am,
|
||||||
MaxPeers: 0,
|
MaxPeers: 0,
|
||||||
Name: "test",
|
Name: "test",
|
||||||
|
SolcPath: testSolcPath,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("%v", err)
|
t.Fatal("%v", err)
|
||||||
@ -102,7 +103,7 @@ func testJEthRE(t *testing.T) (string, *testjethre, *eth.Ethereum) {
|
|||||||
t.Errorf("Error creating DocServer: %v", err)
|
t.Errorf("Error creating DocServer: %v", err)
|
||||||
}
|
}
|
||||||
tf := &testjethre{ds: ds, stateDb: ethereum.ChainManager().State().Copy()}
|
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
|
tf.jsre = repl
|
||||||
return tmp, tf, ethereum
|
return tmp, tf, ethereum
|
||||||
}
|
}
|
||||||
|
@ -326,7 +326,6 @@ func console(ctx *cli.Context) {
|
|||||||
repl := newJSRE(
|
repl := newJSRE(
|
||||||
ethereum,
|
ethereum,
|
||||||
ctx.String(utils.JSpathFlag.Name),
|
ctx.String(utils.JSpathFlag.Name),
|
||||||
ctx.String(utils.SolcPathFlag.Name),
|
|
||||||
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
|
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
|
||||||
true,
|
true,
|
||||||
nil,
|
nil,
|
||||||
@ -348,7 +347,6 @@ func execJSFiles(ctx *cli.Context) {
|
|||||||
repl := newJSRE(
|
repl := newJSRE(
|
||||||
ethereum,
|
ethereum,
|
||||||
ctx.String(utils.JSpathFlag.Name),
|
ctx.String(utils.JSpathFlag.Name),
|
||||||
ctx.String(utils.SolcPathFlag.Name),
|
|
||||||
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
|
ctx.GlobalString(utils.RPCCORSDomainFlag.Name),
|
||||||
false,
|
false,
|
||||||
nil,
|
nil,
|
||||||
|
@ -313,6 +313,7 @@ func MakeEthConfig(clientID, version string, ctx *cli.Context) *eth.Config {
|
|||||||
Dial: true,
|
Dial: true,
|
||||||
BootNodes: ctx.GlobalString(BootnodesFlag.Name),
|
BootNodes: ctx.GlobalString(BootnodesFlag.Name),
|
||||||
GasPrice: common.String2Big(ctx.GlobalString(GasPriceFlag.Name)),
|
GasPrice: common.String2Big(ctx.GlobalString(GasPriceFlag.Name)),
|
||||||
|
SolcPath: ctx.GlobalString(SolcPathFlag.Name),
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/ethereum/ethash"
|
"github.com/ethereum/ethash"
|
||||||
"github.com/ethereum/go-ethereum/accounts"
|
"github.com/ethereum/go-ethereum/accounts"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"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"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
@ -79,6 +80,7 @@ type Config struct {
|
|||||||
GasPrice *big.Int
|
GasPrice *big.Int
|
||||||
MinerThreads int
|
MinerThreads int
|
||||||
AccountManager *accounts.Manager
|
AccountManager *accounts.Manager
|
||||||
|
SolcPath string
|
||||||
|
|
||||||
// NewDB is used to create databases.
|
// NewDB is used to create databases.
|
||||||
// If nil, the default is to create leveldb databases on disk.
|
// If nil, the default is to create leveldb databases on disk.
|
||||||
@ -181,6 +183,8 @@ type Ethereum struct {
|
|||||||
pow *ethash.Ethash
|
pow *ethash.Ethash
|
||||||
protocolManager *ProtocolManager
|
protocolManager *ProtocolManager
|
||||||
downloader *downloader.Downloader
|
downloader *downloader.Downloader
|
||||||
|
SolcPath string
|
||||||
|
solc *compiler.Solidity
|
||||||
|
|
||||||
net *p2p.Server
|
net *p2p.Server
|
||||||
eventMux *event.TypeMux
|
eventMux *event.TypeMux
|
||||||
@ -264,6 +268,7 @@ func New(config *Config) (*Ethereum, error) {
|
|||||||
netVersionId: config.NetworkId,
|
netVersionId: config.NetworkId,
|
||||||
NatSpec: config.NatSpec,
|
NatSpec: config.NatSpec,
|
||||||
MinerThreads: config.MinerThreads,
|
MinerThreads: config.MinerThreads,
|
||||||
|
SolcPath: config.SolcPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
eth.pow = ethash.New()
|
eth.pow = ethash.New()
|
||||||
@ -571,3 +576,18 @@ func saveBlockchainVersion(db common.Database, bcVersion int) {
|
|||||||
db.Put([]byte("BlockchainVersion"), common.NewValue(bcVersion).Bytes())
|
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()
|
||||||
|
}
|
||||||
|
12
xeth/xeth.go
12
xeth/xeth.go
@ -66,9 +66,6 @@ type XEth struct {
|
|||||||
// regmut sync.Mutex
|
// regmut sync.Mutex
|
||||||
// register map[string][]*interface{} // TODO improve return type
|
// register map[string][]*interface{} // TODO improve return type
|
||||||
|
|
||||||
solcPath string
|
|
||||||
solc *compiler.Solidity
|
|
||||||
|
|
||||||
agent *miner.RemoteAgent
|
agent *miner.RemoteAgent
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,17 +376,12 @@ func (self *XEth) Accounts() []string {
|
|||||||
// accessor for solidity compiler.
|
// accessor for solidity compiler.
|
||||||
// memoized if available, retried on-demand if not
|
// memoized if available, retried on-demand if not
|
||||||
func (self *XEth) Solc() (*compiler.Solidity, error) {
|
func (self *XEth) Solc() (*compiler.Solidity, error) {
|
||||||
var err error
|
return self.backend.Solc()
|
||||||
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
|
// set in js console via admin interface or wrapper from cli flags
|
||||||
func (self *XEth) SetSolc(solcPath string) (*compiler.Solidity, error) {
|
func (self *XEth) SetSolc(solcPath string) (*compiler.Solidity, error) {
|
||||||
self.solcPath = solcPath
|
self.backend.SetSolc(solcPath)
|
||||||
self.solc = nil
|
|
||||||
return self.Solc()
|
return self.Solc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user