Skip to content
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

[encodingstreamer] Consider blobs pending confirmation #169

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

ian-shim
Copy link
Contributor

@ian-shim ian-shim commented Jan 9, 2024

Why are these changes needed?

Now that onchain confirmation is handled asynchronously, few things need to change in encoding streamer.
At encoding time, it should not encode blobs that are already pending confirmation.
At batch creation time, it shouldn't delete blobs pending confirmation even if they're stale.
At batcher, 1) blobs should be marked as pending confirmation once it's dispersed to DA nodes, and 2) removed from encoded blob store when batching finishes even when they fail

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@ian-shim ian-shim marked this pull request as ready for review January 9, 2024 06:23
Comment on lines +154 to 159
} else if encodedResult.ReferenceBlockNumber < blockNumber {
// this is safe: https://go.dev/doc/effective_go#for
delete(e.encoded, k)
staleCount++
e.encodedResultSize -= getChunksSize(encodedResult)
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious about whether this case could actually happen?

Possibilities:

  1. I guess since confirmation is happening in another thread, and we don't have locks (e.g. batcher.go, L288), it could be possible that the blob is marked as confirmed in the confirmation thread but not yet removed from the store. But not sure we need to handle that case here.
  2. A blob was encoded but somehow the confirmation transaction never took place. I guess this could probaby happen somehow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think encodedResult.ReferenceBlockNumber > blockNumber would be ever true, and it would be a bug in that case?

  1. Although there is no lock in batcher.go:288, it calls DeleteEncodingResult which would lock the encoded blob store. In that case though, encodedResult.Status would be PendingConfirmation, right?
  2. Depends on how the confirmation transaction ended up not taking place. If it failed somehow, handleFailure would remove the blob from encoded blob store so that it can be re-encoded & retried.

Copy link
Contributor

@mooselumph mooselumph left a comment

Choose a reason for hiding this comment

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

Looks good!

@ian-shim ian-shim merged commit fcffad6 into Layr-Labs:master Jan 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants