Skip to content

chore: rust upgrade #4436

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 3 commits into from
Mar 25, 2025
Merged

chore: rust upgrade #4436

merged 3 commits into from
Mar 25, 2025

Conversation

nkysg
Copy link
Collaborator

@nkysg nkysg commented Mar 24, 2025

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Other information

Summary by CodeRabbit

  • New Features

    • Introduced optional configuration options ("print_gas_info" and "testing") across packages to enhance diagnostic logging and gas information display.
  • Chores

    • Upgraded the Rust toolchain to version 1.82.0.
  • Refactor

    • Streamlined logging and error-handling conditions for testing scenarios to ensure more consistent diagnostic outputs.
  • Style

    • Updated the representation of maximum values for various integer types to use modern constants (e.g., MAX instead of max_value()).
  • Documentation

    • Clarified comments regarding maximum values in several structs and methods for better readability.

@nkysg nkysg requested review from sanlee42 and jolestar as code owners March 24, 2025 04:33
Copy link

coderabbitai bot commented Mar 24, 2025

Walkthrough

This pull request introduces new feature flags in multiple Cargo.toml files, adding placeholders for "print_gas_info" and "testing". It updates conditional compilation attributes from configuration flags (e.g., #[cfg(testing)]) to explicit feature flags (e.g., #[cfg(feature = "testing")]) in several modules. In addition, it removes a logging statement used during testing, adds attributes to suppress dead code warnings in certain files, updates a panic hook type, and bumps the Rust toolchain version. The core logic and functionality remain unchanged.

Changes

Files/Groups Change Summary
executor/Cargo.toml, vm/types/Cargo.toml, vm/vm-runtime/Cargo.toml Added new feature "print_gas_info" (and "testing" in executor and starcoin-gas-meter Cargo.toml) in the [features] section.
executor/src/lib.rs, vm/starcoin-gas-meter/src/gas_meter.rs, vm/vm-runtime/src/starcoin_vm.rs Updated conditional compilation attributes from #[cfg(testing)] to #[cfg(feature = "testing")] for logging statements.
executor/src/block_executor.rs Removed testing-specific logging statement that logged transaction hash and gas usage.
miner/src/create_block_template/metrics.rs, network-p2p/src/metrics.rs, sync/src/parallel/executor.rs Added #[allow(dead_code)] attributes to suppress warnings regarding unused code.
node/src/crash_handler.rs Changed panic handling types from PanicInfo to PanicHookInfo in both function parameters and closure signatures.
rust-toolchain.toml Updated the Rust toolchain version from "1.78.0" to "1.82.0".
sync/src/store/tests.rs Removed import statement for std::u64, indicating it is no longer needed.
sync/tests/common_test_sync_libs.rs Added #[allow(dead_code)] annotation before the DagBlockInfo struct declaration.
txpool/src/pool.rs, txpool/src/tx_pool_service_impl.rs Updated maximum value references from max_value() to MAX for usize and u64 types.
rpc/api/src/state/mod.rs, rpc/api/src/types.rs, rpc/api/src/types/pubsub.rs Updated maximum value references from std::u64::MAX to u64::MAX.
vm/types/src/transaction/mod.rs, vm/types/src/transaction/tests.rs Updated comments and test cases to use MAX constants instead of max_value() for various types.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Executor
    participant Logger
    User->>Executor: Trigger transaction execution
    Executor->>Executor: Check if "testing" feature is enabled
    alt "testing" enabled
        Executor->>Logger: Log transaction details (gas usage, txn hash)
    else "testing" disabled
        Executor-->>Executor: Skip logging
    end
Loading

Suggested reviewers

  • welbon
  • sanlee42
  • jackzhhuang
  • simonjiao

Poem

I'm just a little rabbit on the run,
Hopping fast with every new feature spun.
"print_gas_info" and "testing" now in sight,
Logging rules refined, everything feels light.
With code leaps and bounds, we celebrate in delight! 🐰🎉

✨ Finishing Touches
  • 📝 Generate Docstrings

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

@nkysg nkysg requested review from welbon, simonjiao and jackzhhuang and removed request for jolestar March 24, 2025 04:33
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 (4)
miner/src/create_block_template/metrics.rs (1)

6-6: Suppressing Dead Code Warning in BlockBuilderMetrics
Adding #[allow(dead_code)] here is useful to suppress compiler warnings for potentially unused code in the BlockBuilderMetrics struct. Just ensure that this attribute remains temporary or is revisited when the code becomes active to avoid masking dead code issues.

network-p2p/src/metrics.rs (1)

7-7: Suppressing Dead Code Warning in Metrics Struct
The addition of #[allow(dead_code)] effectively suppresses warnings for the unused portions of the Metrics struct. It’s a pragmatic short-term measure; however, consider scheduling a review later to either integrate or remove dead code as the project evolves.

sync/src/parallel/executor.rs (1)

19-19: Suppress Dead Code Warning for ExecuteState Enum
The new #[allow(dead_code)] attribute for the ExecuteState enum helps avoid unnecessary warnings during compilation. Verify that this enum is indeed planned for future use, or consider cleaning it up if it remains unused to keep the codebase lean.

vm/vm-runtime/Cargo.toml (1)

49-49: New Feature Flag: print_gas_info
The addition of the print_gas_info feature flag is a good move towards modularizing optional functionality. Consider updating the corresponding documentation and tests to explain when and how this feature should be enabled, ensuring clarity for future maintenance.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 053d376 and 4e8330d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • executor/Cargo.toml (1 hunks)
  • executor/src/block_executor.rs (0 hunks)
  • executor/src/lib.rs (1 hunks)
  • miner/src/create_block_template/metrics.rs (1 hunks)
  • network-p2p/src/metrics.rs (1 hunks)
  • node/src/crash_handler.rs (1 hunks)
  • rust-toolchain.toml (1 hunks)
  • sync/src/parallel/executor.rs (1 hunks)
  • vm/starcoin-gas-meter/Cargo.toml (1 hunks)
  • vm/starcoin-gas-meter/src/gas_meter.rs (27 hunks)
  • vm/types/Cargo.toml (1 hunks)
  • vm/vm-runtime/Cargo.toml (1 hunks)
  • vm/vm-runtime/src/starcoin_vm.rs (3 hunks)
💤 Files with no reviewable changes (1)
  • executor/src/block_executor.rs
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: run benchmark
🔇 Additional comments (39)
rust-toolchain.toml (1)

5-5: Rust Toolchain Upgrade to 1.82.0
Updating the Rust toolchain channel to 1.82.0 should bring in the latest improvements and features. Please ensure that this upgrade has been thoroughly validated with your CI build and that all modules are compatible with the new toolchain release.

vm/types/Cargo.toml (1)

48-48: Addition of print_gas_info feature looks good

This new feature flag provides a clean way to conditionally compile gas information printing functionality, which is helpful for debugging and development. The empty array indicates it doesn't automatically enable any dependencies.

vm/starcoin-gas-meter/Cargo.toml (1)

12-14: Addition of features section with testing feature is appropriate

Adding a dedicated testing feature flag provides a standard way to conditionally compile test-only code. This follows modern Rust practices for organizing conditional compilation and aligns with similar changes in other packages within this PR.

executor/Cargo.toml (1)

40-41: Addition of print_gas_info and testing features is appropriate

Adding these feature flags provides a standard way to enable optional functionality, consistent with modern Rust practices. These features align with similar changes in other packages (vm/types, starcoin-gas-meter) and are part of a broader effort to standardize conditional compilation across the project.

executor/src/lib.rs (1)

4-4: Update to standard feature flag syntax is appropriate

Changing from #[cfg(testing)] to #[cfg(feature = "testing")] follows modern Rust conventions for feature flags. This approach properly ties conditional compilation to the feature declared in Cargo.toml, making the codebase more maintainable and aligned with Rust ecosystem standards.

vm/vm-runtime/src/starcoin_vm.rs (3)

951-952: Conditional compilation attribute updated to use feature flag.

The change from #[cfg(testing)] to #[cfg(feature = "testing")] switches from using a configuration flag to using an explicit feature flag, which provides better control over enabling the logging functionality during testing.


1010-1011: Conditional compilation attribute updated to use feature flag.

This change ensures consistent usage of the testing feature flag across the codebase, matching the pattern on line 951.


1576-1581: Conditional compilation attribute updated to use feature flag.

Similar to the previous changes, this updates the conditional compilation attribute for the debugging information logged during charge_global_write_gas_usage. This change aligns with the Rust feature flagging system.

node/src/crash_handler.rs (3)

7-7: Updated panic info type import.

The import has been updated from PanicInfo to PanicHookInfo, which appears to be part of the Rust upgrade mentioned in the PR title.


13-13: Panic hook parameter type updated for compatibility.

The closure parameter type has been changed from PanicInfo to PanicHookInfo to match the updated import. This is a necessary change to maintain compatibility with the newer Rust version.


19-19: Function parameter type updated for consistency.

The parameter type for the handle_panic function has been updated to use PanicHookInfo instead of PanicInfo, maintaining consistency with the changes above.

vm/starcoin-gas-meter/src/gas_meter.rs (28)

22-23: Updated conditional compilation attribute for logger import.

The import statement for starcoin_logger::prelude::* now uses #[cfg(feature = "testing")] instead of what was likely #[cfg(testing)]. This aligns with modern Rust practices of using feature flags for conditional compilation.


190-194: Updated conditional logging to use feature flag.

Switched from configuration flag to feature flag for conditional compilation of log statements during testing. This provides more explicit control over when debugging logs are generated.


295-301: Updated conditional logging to use feature flag.

Similar to the previous change, the debugging output for instruction costs now depends on the "testing" feature being enabled.


308-312: Updated conditional logging to use feature flag.

Consistent update to use feature flags for logging statements.


327-331: Updated conditional logging to use feature flag.

Continuing the pattern of updating all logging statements to use the "testing" feature flag.


350-362: Updated conditional logging to use feature flag.

Both logging statements for CALL_GENERIC cost information now depend on the "testing" feature.


369-370: Consistent update to use feature flag for logging.

Changed LD_CONST logging to use the "testing" feature flag.


388-389: Updated conditional logging to use feature flag.

COPY_LOC logging now uses the feature flag system.


400-401: Updated conditional logging to use feature flag.

MOVE_LOC logging now uses the feature flag system.


412-413: Updated conditional logging to use feature flag.

ST_LOC logging now uses the feature flag system.


432-442: Updated conditional logging to use feature flag.

PACK/PACK_GENERIC logging now uses the feature flag system.


452-472: Updated conditional logging to use feature flag.

UNPACK opcodes logging now uses the feature flag system.


491-492: Updated conditional logging to use feature flag.

READ_REF logging now uses the feature flag system.


506-507: Updated conditional logging to use feature flag.

WRITE_REF logging now uses the feature flag system.


518-519: Updated conditional logging to use feature flag.

EQ operation logging now uses the feature flag system.


530-531: Updated conditional logging to use feature flag.

NEQ operation logging now uses the feature flag system.


554-563: Updated conditional logging to use feature flag.

Borrow global operation logging now uses the feature flag system.


584-594: Updated conditional logging to use feature flag with improved syntax.

The conditional logging for EXISTS operations now uses the feature flag system with improved block syntax for multiple statements.


612-622: Updated conditional logging to use feature flag with improved syntax.

The conditional logging for MOVE_FROM operations now uses the feature flag system with improved block syntax.


646-656: Updated conditional logging to use feature flag with improved syntax.

The conditional logging for MOVE_TO operations now uses the feature flag system with improved block syntax.


669-670: Updated conditional logging to use feature flag.

VEC_PACK operation logging now uses the feature flag system.


677-678: Updated conditional logging to use feature flag.

VEC_LEN operation logging now uses the feature flag system.


698-708: Updated conditional logging to use feature flag with improved syntax.

Vector borrow operations logging now uses the feature flag system with improved block syntax.


722-726: Updated conditional logging to use feature flag.

VEC_PUSH_BACK operation logging now uses the feature flag system.


737-741: Updated conditional logging to use feature flag.

VEC_POP_BACK operation logging now uses the feature flag system.


756-757: Updated conditional logging to use feature flag.

VEC_UNPACK operation logging now uses the feature flag system.


764-765: Updated conditional logging to use feature flag.

VEC_SWAP operation logging now uses the feature flag system.


783-787: Updated conditional logging to use feature flag.

NATIVE_FUNCTION operation logging now uses the feature flag system.

Copy link

Benchmark for 5d0621c

Click to view benchmark
Test Base PR %
accumulator_append 741.3±78.82µs 752.0±97.82µs +1.44%
block_apply/block_apply_10 351.2±7.73ms 363.1±19.76ms +3.39%
block_apply/block_apply_1000 38.9±0.64s 39.5±1.74s +1.54%
get_with_proof/db_store 42.3±2.19µs 41.8±1.38µs -1.18%
get_with_proof/mem_store 35.1±2.11µs 35.4±2.56µs +0.85%
put_and_commit/db_store/1 113.6±6.39µs 111.1±5.06µs -2.20%
put_and_commit/db_store/10 1037.9±65.78µs 1004.6±50.73µs -3.21%
put_and_commit/db_store/100 9.2±0.31ms 9.0±0.39ms -2.17%
put_and_commit/db_store/5 695.2±219.03µs 513.4±25.03µs -26.15%
put_and_commit/db_store/50 4.7±0.24ms 4.8±0.49ms +2.13%
put_and_commit/mem_store/1 68.4±6.86µs 81.8±16.99µs +19.59%
put_and_commit/mem_store/10 639.4±54.52µs 792.5±206.09µs +23.94%
put_and_commit/mem_store/100 6.2±0.34ms 6.4±0.89ms +3.23%
put_and_commit/mem_store/5 317.4±30.69µs 319.7±28.50µs +0.72%
put_and_commit/mem_store/50 3.2±0.23ms 3.1±0.21ms -3.13%
query_block/query_block_in(10)_times(100) 8.1±0.45ms 9.7±0.95ms +19.75%
query_block/query_block_in(10)_times(1000) 80.7±3.16ms 85.9±4.32ms +6.44%
query_block/query_block_in(10)_times(10000) 820.8±27.87ms 818.9±14.69ms -0.23%
query_block/query_block_in(1000)_times(100) 1163.3±36.06µs 1236.1±72.70µs +6.26%
query_block/query_block_in(1000)_times(1000) 11.7±0.50ms 12.0±0.24ms +2.56%
query_block/query_block_in(1000)_times(10000) 116.7±3.52ms 121.7±6.52ms +4.28%
storage_transaction 1049.6±383.50µs 1086.0±384.33µs +3.47%
vm/transaction_execution/1 408.9±20.58ms 399.5±12.27ms -2.30%
vm/transaction_execution/10 125.6±4.77ms 123.0±10.26ms -2.07%
vm/transaction_execution/20 117.5±5.74ms 115.7±2.82ms -1.53%
vm/transaction_execution/5 152.2±4.86ms 152.6±3.84ms +0.26%
vm/transaction_execution/50 136.8±8.01ms 139.5±10.40ms +1.97%

@nkysg nkysg requested a review from yourmoonlight as a code owner March 24, 2025 07:29
@nkysg nkysg removed the request for review from yourmoonlight March 24, 2025 07:30
@@ -16,6 +16,7 @@ use tokio::{

const MAX_TOTAL_WAITING_TIME: u64 = 3600000; // an hour

#[allow(dead_code)]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is ok.

@@ -7,6 +7,7 @@ use starcoin_node::NodeHandle;
use starcoin_types::block::BlockHeader;
use std::sync::Arc;

#[allow(dead_code)]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is ok.

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 (3)
Cargo.toml (1)

226-228: Lint Rule Configuration Change:
The removal of the use_self lint and the addition of doc_lazy_continuation = "allow" reflects a deliberate update to the project's Clippy configuration. Please ensure that this change is documented in your coding guidelines so that contributors understand the rationale behind this adjustment.

scripts/check_commit.sh (1)

12-12: Clippy Lint Flags Update in Commit Check Script:
The updated command

cargo clippy --all-targets -- -Aclippy::doc_lazy_continuation -D warnings

aligns with the new lint configuration in Cargo.toml. Verify that this change does not inadvertently suppress any warnings that could indicate real issues in the code.

.github/workflows/build_test.yml (1)

32-32: Workflow Lint Flags Consistency:
The change to set RUSTFLAGS as

-Aclippy::doc_lazy_continuation -D warnings

ensures that both local checks and CI enforce the updated linting rules consistently. It would be beneficial to update any related developer documentation or onboarding guides to reflect this change.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4e8330d and 0a0c754.

📒 Files selected for processing (39)
  • .github/workflows/build_test.yml (1 hunks)
  • Cargo.toml (1 hunks)
  • chain/tests/block_test_utils.rs (1 hunks)
  • chain/tests/test_block_chain.rs (3 hunks)
  • cmd/miner_client/src/cpu_solver.rs (1 hunks)
  • cmd/starcoin/src/account/nft_cmd.rs (2 hunks)
  • cmd/starcoin/src/account/show_cmd.rs (1 hunks)
  • cmd/starcoin/src/state/list_cmd.rs (1 hunks)
  • commons/accumulator/src/accumulator_test.rs (1 hunks)
  • commons/accumulator/src/node_index.rs (6 hunks)
  • commons/accumulator/src/tree.rs (1 hunks)
  • commons/stream-task/src/collector.rs (1 hunks)
  • consensus/src/difficulty.rs (1 hunks)
  • consensus/src/lib.rs (2 hunks)
  • network-p2p/peerset/src/lib.rs (2 hunks)
  • network-p2p/peerset/tests/fuzz.rs (1 hunks)
  • network-p2p/src/discovery.rs (1 hunks)
  • network-p2p/src/out_events.rs (2 hunks)
  • network-p2p/src/protocol.rs (1 hunks)
  • network-p2p/src/protocol/generic_proto/upgrade/notifications.rs (2 hunks)
  • network-p2p/src/request_responses.rs (2 hunks)
  • network-p2p/src/service_test.rs (1 hunks)
  • rpc/api/src/state/mod.rs (1 hunks)
  • rpc/api/src/types.rs (2 hunks)
  • rpc/api/src/types/pubsub.rs (1 hunks)
  • scripts/check_commit.sh (1 hunks)
  • stratum/src/lib.rs (2 hunks)
  • sync/src/announcement/mod.rs (1 hunks)
  • sync/src/store/tests.rs (0 hunks)
  • sync/tests/common_test_sync_libs.rs (1 hunks)
  • txpool/src/pool.rs (1 hunks)
  • txpool/src/tx_pool_service_impl.rs (2 hunks)
  • types/uint/src/tests.rs (1 hunks)
  • vm/parallel-executor/src/scheduler.rs (1 hunks)
  • vm/transaction-builder-generator/src/python3.rs (1 hunks)
  • vm/types/src/token/token_value.rs (1 hunks)
  • vm/types/src/transaction/mod.rs (3 hunks)
  • vm/types/src/transaction/tests.rs (1 hunks)
  • vm/vm-runtime/src/starcoin_vm.rs (5 hunks)
💤 Files with no reviewable changes (1)
  • sync/src/store/tests.rs
✅ Files skipped from review due to trivial changes (29)
  • rpc/api/src/state/mod.rs
  • sync/tests/common_test_sync_libs.rs
  • txpool/src/pool.rs
  • network-p2p/src/out_events.rs
  • cmd/starcoin/src/state/list_cmd.rs
  • cmd/starcoin/src/account/show_cmd.rs
  • rpc/api/src/types/pubsub.rs
  • consensus/src/difficulty.rs
  • sync/src/announcement/mod.rs
  • vm/types/src/token/token_value.rs
  • cmd/starcoin/src/account/nft_cmd.rs
  • chain/tests/block_test_utils.rs
  • stratum/src/lib.rs
  • network-p2p/src/service_test.rs
  • network-p2p/peerset/tests/fuzz.rs
  • commons/accumulator/src/node_index.rs
  • network-p2p/src/protocol.rs
  • consensus/src/lib.rs
  • rpc/api/src/types.rs
  • cmd/miner_client/src/cpu_solver.rs
  • vm/parallel-executor/src/scheduler.rs
  • network-p2p/peerset/src/lib.rs
  • network-p2p/src/request_responses.rs
  • vm/types/src/transaction/tests.rs
  • commons/accumulator/src/accumulator_test.rs
  • vm/types/src/transaction/mod.rs
  • chain/tests/test_block_chain.rs
  • network-p2p/src/discovery.rs
  • commons/accumulator/src/tree.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • vm/vm-runtime/src/starcoin_vm.rs
🧰 Additional context used
🧬 Code Definitions (1)
txpool/src/tx_pool_service_impl.rs (2)
txpool/src/pool.rs (1)
  • sender (211-213)
vm/types/src/transaction/mod.rs (2)
  • sender (257-259)
  • sender (523-525)
🔇 Additional comments (8)
vm/transaction-builder-generator/src/python3.rs (1)

464-464: Updated string splitting syntax to a more idiomatic form

The code now uses array syntax ['.',] instead of a closure |c| c == '.' for specifying the delimiter in the splitn method. This change maintains the same functionality while adopting more modern Rust syntax.

commons/stream-task/src/collector.rs (1)

86-86: Modernized code with improved clarity.

Changed from u64::max_value() to u64::MAX, which is the more idiomatic approach in modern Rust. This improves code readability while maintaining the same functionality.

types/uint/src/tests.rs (1)

12-12: Consistent modernization of U256 maximum value references.

All instances of U256::max_value() have been replaced with the more idiomatic U256::MAX. This change follows modern Rust conventions and improves code readability while maintaining the same test functionality.

Also applies to: 14-14, 19-21

network-p2p/src/protocol/generic_proto/upgrade/notifications.rs (2)

159-159: Good modernization: Using usize::MAX instead of usize::max_value()

This change modernizes the code by using the usize::MAX constant instead of the deprecated usize::max_value() function. This is in line with Rust's evolution, as constants are preferred over function calls for these values.


373-373: Good modernization: Using usize::MAX instead of usize::max_value()

Similar to the earlier change, this replaces the deprecated usize::max_value() with the modern usize::MAX constant. Both changes are part of the Rust upgrade effort and represent current best practices in Rust development.

txpool/src/tx_pool_service_impl.rs (3)

207-207: Modernized Rust syntax for maximum value

The code has been updated to use usize::MAX instead of usize::max_value(). This is a good modernization that uses the more concise constant syntax introduced in Rust 1.43.0. Both represent the same maximum value, so this is a non-functional change that improves code readability.


292-292: Updated to use u64::MAX constant

The code has been updated to use u64::MAX instead of u64::max_value() when setting the block_number field of the PendingSettings struct. This is part of a consistent effort to modernize the codebase by using the more concise constant syntax introduced in Rust 1.43.0.


297-298: Modernized parameter in inner_status call

The code has been updated to use u64::MAX instead of u64::max_value() when calling the inner_status method. This change is consistent with the other updates in this file and across the codebase, standardizing on the newer Rust syntax for maximum values.

Copy link
Collaborator

@simonjiao simonjiao left a comment

Choose a reason for hiding this comment

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

LGTM

@nkysg nkysg merged commit 2505910 into dag-master Mar 25, 2025
3 of 5 checks passed
@nkysg nkysg deleted the dag-master-rust-upgrade branch March 25, 2025 02:50
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.

3 participants