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

feat: added max bytes size check when creating the batch #321

Merged
merged 13 commits into from
May 17, 2023

Conversation

mtsitrin
Copy link
Contributor

PR Standards

Opening a pull request should be able to meet the following requirements:


For Author:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

@mtsitrin mtsitrin marked this pull request as ready for review May 15, 2023 09:59
@mtsitrin mtsitrin requested a review from a team as a code owner May 15, 2023 09:59
@codecov
Copy link

codecov bot commented May 15, 2023

Codecov Report

Merging #321 (bd0eb36) into main (1f3cc05) will increase coverage by 0.38%.
The diff coverage is 91.42%.

@@            Coverage Diff             @@
##             main     #321      +/-   ##
==========================================
+ Coverage   52.22%   52.60%   +0.38%     
==========================================
  Files          70       70              
  Lines       12566    12627      +61     
==========================================
+ Hits         6563     6643      +80     
+ Misses       5073     5057      -16     
+ Partials      930      927       -3     
Impacted Files Coverage Δ
settlement/dymension/dymension.go 21.29% <0.00%> (-0.24%) ⬇️
block/manager.go 68.80% <96.55%> (+3.10%) ⬆️
config/config.go 91.17% <100.00%> (+0.55%) ⬆️
da/grpc/grpc.go 71.01% <100.00%> (ø)
testutil/mocks.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

block/manager.go Outdated Show resolved Hide resolved
bytes limit can be disable by setting 0 valiue
added UT
moved mocks to testutil package
@mtsitrin mtsitrin requested a review from omritoptix May 16, 2023 07:47
@mtsitrin
Copy link
Contributor Author

Fixed and added UT

block/manager.go Outdated
totalSize = totalSize + block.ToProto().Size() + commit.ToProto().Size()
if totalSize >= int(m.conf.BlockBatchSizeBytes) {
totalSize := batch.ToProto().Size()
if m.conf.BlockBatchSizeBytes > 0 && totalSize >= int(m.conf.BlockBatchSizeBytes) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest adding single validation (vs checking every time) to conf.BlockBatchSizeBytes > 0 as a preliminary stage for starting the rollapp. Look at line 121 for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, It's not the same.
If the flag not provided, it gets the default value by the Viper conf

If it's set explicitly to 0 - I thought it should mean no limit. U say it should enforce the default as in line 121.

Fine, changing it.

block/manager.go Show resolved Hide resolved
block/manager_test.go Outdated Show resolved Hide resolved
block/manager_test.go Outdated Show resolved Hide resolved
block/manager_test.go Outdated Show resolved Hide resolved
@mtsitrin mtsitrin requested a review from omritoptix May 17, 2023 08:23
Base automatically changed from mtsitrin/support_0.46.10 to main May 17, 2023 09:01
block/manager.go Outdated Show resolved Hide resolved
@mtsitrin mtsitrin linked an issue May 17, 2023 that may be closed by this pull request
@mtsitrin mtsitrin merged commit 8b006de into main May 17, 2023
@mtsitrin mtsitrin deleted the mtsitrin/262-support-max-batch-size-in-bytes branch May 17, 2023 10:24
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.

Support max batch size in bytes
2 participants