diff --git a/cmd/clef/main.go b/cmd/clef/main.go index 2e9ed9bed816..9104fba99142 100644 --- a/cmd/clef/main.go +++ b/cmd/clef/main.go @@ -647,7 +647,6 @@ func signer(c *cli.Context) error { rpcAPI := []rpc.API{ { Namespace: "account", - Public: true, Service: api, Version: "1.0"}, } @@ -656,7 +655,7 @@ func signer(c *cli.Context) error { cors := utils.SplitAndTrim(c.GlobalString(utils.HTTPCORSDomainFlag.Name)) srv := rpc.NewServer() - err := node.RegisterApis(rpcAPI, []string{"account"}, srv, false) + err := node.RegisterApis(rpcAPI, []string{"account"}, srv) if err != nil { utils.Fatalf("Could not register API: %w", err) } diff --git a/consensus/clique/clique.go b/consensus/clique/clique.go index 950300f03486..f229d042652d 100644 --- a/consensus/clique/clique.go +++ b/consensus/clique/clique.go @@ -699,7 +699,6 @@ func (c *Clique) APIs(chain consensus.ChainHeaderReader) []rpc.API { Namespace: "clique", Version: "1.0", Service: &API{chain: chain, clique: c}, - Public: false, }} } diff --git a/consensus/ethash/ethash.go b/consensus/ethash/ethash.go index 17640df6d22a..51572665f1ba 100644 --- a/consensus/ethash/ethash.go +++ b/consensus/ethash/ethash.go @@ -681,13 +681,11 @@ func (ethash *Ethash) APIs(chain consensus.ChainHeaderReader) []rpc.API { Namespace: "eth", Version: "1.0", Service: &API{ethash}, - Public: true, }, { Namespace: "ethash", Version: "1.0", Service: &API{ethash}, - Public: true, }, } } diff --git a/eth/backend.go b/eth/backend.go index ca8626b82c92..df94f296f971 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -459,22 +459,18 @@ func (s *Ethereum) APIs() []rpc.API { Namespace: "eth", Version: "1.0", Service: NewEthereumAPI(s), - Public: true, }, { Namespace: "miner", Version: "1.0", Service: NewMinerAPI(s), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: downloader.NewDownloaderAPI(s.handler.downloader, s.eventMux), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: filters.NewFilterAPI(s.APIBackend, false, 5*time.Minute), - Public: true, }, { Namespace: "admin", Version: "1.0", @@ -483,12 +479,10 @@ func (s *Ethereum) APIs() []rpc.API { Namespace: "debug", Version: "1.0", Service: NewDebugAPI(s), - Public: true, }, { Namespace: "net", Version: "1.0", Service: s.netRPCService, - Public: true, }, }...) } diff --git a/eth/catalyst/api.go b/eth/catalyst/api.go index 0c8f0c3610ab..acc9c0e66ecb 100644 --- a/eth/catalyst/api.go +++ b/eth/catalyst/api.go @@ -44,7 +44,6 @@ func Register(stack *node.Node, backend *eth.Ethereum) error { Namespace: "engine", Version: "1.0", Service: NewConsensusAPI(backend), - Public: true, Authenticated: true, }, }) diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 13373442babe..4bc1bae3951f 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -939,7 +939,6 @@ func APIs(backend Backend) []rpc.API { Namespace: "debug", Version: "1.0", Service: NewAPI(backend), - Public: false, }, } } diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go index 6e999877bdd9..b5bca7e5be87 100644 --- a/internal/ethapi/backend.go +++ b/internal/ethapi/backend.go @@ -106,37 +106,30 @@ func GetAPIs(apiBackend Backend) []rpc.API { Namespace: "eth", Version: "1.0", Service: NewEthereumAPI(apiBackend), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: NewBlockChainAPI(apiBackend), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: NewTransactionAPI(apiBackend, nonceLock), - Public: true, }, { Namespace: "txpool", Version: "1.0", Service: NewTxPoolAPI(apiBackend), - Public: true, }, { Namespace: "debug", Version: "1.0", Service: NewDebugAPI(apiBackend), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: NewEthereumAccountAPI(apiBackend.AccountManager()), - Public: true, }, { Namespace: "personal", Version: "1.0", Service: NewPersonalAccountAPI(apiBackend, nonceLock), - Public: false, }, } } diff --git a/les/catalyst/api.go b/les/catalyst/api.go index de09acdb0213..12d21061354d 100644 --- a/les/catalyst/api.go +++ b/les/catalyst/api.go @@ -37,7 +37,6 @@ func Register(stack *node.Node, backend *les.LightEthereum) error { Namespace: "engine", Version: "1.0", Service: NewConsensusAPI(backend), - Public: true, Authenticated: true, }, }) diff --git a/les/client.go b/les/client.go index d8b79d5535d8..7351903e7ac5 100644 --- a/les/client.go +++ b/les/client.go @@ -416,32 +416,26 @@ func (s *LightEthereum) APIs() []rpc.API { Namespace: "eth", Version: "1.0", Service: &LightDummyAPI{}, - Public: true, }, { Namespace: "eth", Version: "1.0", Service: downloader.NewDownloaderAPI(s.handler.downloader, s.eventMux), - Public: true, }, { Namespace: "eth", Version: "1.0", Service: filters.NewFilterAPI(s.ApiBackend, true, 5*time.Minute), - Public: true, }, { Namespace: "net", Version: "1.0", Service: s.netRPCService, - Public: true, }, { Namespace: "les", Version: "1.0", Service: NewLightAPI(&s.lesCommons), - Public: false, }, { Namespace: "vflux", Version: "1.0", Service: s.serverPool.API(), - Public: false, }, }...) } diff --git a/les/server.go b/les/server.go index 436dff2bf64f..894fc138367f 100644 --- a/les/server.go +++ b/les/server.go @@ -161,19 +161,16 @@ func (s *LesServer) APIs() []rpc.API { Namespace: "les", Version: "1.0", Service: NewLightAPI(&s.lesCommons), - Public: false, }, { Namespace: "les", Version: "1.0", Service: NewLightServerAPI(s), - Public: false, }, { Namespace: "debug", Version: "1.0", Service: NewDebugAPI(s), - Public: false, }, } } diff --git a/node/api.go b/node/api.go index 8d0dadc9e241..b395a345ca74 100644 --- a/node/api.go +++ b/node/api.go @@ -37,7 +37,6 @@ func (n *Node) apis() []rpc.API { Namespace: "admin", Version: "1.0", Service: &adminAPI{n}, - Public: true, }, { Namespace: "debug", Version: "1.0", @@ -46,7 +45,6 @@ func (n *Node) apis() []rpc.API { Namespace: "web3", Version: "1.0", Service: &web3API{n}, - Public: true, }, } } diff --git a/node/rpcstack.go b/node/rpcstack.go index 0d2be9008a41..09692c0a0b19 100644 --- a/node/rpcstack.go +++ b/node/rpcstack.go @@ -281,7 +281,7 @@ func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error { // Create RPC server and handler. srv := rpc.NewServer() - if err := RegisterApis(apis, config.Modules, srv, false); err != nil { + if err := RegisterApis(apis, config.Modules, srv); err != nil { return err } h.httpConfig = config @@ -312,7 +312,7 @@ func (h *httpServer) enableWS(apis []rpc.API, config wsConfig) error { } // Create RPC server and handler. srv := rpc.NewServer() - if err := RegisterApis(apis, config.Modules, srv, false); err != nil { + if err := RegisterApis(apis, config.Modules, srv); err != nil { return err } h.wsConfig = config @@ -528,7 +528,7 @@ func (is *ipcServer) stop() error { // RegisterApis checks the given modules' availability, generates an allowlist based on the allowed modules, // and then registers all of the APIs exposed by the services. -func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll bool) error { +func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server) error { if bad, available := checkModuleAvailability(modules, apis); len(bad) > 0 { log.Error("Unavailable modules in HTTP API list", "unavailable", bad, "available", available) } @@ -539,7 +539,7 @@ func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll b } // Register all the APIs exposed by the services for _, api := range apis { - if exposeAll || allowList[api.Namespace] || (len(allowList) == 0 && api.Public) { + if allowList[api.Namespace] || len(allowList) == 0 { if err := srv.RegisterName(api.Namespace, api.Service); err != nil { return err } diff --git a/node/utils_test.go b/node/utils_test.go index 1974e2e17cdd..31dbe911ba81 100644 --- a/node/utils_test.go +++ b/node/utils_test.go @@ -100,12 +100,10 @@ func (f *FullService) APIs() []rpc.API { { Namespace: "debug", Version: "1.0", - Public: true, }, { Namespace: "net", Version: "1.0", - Public: true, }, } } diff --git a/rpc/types.go b/rpc/types.go index f4d05be48cd4..a0d742f49142 100644 --- a/rpc/types.go +++ b/rpc/types.go @@ -33,7 +33,7 @@ type API struct { Namespace string // namespace under which the rpc methods of Service are exposed Version string // api version for DApp's Service interface{} // receiver instance which holds the methods - Public bool // indication if the methods must be considered safe for public use + Public bool // deprecated - this field is no longer used, but retained for compatibility Authenticated bool // whether the api should only be available behind authentication. }