Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
poszu committed Oct 31, 2023
1 parent ac35bfe commit dbb1d76
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion registration/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Config struct {
}

type CertifierConfig struct {
URL string `long:"certifier-url" description:"The URL of the certifier service"`
URL string `long:"certifier-url" description:"The URL of the certifier service"`
PubKey []byte `long:"certifier-pubkey" description:"The public key of the certifier service"`
}

Expand Down
20 changes: 18 additions & 2 deletions registration/registration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ func TestSubmitIdempotence(t *testing.T) {
eg.Go(func() error { return r.Run(ctx) })

// Submit challenge
epoch, _, err := r.Submit(context.Background(), challenge, nodeID, nonce, registration.PowParams{}, nil, time.Time{})
epoch, _, err := r.Submit(
context.Background(),
challenge,
nodeID,
nonce,
registration.PowParams{},
nil,
time.Time{},
)
req.NoError(err)
req.Equal(uint(0), epoch)

Expand Down Expand Up @@ -319,7 +327,15 @@ func Test_CheckCertificate(t *testing.T) {

// passed certificate - still fallback to PoW
powVerifier.EXPECT().Verify(challenge, nodeID, uint64(7)).Return(nil)
_, _, err = r.Submit(context.Background(), challenge, nodeID, 7, registration.PowParams{}, []byte{1, 2, 3, 4}, time.Time{})
_, _, err = r.Submit(
context.Background(),
challenge,
nodeID,
7,
registration.PowParams{},
[]byte{1, 2, 3, 4},
time.Time{},
)
require.NoError(t, err)
})
t.Run("certification check enabled", func(t *testing.T) {
Expand Down
10 changes: 9 additions & 1 deletion rpc/rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ func (r *rpcServer) Submit(ctx context.Context, in *api.SubmitRequest) (*api.Sub
deadline = in.Deadline.AsTime()
}

epoch, end, err := r.registration.Submit(ctx, in.Challenge, in.Pubkey, in.Nonce, powParams, in.Certificate.GetSignature(), deadline)
epoch, end, err := r.registration.Submit(
ctx,
in.Challenge,
in.Pubkey,
in.Nonce,
powParams,
in.Certificate.GetSignature(),
deadline,
)
switch {
// FIXME: remove deprecated PoW
case errors.Is(err, registration.ErrInvalidPow) || errors.Is(err, registration.ErrInvalidPowParams):
Expand Down

0 comments on commit dbb1d76

Please sign in to comment.