From 1d71eb73d2e7c780b14bf83cf1f280ac88297c71 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Wed, 17 Feb 2021 12:49:43 +0100 Subject: [PATCH 1/9] internal/ethapi: disable sending of non eip155 replay protected transactions --- internal/ethapi/api.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index d3c007b9bff1..c470e2466b6e 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1555,6 +1555,10 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c if err := checkTxFee(tx.GasPrice(), tx.Gas(), b.RPCTxFeeCap()); err != nil { return common.Hash{}, err } + // Ensure only eip155 signed transactions are submitted + if !tx.Protected() { + return common.Hash{}, errors.New("Non-eip155 signed transaction submitted") + } if err := b.SendTx(ctx, tx); err != nil { return common.Hash{}, err } From b1f1634a03d7ea8e24a2f43f7f7c546d67bbfae7 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Wed, 17 Feb 2021 13:08:24 +0100 Subject: [PATCH 2/9] internal/ethapi: improved error message --- internal/ethapi/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index c470e2466b6e..cf07200106cb 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1557,7 +1557,7 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c } // Ensure only eip155 signed transactions are submitted if !tx.Protected() { - return common.Hash{}, errors.New("Non-eip155 signed transaction submitted") + return common.Hash{}, errors.New("non-eip155 signed transaction submitted") } if err := b.SendTx(ctx, tx); err != nil { return common.Hash{}, err From 56ff034a62f95fd26f2e92d4e679d1d626045f0e Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Wed, 17 Feb 2021 13:09:11 +0100 Subject: [PATCH 3/9] internal/ethapi: improved error message --- internal/ethapi/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index cf07200106cb..fe0721684bae 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1557,7 +1557,7 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c } // Ensure only eip155 signed transactions are submitted if !tx.Protected() { - return common.Hash{}, errors.New("non-eip155 signed transaction submitted") + return common.Hash{}, errors.New("only replay-protected (EIP-155) transactions allowed over RPC") } if err := b.SendTx(ctx, tx); err != nil { return common.Hash{}, err From ede6175fe936bfaa4923cabe14eaa96a90182491 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Wed, 17 Feb 2021 17:16:07 +0100 Subject: [PATCH 4/9] node: add EIP155Required option --- cmd/utils/flags.go | 10 ++++++++++ eth/api_backend.go | 11 ++++++++--- eth/backend.go | 2 +- internal/ethapi/api.go | 4 ++-- internal/ethapi/backend.go | 1 + les/api_backend.go | 11 ++++++++--- les/client.go | 2 +- node/config.go | 3 +++ 8 files changed, 34 insertions(+), 10 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 0d7b0e1bf568..a66b54ab6e24 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -593,6 +593,10 @@ var ( Name: "preload", Usage: "Comma separated list of JavaScript files to preload into the console", } + AllowUnprotectedTxs = cli.BoolFlag{ + Name: "rpc.allow-unprotected-txs", + Usage: "Allow for unprotected (non EIP155 signed transactions to be submitted via RPC", + } // Network Settings MaxPeersFlag = cli.IntFlag{ @@ -966,6 +970,12 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { if ctx.GlobalIsSet(HTTPPathPrefixFlag.Name) { cfg.HTTPPathPrefix = ctx.GlobalString(HTTPPathPrefixFlag.Name) } + + if ctx.GlobalIsSet(AllowUnprotectedTxs.Name) { + cfg.EIP155Required = !ctx.GlobalBool(AllowUnprotectedTxs.Name) + } else { + cfg.EIP155Required = true + } } // setGraphQL creates the GraphQL listener interface string from the set diff --git a/eth/api_backend.go b/eth/api_backend.go index 17de83a28f90..d8fedc573253 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -41,9 +41,10 @@ import ( // EthAPIBackend implements ethapi.Backend for full nodes type EthAPIBackend struct { - extRPCEnabled bool - eth *Ethereum - gpo *gasprice.Oracle + extRPCEnabled bool + eip155Required bool + eth *Ethereum + gpo *gasprice.Oracle } // ChainConfig returns the active chain configuration. @@ -292,6 +293,10 @@ func (b *EthAPIBackend) ExtRPCEnabled() bool { return b.extRPCEnabled } +func (b *EthAPIBackend) EIP155Required() bool { + return b.eip155Required +} + func (b *EthAPIBackend) RPCGasCap() uint64 { return b.eth.config.RPCGasCap } diff --git a/eth/backend.go b/eth/backend.go index 4170ecc94e90..bdbb9a0d4ed1 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -222,7 +222,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { eth.miner = miner.New(eth, &config.Miner, chainConfig, eth.EventMux(), eth.engine, eth.isLocalBlock) eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData)) - eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), eth, nil} + eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().EIP155Required, eth, nil} gpoParams := config.GPO if gpoParams.Default == nil { gpoParams.Default = config.Miner.GasPrice diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index fe0721684bae..a00bdba41354 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1555,8 +1555,8 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c if err := checkTxFee(tx.GasPrice(), tx.Gas(), b.RPCTxFeeCap()); err != nil { return common.Hash{}, err } - // Ensure only eip155 signed transactions are submitted - if !tx.Protected() { + if b.EIP155Required() && !tx.Protected() { + // Ensure only eip155 signed transactions are submitted if EIP155Required is set. return common.Hash{}, errors.New("only replay-protected (EIP-155) transactions allowed over RPC") } if err := b.SendTx(ctx, tx); err != nil { diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index f0a4c0493c86..36903ab9bddd 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -47,6 +47,7 @@ type Backend interface { ExtRPCEnabled() bool RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs + EIP155Required() bool // allows only for EIP155 transactions. // Blockchain API SetHead(number uint64) diff --git a/les/api_backend.go b/les/api_backend.go index 0839614901ed..45ee05ec4b42 100644 --- a/les/api_backend.go +++ b/les/api_backend.go @@ -40,9 +40,10 @@ import ( ) type LesApiBackend struct { - extRPCEnabled bool - eth *LightEthereum - gpo *gasprice.Oracle + extRPCEnabled bool + eip155Required bool + eth *LightEthereum + gpo *gasprice.Oracle } func (b *LesApiBackend) ChainConfig() *params.ChainConfig { @@ -263,6 +264,10 @@ func (b *LesApiBackend) ExtRPCEnabled() bool { return b.extRPCEnabled } +func (b *LesApiBackend) EIP155Required() bool { + return b.eip155Required +} + func (b *LesApiBackend) RPCGasCap() uint64 { return b.eth.config.RPCGasCap } diff --git a/les/client.go b/les/client.go index 1b26e9a9b5ab..cd82b7d54b72 100644 --- a/les/client.go +++ b/les/client.go @@ -156,7 +156,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) { rawdb.WriteChainConfig(chainDb, genesisHash, chainConfig) } - leth.ApiBackend = &LesApiBackend{stack.Config().ExtRPCEnabled(), leth, nil} + leth.ApiBackend = &LesApiBackend{stack.Config().ExtRPCEnabled(), stack.Config().EIP155Required, leth, nil} gpoParams := config.GPO if gpoParams.Default == nil { gpoParams.Default = config.Miner.GasPrice diff --git a/node/config.go b/node/config.go index 447a69505c09..0889114a96ee 100644 --- a/node/config.go +++ b/node/config.go @@ -191,6 +191,9 @@ type Config struct { staticNodesWarning bool trustedNodesWarning bool oldGethResourceWarning bool + + // Require all transactions to be protected with EIP-155 to prevent replaying on other chains. + EIP155Required bool `toml:",omitempty"` } // IPCEndpoint resolves an IPC endpoint based on a configured value, taking into From 90f7ab2948e28ad9ce08fa50477b06a3d10cfdb5 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Wed, 17 Feb 2021 20:00:34 +0100 Subject: [PATCH 5/9] node: rename EIP155Required to UnprotectedAllowed --- cmd/utils/flags.go | 4 +--- eth/api_backend.go | 12 ++++++------ eth/backend.go | 2 +- internal/ethapi/api.go | 2 +- internal/ethapi/backend.go | 6 +++--- les/api_backend.go | 12 ++++++------ les/client.go | 2 +- node/config.go | 2 +- 8 files changed, 20 insertions(+), 22 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index a66b54ab6e24..2415fc150f57 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -972,9 +972,7 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { } if ctx.GlobalIsSet(AllowUnprotectedTxs.Name) { - cfg.EIP155Required = !ctx.GlobalBool(AllowUnprotectedTxs.Name) - } else { - cfg.EIP155Required = true + cfg.UnprotectedAllowed = ctx.GlobalBool(AllowUnprotectedTxs.Name) } } diff --git a/eth/api_backend.go b/eth/api_backend.go index d8fedc573253..e037a5899ecc 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -41,10 +41,10 @@ import ( // EthAPIBackend implements ethapi.Backend for full nodes type EthAPIBackend struct { - extRPCEnabled bool - eip155Required bool - eth *Ethereum - gpo *gasprice.Oracle + extRPCEnabled bool + unprotectedAllowed bool + eth *Ethereum + gpo *gasprice.Oracle } // ChainConfig returns the active chain configuration. @@ -293,8 +293,8 @@ func (b *EthAPIBackend) ExtRPCEnabled() bool { return b.extRPCEnabled } -func (b *EthAPIBackend) EIP155Required() bool { - return b.eip155Required +func (b *EthAPIBackend) UnprotectedAllowed() bool { + return b.unprotectedAllowed } func (b *EthAPIBackend) RPCGasCap() uint64 { diff --git a/eth/backend.go b/eth/backend.go index bdbb9a0d4ed1..d20920df0b2c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -222,7 +222,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { eth.miner = miner.New(eth, &config.Miner, chainConfig, eth.EventMux(), eth.engine, eth.isLocalBlock) eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData)) - eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().EIP155Required, eth, nil} + eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().UnprotectedAllowed, eth, nil} gpoParams := config.GPO if gpoParams.Default == nil { gpoParams.Default = config.Miner.GasPrice diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index a00bdba41354..52b4f5f506e4 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1555,7 +1555,7 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c if err := checkTxFee(tx.GasPrice(), tx.Gas(), b.RPCTxFeeCap()); err != nil { return common.Hash{}, err } - if b.EIP155Required() && !tx.Protected() { + if !b.UnprotectedAllowed() && !tx.Protected() { // Ensure only eip155 signed transactions are submitted if EIP155Required is set. return common.Hash{}, errors.New("only replay-protected (EIP-155) transactions allowed over RPC") } diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 36903ab9bddd..ebb088fef561 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -45,9 +45,9 @@ type Backend interface { ChainDb() ethdb.Database AccountManager() *accounts.Manager ExtRPCEnabled() bool - RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection - RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs - EIP155Required() bool // allows only for EIP155 transactions. + RPCGasCap() uint64 // global gas cap for eth_call over rpc: DoS protection + RPCTxFeeCap() float64 // global tx fee cap for all transaction related APIs + UnprotectedAllowed() bool // allows only for EIP155 transactions. // Blockchain API SetHead(number uint64) diff --git a/les/api_backend.go b/les/api_backend.go index 45ee05ec4b42..1b441c270528 100644 --- a/les/api_backend.go +++ b/les/api_backend.go @@ -40,10 +40,10 @@ import ( ) type LesApiBackend struct { - extRPCEnabled bool - eip155Required bool - eth *LightEthereum - gpo *gasprice.Oracle + extRPCEnabled bool + unprotectedAllowed bool + eth *LightEthereum + gpo *gasprice.Oracle } func (b *LesApiBackend) ChainConfig() *params.ChainConfig { @@ -264,8 +264,8 @@ func (b *LesApiBackend) ExtRPCEnabled() bool { return b.extRPCEnabled } -func (b *LesApiBackend) EIP155Required() bool { - return b.eip155Required +func (b *LesApiBackend) UnprotectedAllowed() bool { + return b.unprotectedAllowed } func (b *LesApiBackend) RPCGasCap() uint64 { diff --git a/les/client.go b/les/client.go index cd82b7d54b72..21775fdb94e0 100644 --- a/les/client.go +++ b/les/client.go @@ -156,7 +156,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) { rawdb.WriteChainConfig(chainDb, genesisHash, chainConfig) } - leth.ApiBackend = &LesApiBackend{stack.Config().ExtRPCEnabled(), stack.Config().EIP155Required, leth, nil} + leth.ApiBackend = &LesApiBackend{stack.Config().ExtRPCEnabled(), stack.Config().UnprotectedAllowed, leth, nil} gpoParams := config.GPO if gpoParams.Default == nil { gpoParams.Default = config.Miner.GasPrice diff --git a/node/config.go b/node/config.go index 0889114a96ee..883ca7118b20 100644 --- a/node/config.go +++ b/node/config.go @@ -193,7 +193,7 @@ type Config struct { oldGethResourceWarning bool // Require all transactions to be protected with EIP-155 to prevent replaying on other chains. - EIP155Required bool `toml:",omitempty"` + UnprotectedAllowed bool `toml:",omitempty"` } // IPCEndpoint resolves an IPC endpoint based on a configured value, taking into From 671e74882f222f9d74fd9d028145194497d16d7d Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Thu, 18 Feb 2021 10:20:00 +0100 Subject: [PATCH 6/9] cmd: add flag --- cmd/geth/main.go | 1 + cmd/utils/flags.go | 4 +--- node/config.go | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 0236ffb7d38f..2e1ff3897d10 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -199,6 +199,7 @@ var ( utils.InsecureUnlockAllowedFlag, utils.RPCGlobalGasCapFlag, utils.RPCGlobalTxFeeCapFlag, + utils.AllowUnprotectedTxs, } whisperFlags = []cli.Flag{ diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 2415fc150f57..2a10b25ec065 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -971,9 +971,7 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { cfg.HTTPPathPrefix = ctx.GlobalString(HTTPPathPrefixFlag.Name) } - if ctx.GlobalIsSet(AllowUnprotectedTxs.Name) { - cfg.UnprotectedAllowed = ctx.GlobalBool(AllowUnprotectedTxs.Name) - } + cfg.UnprotectedAllowed = ctx.GlobalBool(AllowUnprotectedTxs.Name) } // setGraphQL creates the GraphQL listener interface string from the set diff --git a/node/config.go b/node/config.go index 883ca7118b20..a3b65ddeb25c 100644 --- a/node/config.go +++ b/node/config.go @@ -192,7 +192,7 @@ type Config struct { trustedNodesWarning bool oldGethResourceWarning bool - // Require all transactions to be protected with EIP-155 to prevent replaying on other chains. + // UnprotectedAllowed allows non EIP-155 protected transactions to be send over RPC. UnprotectedAllowed bool `toml:",omitempty"` } From 82208ad69312e15bcccab711bec8a4b0618a2f01 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Thu, 18 Feb 2021 12:15:38 +0100 Subject: [PATCH 7/9] fixed read from config, renamed --- cmd/utils/flags.go | 5 +++-- eth/api_backend.go | 10 +++++----- eth/backend.go | 3 ++- les/api_backend.go | 10 +++++----- les/client.go | 2 +- node/config.go | 4 ++-- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 2a10b25ec065..ed0fc019b1b8 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -970,8 +970,9 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { if ctx.GlobalIsSet(HTTPPathPrefixFlag.Name) { cfg.HTTPPathPrefix = ctx.GlobalString(HTTPPathPrefixFlag.Name) } - - cfg.UnprotectedAllowed = ctx.GlobalBool(AllowUnprotectedTxs.Name) + if ctx.GlobalIsSet(HTTPPathPrefixFlag.Name) { + cfg.AllowUnprotectedTxs = ctx.GlobalBool(AllowUnprotectedTxs.Name) + } } // setGraphQL creates the GraphQL listener interface string from the set diff --git a/eth/api_backend.go b/eth/api_backend.go index e037a5899ecc..2569972e527f 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -41,10 +41,10 @@ import ( // EthAPIBackend implements ethapi.Backend for full nodes type EthAPIBackend struct { - extRPCEnabled bool - unprotectedAllowed bool - eth *Ethereum - gpo *gasprice.Oracle + extRPCEnabled bool + allowUnprotectedTxs bool + eth *Ethereum + gpo *gasprice.Oracle } // ChainConfig returns the active chain configuration. @@ -294,7 +294,7 @@ func (b *EthAPIBackend) ExtRPCEnabled() bool { } func (b *EthAPIBackend) UnprotectedAllowed() bool { - return b.unprotectedAllowed + return b.allowUnprotectedTxs } func (b *EthAPIBackend) RPCGasCap() uint64 { diff --git a/eth/backend.go b/eth/backend.go index d20920df0b2c..d76c89a18c68 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -222,7 +222,8 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { eth.miner = miner.New(eth, &config.Miner, chainConfig, eth.EventMux(), eth.engine, eth.isLocalBlock) eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData)) - eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().UnprotectedAllowed, eth, nil} + eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil} + log.Info("Unprotected TXs allowed", "value", eth.APIBackend.allowUnprotectedTxs) gpoParams := config.GPO if gpoParams.Default == nil { gpoParams.Default = config.Miner.GasPrice diff --git a/les/api_backend.go b/les/api_backend.go index 1b441c270528..f5d2354b60ab 100644 --- a/les/api_backend.go +++ b/les/api_backend.go @@ -40,10 +40,10 @@ import ( ) type LesApiBackend struct { - extRPCEnabled bool - unprotectedAllowed bool - eth *LightEthereum - gpo *gasprice.Oracle + extRPCEnabled bool + allowUnprotectedTxs bool + eth *LightEthereum + gpo *gasprice.Oracle } func (b *LesApiBackend) ChainConfig() *params.ChainConfig { @@ -265,7 +265,7 @@ func (b *LesApiBackend) ExtRPCEnabled() bool { } func (b *LesApiBackend) UnprotectedAllowed() bool { - return b.unprotectedAllowed + return b.allowUnprotectedTxs } func (b *LesApiBackend) RPCGasCap() uint64 { diff --git a/les/client.go b/les/client.go index 21775fdb94e0..2228ca50baab 100644 --- a/les/client.go +++ b/les/client.go @@ -156,7 +156,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) { rawdb.WriteChainConfig(chainDb, genesisHash, chainConfig) } - leth.ApiBackend = &LesApiBackend{stack.Config().ExtRPCEnabled(), stack.Config().UnprotectedAllowed, leth, nil} + leth.ApiBackend = &LesApiBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, leth, nil} gpoParams := config.GPO if gpoParams.Default == nil { gpoParams.Default = config.Miner.GasPrice diff --git a/node/config.go b/node/config.go index a3b65ddeb25c..ef1da15d7076 100644 --- a/node/config.go +++ b/node/config.go @@ -192,8 +192,8 @@ type Config struct { trustedNodesWarning bool oldGethResourceWarning bool - // UnprotectedAllowed allows non EIP-155 protected transactions to be send over RPC. - UnprotectedAllowed bool `toml:",omitempty"` + // AllowUnprotectedTxs allows non EIP-155 protected transactions to be send over RPC. + AllowUnprotectedTxs bool `toml:",omitempty"` } // IPCEndpoint resolves an IPC endpoint based on a configured value, taking into From d73a0eaf3f9c903ffd344fd999e50b59c7e3be2a Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Thu, 18 Feb 2021 12:19:34 +0100 Subject: [PATCH 8/9] typo --- cmd/utils/flags.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index ed0fc019b1b8..e050b40157fb 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -595,7 +595,7 @@ var ( } AllowUnprotectedTxs = cli.BoolFlag{ Name: "rpc.allow-unprotected-txs", - Usage: "Allow for unprotected (non EIP155 signed transactions to be submitted via RPC", + Usage: "Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC", } // Network Settings From 80b4c4279021f423439851a0998465ca0095a958 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Fri, 19 Feb 2021 09:39:41 +0100 Subject: [PATCH 9/9] cmd: wrong logic --- cmd/utils/flags.go | 2 +- eth/backend.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index e050b40157fb..d2a30a8d45cf 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -970,7 +970,7 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) { if ctx.GlobalIsSet(HTTPPathPrefixFlag.Name) { cfg.HTTPPathPrefix = ctx.GlobalString(HTTPPathPrefixFlag.Name) } - if ctx.GlobalIsSet(HTTPPathPrefixFlag.Name) { + if ctx.GlobalIsSet(AllowUnprotectedTxs.Name) { cfg.AllowUnprotectedTxs = ctx.GlobalBool(AllowUnprotectedTxs.Name) } } diff --git a/eth/backend.go b/eth/backend.go index d76c89a18c68..044422763b98 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -223,7 +223,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData)) eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil} - log.Info("Unprotected TXs allowed", "value", eth.APIBackend.allowUnprotectedTxs) + if eth.APIBackend.allowUnprotectedTxs { + log.Info("Unprotected transactions allowed") + } gpoParams := config.GPO if gpoParams.Default == nil { gpoParams.Default = config.Miner.GasPrice