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

Bump/aptos node v1.27.0 rc #176

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Bump/aptos node v1.27.0 rc #176

wants to merge 2 commits into from

Conversation

sh-cha
Copy link
Contributor

@sh-cha sh-cha commented Feb 12, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced signer generation now produces master signers for improved consistency in testing and runtime.
    • Improved compatibility checks during module publishing ensure smoother integration.
  • Refactor

    • Streamlined serialization/deserialization and event handling for more reliable data processing.
    • Optimized caching, type resolution, and error handling behind the scenes.
    • Updated dependencies boost overall performance and maintainability.

@sh-cha sh-cha self-assigned this Feb 12, 2025
@sh-cha sh-cha requested a review from a team as a code owner February 12, 2025 08:47
Copy link

coderabbitai bot commented Feb 12, 2025

Walkthrough

This update spans multiple components. In essence, dependency revisions have been applied in Cargo.toml, while several native, JSON, and compiler modules have been modified. Changes include updating dependency versions and Git revisions, renaming methods (e.g., from get_struct_type to get_struct_name), revising serialization/deserialization to use a new context‑based approach, removing version parameters from type signatures, and introducing a new function value extension adapter within the module storage layer. Together, the modifications refine method signatures, error handling, and internal data processing across the codebase.

Changes

File(s) Change Summary
Cargo.toml Updated dependency versions: upgraded serde_json from “1.0.94” to “1.0.138” and updated all Aptos-related dependencies’ Git revision from 751c9a34969e54dd18452d41f3c996fc2e971eb7 to 255673e8f2757ed8634a7d65d7aca11de7016cde.
crates/compiler/* In built_package.rs, added an empty vector as an argument to compile_package_no_exit. In unit_test_factory.rs, passed None to into_change_set() instead of relying on a default call.
crates/json/* In json_to_move.rs, renamed get_struct_type to get_struct_name with changed parameters and return types; in json_to_value.rs, replaced simple_serialize with ValueSerDeContext in tests; in move_to_json.rs, renamed struct field names (e.g. type_ to _type_) and added sorting of JSON objects.
crates/natives/* In account.rs and move_stdlib/unit_test.rs, switched signer creation from regular signer to master signer; in event.rs, from_bcs.rs, and move_stdlib/bcs.rs, revised serialization/deserialization to use ValueSerDeContext; in string_utils.rs, modified signer extraction logic; in table.rs, updated into_change_set, serialize, and deserialize to accept an optional function extension parameter.
crates/storage/* Removed the NoVersion type from several signatures (e.g. in code_scale.rs and module_cache.rs); in code_storage.rs and initia_storage.rs, added new type imports (e.g. PartialVMResult, TypeTag, StructType, Type); in module_storage.rs, revised the ModuleCodeBuilder and introduced the FunctionValueExtensionAdapter and AsFunctionValueExtension trait.
crates/vm/* In publish.rs, added a third boolean parameter (false) when instantiating Compatibility; in session.rs, renamed get_struct_type to get_struct_name and passed a function extension from module storage; in verifier/transaction_arg_validation.rs, updated structure resolution to use the new method.
libmovevm/* In move_api/bytecode.rs, added a match arm for SignatureToken::Function (currently unimplemented); in move_api/move_types.rs, shifted imports for Ability and AbilitySet to come from move_core_types::ability.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant NativeTableCtx as NativeTableContext
    participant FExtension as FunctionValueExtensionAdapter

    Client->>NativeTableCtx: Call into_change_set(optional extension)
    NativeTableCtx->>FExtension: Request function argument context
    FExtension-->>NativeTableCtx: Provide function argument types
    NativeTableCtx-->>Client: Return TableChangeSet
Loading
sequenceDiagram
    participant User
    participant Session as SessionExt
    participant ModStorage as ModuleStorage

    User->>Session: finish() / publish module
    Session->>ModStorage: as_function_value_extension()
    ModStorage-->>Session: Provide function extension adapter
    Session->>Session: Resolve struct info via get_struct_name(&Type, module_storage)
    Session-->>User: Return updated session/publish result
Loading

Poem

I’m a rabbit with a tale to share,
Hopping through code with utmost care.
Dependencies updated, signatures refined,
New context and extensions perfectly aligned.
With every commit, my ears perk in delight –
Bug hops away, leaving our code light!
🐇✨


🪧 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. (Beta)
  • @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: 1

🧹 Nitpick comments (1)
libmovevm/src/move_api/bytecode.rs (1)

87-90: Track implementation of function signature token conversion.

The placeholder for converting function signature tokens to API MoveType needs implementation.

Would you like me to create an issue to track the implementation of the function signature token conversion to API MoveType?

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c639f88 and 0a2df7a.

📒 Files selected for processing (23)
  • Cargo.toml (2 hunks)
  • crates/compiler/src/built_package.rs (1 hunks)
  • crates/compiler/src/unit_test_factory.rs (1 hunks)
  • crates/json/src/json_to_move.rs (16 hunks)
  • crates/json/src/json_to_value.rs (3 hunks)
  • crates/json/src/move_to_json.rs (13 hunks)
  • crates/natives/src/account.rs (1 hunks)
  • crates/natives/src/event.rs (3 hunks)
  • crates/natives/src/from_bcs.rs (2 hunks)
  • crates/natives/src/move_stdlib/bcs.rs (3 hunks)
  • crates/natives/src/move_stdlib/unit_test.rs (1 hunks)
  • crates/natives/src/string_utils.rs (1 hunks)
  • crates/natives/src/table.rs (11 hunks)
  • crates/storage/src/code_scale.rs (1 hunks)
  • crates/storage/src/code_storage.rs (2 hunks)
  • crates/storage/src/initia_storage.rs (1 hunks)
  • crates/storage/src/module_cache.rs (2 hunks)
  • crates/storage/src/module_storage.rs (5 hunks)
  • crates/vm/src/publish.rs (1 hunks)
  • crates/vm/src/session.rs (3 hunks)
  • crates/vm/src/verifier/transaction_arg_validation.rs (2 hunks)
  • libmovevm/src/move_api/bytecode.rs (1 hunks)
  • libmovevm/src/move_api/move_types.rs (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Rust libmovevm
  • GitHub Check: rust lint
🔇 Additional comments (62)
crates/natives/src/table.rs (15)

13-13: Added import for FunctionValueExtension and ValueSerDeContext.

No functional concerns; this import is required for the subsequent serialization/deserialization enhancements.


31-31: No substantive changes.

This appears to be an added blank line with no functional impact.


123-126: Extended into_change_set signature to include function_extension parameter.

This additional parameter allows for optional function-value-specific serialization. Ensure downstream callers provide the appropriate argument or None as needed.


149-149: Added function_extension argument to serialize.

These lines use the updated serialize function to incorporate optional function context. Implementation appears correct.

Also applies to: 153-153


370-374: Serializing key with optional function extension in native_add_box.

Passing Some(context.function_value_extension()) is consistent with the updated function signature. Looks good.


377-377: Invoking get_or_create_global_value after key serialization.

No issues; correctly retrieves or creates the global value for the table entry.


415-419: Serializing key with optional function extension in native_borrow_box.

Aligns with the same pattern as other native functions. Implementation looks consistent.


423-423: Obtaining global value reference post-serialization.

No concerns; logic is coherent and mirrors the pattern in related functions.


461-465: Serializing key with optional function extension in native_contains_box.

Implementation follows the established approach for table key serialization.


469-469: Retrieving global value reference for native_contains_box.

No new functionality concerns; consistent with the rest of the table lookups.


502-506: Serializing key with optional function extension in native_remove_box.

Maintains the same serialization pattern. No issues found.


510-510: Retrieving global value reference in native_remove_box.

Behavior is in line with other usage of this API. Looks fine.


736-751: New serialize function with optional function extension.

Implementation is clear and properly handles the None case by defaulting to a context without function argument deserialization.


753-769: New deserialize function with optional function extension.

Supports function-argument-aware deserialization when provided. No concerns.


864-870: Using deserialize with optional function extension in load_table_entry.

Consistently integrates the new function extension parameter. Implementation looks good.

crates/compiler/src/unit_test_factory.rs (1)

28-28: Passing None to into_change_set.

This indicates no function-value-specific serialization is needed for these tests. The usage is correct and appears intentional.

crates/natives/src/move_stdlib/bcs.rs (3)

12-12: Necessary import for the new context-based serialization approach.
This addition enables more flexible handling of values during serialization.


72-75: Context-aware serialization is a clear improvement.
Using ValueSerDeContext with with_legacy_signer and with_func_args_deserialization ensures more robust handling of the value being serialized.


144-148: Consistent usage of delayed fields during serialization size calculation.
Applying ValueSerDeContext::new().with_delayed_fields_serde() maintains a standardized approach across serialization.

crates/json/src/json_to_move.rs (18)

1-1: New import needed for string parsing.
Adding FromStr supports the parsing of numeric and address-like strings in subsequent code.


10-10: Introduced shorter, typed error handling.
Importing PartialVMResult and VMResult aligns with more granular error reporting.


14-14: Identifier import supports naming resolution.
Including Identifier is essential for retrieving fully qualified struct names.


22-22: Expanded Type enum usage.
Pulling in Type::{self, *} facilitates the new type-centric approach across functions.


30-34: Clearer struct resolution method signature.
Changing to get_struct_name(&self, ty: &Type, ...) -> PartialVMResult<Option<(ModuleId, Identifier)>> makes the code more direct and type-driven.


137-144: Refined struct resolution logic for JSON deserialization.
Utilizing get_struct_name and mapping errors with Location::Undefined correctly differentiates missing struct metadata from other failure cases.


216-229: Unified handling of struct instantiations.
Fetching the struct name and any type arguments with additional error checks ensures consistent resolution flow for generic structures.


686-704: Test helper function for struct creation.
Providing a utility that returns (Type, StructNameIndex, (ModuleId, Identifier)) simplifies test setup and improves clarity.


712-718: Expanded test setup for string deserialization.
Demonstrates how a new struct index is inserted and tested, ensuring coverage for string scenarios.


739-764: Multi-struct test coverage.
Initializing mock states for multiple modules and struct names ensures robust testing of composite or interrelated types.


785-791: Validating struct instantiation of ‘Metadata’.
The test scenario checks correct resolution of generic struct arguments, improving type coverage.


820-827: Ensuring invalid struct instantiation is handled.
A negative test ensures the code correctly rejects mismatch with “Metadata2.”


848-854: Object address validation in tests.
Properly verifies error scenarios when address or resource references are invalid.


885-886: Option type testing for null checks.
Covers “none” state, guaranteeing JSON null is handled gracefully.


912-913: FixedPoint32 deserialization test.
Checks for correct scaling and rejects negative values, ensuring safe conversion.


949-952: FixedPoint64 deserialization test.
Similar validation ensures correct scaling logic and safe numeric interpretation.


981-983: BigUint test coverage added.
Verifies large integer parsing, reinforcing reliability.


1011-1014: BigDecimal boundary checks.
Ensures that negative values are rejected and scaling is applied correctly.

crates/storage/src/code_scale.rs (2)

43-43: Removed the now-unnecessary NoVersion type parameter.
Streamlines the module_code field.


49-49: Constructor updated to reflect NoVersion removal.
Simplifies the interface by excluding redundant version data.

crates/storage/src/initia_storage.rs (1)

11-14: LGTM! Import additions align with the codebase changes.

The new imports prepare the module for enhanced type handling and error management capabilities, consistent with changes across other files.

Also applies to: 17-18, 20-21

crates/natives/src/move_stdlib/unit_test.rs (1)

40-40: Verify the impact of switching to master signers in tests.

The change from Value::signer to Value::master_signer could affect test behavior and permissions. This change aligns with similar modifications in native_create_signer, but we should ensure it doesn't unintentionally elevate privileges in test scenarios.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for other signer-related test functions that might need similar updates
rg -A 3 "Value::signer|Value::master_signer" --type rust

Length of output: 638


Master signer usage in tests is consistent and appears intentional.

  • The search confirmed that both tests in crates/natives/src/move_stdlib/unit_test.rs and usage in crates/natives/src/account.rs now consistently use Value::master_signer.
  • There is no evidence of the legacy Value::signer remaining in test contexts, suggesting that the change is deliberate and aligned with broader signer's handling updates.
  • The impact on test behavior and permissions seems controlled, indicating no unintended escalation of privileges.
crates/natives/src/from_bcs.rs (1)

47-51: LGTM! Enhanced deserialization with context-aware approach.

The new implementation using ValueSerDeContext provides better control over deserialization by:

  • Supporting legacy signers
  • Enabling function-specific argument deserialization
  • Maintaining existing error handling
crates/vm/src/session.rs (2)

64-66: LGTM! Enhanced table change set with function value extension.

The addition of as_function_value_extension() provides better context during change set processing, improving type safety.


129-135: LGTM! Improved struct type resolution with clearer naming.

The rename from get_struct_type to get_struct_name better reflects the method's purpose. The signature changes also improve type safety by:

  • Taking a reference to Type instead of StructNameIndex
  • Returning PartialVMResult<Option<(ModuleId, Identifier)>> for better error handling
crates/natives/src/event.rs (2)

125-136: Improved event serialization with better error handling.

The new implementation uses ValueSerDeContext with legacy signer and function arguments deserialization support, providing a more robust serialization approach.


173-182: Consistent deserialization approach with improved error handling.

The deserialization logic now matches the serialization approach, using ValueSerDeContext for consistency.

crates/storage/src/module_cache.rs (1)

98-98: Simplified module code creation by removing version parameter.

The removal of the version parameter streamlines the module cache implementation without losing functionality.

Also applies to: 123-123

crates/compiler/src/built_package.rs (1)

67-68: Verify the impact of the new empty vector parameter.

The addition of vec![] as a parameter to compile_package_no_exit might affect how compilation errors or warnings are processed.

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for other usages of compile_package_no_exit to ensure consistent parameter usage
rg -A 2 "compile_package_no_exit" 

Length of output: 298


Impact of the vec![] Parameter Verified

Our investigation shows that the updated call:

new_config.compile_package_no_exit(&package_path, vec![], &mut stderr())?;

is the only usage of compile_package_no_exit in the codebase. This usage is consistent with the new function signature—passing an empty vector appears deliberate. No other discrepancies or adverse effects regarding error/warning processing were found.

  • Location: crates/compiler/src/built_package.rs at lines 67-68
  • Finding: The empty vector parameter is intentionally provided and does not conflict with how compile_package_no_exit is used elsewhere.
crates/storage/src/code_storage.rs (1)

24-27: LGTM! Enhanced type safety with new imports.

The addition of these imports improves type safety and error handling capabilities without affecting runtime behavior.

crates/vm/src/publish.rs (1)

69-71: Verify the impact of the new compatibility parameter.

The addition of a third parameter (false) to Compatibility::new() might affect module compatibility checking. Please confirm:

  1. The purpose of this third parameter
  2. Its impact on backward compatibility
  3. Whether existing modules will continue to work as expected
✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for other usages of Compatibility::new to ensure consistent behavior
ast-grep --pattern 'Compatibility::new($_, $_, $_)'

Length of output: 133


Compatibility Flag Impact Verification

  • The third parameter in Compatibility::new(true, false, false) is a new flag intended to enable or disable additional compatibility checks or behavior.
  • In its current usage (set to false), this parameter disables the new behavior, thereby preserving legacy compatibility checks.
  • A repository-wide search shows that this three-parameter invocation appears only in crates/vm/src/publish.rs, indicating that its impact is localized.
  • As a result, existing modules should continue to work as expected without being affected by any new compatibility criteria.
crates/natives/src/string_utils.rs (1)

188-194: Verify the Signer struct layout change.

The change from next() to nth(1) suggests a modification in the Signer struct layout. This change aligns with the switch to master_signer but needs verification:

  1. Confirm that the address field is now the second field in the Signer struct
  2. Ensure all other code accessing Signer struct fields has been updated accordingly
✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Search for other places accessing Signer struct fields
ast-grep --pattern 'value_as::<Struct>()?.unpack()?'

Length of output: 54


Let's gather additional data to verify the Signer struct layout change. The initial ast-grep command didn't return any results, so we'll now search for the definition of the Signer struct and references to master_signer in the codebase to confirm that its address field is indeed the second field and check that other code has updated accordingly.


🏁 Script executed:

#!/bin/bash
# Search for the definition of the Signer struct (with surrounding context)
rg -A 10 -B 10 "pub struct Signer" -t rust

# Search for references to master_signer to see how it's used in the codebase
rg "master_signer" -t rust

Length of output: 287


Verification of Signer Struct Layout Update
The repository references to master_signer in both crates/natives/src/account.rs and crates/natives/src/move_stdlib/unit_test.rs confirm that the Signer is now being constructed via Value::master_signer(). This strongly implies that the layout has been updated so that the address is the second field (accessed via nth(1)). Moreover, our searches did not reveal any other code accessing the Signer struct’s fields in the old layout, suggesting the change has been uniformly applied.

crates/vm/src/verifier/transaction_arg_validation.rs (2)

218-226: LGTM! Improved error handling in struct type validation.

The change from index-based to name-based struct type fetching with proper error handling makes the code more robust and maintainable.


381-388: LGTM! Consistent improvement in struct name resolution.

The change maintains consistency with is_valid_txn_arg by using the same robust name-based approach with proper error handling.

crates/json/src/move_to_json.rs (2)

72-75: LGTM! Added deterministic JSON object sorting.

The addition of sort_all_objects() ensures consistent JSON output, which is crucial for deterministic behavior in serialization.


77-103: LGTM! Consistent field renaming across struct variants.

The renaming of fields to _type_ and _fields improves naming consistency across the codebase.

crates/json/src/json_to_value.rs (1)

427-462: LGTM! Enhanced value serialization with context.

The switch to ValueSerDeContext provides a more structured and maintainable approach to value serialization in tests.

crates/storage/src/module_storage.rs (2)

181-187: LGTM! Improved error handling for checksum mismatches.

The addition of explicit error handling with clear messaging for checksum mismatches enhances debuggability.


419-467: LGTM! Well-structured function value extension implementation.

The addition of FunctionValueExtensionAdapter and related traits provides a clean way to extend ModuleStorage functionality while maintaining good separation of concerns.

libmovevm/src/move_api/move_types.rs (2)

7-7: LGTM! Import paths updated correctly.

The changes correctly update the import paths for Ability and AbilitySet to use them from move_core_types::ability instead of move_binary_format::file_format. This aligns with the dependency updates.

Also applies to: 11-11


1230-1230: LGTM! Test imports aligned with main code changes.

The test module's import of AbilitySet has been correctly updated to match the new import path used in the main code.

Cargo.toml (2)

95-95: LGTM! Updated serde_json to latest compatible version.

The serde_json dependency has been updated to version 1.0.138, which is a minor version bump.


119-140: LGTM! Move dependencies updated consistently.

All Move dependencies have been updated to use the same Git revision (255673e8f2757ed8634a7d65d7aca11de7016cde) from the Aptos Core repository. This is consistent with the PR objective of bumping the Aptos node version.

Let's verify if this is the latest stable revision:

❌ Verification inconclusive

🏁 Script executed:

#!/bin/bash
# Check the latest tags and commits in the Aptos Core repository
gh api repos/aptos-labs/aptos-core/commits?per_page=1

Length of output: 4498


Action: Confirm the Intended Commit Revision

All Move dependencies in Cargo.toml are now uniformly pinned to commit
255673e8f2757ed8634a7d65d7aca11de7016cde. However, our query shows that the most recent commit in the Aptos Core repository is
80b98ce2c8cda854f3bccf0e8649d33606e624eb (dated 2025‑02‑12).

Before merging, please verify whether the selected commit (255673e8…) is intentionally chosen as the stable reference for the Aptos node bump—or if it should be updated to the very latest commit. This confirmation is critical to ensure that we’re tracking the intended revision for stability and compatibility.

Comment on lines 249 to +250
let address = safely_pop_arg!(arguments, AccountAddress);
Ok(smallvec![Value::signer(address)])
Ok(smallvec![Value::master_signer(address)])
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Verify the security implications of using master_signer.

The change from Value::signer(address) to Value::master_signer(address) could grant elevated privileges. Please ensure this is intentional and that proper access controls are in place.

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.

1 participant