Skip to content

Implement GetPackage gRPC API #22435

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

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

Conversation

nickvikeras
Copy link
Contributor

Description

Implementing GetPackage for the defined gRPC stub. Leaving the other methods unimplemented for now.

Test plan

Added unit tests and did a quick manual grpcurl sanity check -

❯ grpcurl -plaintext -d '{"package_id": "0x3"}' 127.0.0.1:9000 sui.rpc.v2alpha.MovePackageService.GetPackage
{
  "package": {
    "storageId": "0x0000000000000000000000000000000000000000000000000000000000000003",
    "originalId": "0x0000000000000000000000000000000000000000000000000000000000000003",
    "version": "1",
    "modules": [
      {
        "name": "genesis"
      },
      {
        "name": "stake_subsidy"
      },
      {
        "name": "staking_pool"
      },
      {
        "name": "storage_fund"
      },
      {
        "name": "sui_system"
      },
      {
        "name": "sui_system_state_inner"
      },
      {
        "name": "validator"
      },
      {
        "name": "validator_cap"
      },
      {
        "name": "validator_set"
      },
      {
        "name": "validator_wrapper"
      },
      {
        "name": "voting_power"
      }
    ]
  }
}

Release notes

  • gRPC: Implementing GetPackage API

Copy link

vercel bot commented Jun 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2025 7:16pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Jun 18, 2025 7:16pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Jun 18, 2025 7:16pm

Comment on lines +56 to +70
fn extract_modules(package: &MovePackage) -> Result<Vec<Module>> {
let mut modules = Vec::new();

for module_name in package.serialized_module_map().keys() {
// Only return module names
// Full module data is provided by GetModule
modules.push(Module {
name: Some(module_name.clone()),
data_types: vec![],
functions: vec![],
});
}

Ok(modules)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think maybe this isn't what we want. I think we'd want this to fully render data types and function descriptors. And the other apis (get module/function/datatype) are a way to get a smaller amount of scoped data. Also i must have forgotten to change data_types to be one word in the Module message, we should do that to be consistent with how its used elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do. I think I slightly misunderstood what you were explaining yesterday. Where was the risk for exponential payload growth due to repeated type definitions that we were discussing again?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah yeah thats with the old JSONRPC shape of a NormalizedMoveModule. With these new message shapes the output is bounded by the size of the just the package itself

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