Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/geth/consolecmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func localConsole(ctx *cli.Context) error {
// Attach to the newly started node and create the JavaScript console.
client, err := stack.Attach()
if err != nil {
return fmt.Errorf("Failed to attach to the inproc geth: %v", err)
return fmt.Errorf("failed to attach to the inproc geth: %v", err)
}
config := console.Config{
DataDir: utils.MakeDataDir(ctx),
Expand All @@ -87,7 +87,7 @@ func localConsole(ctx *cli.Context) error {
}
console, err := console.New(config)
if err != nil {
return fmt.Errorf("Failed to start the JavaScript console: %v", err)
return fmt.Errorf("failed to start the JavaScript console: %v", err)
}
defer console.Stop(false)

Expand Down
2 changes: 1 addition & 1 deletion cmd/geth/consolecmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
)

const (
ipcAPIs = "admin:1.0 debug:1.0 engine:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0"
ipcAPIs = "admin:1.0 debug:1.0 engine:1.0 eth:1.0 ethash:1.0 miner:1.0 net:1.0 rpc:1.0 txpool:1.0 web3:1.0"
httpAPIs = "eth:1.0 net:1.0 rpc:1.0 web3:1.0"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/geth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ var (
utils.USBFlag,
utils.SmartCardDaemonPathFlag,
utils.OverrideShanghai,
utils.EnablePersonal,
utils.EthashCacheDirFlag,
utils.EthashCachesInMemoryFlag,
utils.EthashCachesOnDiskFlag,
Expand Down
10 changes: 10 additions & 0 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,11 @@ var (
Usage: "Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC",
Category: flags.APICategory,
}
EnablePersonal = &cli.BoolFlag{
Name: "rpc.enabledeprecatedpersonal",
Usage: "Enables the (deprecated) personal namespace",
Category: flags.APICategory,
}

// Network Settings
MaxPeersFlag = &cli.IntFlag{
Expand Down Expand Up @@ -1482,6 +1487,10 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
cfg.JWTSecret = ctx.String(JWTSecretFlag.Name)
}

if ctx.IsSet(EnablePersonal.Name) {
cfg.EnablePersonal = true
}

if ctx.IsSet(ExternalSignerFlag.Name) {
cfg.ExternalSigner = ctx.String(ExternalSignerFlag.Name)
}
Expand Down Expand Up @@ -1875,6 +1884,7 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
cfg.EthDiscoveryURLs = SplitAndTrim(urls)
}
}

// Override any default configs for hard coded networks.
switch {
case ctx.Bool(MainnetFlag.Name):
Expand Down
3 changes: 2 additions & 1 deletion console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (c *Console) initExtensions() error {
}

// Compute aliases from server-provided modules.
aliases := map[string]struct{}{"eth": {}, "personal": {}}
aliases := map[string]struct{}{"eth": {}}
for api := range apis {
if api == "web3" {
continue
Expand Down Expand Up @@ -260,6 +260,7 @@ func (c *Console) initPersonal(vm *goja.Runtime, bridge *bridge) {
if personal == nil || c.prompter == nil {
return
}
log.Error("Enabling deprecated personal namespace")
jeth := vm.NewObject()
vm.Set("jeth", jeth)
jeth.Set("openWallet", personal.Get("openWallet"))
Expand Down
3 changes: 3 additions & 0 deletions node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ type Config struct {

// JWTSecret is the path to the hex-encoded jwt secret.
JWTSecret string `toml:",omitempty"`

// EnablePersonal enables the deprecated personal namespace.
EnablePersonal bool `toml:"-"`
}

// IPCEndpoint resolves an IPC endpoint based on a configured value, taking into
Expand Down
19 changes: 15 additions & 4 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,24 @@ func (n *Node) obtainJWTSecret(cliParam string) ([]byte, error) {
// startup. It's not meant to be called at any time afterwards as it makes certain
// assumptions about the state of the node.
func (n *Node) startRPC() error {
if err := n.startInProc(); err != nil {
// Filter out personal api
apis := n.rpcAPIs
for i, api := range apis {
if api.Namespace == "personal" {
if !n.config.EnablePersonal {
apis = append(apis[:i], apis[i+1:]...)
} else {
log.Error("Deprecated personal namespace activated")
}
}
}
if err := n.startInProc(apis); err != nil {
return err
}

// Configure IPC.
if n.ipc.endpoint != "" {
if err := n.ipc.start(n.rpcAPIs); err != nil {
if err := n.ipc.start(apis); err != nil {
return err
}
}
Expand Down Expand Up @@ -510,8 +521,8 @@ func (n *Node) stopRPC() {
}

// startInProc registers all RPC APIs on the inproc server.
func (n *Node) startInProc() error {
for _, api := range n.rpcAPIs {
func (n *Node) startInProc(apis []rpc.API) error {
for _, api := range apis {
if err := n.inprocHandler.RegisterName(api.Namespace, api.Service); err != nil {
return err
}
Expand Down