-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from KenshiTech/fix-gql-in-consumer-102
fix: move Gql from broker to consumer
- Loading branch information
Showing
147 changed files
with
2,333 additions
and
2,037 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,6 @@ docker/data | |
docker/pgadmin | ||
.clinic | ||
node_trace.* | ||
src/bin | ||
internal/bin | ||
conf.*.private | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
go 1.22.1 | ||
|
||
use ( | ||
./src | ||
./internal | ||
./zk | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/KenshiTech/unchained/config" | ||
"github.com/KenshiTech/unchained/constants" | ||
"github.com/KenshiTech/unchained/crypto/bls" | ||
"github.com/KenshiTech/unchained/ethereum" | ||
"github.com/KenshiTech/unchained/log" | ||
"github.com/KenshiTech/unchained/pos" | ||
"github.com/KenshiTech/unchained/transport/server" | ||
"github.com/KenshiTech/unchained/transport/server/websocket" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
var brokerCmd = &cobra.Command{ | ||
Use: "broker", | ||
Short: "Run the Unchained client in broker mode", | ||
Long: `Run the Unchained client in broker mode`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
log.Start(config.App.System.Log) | ||
log.Logger. | ||
With("Mode", "Broker"). | ||
With("Version", constants.Version). | ||
With("Protocol", constants.ProtocolVersion). | ||
Info("Running Unchained") | ||
|
||
err := config.Load(configPath, secretsPath) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
bls.InitClientIdentity() | ||
|
||
ethRPC := ethereum.New() | ||
pos.New(ethRPC) | ||
|
||
server.New( | ||
websocket.WithWebsocket(), | ||
) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(brokerCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/KenshiTech/unchained/config" | ||
"github.com/KenshiTech/unchained/constants" | ||
"github.com/KenshiTech/unchained/crypto/bls" | ||
"github.com/KenshiTech/unchained/db" | ||
"github.com/KenshiTech/unchained/ethereum" | ||
"github.com/KenshiTech/unchained/log" | ||
"github.com/KenshiTech/unchained/pos" | ||
correctnessService "github.com/KenshiTech/unchained/service/correctness" | ||
evmlogService "github.com/KenshiTech/unchained/service/evmlog" | ||
uniswapService "github.com/KenshiTech/unchained/service/uniswap" | ||
"github.com/KenshiTech/unchained/transport/client" | ||
"github.com/KenshiTech/unchained/transport/client/conn" | ||
"github.com/KenshiTech/unchained/transport/client/handler" | ||
"github.com/KenshiTech/unchained/transport/server" | ||
"github.com/KenshiTech/unchained/transport/server/gql" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var consumerCmd = &cobra.Command{ | ||
Use: "consumer", | ||
Short: "Run the Unchained client in consumer mode", | ||
Long: `Run the Unchained client in consumer mode`, | ||
|
||
PreRun: func(cmd *cobra.Command, args []string) { | ||
config.App.Network.BrokerURI = cmd.Flags().Lookup("broker").Value.String() | ||
config.App.Network.Bind = cmd.Flags().Lookup("graphql").Value.String() | ||
}, | ||
|
||
Run: func(cmd *cobra.Command, args []string) { | ||
log.Start(config.App.System.Log) | ||
log.Logger. | ||
With("Mode", "Consumer"). | ||
With("Version", constants.Version). | ||
With("Protocol", constants.ProtocolVersion). | ||
Info("Running Unchained") | ||
|
||
err := config.Load(configPath, secretsPath) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
bls.InitClientIdentity() | ||
|
||
ethRPC := ethereum.New() | ||
pos := pos.New(ethRPC) | ||
db.Start() | ||
|
||
correctnessService := correctnessService.New(ethRPC) | ||
evmLogService := evmlogService.New(ethRPC, pos) | ||
uniswapService := uniswapService.New(ethRPC, pos) | ||
|
||
conn.Start() | ||
|
||
handler := handler.NewConsumerHandler(correctnessService, uniswapService, evmLogService) | ||
client.NewRPC(handler) | ||
|
||
server.New( | ||
gql.WithGraphQL(), | ||
) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(consumerCmd) | ||
|
||
consumerCmd.Flags().StringP( | ||
"broker", | ||
"b", | ||
"wss://shinobi.brokers.kenshi.io", | ||
"Unchained broker to connect to", | ||
) | ||
|
||
consumerCmd.Flags().StringP( | ||
"graphql", | ||
"g", | ||
"127.0.0.1:8080", | ||
"The graphql server path to bind", | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.