Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/maticnetwork/bor into v0.…
Browse files Browse the repository at this point in the history
…2.15-beta3-candidate
  • Loading branch information
manav2401 committed Mar 30, 2022
2 parents 111a204 + d687d0d commit c8c9296
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ jobs:
run: make all
- name: "Run tests"
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: ./cover.out

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ios:

test:
# Skip mobile and cmd tests since they are being deprecated
go test -v $$(go list ./... | grep -v go-ethereum/cmd/)
go test -v $$(go list ./... | grep -v go-ethereum/cmd/) -cover -coverprofile=cover.out

lint: ## Run linters.
$(GORUN) build/ci.go lint
Expand Down
14 changes: 0 additions & 14 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,4 @@ $ bor server
$ bor server --config ./legacy.toml
```

- Modules, vhost and Cors configuration are common for all jsonrpc endpoints.

Before:

```
$ bor --http --http.modules "eth,web" --ws --ws.modules "eth,web"
```

Now:

```
$ bor server --http --ws --jsonrpc.modules "eth,web"
```

- ```Admin```, ```Personal``` and account related endpoints in ```Eth``` are being removed from the JsonRPC interface. Some of this functionality will be moved to the new GRPC server for operational tasks.
6 changes: 4 additions & 2 deletions docs/cli/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ The ```bor server``` command runs the Bor client.

- ```jsonrpc.vhosts```: Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.

- ```jsonrpc.modules```: API's offered over the HTTP-RPC interface.

- ```http```: Enable the HTTP-RPC server.

- ```http.addr```: HTTP-RPC server listening interface.
Expand All @@ -119,6 +117,8 @@ The ```bor server``` command runs the Bor client.

- ```http.rpcprefix```: HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.

- ```http.modules```: API's offered over the HTTP-RPC interface.

- ```ws```: Enable the WS-RPC server.

- ```ws.addr```: WS-RPC server listening interface.
Expand All @@ -127,6 +127,8 @@ The ```bor server``` command runs the Bor client.

- ```ws.rpcprefix```: HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.

- ```ws.modules```: API's offered over the WS-RPC interface.

- ```graphql```: Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.

### P2P Options
Expand Down
13 changes: 7 additions & 6 deletions internal/cli/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,6 @@ type JsonRPCConfig struct {
// IPCPath is the path of the ipc endpoint
IPCPath string `hcl:"ipc-path,optional"`

// Modules is the list of enabled api modules
Modules []string `hcl:"modules,optional"`

// VHost is the list of valid virtual hosts
VHost []string `hcl:"vhost,optional"`

Expand Down Expand Up @@ -256,6 +253,9 @@ type APIConfig struct {

// Host is the address to bind the api
Host string `hcl:"host,optional"`

// Modules is the list of enabled api modules
Modules []string `hcl:"modules,optional"`
}

type GpoConfig struct {
Expand Down Expand Up @@ -438,7 +438,6 @@ func DefaultConfig() *Config {
JsonRPC: &JsonRPCConfig{
IPCDisable: false,
IPCPath: "",
Modules: []string{"web3", "net"},
Cors: []string{"*"},
VHost: []string{"*"},
GasCap: ethconfig.Defaults.RPCGasCap,
Expand All @@ -448,12 +447,14 @@ func DefaultConfig() *Config {
Port: 8545,
Prefix: "",
Host: "localhost",
Modules: []string{"web3", "net"},
},
Ws: &APIConfig{
Enabled: false,
Port: 8546,
Prefix: "",
Host: "localhost",
Modules: []string{"web3", "net"},
},
Graphql: &APIConfig{
Enabled: false,
Expand Down Expand Up @@ -849,11 +850,11 @@ func (c *Config) buildNode() (*node.Config, error) {
ListenAddr: c.P2P.Bind + ":" + strconv.Itoa(int(c.P2P.Port)),
DiscoveryV5: c.P2P.Discovery.V5Enabled,
},
HTTPModules: c.JsonRPC.Modules,
HTTPModules: c.JsonRPC.Http.Modules,
HTTPCors: c.JsonRPC.Cors,
HTTPVirtualHosts: c.JsonRPC.VHost,
HTTPPathPrefix: c.JsonRPC.Http.Prefix,
WSModules: c.JsonRPC.Modules,
WSModules: c.JsonRPC.Ws.Modules,
WSOrigins: c.JsonRPC.Cors,
WSPathPrefix: c.JsonRPC.Ws.Prefix,
GraphQLCors: c.JsonRPC.Cors,
Expand Down
17 changes: 12 additions & 5 deletions internal/cli/server/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,6 @@ func (c *Command) Flags() *flagset.Flagset {
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
Value: &c.cliConfig.JsonRPC.VHost,
})
f.SliceStringFlag(&flagset.SliceStringFlag{
Name: "jsonrpc.modules",
Usage: "API's offered over the HTTP-RPC interface",
Value: &c.cliConfig.JsonRPC.Modules,
})

// http options
f.BoolFlag(&flagset.BoolFlag{
Expand All @@ -290,6 +285,12 @@ func (c *Command) Flags() *flagset.Flagset {
Usage: "HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
Value: &c.cliConfig.JsonRPC.Http.Prefix,
})
f.SliceStringFlag(&flagset.SliceStringFlag{
Name: "http.modules",
Usage: "API's offered over the HTTP-RPC interface",
Value: &c.cliConfig.JsonRPC.Http.Modules,
})

// ws options
f.BoolFlag(&flagset.BoolFlag{
Name: "ws",
Expand All @@ -311,6 +312,12 @@ func (c *Command) Flags() *flagset.Flagset {
Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
Value: &c.cliConfig.JsonRPC.Ws.Prefix,
})
f.SliceStringFlag(&flagset.SliceStringFlag{
Name: "ws.modules",
Usage: "API's offered over the WS-RPC interface",
Value: &c.cliConfig.JsonRPC.Ws.Modules,
})

// graphql options
f.BoolFlag(&flagset.BoolFlag{
Name: "graphql",
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func NewServer(config *Config) (*Server, error) {

// graphql is started from another place
if config.JsonRPC.Graphql.Enabled {
if err := graphql.New(stack, backend.APIBackend, config.JsonRPC.Cors, config.JsonRPC.Modules); err != nil {
if err := graphql.New(stack, backend.APIBackend, config.JsonRPC.Cors, config.JsonRPC.VHost); err != nil {
return nil, fmt.Errorf("failed to register the GraphQL service: %v", err)
}
}
Expand Down

0 comments on commit c8c9296

Please sign in to comment.