Skip to content

fix coordiantor assign bug #1621

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

Merged
merged 9 commits into from
Mar 12, 2025
Merged

fix coordiantor assign bug #1621

merged 9 commits into from
Mar 12, 2025

Conversation

georgehao
Copy link
Member

@georgehao georgehao commented Mar 12, 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?

The bug:

when provers try it more concurrently, there is no time for the coordinator to recover the attempts.

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 the application version to v4.4.96.
  • New Features
    • Introduced new methods for hard-fork validation in task management, enhancing error handling and task processing capabilities.
    • Added new fields to manage different task types within the task context.
  • Bug Fixes
    • Clarified error message in the Login function to specify "fork" in case of prover hard fork name failure.
  • Style
    • Reorganized import statements across various files for improved clarity and consistency.

Copy link

coderabbitai bot commented Mar 12, 2025

Walkthrough

This pull request updates the software version tag and refactors hard-fork validation in prover tasks. The version tag in common/version/version.go is updated from "v4.4.95" to "v4.4.96". In the coordinator/internal/logic/provertask package, three prover task files (batch, bundle, and chunk) have been modified to replace inlined hard-fork name checks with a new hardForkSanityCheck method. This encapsulates the check logic, simplifies error handling, and renames variables for improved clarity.

Changes

File(s) Summary
common/version/version.go Updated the version tag from "v4.4.95" to "v4.4.96".
coordinator/.../provertask/{batch, bundle, chunk}_prover_task.go Added a new hardForkSanityCheck method in each file to validate hard-fork names within the Assign method; refactored inline checks and renamed error variables for clarity.
coordinator/.../provertask/prover_task.go Added fields to proverTaskContext and methods for hard-fork name retrieval and validation, enhancing task management capabilities.
Makefile Updated paths in goimports commands to use static paths prefixed by scroll-tech/.
coordinator/test/api_test.go Reordered import statements for clarity.
rollup/internal/config/config.go Reordered import statements for clarity.
rollup/internal/controller/{sender, watcher}/sender_test.go Reordered import statements for clarity.
rollup/internal/orm/orm_test.go Reordered import statements for clarity.
rollup/tests/bridge_test.go Reordered import statements for clarity.
tests/integration-test/integration_test.go Reordered import statements for clarity.

Possibly related PRs

Suggested reviewers

  • georgehao
  • Thegaram
  • 0xmountaintop

Poem

I'm just a little rabbit, hopping through the code,
Finding updates in versions along the winding road.
Hard forks now checked with a new helper so neat,
Refactored logic makes every task complete.
With each small change, my heart does a happy beat! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 golangci-lint (1.62.2)

level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package zstd: could not load export data: no export data for "github.com/scroll-tech/da-codec/encoding/zstd""
level=error msg="Running error: can't run linter goanalysis_metalinter\nbuildir: failed to load package zstd: could not load export data: no export data for "github.com/scroll-tech/da-codec/encoding/zstd""


📜 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 fa989ca and 8ecc1b3.

📒 Files selected for processing (1)
  • coordinator/internal/controller/api/auth.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • coordinator/internal/controller/api/auth.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: tests

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@georgehao georgehao added the bump-version Bump the version tag for deployment label Mar 12, 2025
@georgehao georgehao requested review from omerfirmak, yiweichi and colinlyguo and removed request for omerfirmak and yiweichi March 12, 2025 02:49
@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2025

Codecov Report

Attention: Patch coverage is 31.52174% with 63 lines in your changes missing coverage. Please review.

Project coverage is 41.40%. Comparing base (228cba4) to head (8ecc1b3).

Files with missing lines Patch % Lines
...ordinator/internal/logic/provertask/prover_task.go 25.45% 34 Missing and 7 partials ⚠️
...or/internal/logic/provertask/bundle_prover_task.go 10.00% 9 Missing ⚠️
...tor/internal/logic/provertask/batch_prover_task.go 53.84% 4 Missing and 2 partials ⚠️
...tor/internal/logic/provertask/chunk_prover_task.go 53.84% 4 Missing and 2 partials ⚠️
coordinator/internal/controller/api/auth.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1621      +/-   ##
===========================================
+ Coverage    41.32%   41.40%   +0.08%     
===========================================
  Files          222      222              
  Lines        18226    18236      +10     
===========================================
+ Hits          7531     7551      +20     
+ Misses        9963     9952      -11     
- Partials       732      733       +1     
Flag Coverage Δ
coordinator 34.55% <31.52%> (+0.50%) ⬆️
rollup 51.67% <ø> (ø)

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.

colinlyguo
colinlyguo previously approved these changes Mar 12, 2025
yiweichi
yiweichi previously approved these changes Mar 12, 2025
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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2ff333b and fa989ca.

📒 Files selected for processing (10)
  • Makefile (1 hunks)
  • coordinator/internal/logic/provertask/bundle_prover_task.go (3 hunks)
  • coordinator/internal/orm/orm_test.go (1 hunks)
  • coordinator/test/api_test.go (1 hunks)
  • rollup/internal/config/config.go (1 hunks)
  • rollup/internal/controller/sender/sender_test.go (1 hunks)
  • rollup/internal/controller/watcher/watcher_test.go (1 hunks)
  • rollup/internal/orm/orm_test.go (1 hunks)
  • rollup/tests/bridge_test.go (1 hunks)
  • tests/integration-test/integration_test.go (1 hunks)
✅ Files skipped from review due to trivial changes (8)
  • tests/integration-test/integration_test.go
  • coordinator/internal/orm/orm_test.go
  • rollup/internal/controller/watcher/watcher_test.go
  • coordinator/test/api_test.go
  • rollup/internal/config/config.go
  • rollup/internal/controller/sender/sender_test.go
  • rollup/internal/orm/orm_test.go
  • rollup/tests/bridge_test.go
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: tests
🔇 Additional comments (5)
coordinator/internal/logic/provertask/bundle_prover_task.go (5)

20-23: LGTM: Clean import organization

The imports have been properly organized, separating the scroll-tech common packages from external dependencies.


78-80: LGTM: Clean variable declaration

Proper variable declaration for hardForkName that will hold the return value from the hardForkSanityCheck function.


104-106: LGTM: Task context setup

Setting the task type and bundleTask before performing the hard fork sanity check is a logical flow.


168-173: LGTM: Consistent error handling with recovery

The error handling consistently uses the hardForkName from the sanity check result. This maintains atomicity by recovering attempts on failure.


107-112:

✅ Verification successful

Verify the error handling behavior for concurrent prover operations

The addition of hardForkSanityCheck appears to be part of a refactoring to centralize hard-fork name validation. However, the PR objectives mention fixing a bug related to concurrent prover operations not giving the coordinator enough time to recover. This error path may play a role in that fix by returning early with nil instead of an error.


🏁 Script executed:

#!/bin/bash
# Search for the hardForkSanityCheck implementation to understand its behavior
ast-grep --pattern 'func (bp *BundleProverTask) hardForkSanityCheck' -A 30

Length of output: 76


I'll try a broader search to locate the implementation of hardForkSanityCheck since the initial attempt returned no output. Please run the following script to search for any occurrence of "hardForkSanityCheck" within the codebase:

If this search still produces no output, please perform a manual verification of the presence and implementation of hardForkSanityCheck to ensure its behavior aligns with the intended error handling for concurrent prover operations.


🏁 Script executed:

#!/bin/bash
# Search for any occurrence of "hardForkSanityCheck" in the repository to locate its definition or references.
rg "hardForkSanityCheck" -A 30

Length of output: 13050


Review: Early Return on HardForkSanityCheck Failure is Consistent and Intentional

After reviewing the code, we found that:

  • The hardForkSanityCheck function (located in coordinator/internal/logic/provertask/prover_task.go) returns an error if the hard fork name extracted from the context isn’t present in the task context’s list.
  • In bundle_prover_task.go, the result of this check is handled by logging a debug message and returning nil, nil if an error occurs. This early return prevents further dispatching of the same failing task.
  • Similar handling is observed in chunk and batch prover tasks, confirming a consistent refactoring approach aimed at preventing concurrent prover operations from overloading or destabilizing the coordinator.

This approach appears intentional to allow the coordinator extra time to recover from transient issues, aligning with the PR objective to address the bug related to concurrent prover operations.

@georgehao georgehao merged commit 13c8605 into develop Mar 12, 2025
9 checks passed
@georgehao georgehao deleted the fix/coordinator_assign_task branch March 12, 2025 07:13
@coderabbitai coderabbitai bot mentioned this pull request Mar 12, 2025
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