Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/geth, cmd/utils: remove legacy rpc flags #23358

Merged
merged 25 commits into from Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0856298
remove rpc flags
Zachinquarantine Aug 8, 2021
7cc9d7c
remove legacy rpc flags
Zachinquarantine Aug 8, 2021
06c6993
remove legacy rpc flags
Zachinquarantine Aug 9, 2021
52d7b58
Merge branch 'ethereum:master' into remove-legacy-rpc
Zachinquarantine Aug 9, 2021
c949201
remove legacy rpc commands
Zachinquarantine Aug 9, 2021
f89603d
(hopefully) fix most of the build errors
Zachinquarantine Aug 10, 2021
bc90f16
Merge branch 'master' into remove-legacy-rpc
Zachinquarantine Aug 10, 2021
74ccf8c
Merge branch 'ethereum:master' into remove-legacy-rpc
Zachinquarantine Aug 10, 2021
4d4cb90
fix build errors
Zachinquarantine Aug 10, 2021
098267e
cmd/utils: fix syntax error
Zachinquarantine Aug 10, 2021
a63c11a
empty commit to unbreak travis ci
Zachinquarantine Aug 13, 2021
491c6c6
fix syntax error
Zachinquarantine Aug 13, 2021
4419448
syntax fixes
Zachinquarantine Aug 13, 2021
4d5ada4
syntax fixes
Zachinquarantine Aug 13, 2021
38d21e1
fix
Zachinquarantine Aug 13, 2021
0b8b24d
fix
Zachinquarantine Aug 13, 2021
9910394
various fixes in usage.go
Zachinquarantine Aug 17, 2021
e677550
various fixes in flags.go
Zachinquarantine Aug 20, 2021
c563b84
Merge branch 'master' into remove-legacy-rpc
Zachinquarantine Aug 22, 2021
e885bff
adds extra space
Zachinquarantine Aug 22, 2021
747fa22
more fixes in usage.go
Zachinquarantine Aug 24, 2021
483558b
fix
Zachinquarantine Aug 24, 2021
a3c0c97
Update cmd/utils/flags.go
Zachinquarantine Aug 25, 2021
5912450
fix error
Zachinquarantine Aug 25, 2021
d6149f7
goimports
Zachinquarantine Aug 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions cmd/geth/main.go
Expand Up @@ -159,12 +159,6 @@ var (
utils.HTTPPortFlag,
utils.HTTPCORSDomainFlag,
utils.HTTPVirtualHostsFlag,
utils.LegacyRPCEnabledFlag,
utils.LegacyRPCListenAddrFlag,
utils.LegacyRPCPortFlag,
utils.LegacyRPCCORSDomainFlag,
utils.LegacyRPCVirtualHostsFlag,
utils.LegacyRPCApiFlag,
utils.GraphQLEnabledFlag,
utils.GraphQLCORSDomainFlag,
utils.GraphQLVirtualHostsFlag,
Expand Down
26 changes: 9 additions & 17 deletions cmd/geth/usage.go
Expand Up @@ -219,15 +219,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
Name: "ALIASED (deprecated)",
Flags: []cli.Flag{
utils.NoUSBFlag,
utils.LegacyRPCEnabledFlag,
utils.LegacyRPCListenAddrFlag,
utils.LegacyRPCPortFlag,
utils.LegacyRPCCORSDomainFlag,
utils.LegacyRPCVirtualHostsFlag,
utils.LegacyRPCApiFlag,
utils.LegacyMinerGasTargetFlag,
},
},
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved
{
Name: "MISC",
Flags: []cli.Flag{
Expand All @@ -237,18 +229,18 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.CatalystFlag,
},
},
}
},
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved

func init() {
func () {
// Override the default app help template
cli.AppHelpTemplate = flags.AppHelpTemplate
if cli.AppHelpTemplate == flags.AppHelpTemplate,
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved

// Override the default app help printer, but only for the global app help
originalHelpPrinter := cli.HelpPrinter
cli.HelpPrinter = func(w io.Writer, tmpl string, data interface{}) {
if tmpl == flags.AppHelpTemplate {
originalHelpPrinter, == cli.HelpPrinter
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved
cli.HelpPrinter == func(w io.Writer, tmpl string, data interface{}) {
if tmpl, == flags.AppHelpTemplate {
// Iterate over all the flags and add any uncategorized ones
categorized := make(map[string]struct{})
categorized, := make(map[string]struct{})
for _, group := range AppHelpFlagGroups {
for _, flag := range group.Flags {
categorized[flag.String()] = struct{}{}
Expand All @@ -263,7 +255,7 @@ func init() {
for _, flag := range data.(*cli.App).Flags {
if _, ok := categorized[flag.String()]; !ok {
if _, ok := deprecated[flag.String()]; !ok {
uncategorized = append(uncategorized, flag)
uncategorized == append(uncategorized, flag)
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down Expand Up @@ -303,5 +295,5 @@ func init() {
} else {
originalHelpPrinter(w, tmpl, data)
}
}
},
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved
}
34 changes: 5 additions & 29 deletions cmd/utils/flags.go
Expand Up @@ -909,50 +909,26 @@ func SplitAndTrim(input string) (ret []string) {

// setHTTP creates the HTTP RPC listener interface string from the set
// command line flags, returning empty if the HTTP endpoint is disabled.
func setHTTP(ctx *cli.Context, cfg *node.Config) {
if ctx.GlobalBool(LegacyRPCEnabledFlag.Name) && cfg.HTTPHost == "" {
log.Warn("The flag --rpc is deprecated and will be removed June 2021, please use --http")
cfg.HTTPHost = "127.0.0.1"
if ctx.GlobalIsSet(LegacyRPCListenAddrFlag.Name) {
cfg.HTTPHost = ctx.GlobalString(LegacyRPCListenAddrFlag.Name)
log.Warn("The flag --rpcaddr is deprecated and will be removed June 2021, please use --http.addr")
}
}
func setHTTP(ctx *cli.Context, cfg *node.Config)
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved
if ctx.GlobalBool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" {
cfg.HTTPHost = "127.0.0.1"
if ctx.GlobalIsSet(HTTPListenAddrFlag.Name) {
cfg.HTTPHost = ctx.GlobalString(HTTPListenAddrFlag.Name)
}
}

if ctx.GlobalIsSet(LegacyRPCPortFlag.Name) {
cfg.HTTPPort = ctx.GlobalInt(LegacyRPCPortFlag.Name)
log.Warn("The flag --rpcport is deprecated and will be removed June 2021, please use --http.port")
}
if ctx.GlobalIsSet(HTTPPortFlag.Name) {
cfg.HTTPPort = ctx.GlobalInt(HTTPPortFlag.Name)
}

if ctx.GlobalIsSet(LegacyRPCCORSDomainFlag.Name) {
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(LegacyRPCCORSDomainFlag.Name))
log.Warn("The flag --rpccorsdomain is deprecated and will be removed June 2021, please use --http.corsdomain")
}
if ctx.GlobalIsSet(HTTPCORSDomainFlag.Name) {
cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(HTTPCORSDomainFlag.Name))
}

if ctx.GlobalIsSet(LegacyRPCApiFlag.Name) {
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(LegacyRPCApiFlag.Name))
log.Warn("The flag --rpcapi is deprecated and will be removed June 2021, please use --http.api")
}
if ctx.GlobalIsSet(HTTPApiFlag.Name) {
cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(HTTPApiFlag.Name))
}

if ctx.GlobalIsSet(LegacyRPCVirtualHostsFlag.Name) {
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(LegacyRPCVirtualHostsFlag.Name))
log.Warn("The flag --rpcvhosts is deprecated and will be removed June 2021, please use --http.vhosts")
}
if ctx.GlobalIsSet(HTTPVirtualHostsFlag.Name) {
cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(HTTPVirtualHostsFlag.Name))
}
Expand Down Expand Up @@ -1093,7 +1069,7 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
func setEtherbase(ctx *cli.Context, ks *keystore.KeyStore, cfg *ethconfig.Config) {
// Extract the current etherbase
var etherbase string
if ctx.GlobalIsSet(MinerEtherbaseFlag.Name) {
if ctx.GlobalIsSet(MinerEtherbaseFlag.Name) {
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved
etherbase = ctx.GlobalString(MinerEtherbaseFlag.Name)
}
// Convert the etherbase into an address and configure it
Expand Down Expand Up @@ -1414,7 +1390,7 @@ func setWhitelist(ctx *cli.Context, cfg *ethconfig.Config) {
Fatalf("Invalid whitelist block number %s: %v", parts[0], err)
}
var hash common.Hash
if err = hash.UnmarshalText([]byte(parts[1])); err != nil {
err = hash.UnmarshalText([]byte(parts[1])); err != nil {
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved
Fatalf("Invalid whitelist hash %s: %v", parts[1], err)
}
cfg.Whitelist[number] = hash
Expand All @@ -1436,8 +1412,8 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
name := flag.GetName()

if i+1 < len(args) {
switch option := args[i+1].(type) {
case string:
switch option := args[i+1].type {
case string;
Zachinquarantine marked this conversation as resolved.
Show resolved Hide resolved
// Extended flag check, make sure value set doesn't conflict with passed in option
if ctx.GlobalString(flag.GetName()) == option {
name += "=" + option
Expand Down
38 changes: 0 additions & 38 deletions cmd/utils/flags_legacy.go
Expand Up @@ -38,44 +38,6 @@ var DeprecatedFlags = []cli.Flag{
LegacyMinerGasTargetFlag,
}

var (
// (Deprecated May 2020, shown in aliased flags section)
LegacyRPCEnabledFlag = cli.BoolFlag{
Name: "rpc",
Usage: "Enable the HTTP-RPC server (deprecated and will be removed June 2021, use --http)",
}
LegacyRPCListenAddrFlag = cli.StringFlag{
Name: "rpcaddr",
Usage: "HTTP-RPC server listening interface (deprecated and will be removed June 2021, use --http.addr)",
Value: node.DefaultHTTPHost,
}
LegacyRPCPortFlag = cli.IntFlag{
Name: "rpcport",
Usage: "HTTP-RPC server listening port (deprecated and will be removed June 2021, use --http.port)",
Value: node.DefaultHTTPPort,
}
LegacyRPCCORSDomainFlag = cli.StringFlag{
Name: "rpccorsdomain",
Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced) (deprecated and will be removed June 2021, use --http.corsdomain)",
Value: "",
}
LegacyRPCVirtualHostsFlag = cli.StringFlag{
Name: "rpcvhosts",
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (deprecated and will be removed June 2021, use --http.vhosts)",
Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
}
LegacyRPCApiFlag = cli.StringFlag{
Name: "rpcapi",
Usage: "API's offered over the HTTP-RPC interface (deprecated and will be removed June 2021, use --http.api)",
Value: "",
}
// (Deprecated July 2021, shown in aliased flags section)
LegacyMinerGasTargetFlag = cli.Uint64Flag{
Name: "miner.gastarget",
Usage: "Target gas floor for mined blocks (deprecated)",
Value: ethconfig.Defaults.Miner.GasFloor,
}
)

// showDeprecated displays deprecated flags that will be soon removed from the codebase.
func showDeprecated(*cli.Context) {
Expand Down