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

add configurable max blob size #675

Merged
merged 7 commits into from
Aug 1, 2024

Conversation

bxue-l2
Copy link
Contributor

@bxue-l2 bxue-l2 commented Jul 31, 2024

Why are these changes needed?

This PR makes max blob size a configurable parameters, validate if the blob is power of 2.

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

@bxue-l2 bxue-l2 requested review from jianoaix, dmanc and ian-shim July 31, 2024 01:07
return fmt.Errorf("configured max blob size is invalid %v", config.MaxBlobSize)
}

if int64(math.Log2(float64(config.MaxBlobSize))) == int64(math.Log2(float64(config.MaxBlobSize-1))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It's faster to use bit operation, config.MaxBlobSize > 0 && (config.MaxBlobSize&(config.MaxBlobSize-1)) == 0 should work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this only runs once. I think it is more readable this way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but your solution works

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 there are utility functions to check if a number is power of 2 (in encoding or common package). Reusing that has no impact on readabilty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that function is in "github.com/Layr-Labs/eigenda/encoding/fft". I don't want to add a new strange dependancy, what do you think

Copy link
Contributor

Choose a reason for hiding this comment

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

ideally we can pull it out to common/ and share across the codebase

@@ -114,6 +115,14 @@ func RunDisperserServer(ctx *cli.Context) error {
ratelimiter = ratelimit.NewRateLimiter(reg, globalParams, bucketStore, logger)
}

if config.MaxBlobSize < 0 || config.MaxBlobSize > 64*1024*1024 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it fail if config.MaxBlobSize == 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I will exclude 0

@@ -94,6 +94,13 @@ var (
EnvVar: common.PrefixEnvVar(envVarPrefix, "RATE_BUCKET_STORE_SIZE"),
Required: false,
}
MaxBlobSize = cli.IntFlag{
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks no issue if different disperser replicas are using different MaxBlobSize.
Should we add validation to the Node to check if the blob size is under a limit?

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 there is issue. But we want it, it has to be different deployment, which the current devops repo has yet offered that.

I don't think we need to artificially constraint on blob size on the DA node size now, as far as the disperser isn't decentralized, but yes, once we got to the step. We need to have some rate limit or blob constraint. For now, I think we are good.

Empirically, there is no impact on validation speed with respect to the blob size.

return fmt.Errorf("configured max blob size is invalid %v", config.MaxBlobSize)
}

if int64(math.Log2(float64(config.MaxBlobSize))) == int64(math.Log2(float64(config.MaxBlobSize-1))) {
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 there are utility functions to check if a number is power of 2 (in encoding or common package). Reusing that has no impact on readabilty.

@@ -114,6 +115,14 @@ func RunDisperserServer(ctx *cli.Context) error {
ratelimiter = ratelimit.NewRateLimiter(reg, globalParams, bucketStore, logger)
}

if config.MaxBlobSize <= 0 || config.MaxBlobSize > 64*1024*1024 {
Copy link
Contributor

Choose a reason for hiding this comment

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

So we want to support 64MiB?

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 is just a check, we might experiment with it

@bxue-l2 bxue-l2 merged commit 3949da2 into Layr-Labs:master Aug 1, 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