diff --git a/main.go b/main.go index 5191469f0..423205e66 100644 --- a/main.go +++ b/main.go @@ -64,8 +64,6 @@ func main() { altsrc.NewStringFlag(&cli.StringFlag{ Name: PK, Usage: "Specifies the private key for the client.", - Value: "2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d", - DefaultText: "Alice's private key", Category: "Keys:", Destination: &pkString, }), @@ -80,8 +78,6 @@ func main() { altsrc.NewStringFlag(&cli.StringFlag{ Name: CHAIN_PK, Usage: "Specifies the private key to use when interacting with the chain.", - Value: "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80", - DefaultText: "A hardhat / annvil default funded account", Category: "Keys:", Destination: &chainPk, }), @@ -121,21 +117,29 @@ func main() { Flags: flags, Before: altsrc.InitInputSourceWithContext(flags, altsrc.NewTomlSourceFromFlagFunc(CONFIG)), Action: func(cCtx *cli.Context) error { + if pkString == "" { + panic("pk must be set") + } + if chainPk == "" { + panic("chainpk must be set") + } pk := common.Hex2Bytes(pkString) me := crypto.GetAddressFromSecretKeyBytes(pk) logDestination := os.Stdout var ourStore store.Store - fmt.Println("Initialising store...") + if useDurableStore { + fmt.Println("Initialising durable store...") dataFolder := fmt.Sprintf("./data/nitro-service/%s", me.String()) ourStore = store.NewDurableStore(pk, dataFolder, buntdb.Config{}) } else { + fmt.Println("Initialising mem store...") ourStore = store.NewMemStore(pk) } - fmt.Println("Connecting to chain...") + fmt.Println("Connecting to chain " + chainUrl + " with chain id " + fmt.Sprint(chainId) + "...") ethClient, txSubmitter, err := chainutils.ConnectToChain(context.Background(), chainUrl, chainId, common.Hex2Bytes(chainPk)) if err != nil { panic(err) @@ -151,7 +155,7 @@ func main() { panic(err) } - fmt.Println("Initializing message service...") + fmt.Println("Initializing message service on port " + fmt.Sprint(msgPort) + "...") messageservice := p2pms.NewMessageService("127.0.0.1", msgPort, *ourStore.GetAddress(), pk, logDestination) node := client.New( messageservice, @@ -164,8 +168,10 @@ func main() { var transport transport.Responder if useNats { + fmt.Println("Initializing NATS RPC transport...") transport, err = nats.NewNatsTransportAsServer(rpcPort) } else { + fmt.Println("Initializing websocketNATS RPC transport...") transport, err = ws.NewWebSocketTransportAsServer(fmt.Sprint(rpcPort)) } if err != nil { diff --git a/scripts/start-rpc-servers.go b/scripts/start-rpc-servers.go index cd8ab3cc8..09c46b2b2 100644 --- a/scripts/start-rpc-servers.go +++ b/scripts/start-rpc-servers.go @@ -38,7 +38,7 @@ const ( gray color = "[90m" ) -const FUNDED_TEST_PK = "59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d" +const FUNDED_TEST_PK = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" func main() { running := []*exec.Cmd{} @@ -131,7 +131,7 @@ func setupRPCServer(p participant, c color, na types.Address) (*exec.Cmd, error) cmd := exec.Command("go", args...) cmd.Stdout = newColorWriter(c, os.Stdout) - cmd.Stderr = os.Stderr + cmd.Stderr = newColorWriter(c, os.Stderr) err := cmd.Start() if err != nil { return nil, err diff --git a/scripts/test-configs/alice.toml b/scripts/test-configs/alice.toml index dd1565686..6893f422c 100644 --- a/scripts/test-configs/alice.toml +++ b/scripts/test-configs/alice.toml @@ -5,4 +5,5 @@ usedurablestore = true msgport = 3005 rpcport = 4005 -pk = "2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d" \ No newline at end of file +pk = "2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d" +chainpk = "59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d" \ No newline at end of file diff --git a/scripts/test-configs/bob.toml b/scripts/test-configs/bob.toml index 3809a9878..f44bd98e5 100644 --- a/scripts/test-configs/bob.toml +++ b/scripts/test-configs/bob.toml @@ -5,4 +5,5 @@ usedurablestore = true msgport = 3007 rpcport = 4007 -pk = "0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4" \ No newline at end of file +pk = "0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4" +chainpk = "5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a" \ No newline at end of file diff --git a/scripts/test-configs/irene.toml b/scripts/test-configs/irene.toml index 602a4e69e..99d393259 100644 --- a/scripts/test-configs/irene.toml +++ b/scripts/test-configs/irene.toml @@ -5,4 +5,5 @@ usedurablestore = true msgport = 3006 rpcport = 4006 -pk = "febb3b74b0b52d0976f6571d555f4ac8b91c308dfa25c7b58d1e6a7c3f50c781" \ No newline at end of file +pk = "febb3b74b0b52d0976f6571d555f4ac8b91c308dfa25c7b58d1e6a7c3f50c781" +chainpk = "7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6" \ No newline at end of file