-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Node][5/N]Add main function for DA node (#53)
- Loading branch information
Showing
4 changed files
with
68 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/urfave/cli" | ||
|
||
"github.com/Layr-Labs/eigenda/common" | ||
"github.com/Layr-Labs/eigenda/node" | ||
"github.com/Layr-Labs/eigenda/node/flags" | ||
"github.com/Layr-Labs/eigenda/node/grpc" | ||
) | ||
|
||
var ( | ||
Version = "" | ||
GitCommit = "" | ||
GitDate = "" | ||
) | ||
|
||
func main() { | ||
app := cli.NewApp() | ||
app.Flags = flags.Flags | ||
app.Version = fmt.Sprintf("%s-%s-%s", Version, GitCommit, GitDate) | ||
app.Name = "da-node" | ||
app.Usage = "EigenDA Node" | ||
app.Description = "Service for receiving and storing encoded blobs from disperser" | ||
|
||
app.Action = NodeMain | ||
err := app.Run(os.Args) | ||
if err != nil { | ||
log.Fatalln("Application failed.", "Message:", err) | ||
} | ||
|
||
select {} | ||
} | ||
|
||
func NodeMain(ctx *cli.Context) error { | ||
log.Println("Initializing Node") | ||
config, err := node.NewConfig(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Create the node. | ||
var logger common.Logger | ||
node, err := node.NewNode(config, logger) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = node.Start(context.Background()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Creates the GRPC server. | ||
server := grpc.NewServer(config, node, logger) | ||
server.Start() | ||
|
||
return nil | ||
} |
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,4 +1,4 @@ | ||
package server | ||
package grpc | ||
|
||
import ( | ||
"context" | ||
|