Skip to content
Merged
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
14 changes: 8 additions & 6 deletions block/internal/syncing/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ func (s *Syncer) processHeightEvent(event *common.DAHeightEvent) {
}

// only save to p2p stores if the event came from DA
if event.Source == common.SourceDA {
if event.Source == common.SourceDA { // TODO(@julienrbrt): To be reverted once DA Hints are merged (https://github.com/evstack/ev-node/pull/2891)
Copy link
Member Author

Choose a reason for hiding this comment

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

turns out the todo is on the wrong condition, but we'll get it :D (should have been L594)

g, ctx := errgroup.WithContext(s.ctx)
g.Go(func() error {
// broadcast header locally only — prevents spamming the p2p network with old height notifications,
Expand Down Expand Up @@ -591,11 +591,13 @@ func (s *Syncer) trySyncNextBlock(event *common.DAHeightEvent) error {
}

// Verify forced inclusion transactions if configured
if err := s.verifyForcedInclusionTxs(currentState, data); err != nil {
s.logger.Error().Err(err).Uint64("height", nextHeight).Msg("forced inclusion verification failed")
if errors.Is(err, errMaliciousProposer) {
s.cache.RemoveHeaderDAIncluded(headerHash)
return err
if event.Source == common.SourceDA {
if err := s.verifyForcedInclusionTxs(currentState, data); err != nil {
s.logger.Error().Err(err).Uint64("height", nextHeight).Msg("forced inclusion verification failed")
if errors.Is(err, errMaliciousProposer) {
s.cache.RemoveHeaderDAIncluded(headerHash)
return err
}
}
Comment on lines +595 to 601
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The current error handling for verifyForcedInclusionTxs only returns an error if it's errMaliciousProposer. Other errors, such as a transient failure to retrieve data from the DA layer, are logged but then ignored. This allows block processing to continue without proper verification, which could be problematic.

Any error from verifyForcedInclusionTxs should cause trySyncNextBlock to fail. This will allow the caller (processHeightEvent) to handle the error appropriately, such as rescheduling the event for a retry, which is the default behavior for non-critical errors. This makes the syncer more robust against transient issues.

I suggest simplifying the error handling to always return the error, which is also more consistent with how errors from validateBlock are handled just above.

		if err := s.verifyForcedInclusionTxs(currentState, data); err != nil {
			s.logger.Error().Err(err).Uint64("height", nextHeight).Msg("forced inclusion verification failed")
			s.cache.RemoveHeaderDAIncluded(headerHash)
			return err
		}

}

Expand Down
Loading