-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[node] Add more info on error logs #187
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,7 +114,7 @@ func (f *operatorSocketsFilterer) WatchOperatorSocketUpdate(ctx context.Context, | |
} | ||
|
||
sink := make(chan *blsregcoord.ContractBLSRegistryCoordinatorWithIndicesOperatorSocketUpdate) | ||
operatorID := []core.OperatorID{operatorId} | ||
operatorID := [][32]byte{operatorId} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this intended given the goal of this pr? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah this is a consequence of making |
||
_, err = filterer.WatchOperatorSocketUpdate(&bind.WatchOpts{Context: ctx}, sink, operatorID) | ||
if err != nil { | ||
return nil, err | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ import ( | |
|
||
var ( | ||
ErrChunkLengthMismatch = errors.New("chunk length mismatch") | ||
ErrInvalidHeader = errors.New("invalid header") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not being used |
||
) | ||
|
||
// MockChunkValidator is a mock implementation of ChunkValidator | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ import ( | |
|
||
var ( | ||
ErrChunkLengthMismatch = errors.New("chunk length mismatch") | ||
ErrInvalidHeader = errors.New("invalid header") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not being used |
||
ErrBlobQuorumSkip = errors.New("blob skipped for a quorum before verification") | ||
) | ||
|
||
|
@@ -38,12 +37,12 @@ func NewChunkValidator(enc Encoder, asgn AssignmentCoordinator, cst ChainState, | |
|
||
func (v *chunkValidator) validateBlobQuorum(quorumHeader *BlobQuorumInfo, blob *BlobMessage, operatorState *OperatorState) ([]*Chunk, *Assignment, *EncodingParams, error) { | ||
if quorumHeader.AdversaryThreshold >= quorumHeader.QuorumThreshold { | ||
return nil, nil, nil, errors.New("invalid header: quorum threshold does not exceed adversary threshold") | ||
return nil, nil, nil, fmt.Errorf("invalid header: quorum threshold (%d) does not exceed adversary threshold (%d)", quorumHeader.QuorumThreshold, quorumHeader.AdversaryThreshold) | ||
} | ||
|
||
// Check if the operator is a member of the quorum | ||
if _, ok := operatorState.Operators[quorumHeader.QuorumID]; !ok { | ||
return nil, nil, nil, ErrBlobQuorumSkip | ||
return nil, nil, nil, fmt.Errorf("%w: operator %s is not a member of quorum %d", ErrBlobQuorumSkip, v.operatorID.Hex(), quorumHeader.QuorumID) | ||
} | ||
|
||
// Get the assignments for the quorum | ||
|
@@ -54,10 +53,10 @@ func (v *chunkValidator) validateBlobQuorum(quorumHeader *BlobQuorumInfo, blob * | |
|
||
// Validate the number of chunks | ||
if assignment.NumChunks == 0 { | ||
return nil, nil, nil, ErrBlobQuorumSkip | ||
return nil, nil, nil, fmt.Errorf("%w: operator %s has no chunks in quorum %d", ErrBlobQuorumSkip, v.operatorID.Hex(), quorumHeader.QuorumID) | ||
} | ||
if assignment.NumChunks != uint(len(blob.Bundles[quorumHeader.QuorumID])) { | ||
return nil, nil, nil, errors.New("number of chunks does not match assignment") | ||
return nil, nil, nil, fmt.Errorf("number of chunks (%d) does not match assignment (%d)", len(blob.Bundles[quorumHeader.QuorumID]), assignment.NumChunks) | ||
} | ||
|
||
// Validate the chunkLength against the quorum and adversary threshold parameters | ||
|
@@ -70,7 +69,7 @@ func (v *chunkValidator) validateBlobQuorum(quorumHeader *BlobQuorumInfo, blob * | |
chunks := blob.Bundles[quorumHeader.QuorumID] | ||
for _, chunk := range chunks { | ||
if uint(chunk.Length()) != quorumHeader.ChunkLength { | ||
return nil, nil, nil, ErrChunkLengthMismatch | ||
return nil, nil, nil, fmt.Errorf("%w: chunk length (%d) does not match quorum header (%d)", ErrChunkLengthMismatch, chunk.Length(), quorumHeader.ChunkLength) | ||
} | ||
} | ||
|
||
|
@@ -81,15 +80,15 @@ func (v *chunkValidator) validateBlobQuorum(quorumHeader *BlobQuorumInfo, blob * | |
} | ||
|
||
if params.ChunkLength != quorumHeader.ChunkLength { | ||
return nil, nil, nil, errors.New("invalid chunk length") | ||
return nil, nil, nil, fmt.Errorf("%w: chunk length from encoding parameters (%d) does not match quorum header (%d)", ErrChunkLengthMismatch, params.ChunkLength, quorumHeader.ChunkLength) | ||
} | ||
|
||
return chunks, &assignment, ¶ms, nil | ||
} | ||
|
||
func (v *chunkValidator) ValidateBlob(blob *BlobMessage, operatorState *OperatorState) error { | ||
if len(blob.Bundles) != len(blob.BlobHeader.QuorumInfos) { | ||
return errors.New("number of bundles does not match number of quorums") | ||
return fmt.Errorf("number of bundles (%d) does not match number of quorums (%d)", len(blob.Bundles), len(blob.BlobHeader.QuorumInfos)) | ||
} | ||
|
||
// Validate the blob length | ||
|
@@ -127,7 +126,7 @@ func (v *chunkValidator) ValidateBatch(blobs []*BlobMessage, operatorState *Oper | |
|
||
for k, blob := range blobs { | ||
if len(blob.Bundles) != len(blob.BlobHeader.QuorumInfos) { | ||
return errors.New("number of bundles does not match number of quorums") | ||
return fmt.Errorf("number of bundles (%d) does not match number of quorums (%d)", len(blob.Bundles), len(blob.BlobHeader.QuorumInfos)) | ||
} | ||
|
||
// Saved for the blob length validation | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type aliases are convenient, but I think strict types are safer in general (and allow receiver functions)