mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
add extra logging
This commit is contained in:
parent
e23ad7869c
commit
8d904649bd
@ -5,6 +5,7 @@ import (
|
||||
|
||||
"github.com/iden3/go-iden3-crypto/poseidon"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/zap"
|
||||
"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
|
||||
)
|
||||
|
||||
@ -33,6 +34,8 @@ func (a *TokenApplication) handleDataAnnounceProverJoin(
|
||||
payload := []byte("join")
|
||||
|
||||
if t == nil || t.PublicKeySignatureEd448 == nil {
|
||||
a.Logger.Debug("invalid data for join")
|
||||
|
||||
return nil, errors.Wrap(ErrInvalidStateTransition, "handle join")
|
||||
}
|
||||
|
||||
@ -41,11 +44,20 @@ func (a *TokenApplication) handleDataAnnounceProverJoin(
|
||||
t.PublicKeySignatureEd448.PublicKey.KeyValue == nil ||
|
||||
t.Filter == nil || len(t.Filter) != 32 ||
|
||||
t.FrameNumber < currentFrameNumber-1 || t.FrameNumber > currentFrameNumber {
|
||||
a.Logger.Debug(
|
||||
"bad payload",
|
||||
zap.Uint64("given_frame_number", t.FrameNumber),
|
||||
zap.Uint64("current_frame_number", currentFrameNumber),
|
||||
zap.Int("filter_length", len(t.Filter)),
|
||||
)
|
||||
|
||||
return nil, errors.Wrap(ErrInvalidStateTransition, "handle join")
|
||||
}
|
||||
if _, touched := lockMap[string(
|
||||
t.PublicKeySignatureEd448.PublicKey.KeyValue,
|
||||
)]; touched {
|
||||
a.Logger.Debug("already attempted join")
|
||||
|
||||
return nil, errors.Wrap(ErrInvalidStateTransition, "handle join")
|
||||
}
|
||||
payload = binary.BigEndian.AppendUint64(payload, t.FrameNumber)
|
||||
@ -54,16 +66,19 @@ func (a *TokenApplication) handleDataAnnounceProverJoin(
|
||||
if err := t.PublicKeySignatureEd448.Verify(
|
||||
t.PublicKeySignatureEd448.PublicKey.KeyValue,
|
||||
); err != nil {
|
||||
a.Logger.Debug("can't verify signature")
|
||||
return nil, errors.Wrap(ErrInvalidStateTransition, "handle join")
|
||||
}
|
||||
|
||||
address, err := a.getAddressFromSignature(t.PublicKeySignatureEd448)
|
||||
if err != nil {
|
||||
a.Logger.Debug("can't get address from signature")
|
||||
return nil, errors.Wrap(err, "handle join")
|
||||
}
|
||||
|
||||
for _, t := range a.Tries {
|
||||
if t.Contains(address) {
|
||||
a.Logger.Debug("prover already in trie", zap.Binary("address", address))
|
||||
return nil, errors.Wrap(ErrInvalidStateTransition, "handle join")
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user