-
Notifications
You must be signed in to change notification settings - Fork 444
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
Publish Timeboost BlockMetadata to Sequencer Coordinator's redis #2735
base: add-timeboosted-broadcastfeedmessage
Are you sure you want to change the base?
Publish Timeboost BlockMetadata to Sequencer Coordinator's redis #2735
Conversation
…kmetadata-seqcoordinatorredis
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.
Looks pretty solid, just some comments about error handling.
blockMetadataStr, err := c.Client.Get(ctx, redisutil.BlockMetadataKeyFor(pos)).Result() | ||
if err != nil { | ||
log.Debug("SeqCoordinator couldn't read blockMetadata from redis", "err", err, "pos", pos) | ||
return nil | ||
} |
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.
This should distinguish missing data, which I think is legitimate since we might not have metadata, from another error from the redis client like missing data.
Something like:
if err != nil {
if errors.Is(err, redis.Nil) {
// Legitimate case of no metadata
return nil, nil
}
// Real error reading from Redis
return nil, fmt.Errorf("failed reading block metadata: %w", err)
}
Then in update() you can add error handling matching the existing error flow for messages:
metadata, err := c.blockMetadataAt(ctx, msgToRead)
if err != nil {
log.Warn("coordinator failed reading block metadata", "pos", msgToRead, "err", err)
msgReadErr = err // Use existing error flow
break
}
blockMetadataArr = append(blockMetadataArr, metadata)
msgToRead++
This will ultimately cause a retry
if (wantsLockoutErr != nil) || (msgReadErr != nil) {
return c.retryAfterRedisError()
}
} else if len(blockMetadataArr) > 0 { | ||
log.Warn("Size of blockMetadata array doesn't match the size of messages array", "lockMetadataArrSize", len(blockMetadataArr), "messagesSize", len(messages)) | ||
} |
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.
I think this should be an error return here. Even if there's no metadata, blockMetadataArr should be an array of nils the same size as messagesWithBlockInfo.
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.
Forgot to click request changes.
With this PR, the Timeboost information of transactions of a block represented as BlockMetadata (introduced in #2695) will be published to the Sequencer Coordinator redis cluster. Enabling sequencers that are part of this cluster to retrieve BlockMetadata corresponding to a block (when they attempt to sync up new messages from redis).
Resolves NIT-2839