Skip to content

fix: blob uploader #1679

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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open

fix: blob uploader #1679

wants to merge 7 commits into from

Conversation

yiweichi
Copy link
Member

@yiweichi yiweichi commented Jun 11, 2025

Purpose or design rationale of this PR

Describe your change. Make sure to answer these three questions: What does this PR do? Why does it do it? How does it do it?

PR title

Your PR title must follow conventional commits (as we are doing squash merge for each PR), so it must start with one of the following types:

  • build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
  • ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
  • docs: Documentation-only changes
  • feat: A new feature
  • fix: A bug fix
  • perf: A code change that improves performance
  • refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • test: Adding missing tests or correcting existing tests

Deployment tag versioning

Has tag in common/version.go been updated or have you added bump-version label to this PR?

  • No, this PR doesn't involve a new deployment, git tag, docker image tag
  • Yes

Breaking change label

Does this PR have the breaking-change label?

  • No, this PR is not a breaking change
  • Yes

Summary by CodeRabbit

  • Chores

    • Updated version number to v4.5.24.
  • Bug Fixes

    • Improved AWS region configuration for S3 uploads to only include the region when explicitly specified.
    • Adjusted codec version handling for batch uploads to support additional versions.
    • Enhanced update logic to prevent changes to soft-deleted blob upload records.
    • Increased frequency of blob upload attempts to S3 from every 2 seconds to every 1 second.

@yiweichi yiweichi added the bump-version Bump the version tag for deployment label Jun 11, 2025
Copy link

coderabbitai bot commented Jun 11, 2025

Walkthrough

The changes update the version string from "v4.5.23" to "v4.5.24", modify the S3 uploader to append the AWS region option only if explicitly set, temporarily disable a codec version consistency check in the blob uploader, reduce the blob upload interval from 2 seconds to 1 second, and add explicit filtering by batch index, batch hash, platform, and soft deletion status in the blob upload ORM update method. No public entity signatures are altered.

Changes

File(s) Change Summary
common/version/version.go Updated version string constant from "v4.5.23" to "v4.5.24".
rollup/internal/controller/blob_uploader/s3_sender.go Conditionally append AWS region option only if cfg.Region is non-empty in S3 uploader constructor.
rollup/internal/controller/blob_uploader/blob_uploader.go Commented out codec version consistency checks between batch and chunks in constructBlobCodec method; adjusted codec version handling for legacy cases.
rollup/cmd/blob_uploader/app/app.go Reduced periodic blob upload interval from 2 seconds to 1 second.
rollup/internal/orm/blob_upload.go Added explicit Where clause filtering by batch index, batch hash, platform, and deleted_at IS NULL in update query of InsertOrUpdateBlobUpload.

Possibly related PRs

Suggested reviewers

  • georgehao
  • colinlyguo

Poem

A version hops from three to four,
While S3 checks its region store.
Only when a region’s set,
Will options change—no need to fret!
The codec’s check takes a pause,
Uploads now race without a cause.
And DB updates get precise paws.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
rollup/internal/controller/blob_uploader/s3_sender.go (1)

21-23: region field appears unused – consider pruning

S3Uploader.region is set in NewS3Uploader but never referenced in this file. If it isn’t used elsewhere, drop the field to avoid dead state and keep the struct minimal.

-	region  string
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d6b5a8 and 2cd9217.

📒 Files selected for processing (2)
  • common/version/version.go (1 hunks)
  • rollup/internal/controller/blob_uploader/s3_sender.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: bridgehistoryapi-fetcher
  • GitHub Check: coordinator-api
  • GitHub Check: bridgehistoryapi-api
  • GitHub Check: coordinator-cron
  • GitHub Check: rollup-db-cli
  • GitHub Check: bridgehistoryapi-db-cli
  • GitHub Check: blob_uploader
  • GitHub Check: rollup_relayer
  • GitHub Check: gas_oracle
🔇 Additional comments (2)
rollup/internal/controller/blob_uploader/s3_sender.go (1)

39-41: Preventing empty-string region override is the right fix

Passing WithRegion("") silently wipes out the SDK’s normal region-resolution chain and causes runtime errors.
Conditionally appending only when cfg.Region is non-empty removes that foot-gun without altering behaviour when a region is explicitly configured. ✅

common/version/version.go (1)

8-8: Version bump acknowledged

Tag update to v4.5.24 is straightforward. Make sure accompanying release notes reflect the S3 uploader fix.

@codecov-commenter
Copy link

codecov-commenter commented Jun 11, 2025

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 40.15%. Comparing base (5d6b5a8) to head (7eb5212).

Files with missing lines Patch % Lines
...internal/controller/blob_uploader/blob_uploader.go 0.00% 8 Missing ⚠️
...lup/internal/controller/blob_uploader/s3_sender.go 0.00% 3 Missing ⚠️
rollup/internal/orm/blob_upload.go 0.00% 2 Missing ⚠️
rollup/cmd/blob_uploader/app/app.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1679      +/-   ##
===========================================
- Coverage    40.16%   40.15%   -0.02%     
===========================================
  Files          232      232              
  Lines        18448    18454       +6     
===========================================
  Hits          7410     7410              
- Misses       10315    10321       +6     
  Partials       723      723              
Flag Coverage Δ
rollup 46.24% <0.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
rollup/cmd/blob_uploader/app/app.go (1)

73-73: Hard-coded 1 s polling interval – consider making this configurable

Moving from 2 s to 1 s doubles DB queries and S3 PUT attempts.
If traffic patterns change, you’ll need a code change & redeploy just to tune throughput. Reading the interval from cfg.L2Config.BlobUploaderConfig (with a sensible default) would give you the same benefit while keeping ops knobs in config.

-	go utils.Loop(subCtx, 1*time.Second, blobUploader.UploadBlobToS3)
+	interval := cfg.L2Config.BlobUploaderConfig.Tick               // e.g. time.Duration field
+	go utils.Loop(subCtx, interval, blobUploader.UploadBlobToS3)

Also verify that UploadBlobToS3 is re-entrant or self-serialising; at a 1 s cadence it may be invoked again while a previous call is still in flight.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c68a4a0 and 7eb5212.

📒 Files selected for processing (3)
  • rollup/cmd/blob_uploader/app/app.go (1 hunks)
  • rollup/internal/controller/blob_uploader/blob_uploader.go (2 hunks)
  • rollup/internal/orm/blob_upload.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • rollup/internal/controller/blob_uploader/blob_uploader.go
🧰 Additional context used
🧬 Code Graph Analysis (1)
rollup/cmd/blob_uploader/app/app.go (1)
common/utils/utils.go (1)
  • Loop (48-59)
⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: bridgehistoryapi-fetcher
  • GitHub Check: coordinator-api
  • GitHub Check: blob_uploader
  • GitHub Check: bridgehistoryapi-db-cli
  • GitHub Check: bridgehistoryapi-api
  • GitHub Check: rollup_relayer
  • GitHub Check: rollup-db-cli
  • GitHub Check: gas_oracle
  • GitHub Check: coordinator-cron
  • GitHub Check: tests
  • GitHub Check: check
  • GitHub Check: tests
🔇 Additional comments (1)
rollup/internal/orm/blob_upload.go (1)

118-119: 👍 Scoped update looks correct

Adding the explicit Where (incl. deleted_at IS NULL) prevents updating soft-deleted rows and guards against accidental cross-platform collisions. Good improvement. Note that GORM already injects deleted_at IS NULL for soft-delete models, so the extra predicate is harmless but redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump-version Bump the version tag for deployment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants