Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
81294f9d
Commit
81294f9d
authored
Jul 6, 2022
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Formatted output for dump rounds
parent
571502d8
No related branches found
No related tags found
2 merge requests
!510
Release
,
!261
Add dumprounds
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/dumpRounds.go
+60
-11
60 additions, 11 deletions
cmd/dumpRounds.go
cmix/rounds/round.go
+9
-1
9 additions, 1 deletion
cmix/rounds/round.go
with
69 additions
and
12 deletions
cmd/dumpRounds.go
+
60
−
11
View file @
81294f9d
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
package
cmd
package
cmd
import
(
import
(
"encoding/base64"
"fmt"
"fmt"
"strconv"
"strconv"
"time"
"time"
...
@@ -21,8 +22,8 @@ import (
...
@@ -21,8 +22,8 @@ import (
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id"
)
)
//
singleCmd is the single-use subcommand that allows for sending and responding
//
dumpRoundsCmd allows the user to view network information about a specific
//
to single-use messages
.
//
round on the network
.
var
dumpRoundsCmd
=
&
cobra
.
Command
{
var
dumpRoundsCmd
=
&
cobra
.
Command
{
Use
:
"dumprounds"
,
Use
:
"dumprounds"
,
Short
:
"Dump round information for specified rounds"
,
Short
:
"Dump round information for specified rounds"
,
...
@@ -32,13 +33,11 @@ var dumpRoundsCmd = &cobra.Command{
...
@@ -32,13 +33,11 @@ var dumpRoundsCmd = &cobra.Command{
cmixParams
,
e2eParams
:=
initParams
()
cmixParams
,
e2eParams
:=
initParams
()
client
:=
initE2e
(
cmixParams
,
e2eParams
)
client
:=
initE2e
(
cmixParams
,
e2eParams
)
err
:=
client
.
StartNetworkFollower
(
5
*
time
.
Second
)
err
:=
client
.
StartNetworkFollower
(
5
*
time
.
Second
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
// Wait until connected or crash on timeout
connected
:=
make
(
chan
bool
,
10
)
connected
:=
make
(
chan
bool
,
10
)
client
.
GetCmix
()
.
AddHealthCallback
(
client
.
GetCmix
()
.
AddHealthCallback
(
func
(
isconnected
bool
)
{
func
(
isconnected
bool
)
{
...
@@ -49,24 +48,74 @@ var dumpRoundsCmd = &cobra.Command{
...
@@ -49,24 +48,74 @@ var dumpRoundsCmd = &cobra.Command{
numRequests
:=
len
(
roundIDs
)
numRequests
:=
len
(
roundIDs
)
requestCh
:=
make
(
chan
bool
,
numRequests
)
requestCh
:=
make
(
chan
bool
,
numRequests
)
ecp
:=
client
.
GetStorage
()
.
GetNDF
()
.
Registration
.
EllipticPubKey
registration
:=
client
.
GetStorage
()
.
GetNDF
()
.
Registration
fmt
.
Printf
(
"p
ub
k
ey
: %s
\n\n
"
,
ecp
)
ecp
:=
registration
.
EllipticP
ub
K
ey
pubkey
,
err
:=
ec
.
LoadPublicKey
(
ecp
)
pubkey
,
err
:=
ec
.
LoadPublicKey
(
ecp
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
}
}
fmt
.
Printf
(
"registration pubkey: %s
\n\n
"
,
pubkey
.
MarshalText
())
fmt
.
Printf
(
"pubkey unserialized: %s
\n\n
"
,
pubkey
.
MarshalText
())
rcb
:=
func
(
round
rounds
.
Round
,
success
bool
)
{
rcb
:=
func
(
round
rounds
.
Round
,
success
bool
)
{
fmt
.
Printf
(
"Lookup for %v: %v
\n\n
"
,
round
.
ID
,
success
)
if
!
success
{
fmt
.
Printf
(
"Info: %v
\n\n
"
,
round
)
fmt
.
Printf
(
"round %v lookup failed"
,
round
.
ID
)
}
fmt
.
Printf
(
"Round %v:"
,
round
.
ID
)
fmt
.
Printf
(
"
\n\t
Batch size: %v, State: %v"
,
round
.
BatchSize
,
round
.
State
)
fmt
.
Printf
(
"
\n\t
UpdateID: %v, AddrSpaceSize: %v"
,
round
.
UpdateID
,
round
.
AddressSpaceSize
)
fmt
.
Printf
(
"
\n\t
Topology: "
)
for
i
,
nodeId
:=
range
round
.
Raw
.
Topology
{
nidStr
:=
base64
.
StdEncoding
.
EncodeToString
(
nodeId
)
fmt
.
Printf
(
"
\n\t\t
%d
\t
-
\t
%s"
,
i
,
nidStr
)
}
fmt
.
Printf
(
"
\n\t
Timestamps: "
)
for
state
,
ts
:=
range
round
.
Timestamps
{
fmt
.
Printf
(
"
\n\t\t
%v
\t
-
\t
%v"
,
state
,
ts
)
}
fmt
.
Printf
(
"
\n\t
Errors (%d): "
,
len
(
round
.
Raw
.
Errors
))
for
i
,
err
:=
range
round
.
Raw
.
Errors
{
fmt
.
Printf
(
"
\n\t\t
%d - %v"
,
i
,
err
)
}
fmt
.
Printf
(
"
\n\t
ClientErrors (%d): "
,
len
(
round
.
Raw
.
ClientErrors
))
for
_
,
ce
:=
range
round
.
Raw
.
ClientErrors
{
fmt
.
Printf
(
"
\n\t\t
%s - %v, Src: %v"
,
base64
.
StdEncoding
.
EncodeToString
(
ce
.
ClientId
),
ce
.
Error
,
base64
.
StdEncoding
.
EncodeToString
(
ce
.
Source
))
}
ri
:=
round
.
Raw
ri
:=
round
.
Raw
err
=
signature
.
VerifyEddsa
(
ri
,
pubkey
)
err
=
signature
.
VerifyEddsa
(
ri
,
pubkey
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"%+v"
,
err
)
fmt
.
Printf
(
"
\n\t
ECC signature failed: %v"
,
err
)
fmt
.
Printf
(
"
\n\t
use trace logging for sig details"
)
}
else
{
fmt
.
Printf
(
"
\n\t
ECC signature succeeded!
\n\n
"
)
}
}
// fmt.Printf("Round Info RAW: %v\n\n", round)
// rsapubkey, _ := rsa.LoadPublicKeyFromPem([]byte(
// registration.TlsCertificate))
// signature.VerifyRsa(ri, rsapubkey)
// if err != nil {
// fmt.Printf("RSA signature failed: %v", err)
// fmt.Printf("use trace logging for sig details")
// } else {
// fmt.Printf("RSA signature succeeded!")
// }
requestCh
<-
success
requestCh
<-
success
}
}
...
...
This diff is collapsed.
Click to expand it.
cmix/rounds/round.go
+
9
−
1
View file @
81294f9d
package
rounds
package
rounds
import
(
import
(
"fmt"
"time"
jww
"github.com/spf13/jwalterweatherman"
jww
"github.com/spf13/jwalterweatherman"
pb
"gitlab.com/elixxir/comms/mixmessages"
pb
"gitlab.com/elixxir/comms/mixmessages"
"gitlab.com/elixxir/primitives/states"
"gitlab.com/elixxir/primitives/states"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id"
"gitlab.com/xx_network/primitives/id"
"time"
)
)
type
Round
struct
{
type
Round
struct
{
...
@@ -127,3 +129,9 @@ func (r Round) GetEndTimestamp() time.Time {
...
@@ -127,3 +129,9 @@ func (r Round) GetEndTimestamp() time.Time {
// Unreachable
// Unreachable
return
time
.
Time
{}
return
time
.
Time
{}
}
}
// String prints a formatted version of the client error string
func
(
re
*
RoundError
)
String
()
string
{
return
fmt
.
Sprintf
(
"ClientError(ClientID: %s, Err: %s)"
,
re
.
NodeID
,
re
.
Error
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment