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

chore: remove once_cell and lazy_static #1998

Merged
merged 2 commits into from
Jan 31, 2025
Merged

chore: remove once_cell and lazy_static #1998

merged 2 commits into from
Jan 31, 2025

Conversation

carneiro-cw
Copy link
Contributor

@carneiro-cw carneiro-cw commented Jan 31, 2025

User description

closes #1996


PR Type

Enhancement


Description

  • Replace once_cell with std::sync::LazyLock

  • Remove lazy_static dependency

  • Update static variable initializations

  • Adjust import statements and function calls


Changes walkthrough 📝

Relevant files
Enhancement
rpc_server.rs
Replace once_cell::sync::Lazy with std::sync::LazyLock     

src/eth/rpc/rpc_server.rs

  • Import std::sync::LazyLock
  • Replace Lazy with LazyLock for MODE_CHANGE_SEMAPHORE
  • Remove once_cell import
  • +2/-2     
    globals.rs
    Replace once_cell::sync::Lazy with std::sync::LazyLock in globals

    src/globals.rs

  • Import std::sync::LazyLock
  • Replace all Lazy instances with LazyLock
  • Update Lazy::force to LazyLock::force
  • Remove once_cell import
  • +5/-5     
    Dependencies
    Cargo.toml
    Remove lazy_static and once_cell dependencies                       

    Cargo.toml

    • Remove lazy_static dependency
    • Remove once_cell dependency
    +0/-2     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis ✅

    1996 - Fully compliant

    Compliant requirements:

    • Replace once_cell with stdlib implementations
    • Remove once_cell dependency
    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No major issues detected

    Copy link

    PR Code Suggestions ✨

    No code suggestions found for the PR.

    @carneiro-cw carneiro-cw enabled auto-merge (squash) January 31, 2025 20:27
    @carneiro-cw carneiro-cw merged commit e577d1f into main Jan 31, 2025
    38 checks passed
    @carneiro-cw carneiro-cw deleted the remove_lazy_libs branch January 31, 2025 20:43
    @gabriel-aranha-cw
    Copy link
    Contributor

    Final benchmark:
    Run ID: bench-1877920174

    Git Info:

    Configuration:

    • Target Account Strategy: Default

    RPS Stats: Max: 1883.00, Min: 1218.00, Avg: 1679.35, StdDev: 77.88
    TPS Stats: Max: 1886.00, Min: 1517.00, Avg: 1629.87, StdDev: 88.33

    Plot: View Plot

    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.

    Replace once_cell in favor of std::cell::LazyCell and std::cell::LazyLock
    3 participants