Skip to content

Commit

Permalink
val server
Browse files Browse the repository at this point in the history
  • Loading branch information
manojkgorle committed Dec 17, 2024
1 parent cb1e4f9 commit 3dee388
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 6 deletions.
18 changes: 18 additions & 0 deletions cmd/seq-cli/cmd/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/AnomalyFi/hypersdk/chain"
hconsts "github.com/AnomalyFi/hypersdk/consts"
"github.com/AnomalyFi/hypersdk/crypto/bls"
hrpc "github.com/AnomalyFi/hypersdk/rpc"
hutils "github.com/AnomalyFi/hypersdk/utils"
"github.com/AnomalyFi/nodekit-seq/actions"
"github.com/AnomalyFi/nodekit-seq/auth"
Expand Down Expand Up @@ -199,3 +200,20 @@ var auctionCmd = &cobra.Command{
return err
},
}

var updateArcadiaURL = &cobra.Command{
Use: "updateArcadiaURL",
RunE: func(*cobra.Command, []string) error {
// ctx := context.Background()
str, err := handler.Root().PromptString("val rpc url", 1, 100)
if err != nil {
return err
}
valCLI := hrpc.NewJSONRPCValClient(str)
str, err = handler.Root().PromptString("new arcadia url", 1, 150)
if err != nil {
return err
}
return valCLI.UpdateArcadiaURL(str)
},
}
1 change: 1 addition & 0 deletions cmd/seq-cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ func init() {
sequencerMsgCmd,
rollupCmd,
auctionCmd,
updateArcadiaURL,
)

// spam
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/AnomalyFi/nodekit-seq
go 1.21.12

require (
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.8
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.9
github.com/ava-labs/avalanche-network-runner v1.7.4-rc.0
github.com/ava-labs/avalanchego v1.11.10
github.com/ethereum/go-ethereum v1.13.14
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ github.com/AnomalyFi/hypersdk v0.9.7-arcadia.7 h1:SjoKEjhJ1lWLqwyv/SaiHQnFQooPv8
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.7/go.mod h1:0Vj2PdwSFN7pat4Sno39IfmtOiv/gO9mxZXyRKnoKtI=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.8 h1:/ZfefOH39125oxY6kZ6+LzrLG4mfLqsFtC+QLaP39gs=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.8/go.mod h1:0Vj2PdwSFN7pat4Sno39IfmtOiv/gO9mxZXyRKnoKtI=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.9 h1:r++xui2FjCI5k7nmaijLhstOCRq3XEE+lGkvpeeOEOo=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.9/go.mod h1:0Vj2PdwSFN7pat4Sno39IfmtOiv/gO9mxZXyRKnoKtI=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
Expand Down
23 changes: 18 additions & 5 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"encoding/hex"
"flag"
"fmt"
"net"
"net/url"
"os"
"testing"
"time"
Expand All @@ -30,7 +32,6 @@ import (
"github.com/AnomalyFi/hypersdk/crypto/ed25519"
"github.com/AnomalyFi/hypersdk/pubsub"
"github.com/AnomalyFi/hypersdk/rpc"
"github.com/AnomalyFi/hypersdk/utils"
"github.com/AnomalyFi/nodekit-seq/actions"
"github.com/AnomalyFi/nodekit-seq/auth"
"github.com/AnomalyFi/nodekit-seq/consts"
Expand Down Expand Up @@ -346,14 +347,21 @@ var _ = ginkgo.BeforeSuite(func() {
}
}
require.NoError(err)

// valuri := strings.Split(info.Uri, ":")
purl, err := url.Parse(info.Uri)
require.NoError(err)
host, _, err := net.SplitHostPort(purl.Host)
require.NoError(err)
valUri := "http://" + host + hutils.GetPortFromNodeID(nodeID)
hutils.Outf("port url: %s", valUri)
instances = append(instances, instance{
nodeID: nodeID,
uri: u,
cli: cli,
tcli: trpc.NewJSONRPCClient(u, networkID, bid),
wsCli: wsCli,
multicli: trpc.NewMultiJSONRPCClientWithED25519Factory(u, networkID, bid, privBytes),
valCli: rpc.NewJSONRPCValClient(valUri),
})
}

Expand Down Expand Up @@ -381,6 +389,7 @@ type instance struct {
tcli *trpc.JSONRPCClient
wsCli *rpc.WebSocketClient
multicli *trpc.MultiJSONRPCClient
valCli *rpc.JSONRPCValClient
}

var _ = ginkgo.AfterSuite(func() {
Expand Down Expand Up @@ -431,11 +440,15 @@ var _ = ginkgo.Describe("[Network]", func() {
})

var _ = ginkgo.Describe("[Derive Port]", func() {
// require := require.New(ginkgo.GinkgoT())
require := require.New(ginkgo.GinkgoT())

ginkgo.It("can derive port", func() {
ginkgo.It("can derive port and ping", func() {
for _, inst := range instances {
hutils.Outf("{{green}}port number for:{{/}} %s, nodeID: %s\n", utils.GetPortFromNodeID(inst.nodeID), inst.nodeID)
hutils.Outf("{{green}}port number for:{{/}} %s, nodeID: %s\n", hutils.GetPortFromNodeID(inst.nodeID), inst.nodeID)

success, err := inst.valCli.Ping()
require.True(success)
require.NoError(err)
}
})
})
Expand Down

0 comments on commit 3dee388

Please sign in to comment.