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

First System ADO - Current Block creating endpoints anywhere in the VFS #561

Open
wants to merge 9 commits into
base: development
Choose a base branch
from

Conversation

mdjakovic0920
Copy link
Contributor

@mdjakovic0920 mdjakovic0920 commented Sep 10, 2024

Motivation

This ADO aims to create an endpoint anywhere in the VFS at instantiation.
We need a bunch of VFS endpoints for all users to be able to reference.
So this is the first implementation of that.
This is not "user deployable ADO". It will be managed by the root or admin(DAO) user.
Of course, we can get current block height from Env directly, but we need users, non developers to be able to reference those as objects.

Implementation

1. Update VFS

Implemented some methods to add the path of system ADOs like /chain/validators, /etc/aos_version.

ExecuteMsg::AddSystemAdoPath

    AddSystemAdoPath {
        #[schemars(regex = "COMPONENT_NAME_REGEX")]
        name: String,
        #[schemars(regex = "COMPONENT_NAME_REGEX")]
        root: String,
    },

QueryMsg::Subsystem, QueryMsg::SystemPaths

#[returns(Vec<PathDetails>)]
    SubSystem {
        root: String,
        min: Option<SubSystemBound>,
        max: Option<SubSystemBound>,
        limit: Option<u32>,
    },

    #[returns(Vec<String>)]
    SystemPaths { addr: Addr },
pub struct SystemAdoPathIndices<'a> {
    /// PK: root + system_ado_name
    /// Secondary key: address
    pub address: MultiIndex<'a, Addr, SystemAdoPathInfo, (String, String)>,

    /// PK: root + system_ado_name
    /// Secondary key: root
    pub root: MultiIndex<'a, String, SystemAdoPathInfo, (String, String)>,
}
...
fn resolve_system_path(
    storage: &dyn Storage,
    api: &dyn Api,
    path: AndrAddr,
    resolved_paths: &mut Vec<(Addr, String)>,
) -> Result<Addr, ContractError>

2. Current Block ADO

#[andr_instantiate]
#[cw_serde]
pub struct InstantiateMsg {
    pub name: String,
    pub root: String,
}

#[andr_exec]
#[cw_serde]
pub enum ExecuteMsg {}

#[andr_query]
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
    #[returns(String)]
    GetCurrentBlockHeight {},
}

Testing

Added unit test cases for change.

Version Changes

Version is set as 1.0.0

Future work

  • Will add other system ADOs like this ADO.

Summary by CodeRabbit

  • New Features

    • Introduced a new System ADO for tracking the current block within the Andromeda system.
    • Added essential message structures for contract instantiation and querying in the Andromeda blockchain framework.
    • Expanded project structure with a new package for the Andromeda system, providing utilities and message definitions.
    • Implemented a smart contract for managing the current block in the Andromeda system.
    • Added functionality to manage system ADO paths, including the ability to add and query paths.
  • Bug Fixes

    • Improved path validation logic to accommodate a broader range of valid paths.
  • Tests

    • Added comprehensive unit tests to ensure the functionality of new features related to system ADO paths and current block management.
  • Documentation

    • Updated documentation to reflect new functionalities and usage of the Andromeda system.

Copy link
Contributor

coderabbitai bot commented Sep 10, 2024

Walkthrough

The pull request introduces enhancements to the Andromeda project, focusing on the addition of new modules and functionalities for managing system ADO paths and current block management. Key changes include updates to Cargo.toml files for improved workspace organization, the introduction of message structures for contract interactions, and the implementation of functions for executing and querying system paths. Additionally, new testing capabilities are established to ensure the integrity of these functionalities.

Changes

Files Change Summary
Cargo.toml, packages/andromeda-systems/Cargo.toml Added new workspace members and package dependencies, enhancing project structure and modularity.
contracts/os/andromeda-vfs/src/contract.rs, contracts/systems/andromeda-system-current-block/src/contract.rs, packages/andromeda-systems/src/current_block.rs Introduced new message types and functions for executing and querying system ADO paths, expanding contract capabilities.
contracts/systems/andromeda-system-current-block/src/lib.rs Created a new module structure for the Andromeda system, enhancing organization and separation of concerns.
contracts/os/andromeda-vfs/src/execute.rs, contracts/os/andromeda-vfs/src/testing/tests.rs Added functions and test cases for managing system ADO paths, ensuring proper functionality and error handling.

Possibly related PRs

  • feat: Conditional Splitter ADO #441: The changes regarding the addition of a new package dependency and member directory relate to the Conditional Splitter ADO, which also involves managing fund distributions and could interact with the new structures introduced in this PR.
  • feat: Reference Address List for Permission #481: The Reference Address List for Permission PR is relevant as it deals with permissions, which may be affected by the new structures and dependencies introduced here.
  • feat: Set Amount Splitter #507: The Set Amount Splitter PR is related because it involves managing fund distributions, similar to the changes that introduce new components for handling system ADOs.
  • feat: String Storage ADO #512: The String Storage ADO is relevant as it introduces a new storage mechanism that could interact with the new package dependencies added in this PR.
  • feat: add single boolean storage to andromeda-data-storage #513: The Boolean Storage ADO is related as it introduces a new storage type that may interact with the new structures and dependencies introduced here.
  • [IBC / Release 1] feat: IBC Registry #566: The IBC Registry PR is directly related as it introduces a new contract that could utilize the new structures and dependencies added in this PR.

Suggested labels

ci: skip-changelog

🐰 In the garden where ideas bloom,
New paths and blocks dispel the gloom.
A contract here, a query there,
With every change, we hop and share!
So let us dance and cheer with glee,
For Andromeda's growth is plain to see! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • 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 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.

@mdjakovic0920 mdjakovic0920 requested review from crnbarr93, SlayerAnsh and joemonem and removed request for SlayerAnsh September 10, 2024 20:57
Copy link
Contributor

@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

Outside diff range, codebase verification and nitpick comments (1)
contracts/os/andromeda-vfs/src/state.rs (1)

205-233: LGTM, but consider adding a test case.

The resolve_system_path function is well-implemented and correctly resolves system paths, handling symlinks appropriately.

Consider adding a test case for this function to ensure its correctness and handle edge cases. You can create a new test function in the test module at the end of the file.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9d06600 and 8292ad5.

Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
Files selected for processing (18)
  • Cargo.toml (2 hunks)
  • contracts/os/andromeda-vfs/src/contract.rs (2 hunks)
  • contracts/os/andromeda-vfs/src/execute.rs (2 hunks)
  • contracts/os/andromeda-vfs/src/query.rs (2 hunks)
  • contracts/os/andromeda-vfs/src/state.rs (8 hunks)
  • contracts/os/andromeda-vfs/src/testing/tests.rs (4 hunks)
  • contracts/systems/andromeda-system-current-block/.cargo/config (1 hunks)
  • contracts/systems/andromeda-system-current-block/Cargo.toml (1 hunks)
  • contracts/systems/andromeda-system-current-block/examples/schema.rs (1 hunks)
  • contracts/systems/andromeda-system-current-block/src/contract.rs (1 hunks)
  • contracts/systems/andromeda-system-current-block/src/lib.rs (1 hunks)
  • contracts/systems/andromeda-system-current-block/src/mock.rs (1 hunks)
  • contracts/systems/andromeda-system-current-block/src/testing/mod.rs (1 hunks)
  • contracts/systems/andromeda-system-current-block/src/testing/tests.rs (1 hunks)
  • packages/andromeda-systems/Cargo.toml (1 hunks)
  • packages/andromeda-systems/src/current_block.rs (1 hunks)
  • packages/andromeda-systems/src/lib.rs (1 hunks)
  • packages/std/src/os/vfs.rs (6 hunks)
Files skipped from review due to trivial changes (2)
  • contracts/systems/andromeda-system-current-block/.cargo/config
  • contracts/systems/andromeda-system-current-block/Cargo.toml
Additional comments not posted (35)
contracts/systems/andromeda-system-current-block/src/testing/mod.rs (1)

1-1: LGTM!

The code changes are approved.

packages/andromeda-systems/src/lib.rs (1)

1-1: LGTM!

The code changes are approved.

contracts/systems/andromeda-system-current-block/src/lib.rs (1)

1-6: LGTM!

The code changes are approved.

contracts/systems/andromeda-system-current-block/examples/schema.rs (1)

1-10: LGTM!

The code follows the standard pattern for generating the contract schema using cosmwasm_schema::write_api!. The InstantiateMsg, QueryMsg, and ExecuteMsg are imported from the andromeda_systems::current_block module.

packages/andromeda-systems/src/current_block.rs (1)

1-21: LGTM!

The code defines the message types for the current block contract:

  • InstantiateMsg with name and root fields, using the andr_instantiate macro.
  • ExecuteMsg enum without any variants, using the andr_exec macro.
  • QueryMsg enum with a single GetCurrentBlockHeight variant that returns a String, using the andr_query macro and QueryResponses derive macro.

The code follows the standard patterns and looks good.

packages/andromeda-systems/Cargo.toml (1)

1-24: LGTM!

The manifest file for the andromeda-systems package looks good:

  • The package metadata is properly specified with the name, version, edition, Rust version, description, and license.
  • The backtraces feature is defined, which enables backtraces from cosmwasm-std.
  • The library is set to generate both cdylib and rlib crate types.
  • The dependencies are properly specified, including cosmwasm-std, cosmwasm-schema, serde, cw-utils, cw721, cw721-base, and andromeda-std.

The file follows the standard structure and looks good.

contracts/systems/andromeda-system-current-block/src/mock.rs (3)

8-11: LGTM!

The code changes are approved.


13-25: LGTM!

The code changes are approved.


27-29: LGTM!

The code changes are approved.

contracts/systems/andromeda-system-current-block/src/testing/tests.rs (2)

11-25: LGTM!

The code changes are approved.


28-48: LGTM!

The code changes are approved.

Cargo.toml (2)

12-12: LGTM!

The code change is approved.


41-41: LGTM!

The code change is approved.

contracts/os/andromeda-vfs/src/query.rs (2)

25-33: LGTM!

The code changes are approved.


39-41: LGTM!

The code changes are approved.

contracts/systems/andromeda-system-current-block/src/contract.rs (2)

22-56: LGTM!

The code changes are approved.


101-106: LGTM!

The code changes are approved.

contracts/os/andromeda-vfs/src/contract.rs (2)

78-80: LGTM!

The code changes are approved.


113-118: LGTM!

The code changes are approved.

Also applies to: 120-120

contracts/os/andromeda-vfs/src/execute.rs (1)

142-172: LGTM!

The add_system_ado_path function is well-implemented with the following key points:

  • It validates the sender is a system ADO contract.
  • It ensures the name and root are valid component names.
  • It checks for existing paths and prevents unauthorized overriding, enhancing security.

The code changes are approved.

packages/std/src/os/vfs.rs (4)

9-10: LGTM!

The update to the PATH_REGEX constant to include a new segment for user-defined paths under the /home directory is a reasonable addition. It expands the flexibility of path validation and supports more diverse paths within the system.

The code change is approved.


173-178: LGTM!

The addition of the AddSystemAdoPath variant to the ExecuteMsg enum is a good way to facilitate the registration of system ADOs by a registered admin. The name and root fields are appropriately validated against the COMPONENT_NAME_REGEX to ensure they conform to the expected format.

The code change is approved.


208-217: LGTM!

The introduction of the SubSystemBound struct is a good way to manage subsystem boundaries more effectively. Encapsulating the root and name fields within the struct provides a clean and organized approach. The conversion implementation to transform the struct into a tuple of strings adds flexibility in how it can be used.

The code change is approved.


231-237: LGTM!

The addition of the SubSystem variant to the QueryMsg enum is a valuable enhancement to the querying capabilities of the system. It enables more granular control over subsystem data retrieval by allowing optional bounds and limits. This provides flexibility in querying specific ranges of subsystems based on the requirements.

The code change is approved.

contracts/os/andromeda-vfs/src/testing/tests.rs (3)

616-642: LGTM!

The test_add_system_ado_path function is a good addition to the test suite. It covers the basic functionality of adding a system ADO path by executing a message and asserting the resolved address matches the sender. This ensures that the path resolution logic is functioning correctly for system ADOs.

The code change is approved.


795-846: LGTM!

The test_get_subsystems function is a valuable addition to the test suite. It covers the functionality of retrieving subsystems by adding two system ADO paths and querying them. The test constructs expected results and asserts that the query returns the correct subsystems, ensuring that the contract can handle multiple system ADO paths and return them accurately when queried.

The code change is approved.


928-985: LGTM!

The test_get_system_paths function is a good addition to the test suite. It covers the functionality of retrieving system paths associated with a specific sender. The test adds two system ADO paths with different roots and checks that the paths can be resolved correctly, ensuring that the contract maintains the integrity of the path resolution process for system ADO paths with different roots.

The code change is approved.

contracts/os/andromeda-vfs/src/state.rs (8)

49-55: LGTM!

The SystemAdoPathInfo struct is well-defined and captures the necessary information for system paths.


57-65: LGTM!

The SystemAdoPathIndices struct is well-defined and provides efficient indexing for querying system paths by address and root.


67-74: LGTM!

The IndexList trait implementation for SystemAdoPathIndices is correct and follows the expected pattern.


76-91: LGTM!

The system_ado_paths function is well-implemented and sets up the IndexedMap correctly for storing and querying system paths.


317-342: LGTM!

The get_subsystem function is well-implemented and correctly retrieves the subsystem paths based on the specified criteria.


370-386: LGTM!

The get_system_paths function is well-implemented and correctly retrieves and formats the system paths for a given address.


407-424: LGTM!

The add_system_ado_path_name function is well-implemented and correctly adds a new system path entry to the storage.


731-759: LGTM!

The test_resolve_system_path test case is well-written and covers the basic functionality of resolving a system path.

add_system_ado_path_name(deps.storage, root, name, info.sender)?;
}
Some(path) => {
ensure!(path.address == info.sender, ContractError::Unauthorized {})
Copy link
Contributor

Choose a reason for hiding this comment

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

What is being done after this verification? Seems like we're checking authority, then doing nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the system ado is already existed, the existing equal to Some(_).
In this case, it just needs path.address == info.sender, then we don't have to do anything.
It does not need to add the same path.
What do you think of this?

Copy link
Contributor

Choose a reason for hiding this comment

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

We could return an error stating that all that information already exists. Also we should add relevant attributes to the response

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved.

Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (1)
CHANGELOG.md (1)

24-24: Consider adding more context to the changelog entry.

While the current entry is correct, it might be helpful for users to understand the purpose of this new System ADO. Consider expanding the entry to briefly explain its functionality, like this:

- Added System ADO - current block [(#526)](https://github.com/andromedaprotocol/andromeda-core/pull/526)
+ Added System ADO - current block for tracking and querying the current block height [(#526)](https://github.com/andromedaprotocol/andromeda-core/pull/526)

This additional context aligns with the PR objectives and provides more clarity about the new feature.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8292ad5 and b028a66.

🔇 Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • Cargo.toml (2 hunks)
  • DEADJOE (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • DEADJOE
🔇 Additional comments not posted (3)
Cargo.toml (2)

41-41: LGTM! Verify the andromeda-systems package.

The addition of the andromeda-systems package as a workspace dependency is consistent with the PR objectives. The version "1.0.0" aligns with the initial implementation mentioned in the PR summary.

To ensure the new package is properly set up, run the following script:

#!/bin/bash
# Description: Verify the existence and version of the andromeda-systems package

# Test 1: Check if the package directory exists
if [ -d "packages/andromeda-systems" ]; then
    echo "packages/andromeda-systems directory exists."
else
    echo "Error: packages/andromeda-systems directory does not exist."
    exit 1
fi

# Test 2: Check for Cargo.toml in the package directory
if [ -f "packages/andromeda-systems/Cargo.toml" ]; then
    echo "Cargo.toml found in packages/andromeda-systems."
else
    echo "Error: Cargo.toml not found in packages/andromeda-systems."
    exit 1
fi

# Test 3: Verify the package version
version=$(grep '^version =' packages/andromeda-systems/Cargo.toml | awk -F '"' '{print $2}')
if [ "$version" = "1.0.0" ]; then
    echo "andromeda-systems package version is correct: 1.0.0"
else
    echo "Warning: andromeda-systems package version is $version, expected 1.0.0"
fi

12-12: LGTM! Verify the contents of the new systems directory.

The addition of "contracts/systems/*" to the workspace members aligns with the PR objectives of introducing system ADOs. This change allows the inclusion of system-related contracts in the workspace.

To ensure the new directory is properly set up, run the following script:

CHANGELOG.md (1)

24-24: LGTM! The changelog entry is well-formatted and consistent.

The new changelog entry for the System ADO - current block is:

  1. Correctly formatted, matching the style of other entries.
  2. Consistent with the PR objectives, which mention the introduction of a "Current Block ADO".
  3. Appropriately placed within the "Added" section of the changelog.

Good job on maintaining clear and consistent documentation!

@joemonem
Copy link
Contributor

Of course, we can get current block height from Env directly, but we need users, non developers to be able to reference those as objects.

Wouldn't the user still need to construct a Query message to be sent to the Current Block ADO, and handle its response? Which I find more technically challenging that simply getting the current block height from Env.

@mdjakovic0920
Copy link
Contributor Author

Of course, we can get current block height from Env directly, but we need users, non developers to be able to reference those as objects.

Wouldn't the user still need to construct a Query message to be sent to the Current Block ADO, and handle its response? Which I find more technically challenging that simply getting the current block height from Env.

Yeah, you are right.
But this is the one example instance of the system ADOs. The system ADOs will make lots of endpoints like /etc/aos_version, /chain/validators, /etc/hostname etc.
I made this to confirm the functionalities of changes at VFS ADO.
The main change is VFS ADO modifying, so if it is reviewed successfully, we can build the other system ADOs that will make other VFS endpoint easily.
System ADOs will consists lots of ADOs, not only this ADO.

Copy link
Contributor

@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: 5

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between b028a66 and 379e8b5.

📒 Files selected for processing (2)
  • contracts/os/andromeda-vfs/src/execute.rs (2 hunks)
  • contracts/os/andromeda-vfs/src/testing/tests.rs (4 hunks)

contracts/os/andromeda-vfs/src/execute.rs Show resolved Hide resolved
contracts/os/andromeda-vfs/src/execute.rs Outdated Show resolved Hide resolved
contracts/os/andromeda-vfs/src/testing/tests.rs Outdated Show resolved Hide resolved
contracts/os/andromeda-vfs/src/testing/tests.rs Outdated Show resolved Hide resolved
contracts/os/andromeda-vfs/src/testing/tests.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@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

🧹 Outside diff range and nitpick comments (1)
packages/std/src/testing/mock_querier.rs (1)

183-186: LGTM: ContractInfo query handling updated for system contract.

The addition of MOCK_SYSTEM_CONTRACT with code_id 4 is consistent with the existing pattern and aligns with the introduction of the new system contract constant.

Consider using a match statement instead of multiple if-else conditions for better readability:

-                if contract_addr == MOCK_WALLET {
-                    return SystemResult::Ok(ContractResult::Err(
-                        "Not a valid contract".to_string(),
-                    ));
-                }
-                let mut resp = ContractInfoResponse::default();
-                resp.code_id = match contract_addr.as_str() {
-                    MOCK_SYSTEM_CONTRACT => 4,
-                    MOCK_APP_CONTRACT => 3,
-                    INVALID_CONTRACT => 2,
-                    _ => 1,
-                };
+                match contract_addr.as_str() {
+                    MOCK_WALLET => return SystemResult::Ok(ContractResult::Err("Not a valid contract".to_string())),
+                    MOCK_SYSTEM_CONTRACT => ContractInfoResponse { code_id: 4, ..Default::default() },
+                    MOCK_APP_CONTRACT => ContractInfoResponse { code_id: 3, ..Default::default() },
+                    INVALID_CONTRACT => ContractInfoResponse { code_id: 2, ..Default::default() },
+                    _ => ContractInfoResponse { code_id: 1, ..Default::default() },
+                }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 379e8b5 and 6141e8d.

📒 Files selected for processing (3)
  • contracts/os/andromeda-vfs/src/execute.rs (2 hunks)
  • contracts/os/andromeda-vfs/src/testing/tests.rs (6 hunks)
  • packages/std/src/testing/mock_querier.rs (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • contracts/os/andromeda-vfs/src/execute.rs
  • contracts/os/andromeda-vfs/src/testing/tests.rs
🔇 Additional comments not posted (3)
packages/std/src/testing/mock_querier.rs (3)

31-32: LGTM: New mock system contract constant added.

The addition of MOCK_SYSTEM_CONTRACT is consistent with other mock contract constants and follows the established naming convention.


488-492: LGTM: ADODB raw query handling updated for system contract.

The addition of the case for key "4" returning "system-contract" as the ADO type is consistent with the existing pattern and corresponds to the new MOCK_SYSTEM_CONTRACT with code_id 4.


Line range hint 1-559: Summary: Mock querier updated to support system contract.

The changes in this file consistently introduce support for a new system contract in the mock querier:

  1. A new constant MOCK_SYSTEM_CONTRACT is added.
  2. ContractInfo query handling is updated to include the system contract.
  3. ADODB raw query handling is extended to support the system contract ADO type.

These modifications are well-integrated and follow the existing patterns in the file. The changes appear to be complete and consistent for supporting the new system contract in testing scenarios.

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.

2 participants