Skip to content

Conversation

yiweichi
Copy link
Member

@yiweichi yiweichi commented Jun 11, 2025

Purpose or design rationale of this PR

Added two small fixes:

  1. fixed orm function InsertOrUpdateBlobUpload.
  2. fixed to get aws s3 bucket region from host mechine.

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

  • Improvements

    • Increased the frequency of blob uploads to S3 for faster processing.
    • Improved AWS region handling to only apply region settings when explicitly specified.
    • Enhanced database update logic to ensure updates only affect active, non-deleted blob upload records.
  • Other

    • Updated version to v4.5.30.

@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

This update includes a version bump, a change to S3 uploader region configuration to only set the region if specified, a reduction in the blob uploader's upload interval from 2 seconds to 1 second, and a stricter update condition in the InsertOrUpdateBlobUpload ORM method to avoid updating soft-deleted records.

Changes

File(s) Change Summary
common/version/version.go Updated version string from "v4.5.29" to "v4.5.30".
rollup/internal/controller/blob_uploader/s3_sender.go Region is now conditionally appended to AWS SDK options only if specified in config.
rollup/cmd/blob_uploader/app/app.go Reduced blob upload interval from 2 seconds to 1 second.
rollup/internal/orm/blob_upload.go InsertOrUpdateBlobUpload now adds explicit Where clause to avoid updating soft-deleted records.

Sequence Diagram(s)

sequenceDiagram
    participant Scheduler as BlobUploader Scheduler
    participant Uploader as S3Uploader
    participant ORM as BlobUpload ORM

    Scheduler->>Uploader: Every 1 second, call UploadBlobToS3
    Uploader->>ORM: InsertOrUpdateBlobUpload(batch_index, batch_hash, platform)
    ORM->>ORM: Update record WHERE batch_index, batch_hash, platform, deleted_at IS NULL
    ORM-->>Uploader: Success/Failure
    Uploader-->>Scheduler: Upload result
Loading

Possibly related PRs

Suggested reviewers

  • georgehao
  • colinlyguo

Poem

In the land of code where blobs take flight,
The uploader now works twice as bright.
With careful checks, no ghosts slip by,
S3’s region set only when nigh.
Version bumped, all systems go—
A hoppy update, onward we flow!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 88f9244 and d73f57c.

📒 Files selected for processing (1)
  • common/version/version.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • common/version/version.go
✨ 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 6 lines in your changes missing coverage. Please review.

Project coverage is 40.15%. Comparing base (b7a172a) to head (fad502d).
Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
...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    39.86%   40.15%   +0.29%     
===========================================
  Files          236      232       -4     
  Lines        18808    18243     -565     
===========================================
- Hits          7498     7326     -172     
+ Misses       10575    10210     -365     
+ Partials       735      707      -28     
Flag Coverage Δ
rollup 46.31% <0.00%> (-0.02%) ⬇️

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.

@yiweichi yiweichi changed the title fix: blob uploader fix(blob-uploader): orm function InsertOrUpdateBlobUpload and s3 bucket region configuration Jul 7, 2025
@yiweichi yiweichi requested review from colinlyguo and georgehao July 7, 2025 16:10
@yiweichi yiweichi merged commit de17ad4 into develop Jul 16, 2025
1 check passed
@yiweichi yiweichi deleted the fix-blob-uploader branch July 16, 2025 10:36
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.

4 participants