Skip to content

Commit

Permalink
Removed graphQL
Browse files Browse the repository at this point in the history
  • Loading branch information
kiltsonfire authored and wizeguyy committed Jan 25, 2023
1 parent 42a535c commit 9bc3aa0
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 2,325 deletions.
2 changes: 1 addition & 1 deletion build/update-license.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

//go:build none
// +build none

/*
Expand Down Expand Up @@ -70,7 +71,6 @@ var (
"consensus/blake3pow/xor.go",
"crypto/bn256/",
"crypto/ecies/",
"graphql/graphiql.go",
"internal/jsre/deps",
"log/",
"metrics/",
Expand Down
6 changes: 1 addition & 5 deletions cmd/go-quai/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (

"gopkg.in/urfave/cli.v1"

"github.com/naoina/toml"
"github.com/dominant-strategies/go-quai/cmd/utils"
"github.com/dominant-strategies/go-quai/eth/catalyst"
"github.com/dominant-strategies/go-quai/eth/ethconfig"
Expand All @@ -36,6 +35,7 @@ import (
"github.com/dominant-strategies/go-quai/metrics"
"github.com/dominant-strategies/go-quai/node"
"github.com/dominant-strategies/go-quai/params"
"github.com/naoina/toml"
)

var (
Expand Down Expand Up @@ -163,10 +163,6 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
}
}

// Configure GraphQL if requested
if ctx.GlobalIsSet(utils.GraphQLEnabledFlag.Name) {
utils.RegisterGraphQLService(stack, backend, cfg.Node)
}
// Add the Ethereum Stats daemon if requested.
if cfg.Ethstats.URL != "" {
utils.RegisterEthStatsService(stack, backend, cfg.Ethstats.URL)
Expand Down
3 changes: 0 additions & 3 deletions cmd/go-quai/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ var (
utils.LegacyRPCCORSDomainFlag,
utils.LegacyRPCVirtualHostsFlag,
utils.LegacyRPCApiFlag,
utils.GraphQLEnabledFlag,
utils.GraphQLCORSDomainFlag,
utils.GraphQLVirtualHostsFlag,
utils.HTTPApiFlag,
utils.HTTPPathPrefixFlag,
utils.WSEnabledFlag,
Expand Down
3 changes: 0 additions & 3 deletions cmd/go-quai/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
utils.WSApiFlag,
utils.WSPathPrefixFlag,
utils.WSAllowedOriginsFlag,
utils.GraphQLEnabledFlag,
utils.GraphQLCORSDomainFlag,
utils.GraphQLVirtualHostsFlag,
utils.RPCGlobalGasCapFlag,
utils.RPCGlobalTxFeeCapFlag,
utils.AllowUnprotectedTxs,
Expand Down
34 changes: 0 additions & 34 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import (
"github.com/dominant-strategies/go-quai/eth/tracers"
"github.com/dominant-strategies/go-quai/ethdb"
"github.com/dominant-strategies/go-quai/ethstats"
"github.com/dominant-strategies/go-quai/graphql"
"github.com/dominant-strategies/go-quai/internal/ethapi"
"github.com/dominant-strategies/go-quai/internal/flags"
"github.com/dominant-strategies/go-quai/log"
Expand Down Expand Up @@ -478,20 +477,6 @@ var (
Usage: "HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
Value: "",
}
GraphQLEnabledFlag = cli.BoolFlag{
Name: "graphql",
Usage: "Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.",
}
GraphQLCORSDomainFlag = cli.StringFlag{
Name: "graphql.corsdomain",
Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
Value: "",
}
GraphQLVirtualHostsFlag = cli.StringFlag{
Name: "graphql.vhosts",
Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
Value: strings.Join(node.DefaultConfig.GraphQLVirtualHosts, ","),
}
WSEnabledFlag = cli.BoolFlag{
Name: "ws",
Usage: "Enable the WS-RPC server",
Expand Down Expand Up @@ -911,17 +896,6 @@ func setHTTP(ctx *cli.Context, cfg *node.Config) {
}
}

// setGraphQL creates the GraphQL listener interface string from the set
// command line flags, returning empty if the GraphQL endpoint is disabled.
func setGraphQL(ctx *cli.Context, cfg *node.Config) {
if ctx.GlobalIsSet(GraphQLCORSDomainFlag.Name) {
cfg.GraphQLCors = SplitAndTrim(ctx.GlobalString(GraphQLCORSDomainFlag.Name))
}
if ctx.GlobalIsSet(GraphQLVirtualHostsFlag.Name) {
cfg.GraphQLVirtualHosts = SplitAndTrim(ctx.GlobalString(GraphQLVirtualHostsFlag.Name))
}
}

// setWS creates the WebSocket RPC listener interface string from the set
// command line flags, returning empty if the HTTP endpoint is disabled.
func setWS(ctx *cli.Context, cfg *node.Config) {
Expand Down Expand Up @@ -1140,7 +1114,6 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
SetP2PConfig(ctx, &cfg.P2P)
setIPC(ctx, cfg)
setHTTP(ctx, cfg)
setGraphQL(ctx, cfg)
setWS(ctx, cfg)
setNodeUserIdent(ctx, cfg)
setDataDir(ctx, cfg)
Expand Down Expand Up @@ -1631,13 +1604,6 @@ func RegisterEthStatsService(stack *node.Node, backend ethapi.Backend, url strin
}
}

// RegisterGraphQLService is a utility function to construct a new service and register it against a node.
func RegisterGraphQLService(stack *node.Node, backend ethapi.Backend, cfg node.Config) {
if err := graphql.New(stack, backend, cfg.GraphQLCors, cfg.GraphQLVirtualHosts); err != nil {
Fatalf("Failed to register the GraphQL service: %v", err)
}
}

func SetupMetrics(ctx *cli.Context) {
if metrics.Enabled {
log.Info("Enabling metrics collection")
Expand Down
55 changes: 0 additions & 55 deletions common/hexutil/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,6 @@ func (b Bytes) String() string {
return Encode(b)
}

// ImplementsGraphQLType returns true if Bytes implements the specified GraphQL type.
func (b Bytes) ImplementsGraphQLType(name string) bool { return name == "Bytes" }

// UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (b *Bytes) UnmarshalGraphQL(input interface{}) error {
var err error
switch input := input.(type) {
case string:
data, err := Decode(input)
if err != nil {
return err
}
*b = data
default:
err = fmt.Errorf("unexpected type %T for Bytes", input)
}
return err
}

// UnmarshalFixedJSON decodes the input as a string with 0x prefix. The length of out
// determines the required input length. This function is commonly used to implement the
// UnmarshalJSON method for fixed-size types.
Expand Down Expand Up @@ -206,25 +187,6 @@ func (b *Big) String() string {
return EncodeBig(b.ToInt())
}

// ImplementsGraphQLType returns true if Big implements the provided GraphQL type.
func (b Big) ImplementsGraphQLType(name string) bool { return name == "BigInt" }

// UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (b *Big) UnmarshalGraphQL(input interface{}) error {
var err error
switch input := input.(type) {
case string:
return b.UnmarshalText([]byte(input))
case int32:
var num big.Int
num.SetInt64(int64(input))
*b = Big(num)
default:
err = fmt.Errorf("unexpected type %T for BigInt", input)
}
return err
}

// Uint64 marshals/unmarshals as a JSON string with 0x prefix.
// The zero value marshals as "0x0".
type Uint64 uint64
Expand Down Expand Up @@ -272,23 +234,6 @@ func (b Uint64) String() string {
return EncodeUint64(uint64(b))
}

// ImplementsGraphQLType returns true if Uint64 implements the provided GraphQL type.
func (b Uint64) ImplementsGraphQLType(name string) bool { return name == "Long" }

// UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (b *Uint64) UnmarshalGraphQL(input interface{}) error {
var err error
switch input := input.(type) {
case string:
return b.UnmarshalText([]byte(input))
case int32:
*b = Uint64(input)
default:
err = fmt.Errorf("unexpected type %T for Long", input)
}
return err
}

// Uint marshals/unmarshals as a JSON string with 0x prefix.
// The zero value marshals as "0x0".
type Uint uint
Expand Down
30 changes: 0 additions & 30 deletions common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,21 +183,6 @@ func (h Hash) Value() (driver.Value, error) {
return h[:], nil
}

// ImplementsGraphQLType returns true if Hash implements the specified GraphQL type.
func (Hash) ImplementsGraphQLType(name string) bool { return name == "Bytes32" }

// UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (h *Hash) UnmarshalGraphQL(input interface{}) error {
var err error
switch input := input.(type) {
case string:
err = h.UnmarshalText([]byte(input))
default:
err = fmt.Errorf("unexpected type %T for Hash", input)
}
return err
}

// UnprefixedHash allows marshaling a Hash without 0x prefix.
type UnprefixedHash Hash

Expand Down Expand Up @@ -355,21 +340,6 @@ func (a Address) Value() (driver.Value, error) {
return a[:], nil
}

// ImplementsGraphQLType returns true if Hash implements the specified GraphQL type.
func (a Address) ImplementsGraphQLType(name string) bool { return name == "Address" }

// UnmarshalGraphQL unmarshals the provided GraphQL query data.
func (a *Address) UnmarshalGraphQL(input interface{}) error {
var err error
switch input := input.(type) {
case string:
err = a.UnmarshalText([]byte(input))
default:
err = fmt.Errorf("unexpected type %T for Address", input)
}
return err
}

// UnprefixedAddress allows marshaling an Address without 0x prefix.
type UnprefixedAddress Address

Expand Down
120 changes: 0 additions & 120 deletions graphql/graphiql.go

This file was deleted.

Loading

0 comments on commit 9bc3aa0

Please sign in to comment.