diff --git a/cmd/gubiq/main.go b/cmd/gubiq/main.go index 49a0c1e75a..c8416fb942 100644 --- a/cmd/gubiq/main.go +++ b/cmd/gubiq/main.go @@ -139,7 +139,6 @@ func init() { utils.EthStatsURLFlag, utils.MetricsEnabledFlag, utils.FakePoWFlag, - utils.SolcPathFlag, utils.GpoMinGasPriceFlag, utils.GpoMaxGasPriceFlag, utils.GpoFullBlockRatioFlag, diff --git a/cmd/gubiq/usage.go b/cmd/gubiq/usage.go index f024576984..ebbfdbf11d 100644 --- a/cmd/gubiq/usage.go +++ b/cmd/gubiq/usage.go @@ -172,12 +172,6 @@ var AppHelpFlagGroups = []flagGroup{ utils.WhisperEnabledFlag, }, }, - { - Name: "MISCELLANEOUS", - Flags: []cli.Flag{ - utils.SolcPathFlag, - }, - }, } func init() { diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 55f4e21e41..3b5f60f141 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -376,11 +376,6 @@ var ( Usage: "JavaScript root path for `loadScript`", Value: ".", } - SolcPathFlag = cli.StringFlag{ - Name: "solc", - Usage: "Solidity compiler command to be used", - Value: "solc", - } // Gas price oracle settings GpoMinGasPriceFlag = cli.StringFlag{ @@ -749,7 +744,6 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) { GpobaseStepDown: ctx.GlobalInt(GpobaseStepDownFlag.Name), GpobaseStepUp: ctx.GlobalInt(GpobaseStepUpFlag.Name), GpobaseCorrectionFactor: ctx.GlobalInt(GpobaseCorrectionFactorFlag.Name), - SolcPath: ctx.GlobalString(SolcPathFlag.Name), AutoDAG: ctx.GlobalBool(AutoDAGFlag.Name) || ctx.GlobalBool(MiningEnabledFlag.Name), EnablePreimageRecording: ctx.GlobalBool(VMEnableDebugFlag.Name), } diff --git a/eth/backend.go b/eth/backend.go index 3ca5902ab3..f74494533c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -88,7 +88,6 @@ type Config struct { Etherbase common.Address GasPrice *big.Int MinerThreads int - SolcPath string GpoMinGasPrice *big.Int GpoMaxGasPrice *big.Int @@ -136,7 +135,6 @@ type Ethereum struct { AutoDAG bool autodagquit chan bool etherbase common.Address - solcPath string netVersionId int netRPCService *ethapi.PublicNetAPI @@ -174,7 +172,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { etherbase: config.Etherbase, MinerThreads: config.MinerThreads, AutoDAG: config.AutoDAG, - solcPath: config.SolcPath, } if err := addMipmapBloomBins(chainDb); err != nil { @@ -305,7 +302,7 @@ func CreatePoW(config *Config) (pow.PoW, error) { // APIs returns the collection of RPC services the ethereum package offers. // NOTE, some of these services probably need to be moved to somewhere else. func (s *Ethereum) APIs() []rpc.API { - return append(ethapi.GetAPIs(s.ApiBackend, s.solcPath), []rpc.API{ + return append(ethapi.GetAPIs(s.ApiBackend), []rpc.API{ { Namespace: "eth", Version: "1.0", diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 759e235ef2..eb0ca2a1f9 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -72,9 +72,8 @@ type State interface { GetNonce(ctx context.Context, addr common.Address) (uint64, error) } -func GetAPIs(apiBackend Backend, solcPath string) []rpc.API { - compiler := makeCompilerAPIs(solcPath) - all := []rpc.API{ +func GetAPIs(apiBackend Backend) []rpc.API { + return []rpc.API{ { Namespace: "eth", Version: "1.0", @@ -116,5 +115,4 @@ func GetAPIs(apiBackend Backend, solcPath string) []rpc.API { Public: false, }, } - return append(compiler, all...) } diff --git a/internal/ethapi/solc.go b/internal/ethapi/solc.go deleted file mode 100644 index f0317703f3..0000000000 --- a/internal/ethapi/solc.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2016 The go-ethereum Authors -// This file is part of the go-ethereum library. -// -// The go-ethereum library is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// The go-ethereum library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with the go-ethereum library. If not, see . - -package ethapi - -import ( - "sync" - - "github.com/ubiq/go-ubiq/common/compiler" - "github.com/ubiq/go-ubiq/rpc" -) - -func makeCompilerAPIs(solcPath string) []rpc.API { - c := &compilerAPI{solc: solcPath} - return []rpc.API{ - { - Namespace: "eth", - Version: "1.0", - Service: (*PublicCompilerAPI)(c), - Public: true, - }, - { - Namespace: "admin", - Version: "1.0", - Service: (*CompilerAdminAPI)(c), - Public: true, - }, - } -} - -type compilerAPI struct { - // This lock guards the solc path set through the API. - // It also ensures that only one solc process is used at - // any time. - mu sync.Mutex - solc string -} - -type CompilerAdminAPI compilerAPI - -// SetSolc sets the Solidity compiler path to be used by the node. -func (api *CompilerAdminAPI) SetSolc(path string) (string, error) { - api.mu.Lock() - defer api.mu.Unlock() - info, err := compiler.SolidityVersion(path) - if err != nil { - return "", err - } - api.solc = path - return info.FullVersion, nil -} - -type PublicCompilerAPI compilerAPI - -// CompileSolidity compiles the given solidity source. -func (api *PublicCompilerAPI) CompileSolidity(source string) (map[string]*compiler.Contract, error) { - api.mu.Lock() - defer api.mu.Unlock() - return compiler.CompileSolidityString(api.solc, source) -} - -func (api *PublicCompilerAPI) GetCompilers() ([]string, error) { - api.mu.Lock() - defer api.mu.Unlock() - if _, err := compiler.SolidityVersion(api.solc); err == nil { - return []string{"Solidity"}, nil - } - return []string{}, nil -} diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 3fa5d7bc9b..8a7b15f69a 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -93,11 +93,6 @@ web3._extend({ call: 'admin_sleepBlocks', params: 2 }), - new web3._extend.Method({ - name: 'setSolc', - call: 'admin_setSolc', - params: 1 - }), new web3._extend.Method({ name: 'startRPC', call: 'admin_startRPC', diff --git a/les/backend.go b/les/backend.go index e589c30af5..0977f5d423 100644 --- a/les/backend.go +++ b/les/backend.go @@ -24,7 +24,6 @@ import ( "github.com/ubiq/go-ubiq/accounts" "github.com/ubiq/go-ubiq/common" - "github.com/ubiq/go-ubiq/common/compiler" "github.com/ubiq/go-ubiq/common/hexutil" "github.com/ubiq/go-ubiq/core" "github.com/ubiq/go-ubiq/core/types" @@ -63,8 +62,6 @@ type LightEthereum struct { eventMux *event.TypeMux pow pow.PoW accountManager *accounts.Manager - solcPath string - solc *compiler.Solidity netVersionId int netRPCService *ethapi.PublicNetAPI @@ -94,7 +91,6 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) { pow: pow, shutdownChan: make(chan bool), netVersionId: config.NetworkId, - solcPath: config.SolcPath, } if config.ChainConfig == nil { @@ -144,7 +140,7 @@ func (s *LightDummyAPI) Mining() bool { // APIs returns the collection of RPC services the ethereum package offers. // NOTE, some of these services probably need to be moved to somewhere else. func (s *LightEthereum) APIs() []rpc.API { - return append(ethapi.GetAPIs(s.ApiBackend, s.solcPath), []rpc.API{ + return append(ethapi.GetAPIs(s.ApiBackend), []rpc.API{ { Namespace: "eth", Version: "1.0",