Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion block/internal/submitting/submitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (s *Submitter) processDAInclusionLoop() {
}

// setFinalWithRetry sets the final height in executor with retry logic.
// NOTE: the function retries the execution client call regardless of the error. Some execution clients errors are irrecoverable, and will eventually halt the node, as expected.
// NOTE: the function retries the execution client call regardless of the error. Some execution client errors are irrecoverable, and will eventually halt the node, as expected.
func (s *Submitter) setFinalWithRetry(nextHeight uint64) error {
for attempt := 1; attempt <= common.MaxRetriesBeforeHalt; attempt++ {
if err := s.exec.SetFinal(s.ctx, nextHeight); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion types/signed_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func (sh *SignedHeader) ValidateBasic() error {
return ErrSignatureVerificationFailed
}

// ValidateBasicWithData performs basic validator of a signed header, granted data for syncing node.
// ValidateBasicWithData performs basic validation of a signed header, given data for syncing node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this change improves the grammar, the comment could be more concise and align better with the comment for ValidateBasic. ValidateBasic is documented as being for an aggregator node. This function appears to be for a sync node. A more direct comment would be clearer.

Suggested change
// ValidateBasicWithData performs basic validation of a signed header, given data for syncing node.
// ValidateBasicWithData performs basic validation of a signed header for a sync node.

func (sh *SignedHeader) ValidateBasicWithData(data *Data) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This function ValidateBasicWithData shares a significant amount of code with ValidateBasic (lines 110-186). This duplication makes the code harder to maintain, as bug fixes or logic changes need to be applied in both places.

To improve maintainability, consider refactoring the common validation logic into a private helper function. The differences, like the signature provider (aggregatorSignatureProvider vs. syncNodeSignatureBytesProvider), could be handled by passing a function as an argument to the new helper.

if err := sh.Header.ValidateBasic(); err != nil {
return err
Expand Down
Loading