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

[4/N][zero serialization] Add fallback to the encoder client when it cannot tell chunk encoding format #738

Merged
merged 1 commit into from
Sep 1, 2024

Conversation

jianoaix
Copy link
Contributor

@jianoaix jianoaix commented Sep 1, 2024

Why are these changes needed?

We need the batcher to fallback to Gob chunk encoding, when chunks returned from Encoder do not have encoding format specified.

The reason is this case:

So the Encoder will produce Gob chunks, and when Batcher tries to find out the format, it'll get ChunkEncodingFormat_UNKNOWN. So this shouldn't be treated as an error; instead, it should be treated as Gob.

Compatibility/correctness reasoning

Let's denote the versions of Encoder as:

And versions of Bather as:

The reasoning and testing of the compatibility of 9 combinations:

  • E0-B0: current state
  • E0-B1: the Encoder returns Gob, and Batcher sees ChunkEncodingFormat_UNKNOWN, but correctly falls back to Gob
  • E0-B2: same as E0-B1, but additionally the Batcher will convert Gob to Gnark on the fly before sending to Node, at
    chunksData, err = chunksData.ToGnarkFormat()
  • E1-B0: the Encoder returns Gob and with the chunk_encoding_format set as GOB in the response; the Batcher doesn't care about chunk_encoding_format and just get the chunks and treat them as Gob, which is correct
  • E1-B1: similar to E1-B0, it's just the Batcher will pass the chunk_encoding_format to Dispatcher, which will send chunk to Node as it is
  • E1-B2: similar to E1-B1, it's just the Dispatcher will convert Gob to Gnark on the fly before sending to Node, at
    chunksData, err = chunksData.ToGnarkFormat()
  • E2-B0: N/A -- the Batcher will get new release(s) before the Encoder enable the ENCODER_ENABLE_GNARK_CHUNK_ENCODING as true
  • E2-B1: the Encoder will return chunks in Gnark, with chunk_encoding_format set to GNARK; and then Batcher will understand it's GNARK, but it'll convert them from GNARK to GOB on the fly before sending to Node, at
    chunksData, err = chunksData.ToGobFormat()
  • E2-B2: similar to E2-B1, but now the Batcher will just send the chunks as it is to Node

Testing

All of the above combinations tested in preprod.

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 September 1, 2024 04:52
@jianoaix jianoaix merged commit 081d690 into Layr-Labs:master Sep 1, 2024
7 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