Skip to content

Feature: viewGlobalCode RPC request #13531

@akorchyn

Description

@akorchyn

Contact Details

No response

Feature Request

Currently, the RPC can't return the code for global contracts.
As a workaround, it's possible to retrieve the code by using the global contract and then retrieving the code from it, but this is suboptimal and shouldn't be the primary solution.

I propose creating a new RPC endpoint, similar to viewCode, that returns the code for a provided global identifier (either a global hash or a global account ID).

Beneficiary

As for me, it makes sense to have this endpoint.
Main benefits and use cases:

  • near-verify-rs
    Can't fetch the hash/code to verify that the deployed code matches the repo.
    This blocks code verification and lowers trust for GlobalDeploy.

  • near-cli-rs
    This CLI tool supports transaction reconstruction from any transaction. However, it cannot reconstruct a transaction from a GlobalDeploy, as the transaction only returns the code hash during querying. This behavior is the same as with a local deploy, but in that case, we can load the code using the viewCode call by querying the transaction block. Unfortunately, this isn't possible with GlobalDeploy, as there is no way to retrieve the code from the Global ID. I doubt this will see heavy usage, but it's still important to maintain full CLI functionality.

Priority

I think it's pretty important as it feels unfinished similar to #13373

Contributing

  • Yes, I am interested

Metadata

Metadata

Assignees

Labels

communityIssues created by community

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions