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

[7/N] Chunk encoding optimization: Node support for mixed encoding #654

Merged
merged 6 commits into from
Aug 5, 2024

Conversation

jianoaix
Copy link
Contributor

@jianoaix jianoaix commented Jul 22, 2024

Why are these changes needed?

To make the Node able to serve both Gob and Gnark chunks, and return only Gob chunks during migration -- guarded by a flag.

This also added more test coverage for the mixed encoding which can be the case during migration.

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 :(

@jianoaix jianoaix requested a review from bxue-l2 July 22, 2024 23:50
@@ -307,6 +307,26 @@ func (s *Server) RetrieveChunks(ctx context.Context, in *pb.RetrieveChunksReques
s.node.Metrics.RecordRPCRequest("RetrieveChunks", "failure", time.Since(start))
return nil, fmt.Errorf("could not find chunks for batchHeaderHash %v, blob index: %v, quorumID: %v", batchHeaderHash, in.GetBlobIndex(), in.GetQuorumId())
}
if !s.config.EnableGnarkBundleEncoding && format == pb.ChunkEncoding_GNARK {
Copy link
Contributor

@bxue-l2 bxue-l2 Jul 26, 2024

Choose a reason for hiding this comment

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

there would be a case when gnark blob is enabled but, the client forgot to set the flag. why not make two interfaces altogether, and remove the flag?

If this happens, the system might be able to store data, but not be able to retrieve. It would be a safety violation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having a separate interface (from RetrieveChunks) will still have the issue of "old-new" communication: if a new client talks to an old server (which doesn't have the new API), it will fail.

QuorumId: 1,
})
assert.NoError(t, err)
assert.Equal(t, pb.ChunkEncoding_UNKNOWN, retrievalReply.Encoding)
Copy link
Contributor

Choose a reason for hiding this comment

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

nice, so you handled the case when bundle is empty when operator is not in that quorum. But you also return the unknown when blob cannot be retrieved, but since you return the error there,so it would fine I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be fine, empty bundle has no header to tell what's the encoding format anyway.

@@ -388,6 +498,7 @@ func TestRetrieveChunks(t *testing.T) {
QuorumId: 0,
})
assert.NoError(t, err)
assert.Equal(t, pb.ChunkEncoding_GOB, retrievalReply.Encoding)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is it gob, since the storeChunkfunction is true?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think in the node/store.go func DecodeChunks, you regard format 0 as ChunkEncoding_GOB. It is confusing since it is sometimes 0 sometimes 2.

Copy link
Contributor

Choose a reason for hiding this comment

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

but anyway, shouldn't the format be 1, since it is requested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default, EnableGnarkBundleEncoding flag is false, so the node will continue to return GOB, even though the underlying data stored in DB is in GNARK.

The ID for protobuf and the enum in golang are different for a reason, added the documentation: 7978389

Copy link
Contributor

@bxue-l2 bxue-l2 left a comment

Choose a reason for hiding this comment

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

lgtm

}
bundles[uint8(quorumID)] = bundleMsg
} else {
bundles[uint8(quorumID)] = make([]*encoding.Frame, 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

good catch. I think it is handling the case, when there is quorum which the operator does not belong to. But I thought you already catch it here, https://github.com/Layr-Labs/eigenda/blob/master/disperser/batcher/grpc/dispatcher.go#L376

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the question is if the grpc would return a nil, or empty array.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the operator is not in this quorum, then the bundle is an empty []byte (not nil), so len(bundle.GetBundle()) is 0

@jianoaix jianoaix merged commit 7f466d6 into Layr-Labs:master Aug 5, 2024
6 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